Clang Project

clang_source_code/include/clang/Sema/Sema.h
1//===--- Sema.h - Semantic Analysis & AST Building --------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the Sema class, which performs semantic analysis and
10// builds ASTs.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SEMA_SEMA_H
15#define LLVM_CLANG_SEMA_SEMA_H
16
17#include "clang/AST/Attr.h"
18#include "clang/AST/Availability.h"
19#include "clang/AST/ComparisonCategories.h"
20#include "clang/AST/DeclTemplate.h"
21#include "clang/AST/DeclarationName.h"
22#include "clang/AST/Expr.h"
23#include "clang/AST/ExprCXX.h"
24#include "clang/AST/ExprObjC.h"
25#include "clang/AST/ExternalASTSource.h"
26#include "clang/AST/LocInfoType.h"
27#include "clang/AST/MangleNumberingContext.h"
28#include "clang/AST/NSAPI.h"
29#include "clang/AST/PrettyPrinter.h"
30#include "clang/AST/StmtCXX.h"
31#include "clang/AST/TypeLoc.h"
32#include "clang/AST/TypeOrdering.h"
33#include "clang/Basic/ExpressionTraits.h"
34#include "clang/Basic/Module.h"
35#include "clang/Basic/OpenMPKinds.h"
36#include "clang/Basic/PragmaKinds.h"
37#include "clang/Basic/Specifiers.h"
38#include "clang/Basic/TemplateKinds.h"
39#include "clang/Basic/TypeTraits.h"
40#include "clang/Sema/AnalysisBasedWarnings.h"
41#include "clang/Sema/CleanupInfo.h"
42#include "clang/Sema/DeclSpec.h"
43#include "clang/Sema/ExternalSemaSource.h"
44#include "clang/Sema/IdentifierResolver.h"
45#include "clang/Sema/ObjCMethodList.h"
46#include "clang/Sema/Ownership.h"
47#include "clang/Sema/Scope.h"
48#include "clang/Sema/TypoCorrection.h"
49#include "clang/Sema/Weak.h"
50#include "llvm/ADT/ArrayRef.h"
51#include "llvm/ADT/Optional.h"
52#include "llvm/ADT/SetVector.h"
53#include "llvm/ADT/SmallBitVector.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
62namespace llvm {
63  class APSInt;
64  template <typename ValueT> struct DenseMapInfo;
65  template <typename ValueT, typename ValueInfoT> class DenseSet;
66  class SmallBitVector;
67  struct InlineAsmIdentifierInfo;
68}
69
70namespace clang {
71  class ADLResult;
72  class ASTConsumer;
73  class ASTContext;
74  class ASTMutationListener;
75  class ASTReader;
76  class ASTWriter;
77  class ArrayType;
78  class ParsedAttr;
79  class BindingDecl;
80  class BlockDecl;
81  class CapturedDecl;
82  class CXXBasePath;
83  class CXXBasePaths;
84  class CXXBindTemporaryExpr;
85  typedef SmallVector<CXXBaseSpecifier*, 4CXXCastPath;
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;
125  typedef MutableArrayRef<ImplicitConversionSequenceConversionSequenceList;
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;
137  typedef ArrayRef<std::pair<IdentifierInfo *, SourceLocation>> ModuleIdPath;
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 OMPRequiresDecl;
156  class OMPDeclareReductionDecl;
157  class OMPDeclareSimdDecl;
158  class OMPClause;
159  struct OMPVarListLocTy;
160  struct OverloadCandidate;
161  class OverloadCandidateSet;
162  class OverloadExpr;
163  class ParenListExpr;
164  class ParmVarDecl;
165  class Preprocessor;
166  class PseudoDestructorTypeStorage;
167  class PseudoObjectExpr;
168  class QualType;
169  class StandardConversionSequence;
170  class Stmt;
171  class StringLiteral;
172  class SwitchStmt;
173  class TemplateArgument;
174  class TemplateArgumentList;
175  class TemplateArgumentLoc;
176  class TemplateDecl;
177  class TemplateInstantiationCallback;
178  class TemplateParameterList;
179  class TemplatePartialOrderingContext;
180  class TemplateTemplateParmDecl;
181  class Token;
182  class TypeAliasDecl;
183  class TypedefDecl;
184  class TypedefNameDecl;
185  class TypeLoc;
186  class TypoCorrectionConsumer;
187  class UnqualifiedId;
188  class UnresolvedLookupExpr;
189  class UnresolvedMemberExpr;
190  class UnresolvedSetImpl;
191  class UnresolvedSetIterator;
192  class UsingDecl;
193  class UsingShadowDecl;
194  class ValueDecl;
195  class VarDecl;
196  class VarTemplateSpecializationDecl;
197  class VisibilityAttr;
198  class VisibleDeclConsumer;
199  class IndirectFieldDecl;
200  struct DeductionFailureInfo;
201  class TemplateSpecCandidateSet;
202
203namespace sema {
204  class AccessedEntity;
205  class BlockScopeInfo;
206  class Capture;
207  class CapturedRegionScopeInfo;
208  class CapturingScopeInfo;
209  class CompoundScopeInfo;
210  class DelayedDiagnostic;
211  class DelayedDiagnosticPool;
212  class FunctionScopeInfo;
213  class LambdaScopeInfo;
214  class PossiblyUnreachableDiag;
215  class SemaPPCallbacks;
216  class TemplateDeductionInfo;
217}
218
219namespace threadSafety {
220  class BeforeSet;
221  void threadSafetyCleanup(BeforeSetCache);
222}
223
224// FIXME: No way to easily map from TemplateTypeParmTypes to
225// TemplateTypeParmDecls, so we have this horrible PointerUnion.
226typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType*, NamedDecl*>,
227                  SourceLocation> UnexpandedParameterPack;
228
229/// Describes whether we've seen any nullability information for the given
230/// file.
231struct FileNullability {
232  /// The first pointer declarator (of any pointer kind) in the file that does
233  /// not have a corresponding nullability annotation.
234  SourceLocation PointerLoc;
235
236  /// The end location for the first pointer declarator in the file. Used for
237  /// placing fix-its.
238  SourceLocation PointerEndLoc;
239
240  /// Which kind of pointer declarator we saw.
241  uint8_t PointerKind;
242
243  /// Whether we saw any type nullability annotations in the given file.
244  bool SawTypeNullability = false;
245};
246
247/// A mapping from file IDs to a record of whether we've seen nullability
248/// information in that file.
249class FileNullabilityMap {
250  /// A mapping from file IDs to the nullability information for each file ID.
251  llvm::DenseMap<FileID, FileNullability> Map;
252
253  /// A single-element cache based on the file ID.
254  struct {
255    FileID File;
256    FileNullability Nullability;
257  } Cache;
258
259public:
260  FileNullability &operator[](FileID file) {
261    // Check the single-element cache.
262    if (file == Cache.File)
263      return Cache.Nullability;
264
265    // It's not in the single-element cache; flush the cache if we have one.
266    if (!Cache.File.isInvalid()) {
267      Map[Cache.File] = Cache.Nullability;
268    }
269
270    // Pull this entry into the cache.
271    Cache.File = file;
272    Cache.Nullability = Map[file];
273    return Cache.Nullability;
274  }
275};
276
277/// Keeps track of expected type during expression parsing. The type is tied to
278/// a particular token, all functions that update or consume the type take a
279/// start location of the token they are looking at as a parameter. This allows
280/// to avoid updating the type on hot paths in the parser.
281class PreferredTypeBuilder {
282public:
283  PreferredTypeBuilder() = default;
284  explicit PreferredTypeBuilder(QualType Type) : Type(Type) {}
285
286  void enterCondition(Sema &SSourceLocation Tok);
287  void enterReturn(Sema &SSourceLocation Tok);
288  void enterVariableInit(SourceLocation TokDecl *D);
289  /// Computing a type for the function argument may require running
290  /// overloading, so we postpone its computation until it is actually needed.
291  ///
292  /// Clients should be very careful when using this funciton, as it stores a
293  /// function_ref, clients should make sure all calls to get() with the same
294  /// location happen while function_ref is alive.
295  void enterFunctionArgument(SourceLocation Tok,
296                             llvm::function_ref<QualType()> ComputeType);
297
298  void enterParenExpr(SourceLocation TokSourceLocation LParLoc);
299  void enterUnary(Sema &SSourceLocation Toktok::TokenKind OpKind,
300                  SourceLocation OpLoc);
301  void enterBinary(Sema &SSourceLocation TokExpr *LHStok::TokenKind Op);
302  void enterMemAccess(Sema &SSourceLocation TokExpr *Base);
303  void enterSubscript(Sema &SSourceLocation TokExpr *LHS);
304  /// Handles all type casts, including C-style cast, C++ casts, etc.
305  void enterTypeCast(SourceLocation TokQualType CastType);
306
307  QualType get(SourceLocation Tokconst {
308    if (Tok != ExpectedLoc)
309      return QualType();
310    if (!Type.isNull())
311      return Type;
312    if (ComputeType)
313      return ComputeType();
314    return QualType();
315  }
316
317private:
318  /// Start position of a token for which we store expected type.
319  SourceLocation ExpectedLoc;
320  /// Expected type for a token starting at ExpectedLoc.
321  QualType Type;
322  /// A function to compute expected type at ExpectedLoc. It is only considered
323  /// if Type is null.
324  llvm::function_ref<QualType()> ComputeType;
325};
326
327/// Sema - This implements semantic analysis and AST building for C.
328class Sema {
329  Sema(const Sema &) = delete;
330  void operator=(const Sema &) = delete;
331
332  ///Source of additional semantic information.
333  ExternalSemaSource *ExternalSource;
334
335  ///Whether Sema has generated a multiplexer and has to delete it.
336  bool isMultiplexExternalSource;
337
338  static bool mightHaveNonExternalLinkage(const DeclaratorDecl *FD);
339
340  bool isVisibleSlow(const NamedDecl *D);
341
342  /// Determine whether two declarations should be linked together, given that
343  /// the old declaration might not be visible and the new declaration might
344  /// not have external linkage.
345  bool shouldLinkPossiblyHiddenDecl(const NamedDecl *Old,
346                                    const NamedDecl *New) {
347    if (isVisible(Old))
348     return true;
349    // See comment in below overload for why it's safe to compute the linkage
350    // of the new declaration here.
351    if (New->isExternallyDeclarable()) {
352       (0) . __assert_fail ("Old->isExternallyDeclarable() && \"should not have found a non-externally-declarable previous decl\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 353, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Old->isExternallyDeclarable() &&
353 (0) . __assert_fail ("Old->isExternallyDeclarable() && \"should not have found a non-externally-declarable previous decl\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 353, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">             "should not have found a non-externally-declarable previous decl");
354      return true;
355    }
356    return false;
357  }
358  bool shouldLinkPossiblyHiddenDecl(LookupResult &Oldconst NamedDecl *New);
359
360  void setupImplicitSpecialMemberType(CXXMethodDecl *SpecialMem,
361                                      QualType ResultTy,
362                                      ArrayRef<QualTypeArgs);
363
364public:
365  typedef OpaquePtr<DeclGroupRefDeclGroupPtrTy;
366  typedef OpaquePtr<TemplateNameTemplateTy;
367  typedef OpaquePtr<QualTypeTypeTy;
368
369  OpenCLOptions OpenCLFeatures;
370  FPOptions FPFeatures;
371
372  const LangOptions &LangOpts;
373  Preprocessor &PP;
374  ASTContext &Context;
375  ASTConsumer &Consumer;
376  DiagnosticsEngine &Diags;
377  SourceManager &SourceMgr;
378
379  /// Flag indicating whether or not to collect detailed statistics.
380  bool CollectStats;
381
382  /// Code-completion consumer.
383  CodeCompleteConsumer *CodeCompleter;
384
385  /// CurContext - This is the current declaration context of parsing.
386  DeclContext *CurContext;
387
388  /// Generally null except when we temporarily switch decl contexts,
389  /// like in \see ActOnObjCTemporaryExitContainerContext.
390  DeclContext *OriginalLexicalContext;
391
392  /// VAListTagName - The declaration name corresponding to __va_list_tag.
393  /// This is used as part of a hack to omit that class from ADL results.
394  DeclarationName VAListTagName;
395
396  bool MSStructPragmaOn// True when \#pragma ms_struct on
397
398  /// Controls member pointer representation format under the MS ABI.
399  LangOptions::PragmaMSPointersToMembersKind
400      MSPointerToMemberRepresentationMethod;
401
402  /// Stack of active SEH __finally scopes.  Can be empty.
403  SmallVector<Scope*, 2CurrentSEHFinally;
404
405  /// Source location for newly created implicit MSInheritanceAttrs
406  SourceLocation ImplicitMSInheritanceAttrLoc;
407
408  /// pragma clang section kind
409  enum PragmaClangSectionKind {
410    PCSK_Invalid      = 0,
411    PCSK_BSS          = 1,
412    PCSK_Data         = 2,
413    PCSK_Rodata       = 3,
414    PCSK_Text         = 4
415   };
416
417  enum PragmaClangSectionAction {
418    PCSA_Set     = 0,
419    PCSA_Clear   = 1
420  };
421
422  struct PragmaClangSection {
423    std::string SectionName;
424    bool Valid = false;
425    SourceLocation PragmaLocation;
426
427    void Act(SourceLocation PragmaLocation,
428             PragmaClangSectionAction Action,
429             StringLiteralName);
430   };
431
432   PragmaClangSection PragmaClangBSSSection;
433   PragmaClangSection PragmaClangDataSection;
434   PragmaClangSection PragmaClangRodataSection;
435   PragmaClangSection PragmaClangTextSection;
436
437  enum PragmaMsStackAction {
438    PSK_Reset     = 0x0,                // #pragma ()
439    PSK_Set       = 0x1,                // #pragma (value)
440    PSK_Push      = 0x2,                // #pragma (push[, id])
441    PSK_Pop       = 0x4,                // #pragma (pop[, id])
442    PSK_Show      = 0x8,                // #pragma (show) -- only for "pack"!
443    PSK_Push_Set  = PSK_Push | PSK_Set// #pragma (push[, id], value)
444    PSK_Pop_Set   = PSK_Pop | PSK_Set,  // #pragma (pop[, id], value)
445  };
446
447  template<typename ValueType>
448  struct PragmaStack {
449    struct Slot {
450      llvm::StringRef StackSlotLabel;
451      ValueType Value;
452      SourceLocation PragmaLocation;
453      SourceLocation PragmaPushLocation;
454      Slot(llvm::StringRef StackSlotLabel, ValueType Value,
455           SourceLocation PragmaLocationSourceLocation PragmaPushLocation)
456          : StackSlotLabel(StackSlotLabel), Value(Value),
457            PragmaLocation(PragmaLocation),
458            PragmaPushLocation(PragmaPushLocation) {}
459    };
460    void Act(SourceLocation PragmaLocation,
461             PragmaMsStackAction Action,
462             llvm::StringRef StackSlotLabel,
463             ValueType Value);
464
465    // MSVC seems to add artificial slots to #pragma stacks on entering a C++
466    // method body to restore the stacks on exit, so it works like this:
467    //
468    //   struct S {
469    //     #pragma <name>(push, InternalPragmaSlot, <current_pragma_value>)
470    //     void Method {}
471    //     #pragma <name>(pop, InternalPragmaSlot)
472    //   };
473    //
474    // It works even with #pragma vtordisp, although MSVC doesn't support
475    //   #pragma vtordisp(push [, id], n)
476    // syntax.
477    //
478    // Push / pop a named sentinel slot.
479    void SentinelAction(PragmaMsStackAction ActionStringRef Label) {
480       (0) . __assert_fail ("(Action == PSK_Push || Action == PSK_Pop) && \"Can only push / pop #pragma stack sentinels!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 481, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((Action == PSK_Push || Action == PSK_Pop) &&
481 (0) . __assert_fail ("(Action == PSK_Push || Action == PSK_Pop) && \"Can only push / pop #pragma stack sentinels!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 481, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">             "Can only push / pop #pragma stack sentinels!");
482      Act(CurrentPragmaLocation, Action, Label, CurrentValue);
483    }
484
485    // Constructors.
486    explicit PragmaStack(const ValueType &Default)
487        : DefaultValue(Default), CurrentValue(Default) {}
488
489    bool hasValue() const { return CurrentValue != DefaultValue; }
490
491    SmallVector<Slot2Stack;
492    ValueType DefaultValue// Value used for PSK_Reset action.
493    ValueType CurrentValue;
494    SourceLocation CurrentPragmaLocation;
495  };
496  // FIXME: We should serialize / deserialize these if they occur in a PCH (but
497  // we shouldn't do so if they're in a module).
498
499  /// Whether to insert vtordisps prior to virtual bases in the Microsoft
500  /// C++ ABI.  Possible values are 0, 1, and 2, which mean:
501  ///
502  /// 0: Suppress all vtordisps
503  /// 1: Insert vtordisps in the presence of vbase overrides and non-trivial
504  ///    structors
505  /// 2: Always insert vtordisps to support RTTI on partially constructed
506  ///    objects
507  PragmaStack<MSVtorDispAttr::Mode> VtorDispStack;
508  // #pragma pack.
509  // Sentinel to represent when the stack is set to mac68k alignment.
510  static const unsigned kMac68kAlignmentSentinel = ~0U;
511  PragmaStack<unsignedPackStack;
512  // The current #pragma pack values and locations at each #include.
513  struct PackIncludeState {
514    unsigned CurrentValue;
515    SourceLocation CurrentPragmaLocation;
516    bool HasNonDefaultValueShouldWarnOnInclude;
517  };
518  SmallVector<PackIncludeState8PackIncludeStack;
519  // Segment #pragmas.
520  PragmaStack<StringLiteral *> DataSegStack;
521  PragmaStack<StringLiteral *> BSSSegStack;
522  PragmaStack<StringLiteral *> ConstSegStack;
523  PragmaStack<StringLiteral *> CodeSegStack;
524
525  // RAII object to push / pop sentinel slots for all MS #pragma stacks.
526  // Actions should be performed only if we enter / exit a C++ method body.
527  class PragmaStackSentinelRAII {
528  public:
529    PragmaStackSentinelRAII(Sema &SStringRef SlotLabelbool ShouldAct);
530    ~PragmaStackSentinelRAII();
531
532  private:
533    Sema &S;
534    StringRef SlotLabel;
535    bool ShouldAct;
536  };
537
538  /// A mapping that describes the nullability we've seen in each header file.
539  FileNullabilityMap NullabilityMap;
540
541  /// Last section used with #pragma init_seg.
542  StringLiteral *CurInitSeg;
543  SourceLocation CurInitSegLoc;
544
545  /// VisContext - Manages the stack for \#pragma GCC visibility.
546  void *VisContext// Really a "PragmaVisStack*"
547
548  /// This an attribute introduced by \#pragma clang attribute.
549  struct PragmaAttributeEntry {
550    SourceLocation Loc;
551    ParsedAttr *Attribute;
552    SmallVector<attr::SubjectMatchRule4MatchRules;
553    bool IsUsed;
554  };
555
556  /// A push'd group of PragmaAttributeEntries.
557  struct PragmaAttributeGroup {
558    /// The location of the push attribute.
559    SourceLocation Loc;
560    /// The namespace of this push group.
561    const IdentifierInfo *Namespace;
562    SmallVector<PragmaAttributeEntry2Entries;
563  };
564
565  SmallVector<PragmaAttributeGroup2PragmaAttributeStack;
566
567  /// The declaration that is currently receiving an attribute from the
568  /// #pragma attribute stack.
569  const Decl *PragmaAttributeCurrentTargetDecl;
570
571  /// This represents the last location of a "#pragma clang optimize off"
572  /// directive if such a directive has not been closed by an "on" yet. If
573  /// optimizations are currently "on", this is set to an invalid location.
574  SourceLocation OptimizeOffPragmaLocation;
575
576  /// Flag indicating if Sema is building a recovery call expression.
577  ///
578  /// This flag is used to avoid building recovery call expressions
579  /// if Sema is already doing so, which would cause infinite recursions.
580  bool IsBuildingRecoveryCallExpr;
581
582  /// Used to control the generation of ExprWithCleanups.
583  CleanupInfo Cleanup;
584
585  /// ExprCleanupObjects - This is the stack of objects requiring
586  /// cleanup that are created by the current full expression.  The
587  /// element type here is ExprWithCleanups::Object.
588  SmallVector<BlockDecl*, 8ExprCleanupObjects;
589
590  /// Store a set of either DeclRefExprs or MemberExprs that contain a reference
591  /// to a variable (constant) that may or may not be odr-used in this Expr, and
592  /// we won't know until all lvalue-to-rvalue and discarded value conversions
593  /// have been applied to all subexpressions of the enclosing full expression.
594  /// This is cleared at the end of each full expression.
595  using MaybeODRUseExprSet = llvm::SmallPtrSet<Expr *, 2>;
596  MaybeODRUseExprSet MaybeODRUseExprs;
597
598  std::unique_ptr<sema::FunctionScopeInfoPreallocatedFunctionScope;
599
600  /// Stack containing information about each of the nested
601  /// function, block, and method scopes that are currently active.
602  SmallVector<sema::FunctionScopeInfo *, 4FunctionScopes;
603
604  typedef LazyVector<TypedefNameDecl *, ExternalSemaSource,
605                     &ExternalSemaSource::ReadExtVectorDecls22>
606    ExtVectorDeclsType;
607
608  /// ExtVectorDecls - This is a list all the extended vector types. This allows
609  /// us to associate a raw vector type with one of the ext_vector type names.
610  /// This is only necessary for issuing pretty diagnostics.
611  ExtVectorDeclsType ExtVectorDecls;
612
613  /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
614  std::unique_ptr<CXXFieldCollectorFieldCollector;
615
616  typedef llvm::SmallSetVector<NamedDecl *, 16NamedDeclSetType;
617
618  /// Set containing all declared private fields that are not used.
619  NamedDeclSetType UnusedPrivateFields;
620
621  /// Set containing all typedefs that are likely unused.
622  llvm::SmallSetVector<const TypedefNameDecl *, 4>
623      UnusedLocalTypedefNameCandidates;
624
625  /// Delete-expressions to be analyzed at the end of translation unit
626  ///
627  /// This list contains class members, and locations of delete-expressions
628  /// that could not be proven as to whether they mismatch with new-expression
629  /// used in initializer of the field.
630  typedef std::pair<SourceLocationboolDeleteExprLoc;
631  typedef llvm::SmallVector<DeleteExprLoc4DeleteLocs;
632  llvm::MapVector<FieldDecl *, DeleteLocs> DeleteExprs;
633
634  typedef llvm::SmallPtrSet<const CXXRecordDecl*, 8RecordDeclSetTy;
635
636  /// PureVirtualClassDiagSet - a set of class declarations which we have
637  /// emitted a list of pure virtual functions. Used to prevent emitting the
638  /// same list more than once.
639  std::unique_ptr<RecordDeclSetTyPureVirtualClassDiagSet;
640
641  /// ParsingInitForAutoVars - a set of declarations with auto types for which
642  /// we are currently parsing the initializer.
643  llvm::SmallPtrSet<const Decl*, 4ParsingInitForAutoVars;
644
645  /// Look for a locally scoped extern "C" declaration by the given name.
646  NamedDecl *findLocallyScopedExternCDecl(DeclarationName Name);
647
648  typedef LazyVector<VarDecl *, ExternalSemaSource,
649                     &ExternalSemaSource::ReadTentativeDefinitions22>
650    TentativeDefinitionsType;
651
652  /// All the tentative definitions encountered in the TU.
653  TentativeDefinitionsType TentativeDefinitions;
654
655  typedef LazyVector<const DeclaratorDecl *, ExternalSemaSource,
656                     &ExternalSemaSource::ReadUnusedFileScopedDecls22>
657    UnusedFileScopedDeclsType;
658
659  /// The set of file scoped decls seen so far that have not been used
660  /// and must warn if not used. Only contains the first declaration.
661  UnusedFileScopedDeclsType UnusedFileScopedDecls;
662
663  typedef LazyVector<CXXConstructorDecl *, ExternalSemaSource,
664                     &ExternalSemaSource::ReadDelegatingConstructors22>
665    DelegatingCtorDeclsType;
666
667  /// All the delegating constructors seen so far in the file, used for
668  /// cycle detection at the end of the TU.
669  DelegatingCtorDeclsType DelegatingCtorDecls;
670
671  /// All the overriding functions seen during a class definition
672  /// that had their exception spec checks delayed, plus the overridden
673  /// function.
674  SmallVector<std::pair<const CXXMethodDecl*, const CXXMethodDecl*>, 2>
675    DelayedOverridingExceptionSpecChecks;
676
677  /// All the function redeclarations seen during a class definition that had
678  /// their exception spec checks delayed, plus the prior declaration they
679  /// should be checked against. Except during error recovery, the new decl
680  /// should always be a friend declaration, as that's the only valid way to
681  /// redeclare a special member before its class is complete.
682  SmallVector<std::pair<FunctionDecl*, FunctionDecl*>, 2>
683    DelayedEquivalentExceptionSpecChecks;
684
685  /// All the members seen during a class definition which were both
686  /// explicitly defaulted and had explicitly-specified exception
687  /// specifications, along with the function type containing their
688  /// user-specified exception specification. Those exception specifications
689  /// were overridden with the default specifications, but we still need to
690  /// check whether they are compatible with the default specification, and
691  /// we can't do that until the nesting set of class definitions is complete.
692  SmallVector<std::pair<CXXMethodDecl*, const FunctionProtoType*>, 2>
693    DelayedDefaultedMemberExceptionSpecs;
694
695  typedef llvm::MapVector<const FunctionDecl *,
696                          std::unique_ptr<LateParsedTemplate>>
697      LateParsedTemplateMapT;
698  LateParsedTemplateMapT LateParsedTemplateMap;
699
700  /// Callback to the parser to parse templated functions when needed.
701  typedef void LateTemplateParserCB(void *PLateParsedTemplate &LPT);
702  typedef void LateTemplateParserCleanupCB(void *P);
703  LateTemplateParserCB *LateTemplateParser;
704  LateTemplateParserCleanupCB *LateTemplateParserCleanup;
705  void *OpaqueParser;
706
707  void SetLateTemplateParser(LateTemplateParserCB *LTP,
708                             LateTemplateParserCleanupCB *LTPCleanup,
709                             void *P) {
710    LateTemplateParser = LTP;
711    LateTemplateParserCleanup = LTPCleanup;
712    OpaqueParser = P;
713  }
714
715  class DelayedDiagnostics;
716
717  class DelayedDiagnosticsState {
718    sema::DelayedDiagnosticPool *SavedPool;
719    friend class Sema::DelayedDiagnostics;
720  };
721  typedef DelayedDiagnosticsState ParsingDeclState;
722  typedef DelayedDiagnosticsState ProcessingContextState;
723
724  /// A class which encapsulates the logic for delaying diagnostics
725  /// during parsing and other processing.
726  class DelayedDiagnostics {
727    /// The current pool of diagnostics into which delayed
728    /// diagnostics should go.
729    sema::DelayedDiagnosticPool *CurPool;
730
731  public:
732    DelayedDiagnostics() : CurPool(nullptr) {}
733
734    /// Adds a delayed diagnostic.
735    void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h
736
737    /// Determines whether diagnostics should be delayed.
738    bool shouldDelayDiagnostics() { return CurPool != nullptr; }
739
740    /// Returns the current delayed-diagnostics pool.
741    sema::DelayedDiagnosticPool *getCurrentPool() const {
742      return CurPool;
743    }
744
745    /// Enter a new scope.  Access and deprecation diagnostics will be
746    /// collected in this pool.
747    DelayedDiagnosticsState push(sema::DelayedDiagnosticPool &pool) {
748      DelayedDiagnosticsState state;
749      state.SavedPool = CurPool;
750      CurPool = &pool;
751      return state;
752    }
753
754    /// Leave a delayed-diagnostic state that was previously pushed.
755    /// Do not emit any of the diagnostics.  This is performed as part
756    /// of the bookkeeping of popping a pool "properly".
757    void popWithoutEmitting(DelayedDiagnosticsState state) {
758      CurPool = state.SavedPool;
759    }
760
761    /// Enter a new scope where access and deprecation diagnostics are
762    /// not delayed.
763    DelayedDiagnosticsState pushUndelayed() {
764      DelayedDiagnosticsState state;
765      state.SavedPool = CurPool;
766      CurPool = nullptr;
767      return state;
768    }
769
770    /// Undo a previous pushUndelayed().
771    void popUndelayed(DelayedDiagnosticsState state) {
772      assert(CurPool == nullptr);
773      CurPool = state.SavedPool;
774    }
775  } DelayedDiagnostics;
776
777  /// A RAII object to temporarily push a declaration context.
778  class ContextRAII {
779  private:
780    Sema &S;
781    DeclContext *SavedContext;
782    ProcessingContextState SavedContextState;
783    QualType SavedCXXThisTypeOverride;
784
785  public:
786    ContextRAII(Sema &SDeclContext *ContextToPushbool NewThisContext = true)
787      : S(S), SavedContext(S.CurContext),
788        SavedContextState(S.DelayedDiagnostics.pushUndelayed()),
789        SavedCXXThisTypeOverride(S.CXXThisTypeOverride)
790    {
791       (0) . __assert_fail ("ContextToPush && \"pushing null context\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 791, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(ContextToPush && "pushing null context");
792      S.CurContext = ContextToPush;
793      if (NewThisContext)
794        S.CXXThisTypeOverride = QualType();
795    }
796
797    void pop() {
798      if (!SavedContextreturn;
799      S.CurContext = SavedContext;
800      S.DelayedDiagnostics.popUndelayed(SavedContextState);
801      S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
802      SavedContext = nullptr;
803    }
804
805    ~ContextRAII() {
806      pop();
807    }
808  };
809
810  /// RAII object to handle the state changes required to synthesize
811  /// a function body.
812  class SynthesizedFunctionScope {
813    Sema &S;
814    Sema::ContextRAII SavedContext;
815    bool PushedCodeSynthesisContext = false;
816
817  public:
818    SynthesizedFunctionScope(Sema &SDeclContext *DC)
819        : S(S), SavedContext(SDC) {
820      S.PushFunctionScope();
821      S.PushExpressionEvaluationContext(
822          Sema::ExpressionEvaluationContext::PotentiallyEvaluated);
823      if (auto *FD = dyn_cast<FunctionDecl>(DC))
824        FD->setWillHaveBody(true);
825      else
826        (DC)", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 826, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isa<ObjCMethodDecl>(DC));
827    }
828
829    void addContextNote(SourceLocation UseLoc) {
830      assert(!PushedCodeSynthesisContext);
831
832      Sema::CodeSynthesisContext Ctx;
833      Ctx.Kind = Sema::CodeSynthesisContext::DefiningSynthesizedFunction;
834      Ctx.PointOfInstantiation = UseLoc;
835      Ctx.Entity = cast<Decl>(S.CurContext);
836      S.pushCodeSynthesisContext(Ctx);
837
838      PushedCodeSynthesisContext = true;
839    }
840
841    ~SynthesizedFunctionScope() {
842      if (PushedCodeSynthesisContext)
843        S.popCodeSynthesisContext();
844      if (auto *FD = dyn_cast<FunctionDecl>(S.CurContext))
845        FD->setWillHaveBody(false);
846      S.PopExpressionEvaluationContext();
847      S.PopFunctionScopeInfo();
848    }
849  };
850
851  /// WeakUndeclaredIdentifiers - Identifiers contained in
852  /// \#pragma weak before declared. rare. may alias another
853  /// identifier, declared or undeclared
854  llvm::MapVector<IdentifierInfo *, WeakInfo> WeakUndeclaredIdentifiers;
855
856  /// ExtnameUndeclaredIdentifiers - Identifiers contained in
857  /// \#pragma redefine_extname before declared.  Used in Solaris system headers
858  /// to define functions that occur in multiple standards to call the version
859  /// in the currently selected standard.
860  llvm::DenseMap<IdentifierInfo*,AsmLabelAttr*> ExtnameUndeclaredIdentifiers;
861
862
863  /// Load weak undeclared identifiers from the external source.
864  void LoadExternalWeakUndeclaredIdentifiers();
865
866  /// WeakTopLevelDecl - Translation-unit scoped declarations generated by
867  /// \#pragma weak during processing of other Decls.
868  /// I couldn't figure out a clean way to generate these in-line, so
869  /// we store them here and handle separately -- which is a hack.
870  /// It would be best to refactor this.
871  SmallVector<Decl*,2WeakTopLevelDecl;
872
873  IdentifierResolver IdResolver;
874
875  /// Translation Unit Scope - useful to Objective-C actions that need
876  /// to lookup file scope declarations in the "ordinary" C decl namespace.
877  /// For example, user-defined classes, built-in "id" type, etc.
878  Scope *TUScope;
879
880  /// The C++ "std" namespace, where the standard library resides.
881  LazyDeclPtr StdNamespace;
882
883  /// The C++ "std::bad_alloc" class, which is defined by the C++
884  /// standard library.
885  LazyDeclPtr StdBadAlloc;
886
887  /// The C++ "std::align_val_t" enum class, which is defined by the C++
888  /// standard library.
889  LazyDeclPtr StdAlignValT;
890
891  /// The C++ "std::experimental" namespace, where the experimental parts
892  /// of the standard library resides.
893  NamespaceDecl *StdExperimentalNamespaceCache;
894
895  /// The C++ "std::initializer_list" template, which is defined in
896  /// \<initializer_list>.
897  ClassTemplateDecl *StdInitializerList;
898
899  /// The C++ "std::coroutine_traits" template, which is defined in
900  /// \<coroutine_traits>
901  ClassTemplateDecl *StdCoroutineTraitsCache;
902
903  /// The C++ "type_info" declaration, which is defined in \<typeinfo>.
904  RecordDecl *CXXTypeInfoDecl;
905
906  /// The MSVC "_GUID" struct, which is defined in MSVC header files.
907  RecordDecl *MSVCGuidDecl;
908
909  /// Caches identifiers/selectors for NSFoundation APIs.
910  std::unique_ptr<NSAPINSAPIObj;
911
912  /// The declaration of the Objective-C NSNumber class.
913  ObjCInterfaceDecl *NSNumberDecl;
914
915  /// The declaration of the Objective-C NSValue class.
916  ObjCInterfaceDecl *NSValueDecl;
917
918  /// Pointer to NSNumber type (NSNumber *).
919  QualType NSNumberPointer;
920
921  /// Pointer to NSValue type (NSValue *).
922  QualType NSValuePointer;
923
924  /// The Objective-C NSNumber methods used to create NSNumber literals.
925  ObjCMethodDecl *NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods];
926
927  /// The declaration of the Objective-C NSString class.
928  ObjCInterfaceDecl *NSStringDecl;
929
930  /// Pointer to NSString type (NSString *).
931  QualType NSStringPointer;
932
933  /// The declaration of the stringWithUTF8String: method.
934  ObjCMethodDecl *StringWithUTF8StringMethod;
935
936  /// The declaration of the valueWithBytes:objCType: method.
937  ObjCMethodDecl *ValueWithBytesObjCTypeMethod;
938
939  /// The declaration of the Objective-C NSArray class.
940  ObjCInterfaceDecl *NSArrayDecl;
941
942  /// The declaration of the arrayWithObjects:count: method.
943  ObjCMethodDecl *ArrayWithObjectsMethod;
944
945  /// The declaration of the Objective-C NSDictionary class.
946  ObjCInterfaceDecl *NSDictionaryDecl;
947
948  /// The declaration of the dictionaryWithObjects:forKeys:count: method.
949  ObjCMethodDecl *DictionaryWithObjectsMethod;
950
951  /// id<NSCopying> type.
952  QualType QIDNSCopying;
953
954  /// will hold 'respondsToSelector:'
955  Selector RespondsToSelectorSel;
956
957  /// A flag to remember whether the implicit forms of operator new and delete
958  /// have been declared.
959  bool GlobalNewDeleteDeclared;
960
961  /// A flag to indicate that we're in a context that permits abstract
962  /// references to fields.  This is really a
963  bool AllowAbstractFieldReference;
964
965  /// Describes how the expressions currently being parsed are
966  /// evaluated at run-time, if at all.
967  enum class ExpressionEvaluationContext {
968    /// The current expression and its subexpressions occur within an
969    /// unevaluated operand (C++11 [expr]p7), such as the subexpression of
970    /// \c sizeof, where the type of the expression may be significant but
971    /// no code will be generated to evaluate the value of the expression at
972    /// run time.
973    Unevaluated,
974
975    /// The current expression occurs within a braced-init-list within
976    /// an unevaluated operand. This is mostly like a regular unevaluated
977    /// context, except that we still instantiate constexpr functions that are
978    /// referenced here so that we can perform narrowing checks correctly.
979    UnevaluatedList,
980
981    /// The current expression occurs within a discarded statement.
982    /// This behaves largely similarly to an unevaluated operand in preventing
983    /// definitions from being required, but not in other ways.
984    DiscardedStatement,
985
986    /// The current expression occurs within an unevaluated
987    /// operand that unconditionally permits abstract references to
988    /// fields, such as a SIZE operator in MS-style inline assembly.
989    UnevaluatedAbstract,
990
991    /// The current context is "potentially evaluated" in C++11 terms,
992    /// but the expression is evaluated at compile-time (like the values of
993    /// cases in a switch statement).
994    ConstantEvaluated,
995
996    /// The current expression is potentially evaluated at run time,
997    /// which means that code may be generated to evaluate the value of the
998    /// expression at run time.
999    PotentiallyEvaluated,
1000
1001    /// The current expression is potentially evaluated, but any
1002    /// declarations referenced inside that expression are only used if
1003    /// in fact the current expression is used.
1004    ///
1005    /// This value is used when parsing default function arguments, for which
1006    /// we would like to provide diagnostics (e.g., passing non-POD arguments
1007    /// through varargs) but do not want to mark declarations as "referenced"
1008    /// until the default argument is used.
1009    PotentiallyEvaluatedIfUsed
1010  };
1011
1012  /// Data structure used to record current or nested
1013  /// expression evaluation contexts.
1014  struct ExpressionEvaluationContextRecord {
1015    /// The expression evaluation context.
1016    ExpressionEvaluationContext Context;
1017
1018    /// Whether the enclosing context needed a cleanup.
1019    CleanupInfo ParentCleanup;
1020
1021    /// Whether we are in a decltype expression.
1022    bool IsDecltype;
1023
1024    /// The number of active cleanup objects when we entered
1025    /// this expression evaluation context.
1026    unsigned NumCleanupObjects;
1027
1028    /// The number of typos encountered during this expression evaluation
1029    /// context (i.e. the number of TypoExprs created).
1030    unsigned NumTypos;
1031
1032    MaybeODRUseExprSet SavedMaybeODRUseExprs;
1033
1034    /// The lambdas that are present within this context, if it
1035    /// is indeed an unevaluated context.
1036    SmallVector<LambdaExpr *, 2Lambdas;
1037
1038    /// The declaration that provides context for lambda expressions
1039    /// and block literals if the normal declaration context does not
1040    /// suffice, e.g., in a default function argument.
1041    Decl *ManglingContextDecl;
1042
1043    /// The context information used to mangle lambda expressions
1044    /// and block literals within this context.
1045    ///
1046    /// This mangling information is allocated lazily, since most contexts
1047    /// do not have lambda expressions or block literals.
1048    std::unique_ptr<MangleNumberingContextMangleNumbering;
1049
1050    /// If we are processing a decltype type, a set of call expressions
1051    /// for which we have deferred checking the completeness of the return type.
1052    SmallVector<CallExpr *, 8DelayedDecltypeCalls;
1053
1054    /// If we are processing a decltype type, a set of temporary binding
1055    /// expressions for which we have deferred checking the destructor.
1056    SmallVector<CXXBindTemporaryExpr *, 8DelayedDecltypeBinds;
1057
1058    llvm::SmallPtrSet<const Expr *, 8PossibleDerefs;
1059
1060    /// \brief Describes whether we are in an expression constext which we have
1061    /// to handle differently.
1062    enum ExpressionKind {
1063      EK_DecltypeEK_TemplateArgumentEK_Other
1064    } ExprContext;
1065
1066    ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context,
1067                                      unsigned NumCleanupObjects,
1068                                      CleanupInfo ParentCleanup,
1069                                      Decl *ManglingContextDecl,
1070                                      ExpressionKind ExprContext)
1071        : Context(Context), ParentCleanup(ParentCleanup),
1072          NumCleanupObjects(NumCleanupObjects), NumTypos(0),
1073          ManglingContextDecl(ManglingContextDecl), MangleNumbering(),
1074          ExprContext(ExprContext) {}
1075
1076    /// Retrieve the mangling numbering context, used to consistently
1077    /// number constructs like lambdas for mangling.
1078    MangleNumberingContext &getMangleNumberingContext(ASTContext &Ctx);
1079
1080    bool isUnevaluated() const {
1081      return Context == ExpressionEvaluationContext::Unevaluated ||
1082             Context == ExpressionEvaluationContext::UnevaluatedAbstract ||
1083             Context == ExpressionEvaluationContext::UnevaluatedList;
1084    }
1085    bool isConstantEvaluated() const {
1086      return Context == ExpressionEvaluationContext::ConstantEvaluated;
1087    }
1088  };
1089
1090  /// A stack of expression evaluation contexts.
1091  SmallVector<ExpressionEvaluationContextRecord8ExprEvalContexts;
1092
1093  /// Emit a warning for all pending noderef expressions that we recorded.
1094  void WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec);
1095
1096  /// Compute the mangling number context for a lambda expression or
1097  /// block literal.
1098  ///
1099  /// \param DC - The DeclContext containing the lambda expression or
1100  /// block literal.
1101  /// \param[out] ManglingContextDecl - Returns the ManglingContextDecl
1102  /// associated with the context, if relevant.
1103  MangleNumberingContext *getCurrentMangleNumberContext(
1104    const DeclContext *DC,
1105    Decl *&ManglingContextDecl);
1106
1107
1108  /// SpecialMemberOverloadResult - The overloading result for a special member
1109  /// function.
1110  ///
1111  /// This is basically a wrapper around PointerIntPair. The lowest bits of the
1112  /// integer are used to determine whether overload resolution succeeded.
1113  class SpecialMemberOverloadResult {
1114  public:
1115    enum Kind {
1116      NoMemberOrDeleted,
1117      Ambiguous,
1118      Success
1119    };
1120
1121  private:
1122    llvm::PointerIntPair<CXXMethodDecl*, 2Pair;
1123
1124  public:
1125    SpecialMemberOverloadResult() : Pair() {}
1126    SpecialMemberOverloadResult(CXXMethodDecl *MD)
1127        : Pair(MD, MD->isDeleted() ? NoMemberOrDeleted : Success) {}
1128
1129    CXXMethodDecl *getMethod() const { return Pair.getPointer(); }
1130    void setMethod(CXXMethodDecl *MD) { Pair.setPointer(MD); }
1131
1132    Kind getKind() const { return static_cast<Kind>(Pair.getInt()); }
1133    void setKind(Kind K) { Pair.setInt(K); }
1134  };
1135
1136  class SpecialMemberOverloadResultEntry
1137      : public llvm::FastFoldingSetNode,
1138        public SpecialMemberOverloadResult {
1139  public:
1140    SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
1141      : FastFoldingSetNode(ID)
1142    {}
1143  };
1144
1145  /// A cache of special member function overload resolution results
1146  /// for C++ records.
1147  llvm::FoldingSet<SpecialMemberOverloadResultEntry> SpecialMemberCache;
1148
1149  /// A cache of the flags available in enumerations with the flag_bits
1150  /// attribute.
1151  mutable llvm::DenseMap<const EnumDecl*, llvm::APInt> FlagBitsCache;
1152
1153  /// The kind of translation unit we are processing.
1154  ///
1155  /// When we're processing a complete translation unit, Sema will perform
1156  /// end-of-translation-unit semantic tasks (such as creating
1157  /// initializers for tentative definitions in C) once parsing has
1158  /// completed. Modules and precompiled headers perform different kinds of
1159  /// checks.
1160  TranslationUnitKind TUKind;
1161
1162  llvm::BumpPtrAllocator BumpAlloc;
1163
1164  /// The number of SFINAE diagnostics that have been trapped.
1165  unsigned NumSFINAEErrors;
1166
1167  typedef llvm::DenseMap<ParmVarDecl *, llvm::TinyPtrVector<ParmVarDecl *>>
1168    UnparsedDefaultArgInstantiationsMap;
1169
1170  /// A mapping from parameters with unparsed default arguments to the
1171  /// set of instantiations of each parameter.
1172  ///
1173  /// This mapping is a temporary data structure used when parsing
1174  /// nested class templates or nested classes of class templates,
1175  /// where we might end up instantiating an inner class before the
1176  /// default arguments of its methods have been parsed.
1177  UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations;
1178
1179  // Contains the locations of the beginning of unparsed default
1180  // argument locations.
1181  llvm::DenseMap<ParmVarDecl *, SourceLocation> UnparsedDefaultArgLocs;
1182
1183  /// UndefinedInternals - all the used, undefined objects which require a
1184  /// definition in this translation unit.
1185  llvm::MapVector<NamedDecl *, SourceLocation> UndefinedButUsed;
1186
1187  /// Determine if VD, which must be a variable or function, is an external
1188  /// symbol that nonetheless can't be referenced from outside this translation
1189  /// unit because its type has no linkage and it's not extern "C".
1190  bool isExternalWithNoLinkageType(ValueDecl *VD);
1191
1192  /// Obtain a sorted list of functions that are undefined but ODR-used.
1193  void getUndefinedButUsed(
1194      SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> > &Undefined);
1195
1196  /// Retrieves list of suspicious delete-expressions that will be checked at
1197  /// the end of translation unit.
1198  const llvm::MapVector<FieldDecl *, DeleteLocs> &
1199  getMismatchingDeleteExpressions() const;
1200
1201  typedef std::pair<ObjCMethodListObjCMethodListGlobalMethods;
1202  typedef llvm::DenseMap<Selector, GlobalMethods> GlobalMethodPool;
1203
1204  /// Method Pool - allows efficient lookup when typechecking messages to "id".
1205  /// We need to maintain a list, since selectors can have differing signatures
1206  /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
1207  /// of selectors are "overloaded").
1208  /// At the head of the list it is recorded whether there were 0, 1, or >= 2
1209  /// methods inside categories with a particular selector.
1210  GlobalMethodPool MethodPool;
1211
1212  /// Method selectors used in a \@selector expression. Used for implementation
1213  /// of -Wselector.
1214  llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
1215
1216  /// Kinds of C++ special members.
1217  enum CXXSpecialMember {
1218    CXXDefaultConstructor,
1219    CXXCopyConstructor,
1220    CXXMoveConstructor,
1221    CXXCopyAssignment,
1222    CXXMoveAssignment,
1223    CXXDestructor,
1224    CXXInvalid
1225  };
1226
1227  typedef llvm::PointerIntPair<CXXRecordDecl *, 3, CXXSpecialMember>
1228      SpecialMemberDecl;
1229
1230  /// The C++ special members which we are currently in the process of
1231  /// declaring. If this process recursively triggers the declaration of the
1232  /// same special member, we should act as if it is not yet declared.
1233  llvm::SmallPtrSet<SpecialMemberDecl, 4SpecialMembersBeingDeclared;
1234
1235  /// The function definitions which were renamed as part of typo-correction
1236  /// to match their respective declarations. We want to keep track of them
1237  /// to ensure that we don't emit a "redefinition" error if we encounter a
1238  /// correctly named definition after the renamed definition.
1239  llvm::SmallPtrSet<const NamedDecl *, 4TypoCorrectedFunctionDefinitions;
1240
1241  /// Stack of types that correspond to the parameter entities that are
1242  /// currently being copy-initialized. Can be empty.
1243  llvm::SmallVector<QualType4CurrentParameterCopyTypes;
1244
1245  void ReadMethodPool(Selector Sel);
1246  void updateOutOfDateSelector(Selector Sel);
1247
1248  /// Private Helper predicate to check for 'self'.
1249  bool isSelfExpr(Expr *RExpr);
1250  bool isSelfExpr(Expr *RExprconst ObjCMethodDecl *Method);
1251
1252  /// Cause the active diagnostic on the DiagosticsEngine to be
1253  /// emitted. This is closely coupled to the SemaDiagnosticBuilder class and
1254  /// should not be used elsewhere.
1255  void EmitCurrentDiagnostic(unsigned DiagID);
1256
1257  /// Records and restores the FP_CONTRACT state on entry/exit of compound
1258  /// statements.
1259  class FPContractStateRAII {
1260  public:
1261    FPContractStateRAII(Sema &S) : S(S), OldFPFeaturesState(S.FPFeatures) {}
1262    ~FPContractStateRAII() { S.FPFeatures = OldFPFeaturesState; }
1263
1264  private:
1265    SemaS;
1266    FPOptions OldFPFeaturesState;
1267  };
1268
1269  void addImplicitTypedef(StringRef NameQualType T);
1270
1271public:
1272  Sema(Preprocessor &ppASTContext &ctxtASTConsumer &consumer,
1273       TranslationUnitKind TUKind = TU_Complete,
1274       CodeCompleteConsumer *CompletionConsumer = nullptr);
1275  ~Sema();
1276
1277  /// Perform initialization that occurs after the parser has been
1278  /// initialized but before it parses anything.
1279  void Initialize();
1280
1281  const LangOptions &getLangOpts() const { return LangOpts; }
1282  OpenCLOptions &getOpenCLOptions() { return OpenCLFeatures; }
1283  FPOptions     &getFPOptions() { return FPFeatures; }
1284
1285  DiagnosticsEngine &getDiagnostics() const { return Diags; }
1286  SourceManager &getSourceManager() const { return SourceMgr; }
1287  Preprocessor &getPreprocessor() const { return PP; }
1288  ASTContext &getASTContext() const { return Context; }
1289  ASTConsumer &getASTConsumer() const { return Consumer; }
1290  ASTMutationListener *getASTMutationListener() const;
1291  ExternalSemaSourcegetExternalSource() const { return ExternalSource; }
1292
1293  ///Registers an external source. If an external source already exists,
1294  /// creates a multiplex external source and appends to it.
1295  ///
1296  ///\param[in] E - A non-null external sema source.
1297  ///
1298  void addExternalSource(ExternalSemaSource *E);
1299
1300  void PrintStats() const;
1301
1302  /// Helper class that creates diagnostics with optional
1303  /// template instantiation stacks.
1304  ///
1305  /// This class provides a wrapper around the basic DiagnosticBuilder
1306  /// class that emits diagnostics. SemaDiagnosticBuilder is
1307  /// responsible for emitting the diagnostic (as DiagnosticBuilder
1308  /// does) and, if the diagnostic comes from inside a template
1309  /// instantiation, printing the template instantiation stack as
1310  /// well.
1311  class SemaDiagnosticBuilder : public DiagnosticBuilder {
1312    Sema &SemaRef;
1313    unsigned DiagID;
1314
1315  public:
1316    SemaDiagnosticBuilder(DiagnosticBuilder &DBSema &SemaRefunsigned DiagID)
1317      : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) { }
1318
1319    // This is a cunning lie. DiagnosticBuilder actually performs move
1320    // construction in its copy constructor (but due to varied uses, it's not
1321    // possible to conveniently express this as actual move construction). So
1322    // the default copy ctor here is fine, because the base class disables the
1323    // source anyway, so the user-defined ~SemaDiagnosticBuilder is a safe no-op
1324    // in that case anwyay.
1325    SemaDiagnosticBuilder(const SemaDiagnosticBuilder&) = default;
1326
1327    ~SemaDiagnosticBuilder() {
1328      // If we aren't active, there is nothing to do.
1329      if (!isActive()) return;
1330
1331      // Otherwise, we need to emit the diagnostic. First flush the underlying
1332      // DiagnosticBuilder data, and clear the diagnostic builder itself so it
1333      // won't emit the diagnostic in its own destructor.
1334      //
1335      // This seems wasteful, in that as written the DiagnosticBuilder dtor will
1336      // do its own needless checks to see if the diagnostic needs to be
1337      // emitted. However, because we take care to ensure that the builder
1338      // objects never escape, a sufficiently smart compiler will be able to
1339      // eliminate that code.
1340      FlushCounts();
1341      Clear();
1342
1343      // Dispatch to Sema to emit the diagnostic.
1344      SemaRef.EmitCurrentDiagnostic(DiagID);
1345    }
1346
1347    /// Teach operator<< to produce an object of the correct type.
1348    template<typename T>
1349    friend const SemaDiagnosticBuilder &operator<<(
1350        const SemaDiagnosticBuilder &Diagconst T &Value) {
1351      const DiagnosticBuilder &BaseDiag = Diag;
1352      BaseDiag << Value;
1353      return Diag;
1354    }
1355  };
1356
1357  /// Emit a diagnostic.
1358  SemaDiagnosticBuilder Diag(SourceLocation Locunsigned DiagID) {
1359    DiagnosticBuilder DB = Diags.Report(LocDiagID);
1360    return SemaDiagnosticBuilder(DB, *thisDiagID);
1361  }
1362
1363  /// Emit a partial diagnostic.
1364  SemaDiagnosticBuilder Diag(SourceLocation Locconst PartialDiagnosticPD);
1365
1366  /// Build a partial diagnostic.
1367  PartialDiagnostic PDiag(unsigned DiagID = 0); // in SemaInternal.h
1368
1369  bool findMacroSpelling(SourceLocation &locStringRef name);
1370
1371  /// Get a string to suggest for zero-initialization of a type.
1372  std::string
1373  getFixItZeroInitializerForType(QualType TSourceLocation Locconst;
1374  std::string getFixItZeroLiteralForType(QualType TSourceLocation Locconst;
1375
1376  /// Calls \c Lexer::getLocForEndOfToken()
1377  SourceLocation getLocForEndOfToken(SourceLocation Locunsigned Offset = 0);
1378
1379  /// Retrieve the module loader associated with the preprocessor.
1380  ModuleLoader &getModuleLoader() const;
1381
1382  void emitAndClearUnusedLocalTypedefWarnings();
1383
1384  void ActOnStartOfTranslationUnit();
1385  void ActOnEndOfTranslationUnit();
1386
1387  void CheckDelegatingCtorCycles();
1388
1389  Scope *getScopeForContext(DeclContext *Ctx);
1390
1391  void PushFunctionScope();
1392  void PushBlockScope(Scope *BlockScopeBlockDecl *Block);
1393  sema::LambdaScopeInfo *PushLambdaScope();
1394
1395  /// This is used to inform Sema what the current TemplateParameterDepth
1396  /// is during Parsing.  Currently it is used to pass on the depth
1397  /// when parsing generic lambda 'auto' parameters.
1398  void RecordParsingTemplateParameterDepth(unsigned Depth);
1399
1400  void PushCapturedRegionScope(Scope *RegionScopeCapturedDecl *CD,
1401                               RecordDecl *RD,
1402                               CapturedRegionKind K);
1403  void
1404  PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP = nullptr,
1405                       const Decl *D = nullptr,
1406                       const BlockExpr *blkExpr = nullptr);
1407
1408  sema::FunctionScopeInfo *getCurFunction() const {
1409    return FunctionScopes.empty() ? nullptr : FunctionScopes.back();
1410  }
1411
1412  sema::FunctionScopeInfo *getEnclosingFunction() const;
1413
1414  void setFunctionHasBranchIntoScope();
1415  void setFunctionHasBranchProtectedScope();
1416  void setFunctionHasIndirectGoto();
1417
1418  void PushCompoundScope(bool IsStmtExpr);
1419  void PopCompoundScope();
1420
1421  sema::CompoundScopeInfo &getCurCompoundScope() const;
1422
1423  bool hasAnyUnrecoverableErrorsInThisFunction() const;
1424
1425  /// Retrieve the current block, if any.
1426  sema::BlockScopeInfo *getCurBlock();
1427
1428  /// Retrieve the current lambda scope info, if any.
1429  /// \param IgnoreNonLambdaCapturingScope true if should find the top-most
1430  /// lambda scope info ignoring all inner capturing scopes that are not
1431  /// lambda scopes.
1432  sema::LambdaScopeInfo *
1433  getCurLambda(bool IgnoreNonLambdaCapturingScope = false);
1434
1435  /// Retrieve the current generic lambda info, if any.
1436  sema::LambdaScopeInfo *getCurGenericLambda();
1437
1438  /// Retrieve the current captured region, if any.
1439  sema::CapturedRegionScopeInfo *getCurCapturedRegion();
1440
1441  /// WeakTopLevelDeclDecls - access to \#pragma weak-generated Decls
1442  SmallVectorImpl<Decl *> &WeakTopLevelDecls() { return WeakTopLevelDecl; }
1443
1444  void ActOnComment(SourceRange Comment);
1445
1446  //===--------------------------------------------------------------------===//
1447  // Type Analysis / Processing: SemaType.cpp.
1448  //
1449
1450  QualType BuildQualifiedType(QualType TSourceLocation LocQualifiers Qs,
1451                              const DeclSpec *DS = nullptr);
1452  QualType BuildQualifiedType(QualType TSourceLocation Locunsigned CVRA,
1453                              const DeclSpec *DS = nullptr);
1454  QualType BuildPointerType(QualType T,
1455                            SourceLocation LocDeclarationName Entity);
1456  QualType BuildReferenceType(QualType Tbool LValueRef,
1457                              SourceLocation LocDeclarationName Entity);
1458  QualType BuildArrayType(QualType TArrayType::ArraySizeModifier ASM,
1459                          Expr *ArraySizeunsigned Quals,
1460                          SourceRange BracketsDeclarationName Entity);
1461  QualType BuildVectorType(QualType TExpr *VecSizeSourceLocation AttrLoc);
1462  QualType BuildExtVectorType(QualType TExpr *ArraySize,
1463                              SourceLocation AttrLoc);
1464  QualType BuildAddressSpaceAttr(QualType &TLangAS ASIdxExpr *AddrSpace,
1465                                 SourceLocation AttrLoc);
1466
1467  /// Same as above, but constructs the AddressSpace index if not provided.
1468  QualType BuildAddressSpaceAttr(QualType &TExpr *AddrSpace,
1469                                 SourceLocation AttrLoc);
1470
1471  bool CheckFunctionReturnType(QualType TSourceLocation Loc);
1472
1473  /// Build a function type.
1474  ///
1475  /// This routine checks the function type according to C++ rules and
1476  /// under the assumption that the result type and parameter types have
1477  /// just been instantiated from a template. It therefore duplicates
1478  /// some of the behavior of GetTypeForDeclarator, but in a much
1479  /// simpler form that is only suitable for this narrow use case.
1480  ///
1481  /// \param T The return type of the function.
1482  ///
1483  /// \param ParamTypes The parameter types of the function. This array
1484  /// will be modified to account for adjustments to the types of the
1485  /// function parameters.
1486  ///
1487  /// \param Loc The location of the entity whose type involves this
1488  /// function type or, if there is no such entity, the location of the
1489  /// type that will have function type.
1490  ///
1491  /// \param Entity The name of the entity that involves the function
1492  /// type, if known.
1493  ///
1494  /// \param EPI Extra information about the function type. Usually this will
1495  /// be taken from an existing function with the same prototype.
1496  ///
1497  /// \returns A suitable function type, if there are no errors. The
1498  /// unqualified type will always be a FunctionProtoType.
1499  /// Otherwise, returns a NULL type.
1500  QualType BuildFunctionType(QualType T,
1501                             MutableArrayRef<QualTypeParamTypes,
1502                             SourceLocation LocDeclarationName Entity,
1503                             const FunctionProtoType::ExtProtoInfo &EPI);
1504
1505  QualType BuildMemberPointerType(QualType TQualType Class,
1506                                  SourceLocation Loc,
1507                                  DeclarationName Entity);
1508  QualType BuildBlockPointerType(QualType T,
1509                                 SourceLocation LocDeclarationName Entity);
1510  QualType BuildParenType(QualType T);
1511  QualType BuildAtomicType(QualType TSourceLocation Loc);
1512  QualType BuildReadPipeType(QualType T,
1513                         SourceLocation Loc);
1514  QualType BuildWritePipeType(QualType T,
1515                         SourceLocation Loc);
1516
1517  TypeSourceInfo *GetTypeForDeclarator(Declarator &DScope *S);
1518  TypeSourceInfo *GetTypeForDeclaratorCast(Declarator &DQualType FromTy);
1519
1520  /// Package the given type and TSI into a ParsedType.
1521  ParsedType CreateParsedType(QualType TTypeSourceInfo *TInfo);
1522  DeclarationNameInfo GetNameForDeclarator(Declarator &D);
1523  DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name);
1524  static QualType GetTypeFromParser(ParsedType Ty,
1525                                    TypeSourceInfo **TInfo = nullptr);
1526  CanThrowResult canThrow(const Expr *E);
1527  const FunctionProtoType *ResolveExceptionSpec(SourceLocation Loc,
1528                                                const FunctionProtoType *FPT);
1529  void UpdateExceptionSpec(FunctionDecl *FD,
1530                           const FunctionProtoType::ExceptionSpecInfo &ESI);
1531  bool CheckSpecifiedExceptionType(QualType &TSourceRange Range);
1532  bool CheckDistantExceptionSpec(QualType T);
1533  bool CheckEquivalentExceptionSpec(FunctionDecl *OldFunctionDecl *New);
1534  bool CheckEquivalentExceptionSpec(
1535      const FunctionProtoType *OldSourceLocation OldLoc,
1536      const FunctionProtoType *NewSourceLocation NewLoc);
1537  bool CheckEquivalentExceptionSpec(
1538      const PartialDiagnostic &DiagIDconst PartialDiagnostic & NoteID,
1539      const FunctionProtoType *OldSourceLocation OldLoc,
1540      const FunctionProtoType *NewSourceLocation NewLoc);
1541  bool handlerCanCatch(QualType HandlerTypeQualType ExceptionType);
1542  bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID,
1543                                const PartialDiagnostic &NestedDiagID,
1544                                const PartialDiagnostic &NoteID,
1545                                const FunctionProtoType *Superset,
1546                                SourceLocation SuperLoc,
1547                                const FunctionProtoType *Subset,
1548                                SourceLocation SubLoc);
1549  bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID,
1550                               const PartialDiagnostic &NoteID,
1551                               const FunctionProtoType *Target,
1552                               SourceLocation TargetLoc,
1553                               const FunctionProtoType *Source,
1554                               SourceLocation SourceLoc);
1555
1556  TypeResult ActOnTypeName(Scope *SDeclarator &D);
1557
1558  /// The parser has parsed the context-sensitive type 'instancetype'
1559  /// in an Objective-C message declaration. Return the appropriate type.
1560  ParsedType ActOnObjCInstanceType(SourceLocation Loc);
1561
1562  /// Abstract class used to diagnose incomplete types.
1563  struct TypeDiagnoser {
1564    TypeDiagnoser() {}
1565
1566    virtual void diagnose(Sema &SSourceLocation LocQualType T) = 0;
1567    virtual ~TypeDiagnoser() {}
1568  };
1569
1570  static int getPrintable(int I) { return I; }
1571  static unsigned getPrintable(unsigned I) { return I; }
1572  static bool getPrintable(bool B) { return B; }
1573  static const char * getPrintable(const char *S) { return S; }
1574  static StringRef getPrintable(StringRef S) { return S; }
1575  static const std::string &getPrintable(const std::string &S) { return S; }
1576  static const IdentifierInfo *getPrintable(const IdentifierInfo *II) {
1577    return II;
1578  }
1579  static DeclarationName getPrintable(DeclarationName N) { return N; }
1580  static QualType getPrintable(QualType T) { return T; }
1581  static SourceRange getPrintable(SourceRange R) { return R; }
1582  static SourceRange getPrintable(SourceLocation L) { return L; }
1583  static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); }
1584  static SourceRange getPrintable(TypeLoc TL) { return TL.getSourceRange();}
1585
1586  template <typename... Ts> class BoundTypeDiagnoser : public TypeDiagnoser {
1587    unsigned DiagID;
1588    std::tuple<const Ts &...> Args;
1589
1590    template <std::size_t... Is>
1591    void emit(const SemaDiagnosticBuilder &DB,
1592              llvm::index_sequence<Is...>) const {
1593      // Apply all tuple elements to the builder in order.
1594      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1595      (void)Dummy;
1596    }
1597
1598  public:
1599    BoundTypeDiagnoser(unsigned DiagIDconst Ts &...Args)
1600        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1601       (0) . __assert_fail ("DiagID != 0 && \"no diagnostic for type diagnoser\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 1601, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(DiagID != 0 && "no diagnostic for type diagnoser");
1602    }
1603
1604    void diagnose(Sema &SSourceLocation LocQualType T) override {
1605      const SemaDiagnosticBuilder &DB = S.Diag(LocDiagID);
1606      emit(DB, llvm::index_sequence_for<Ts...>());
1607      DB << T;
1608    }
1609  };
1610
1611private:
1612  /// Methods for marking which expressions involve dereferencing a pointer
1613  /// marked with the 'noderef' attribute. Expressions are checked bottom up as
1614  /// they are parsed, meaning that a noderef pointer may not be accessed. For
1615  /// example, in `&*p` where `p` is a noderef pointer, we will first parse the
1616  /// `*p`, but need to check that `address of` is called on it. This requires
1617  /// keeping a container of all pending expressions and checking if the address
1618  /// of them are eventually taken.
1619  void CheckSubscriptAccessOfNoDeref(const ArraySubscriptExpr *E);
1620  void CheckAddressOfNoDeref(const Expr *E);
1621  void CheckMemberAccessOfNoDeref(const MemberExpr *E);
1622
1623  bool RequireCompleteTypeImpl(SourceLocation LocQualType T,
1624                               TypeDiagnoser *Diagnoser);
1625
1626  struct ModuleScope {
1627    clang::Module *Module = nullptr;
1628    bool ModuleInterface = false;
1629    VisibleModuleSet OuterVisibleModules;
1630  };
1631  /// The modules we're currently parsing.
1632  llvm::SmallVector<ModuleScope16ModuleScopes;
1633
1634  /// Get the module whose scope we are currently within.
1635  Module *getCurrentModule() const {
1636    return ModuleScopes.empty() ? nullptr : ModuleScopes.back().Module;
1637  }
1638
1639  VisibleModuleSet VisibleModules;
1640
1641public:
1642  /// Get the module owning an entity.
1643  Module *getOwningModule(Decl *Entity) { return Entity->getOwningModule(); }
1644
1645  /// Make a merged definition of an existing hidden definition \p ND
1646  /// visible at the specified location.
1647  void makeMergedDefinitionVisible(NamedDecl *ND);
1648
1649  bool isModuleVisible(const Module *Mbool ModulePrivate = false);
1650
1651  /// Determine whether a declaration is visible to name lookup.
1652  bool isVisible(const NamedDecl *D) {
1653    return !D->isHidden() || isVisibleSlow(D);
1654  }
1655
1656  /// Determine whether any declaration of an entity is visible.
1657  bool
1658  hasVisibleDeclaration(const NamedDecl *D,
1659                        llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
1660    return isVisible(D) || hasVisibleDeclarationSlow(DModules);
1661  }
1662  bool hasVisibleDeclarationSlow(const NamedDecl *D,
1663                                 llvm::SmallVectorImpl<Module *> *Modules);
1664
1665  bool hasVisibleMergedDefinition(NamedDecl *Def);
1666  bool hasMergedDefinitionInCurrentModule(NamedDecl *Def);
1667
1668  /// Determine if \p D and \p Suggested have a structurally compatible
1669  /// layout as described in C11 6.2.7/1.
1670  bool hasStructuralCompatLayout(Decl *DDecl *Suggested);
1671
1672  /// Determine if \p D has a visible definition. If not, suggest a declaration
1673  /// that should be made visible to expose the definition.
1674  bool hasVisibleDefinition(NamedDecl *DNamedDecl **Suggested,
1675                            bool OnlyNeedComplete = false);
1676  bool hasVisibleDefinition(const NamedDecl *D) {
1677    NamedDecl *Hidden;
1678    return hasVisibleDefinition(const_cast<NamedDecl*>(D), &Hidden);
1679  }
1680
1681  /// Determine if the template parameter \p D has a visible default argument.
1682  bool
1683  hasVisibleDefaultArgument(const NamedDecl *D,
1684                            llvm::SmallVectorImpl<Module *> *Modules = nullptr);
1685
1686  /// Determine if there is a visible declaration of \p D that is an explicit
1687  /// specialization declaration for a specialization of a template. (For a
1688  /// member specialization, use hasVisibleMemberSpecialization.)
1689  bool hasVisibleExplicitSpecialization(
1690      const NamedDecl *Dllvm::SmallVectorImpl<Module *> *Modules = nullptr);
1691
1692  /// Determine if there is a visible declaration of \p D that is a member
1693  /// specialization declaration (as opposed to an instantiated declaration).
1694  bool hasVisibleMemberSpecialization(
1695      const NamedDecl *Dllvm::SmallVectorImpl<Module *> *Modules = nullptr);
1696
1697  /// Determine if \p A and \p B are equivalent internal linkage declarations
1698  /// from different modules, and thus an ambiguity error can be downgraded to
1699  /// an extension warning.
1700  bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A,
1701                                              const NamedDecl *B);
1702  void diagnoseEquivalentInternalLinkageDeclarations(
1703      SourceLocation Locconst NamedDecl *D,
1704      ArrayRef<const NamedDecl *> Equiv);
1705
1706  bool isUsualDeallocationFunction(const CXXMethodDecl *FD);
1707
1708  bool isCompleteType(SourceLocation LocQualType T) {
1709    return !RequireCompleteTypeImpl(LocTnullptr);
1710  }
1711  bool RequireCompleteType(SourceLocation LocQualType T,
1712                           TypeDiagnoser &Diagnoser);
1713  bool RequireCompleteType(SourceLocation LocQualType T,
1714                           unsigned DiagID);
1715
1716  template <typename... Ts>
1717  bool RequireCompleteType(SourceLocation LocQualType Tunsigned DiagID,
1718                           const Ts &...Args) {
1719    BoundTypeDiagnoser<Ts...> Diagnoser(DiagIDArgs...);
1720    return RequireCompleteType(LocTDiagnoser);
1721  }
1722
1723  void completeExprArrayBound(Expr *E);
1724  bool RequireCompleteExprType(Expr *ETypeDiagnoser &Diagnoser);
1725  bool RequireCompleteExprType(Expr *Eunsigned DiagID);
1726
1727  template <typename... Ts>
1728  bool RequireCompleteExprType(Expr *Eunsigned DiagIDconst Ts &...Args) {
1729    BoundTypeDiagnoser<Ts...> Diagnoser(DiagIDArgs...);
1730    return RequireCompleteExprType(EDiagnoser);
1731  }
1732
1733  bool RequireLiteralType(SourceLocation LocQualType T,
1734                          TypeDiagnoser &Diagnoser);
1735  bool RequireLiteralType(SourceLocation LocQualType Tunsigned DiagID);
1736
1737  template <typename... Ts>
1738  bool RequireLiteralType(SourceLocation LocQualType Tunsigned DiagID,
1739                          const Ts &...Args) {
1740    BoundTypeDiagnoser<Ts...> Diagnoser(DiagIDArgs...);
1741    return RequireLiteralType(LocTDiagnoser);
1742  }
1743
1744  QualType getElaboratedType(ElaboratedTypeKeyword Keyword,
1745                             const CXXScopeSpec &SSQualType T,
1746                             TagDecl *OwnedTagDecl = nullptr);
1747
1748  QualType BuildTypeofExprType(Expr *ESourceLocation Loc);
1749  /// If AsUnevaluated is false, E is treated as though it were an evaluated
1750  /// context, such as when building a type for decltype(auto).
1751  QualType BuildDecltypeType(Expr *ESourceLocation Loc,
1752                             bool AsUnevaluated = true);
1753  QualType BuildUnaryTransformType(QualType BaseType,
1754                                   UnaryTransformType::UTTKind UKind,
1755                                   SourceLocation Loc);
1756
1757  //===--------------------------------------------------------------------===//
1758  // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
1759  //
1760
1761  struct SkipBodyInfo {
1762    SkipBodyInfo()
1763        : ShouldSkip(false), CheckSameAsPrevious(false), Previous(nullptr),
1764          New(nullptr) {}
1765    bool ShouldSkip;
1766    bool CheckSameAsPrevious;
1767    NamedDecl *Previous;
1768    NamedDecl *New;
1769  };
1770
1771  DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *PtrDecl *OwnedType = nullptr);
1772
1773  void DiagnoseUseOfUnimplementedSelectors();
1774
1775  bool isSimpleTypeSpecifier(tok::TokenKind Kindconst;
1776
1777  ParsedType getTypeName(const IdentifierInfo &IISourceLocation NameLoc,
1778                         Scope *SCXXScopeSpec *SS = nullptr,
1779                         bool isClassName = falsebool HasTrailingDot = false,
1780                         ParsedType ObjectType = nullptr,
1781                         bool IsCtorOrDtorName = false,
1782                         bool WantNontrivialTypeSourceInfo = false,
1783                         bool IsClassTemplateDeductionContext = true,
1784                         IdentifierInfo **CorrectedII = nullptr);
1785  TypeSpecifierType isTagName(IdentifierInfo &IIScope *S);
1786  bool isMicrosoftMissingTypename(const CXXScopeSpec *SSScope *S);
1787  void DiagnoseUnknownTypeName(IdentifierInfo *&II,
1788                               SourceLocation IILoc,
1789                               Scope *S,
1790                               CXXScopeSpec *SS,
1791                               ParsedType &SuggestedType,
1792                               bool IsTemplateName = false);
1793
1794  /// Attempt to behave like MSVC in situations where lookup of an unqualified
1795  /// type name has failed in a dependent context. In these situations, we
1796  /// automatically form a DependentTypeName that will retry lookup in a related
1797  /// scope during instantiation.
1798  ParsedType ActOnMSVCUnknownTypeName(const IdentifierInfo &II,
1799                                      SourceLocation NameLoc,
1800                                      bool IsTemplateTypeArg);
1801
1802  /// Describes the result of the name lookup and resolution performed
1803  /// by \c ClassifyName().
1804  enum NameClassificationKind {
1805    NC_Unknown,
1806    NC_Error,
1807    NC_Keyword,
1808    NC_Type,
1809    NC_Expression,
1810    NC_NestedNameSpecifier,
1811    NC_TypeTemplate,
1812    NC_VarTemplate,
1813    NC_FunctionTemplate
1814  };
1815
1816  class NameClassification {
1817    NameClassificationKind Kind;
1818    ExprResult Expr;
1819    TemplateName Template;
1820    ParsedType Type;
1821
1822    explicit NameClassification(NameClassificationKind Kind) : Kind(Kind) {}
1823
1824  public:
1825    NameClassification(ExprResult Expr) : Kind(NC_Expression), Expr(Expr) {}
1826
1827    NameClassification(ParsedType Type) : Kind(NC_Type), Type(Type) {}
1828
1829    NameClassification(const IdentifierInfo *Keyword) : Kind(NC_Keyword) {}
1830
1831    static NameClassification Error() {
1832      return NameClassification(NC_Error);
1833    }
1834
1835    static NameClassification Unknown() {
1836      return NameClassification(NC_Unknown);
1837    }
1838
1839    static NameClassification NestedNameSpecifier() {
1840      return NameClassification(NC_NestedNameSpecifier);
1841    }
1842
1843    static NameClassification TypeTemplate(TemplateName Name) {
1844      NameClassification Result(NC_TypeTemplate);
1845      Result.Template = Name;
1846      return Result;
1847    }
1848
1849    static NameClassification VarTemplate(TemplateName Name) {
1850      NameClassification Result(NC_VarTemplate);
1851      Result.Template = Name;
1852      return Result;
1853    }
1854
1855    static NameClassification FunctionTemplate(TemplateName Name) {
1856      NameClassification Result(NC_FunctionTemplate);
1857      Result.Template = Name;
1858      return Result;
1859    }
1860
1861    NameClassificationKind getKind() const { return Kind; }
1862
1863    ParsedType getType() const {
1864      assert(Kind == NC_Type);
1865      return Type;
1866    }
1867
1868    ExprResult getExpression() const {
1869      assert(Kind == NC_Expression);
1870      return Expr;
1871    }
1872
1873    TemplateName getTemplateName() const {
1874      assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate ||
1875             Kind == NC_VarTemplate);
1876      return Template;
1877    }
1878
1879    TemplateNameKind getTemplateNameKind() const {
1880      switch (Kind) {
1881      case NC_TypeTemplate:
1882        return TNK_Type_template;
1883      case NC_FunctionTemplate:
1884        return TNK_Function_template;
1885      case NC_VarTemplate:
1886        return TNK_Var_template;
1887      default:
1888        llvm_unreachable("unsupported name classification.");
1889      }
1890    }
1891  };
1892
1893  /// Perform name lookup on the given name, classifying it based on
1894  /// the results of name lookup and the following token.
1895  ///
1896  /// This routine is used by the parser to resolve identifiers and help direct
1897  /// parsing. When the identifier cannot be found, this routine will attempt
1898  /// to correct the typo and classify based on the resulting name.
1899  ///
1900  /// \param S The scope in which we're performing name lookup.
1901  ///
1902  /// \param SS The nested-name-specifier that precedes the name.
1903  ///
1904  /// \param Name The identifier. If typo correction finds an alternative name,
1905  /// this pointer parameter will be updated accordingly.
1906  ///
1907  /// \param NameLoc The location of the identifier.
1908  ///
1909  /// \param NextToken The token following the identifier. Used to help
1910  /// disambiguate the name.
1911  ///
1912  /// \param IsAddressOfOperand True if this name is the operand of a unary
1913  ///        address of ('&') expression, assuming it is classified as an
1914  ///        expression.
1915  ///
1916  /// \param CCC The correction callback, if typo correction is desired.
1917  NameClassification ClassifyName(Scope *SCXXScopeSpec &SS,
1918                                  IdentifierInfo *&NameSourceLocation NameLoc,
1919                                  const Token &NextToken,
1920                                  bool IsAddressOfOperand,
1921                                  CorrectionCandidateCallback *CCC = nullptr);
1922
1923  /// Describes the detailed kind of a template name. Used in diagnostics.
1924  enum class TemplateNameKindForDiagnostics {
1925    ClassTemplate,
1926    FunctionTemplate,
1927    VarTemplate,
1928    AliasTemplate,
1929    TemplateTemplateParam,
1930    DependentTemplate
1931  };
1932  TemplateNameKindForDiagnostics
1933  getTemplateNameKindForDiagnostics(TemplateName Name);
1934
1935  /// Determine whether it's plausible that E was intended to be a
1936  /// template-name.
1937  bool mightBeIntendedToBeTemplateName(ExprResult Ebool &Dependent) {
1938    if (!getLangOpts().CPlusPlus || E.isInvalid())
1939      return false;
1940    Dependent = false;
1941    if (auto *DRE = dyn_cast<DeclRefExpr>(E.get()))
1942      return !DRE->hasExplicitTemplateArgs();
1943    if (auto *ME = dyn_cast<MemberExpr>(E.get()))
1944      return !ME->hasExplicitTemplateArgs();
1945    Dependent = true;
1946    if (auto *DSDRE = dyn_cast<DependentScopeDeclRefExpr>(E.get()))
1947      return !DSDRE->hasExplicitTemplateArgs();
1948    if (auto *DSME = dyn_cast<CXXDependentScopeMemberExpr>(E.get()))
1949      return !DSME->hasExplicitTemplateArgs();
1950    // Any additional cases recognized here should also be handled by
1951    // diagnoseExprIntendedAsTemplateName.
1952    return false;
1953  }
1954  void diagnoseExprIntendedAsTemplateName(Scope *SExprResult TemplateName,
1955                                          SourceLocation Less,
1956                                          SourceLocation Greater);
1957
1958  Decl *ActOnDeclarator(Scope *SDeclarator &D);
1959
1960  NamedDecl *HandleDeclarator(Scope *SDeclarator &D,
1961                              MultiTemplateParamsArg TemplateParameterLists);
1962  void RegisterLocallyScopedExternCDecl(NamedDecl *NDScope *S);
1963  bool DiagnoseClassNameShadow(DeclContext *DCDeclarationNameInfo Info);
1964  bool diagnoseQualifiedDeclaration(CXXScopeSpec &SSDeclContext *DC,
1965                                    DeclarationName NameSourceLocation Loc,
1966                                    bool IsTemplateId);
1967  void
1968  diagnoseIgnoredQualifiers(unsigned DiagIDunsigned Quals,
1969                            SourceLocation FallbackLoc,
1970                            SourceLocation ConstQualLoc = SourceLocation(),
1971                            SourceLocation VolatileQualLoc = SourceLocation(),
1972                            SourceLocation RestrictQualLoc = SourceLocation(),
1973                            SourceLocation AtomicQualLoc = SourceLocation(),
1974                            SourceLocation UnalignedQualLoc = SourceLocation());
1975
1976  static bool adjustContextForLocalExternDecl(DeclContext *&DC);
1977  void DiagnoseFunctionSpecifiers(const DeclSpec &DS);
1978  NamedDecl *getShadowedDeclaration(const TypedefNameDecl *D,
1979                                    const LookupResult &R);
1980  NamedDecl *getShadowedDeclaration(const VarDecl *Dconst LookupResult &R);
1981  void CheckShadow(NamedDecl *DNamedDecl *ShadowedDecl,
1982                   const LookupResult &R);
1983  void CheckShadow(Scope *SVarDecl *D);
1984
1985  /// Warn if 'E', which is an expression that is about to be modified, refers
1986  /// to a shadowing declaration.
1987  void CheckShadowingDeclModification(Expr *ESourceLocation Loc);
1988
1989  void DiagnoseShadowingLambdaDecls(const sema::LambdaScopeInfo *LSI);
1990
1991private:
1992  /// Map of current shadowing declarations to shadowed declarations. Warn if
1993  /// it looks like the user is trying to modify the shadowing declaration.
1994  llvm::DenseMap<const NamedDecl *, const NamedDecl *> ShadowingDecls;
1995
1996public:
1997  void CheckCastAlign(Expr *OpQualType TSourceRange TRange);
1998  void handleTagNumbering(const TagDecl *TagScope *TagScope);
1999  void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
2000                                    TypedefNameDecl *NewTD);
2001  void CheckTypedefForVariablyModifiedType(Scope *STypedefNameDecl *D);
2002  NamedDeclActOnTypedefDeclarator(ScopeSDeclaratorDDeclContextDC,
2003                                    TypeSourceInfo *TInfo,
2004                                    LookupResult &Previous);
2005  NamedDeclActOnTypedefNameDecl(ScopeSDeclContextDCTypedefNameDecl *D,
2006                                  LookupResult &Previousbool &Redeclaration);
2007  NamedDecl *ActOnVariableDeclarator(Scope *SDeclarator &DDeclContext *DC,
2008                                     TypeSourceInfo *TInfo,
2009                                     LookupResult &Previous,
2010                                     MultiTemplateParamsArg TemplateParamLists,
2011                                     bool &AddToScope,
2012                                     ArrayRef<BindingDecl *> Bindings = None);
2013  NamedDecl *
2014  ActOnDecompositionDeclarator(Scope *SDeclarator &D,
2015                               MultiTemplateParamsArg TemplateParamLists);
2016  // Returns true if the variable declaration is a redeclaration
2017  bool CheckVariableDeclaration(VarDecl *NewVDLookupResult &Previous);
2018  void CheckVariableDeclarationType(VarDecl *NewVD);
2019  bool DeduceVariableDeclarationType(VarDecl *VDeclbool DirectInit,
2020                                     Expr *&Init);
2021  void CheckCompleteVariableDeclaration(VarDecl *VD);
2022  void CheckCompleteDecompositionDeclaration(DecompositionDecl *DD);
2023  void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D);
2024
2025  NamedDeclActOnFunctionDeclarator(ScopeSDeclaratorDDeclContextDC,
2026                                     TypeSourceInfo *TInfo,
2027                                     LookupResult &Previous,
2028                                     MultiTemplateParamsArg TemplateParamLists,
2029                                     bool &AddToScope);
2030  bool AddOverriddenMethods(CXXRecordDecl *DCCXXMethodDecl *MD);
2031
2032  bool CheckConstexprFunctionDecl(const FunctionDecl *FD);
2033  bool CheckConstexprFunctionBody(const FunctionDecl *FDStmt *Body);
2034
2035  void DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD);
2036  void FindHiddenVirtualMethods(CXXMethodDecl *MD,
2037                          SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
2038  void NoteHiddenVirtualMethods(CXXMethodDecl *MD,
2039                          SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
2040  // Returns true if the function declaration is a redeclaration
2041  bool CheckFunctionDeclaration(Scope *S,
2042                                FunctionDecl *NewFDLookupResult &Previous,
2043                                bool IsMemberSpecialization);
2044  bool shouldLinkDependentDeclWithPrevious(Decl *DDecl *OldDecl);
2045  bool canFullyTypeCheckRedeclaration(ValueDecl *NewDValueDecl *OldD,
2046                                      QualType NewTQualType OldT);
2047  void CheckMain(FunctionDecl *FDconst DeclSpec &D);
2048  void CheckMSVCRTEntryPoint(FunctionDecl *FD);
2049  Attr *getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FDbool IsDefinition);
2050  Decl *ActOnParamDeclarator(Scope *SDeclarator &D);
2051  ParmVarDecl *BuildParmVarDeclForTypedef(DeclContext *DC,
2052                                          SourceLocation Loc,
2053                                          QualType T);
2054  ParmVarDecl *CheckParameter(DeclContext *DCSourceLocation StartLoc,
2055                              SourceLocation NameLocIdentifierInfo *Name,
2056                              QualType TTypeSourceInfo *TSInfo,
2057                              StorageClass SC);
2058  void ActOnParamDefaultArgument(Decl *param,
2059                                 SourceLocation EqualLoc,
2060                                 Expr *defarg);
2061  void ActOnParamUnparsedDefaultArgument(Decl *param,
2062                                         SourceLocation EqualLoc,
2063                                         SourceLocation ArgLoc);
2064  void ActOnParamDefaultArgumentError(Decl *paramSourceLocation EqualLoc);
2065  bool SetParamDefaultArgument(ParmVarDecl *ParamExpr *DefaultArg,
2066                               SourceLocation EqualLoc);
2067
2068  void AddInitializerToDecl(Decl *dclExpr *initbool DirectInit);
2069  void ActOnUninitializedDecl(Decl *dcl);
2070  void ActOnInitializerError(Decl *Dcl);
2071
2072  void ActOnPureSpecifier(Decl *DSourceLocation PureSpecLoc);
2073  void ActOnCXXForRangeDecl(Decl *D);
2074  StmtResult ActOnCXXForRangeIdentifier(Scope *SSourceLocation IdentLoc,
2075                                        IdentifierInfo *Ident,
2076                                        ParsedAttributes &Attrs,
2077                                        SourceLocation AttrEnd);
2078  void SetDeclDeleted(Decl *dclSourceLocation DelLoc);
2079  void SetDeclDefaulted(Decl *dclSourceLocation DefaultLoc);
2080  void CheckStaticLocalForDllExport(VarDecl *VD);
2081  void FinalizeDeclaration(Decl *D);
2082  DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *Sconst DeclSpec &DS,
2083                                         ArrayRef<Decl *> Group);
2084  DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef<Decl *> Group);
2085
2086  /// Should be called on all declarations that might have attached
2087  /// documentation comments.
2088  void ActOnDocumentableDecl(Decl *D);
2089  void ActOnDocumentableDecls(ArrayRef<Decl *> Group);
2090
2091  void ActOnFinishKNRParamDeclarations(Scope *SDeclarator &D,
2092                                       SourceLocation LocAfterDecls);
2093  void CheckForFunctionRedefinition(
2094      FunctionDecl *FDconst FunctionDecl *EffectiveDefinition = nullptr,
2095      SkipBodyInfo *SkipBody = nullptr);
2096  Decl *ActOnStartOfFunctionDef(Scope *SDeclarator &D,
2097                                MultiTemplateParamsArg TemplateParamLists,
2098                                SkipBodyInfo *SkipBody = nullptr);
2099  Decl *ActOnStartOfFunctionDef(Scope *SDecl *D,
2100                                SkipBodyInfo *SkipBody = nullptr);
2101  void ActOnStartOfObjCMethodDef(Scope *SDecl *D);
2102  bool isObjCMethodDecl(Decl *D) {
2103    return D && isa<ObjCMethodDecl>(D);
2104  }
2105
2106  /// Determine whether we can delay parsing the body of a function or
2107  /// function template until it is used, assuming we don't care about emitting
2108  /// code for that function.
2109  ///
2110  /// This will be \c false if we may need the body of the function in the
2111  /// middle of parsing an expression (where it's impractical to switch to
2112  /// parsing a different function), for instance, if it's constexpr in C++11
2113  /// or has an 'auto' return type in C++14. These cases are essentially bugs.
2114  bool canDelayFunctionBody(const Declarator &D);
2115
2116  /// Determine whether we can skip parsing the body of a function
2117  /// definition, assuming we don't care about analyzing its body or emitting
2118  /// code for that function.
2119  ///
2120  /// This will be \c false only if we may need the body of the function in
2121  /// order to parse the rest of the program (for instance, if it is
2122  /// \c constexpr in C++11 or has an 'auto' return type in C++14).
2123  bool canSkipFunctionBody(Decl *D);
2124
2125  void computeNRVO(Stmt *Bodysema::FunctionScopeInfo *Scope);
2126  Decl *ActOnFinishFunctionBody(Decl *DeclStmt *Body);
2127  Decl *ActOnFinishFunctionBody(Decl *DeclStmt *Bodybool IsInstantiation);
2128  Decl *ActOnSkippedFunctionBody(Decl *Decl);
2129  void ActOnFinishInlineFunctionDef(FunctionDecl *D);
2130
2131  /// ActOnFinishDelayedAttribute - Invoked when we have finished parsing an
2132  /// attribute for which parsing is delayed.
2133  void ActOnFinishDelayedAttribute(Scope *SDecl *DParsedAttributes &Attrs);
2134
2135  /// Diagnose any unused parameters in the given sequence of
2136  /// ParmVarDecl pointers.
2137  void DiagnoseUnusedParameters(ArrayRef<ParmVarDecl *> Parameters);
2138
2139  /// Diagnose whether the size of parameters or return value of a
2140  /// function or obj-c method definition is pass-by-value and larger than a
2141  /// specified threshold.
2142  void
2143  DiagnoseSizeOfParametersAndReturnValue(ArrayRef<ParmVarDecl *> Parameters,
2144                                         QualType ReturnTyNamedDecl *D);
2145
2146  void DiagnoseInvalidJumps(Stmt *Body);
2147  Decl *ActOnFileScopeAsmDecl(Expr *expr,
2148                              SourceLocation AsmLoc,
2149                              SourceLocation RParenLoc);
2150
2151  /// Handle a C++11 empty-declaration and attribute-declaration.
2152  Decl *ActOnEmptyDeclaration(Scope *Sconst ParsedAttributesView &AttrList,
2153                              SourceLocation SemiLoc);
2154
2155  enum class ModuleDeclKind {
2156    Interface,      ///< 'export module X;'
2157    Implementation///< 'module X;'
2158    Partition,      ///< 'module partition X;'
2159  };
2160
2161  /// The parser has processed a module-declaration that begins the definition
2162  /// of a module interface or implementation.
2163  DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc,
2164                                 SourceLocation ModuleLocModuleDeclKind MDK,
2165                                 ModuleIdPath Path);
2166
2167  /// The parser has processed a module import declaration.
2168  ///
2169  /// \param AtLoc The location of the '@' symbol, if any.
2170  ///
2171  /// \param ImportLoc The location of the 'import' keyword.
2172  ///
2173  /// \param Path The module access path.
2174  DeclResult ActOnModuleImport(SourceLocation AtLocSourceLocation ImportLoc,
2175                               ModuleIdPath Path);
2176
2177  /// The parser has processed a module import translated from a
2178  /// #include or similar preprocessing directive.
2179  void ActOnModuleInclude(SourceLocation DirectiveLocModule *Mod);
2180  void BuildModuleInclude(SourceLocation DirectiveLocModule *Mod);
2181
2182  /// The parsed has entered a submodule.
2183  void ActOnModuleBegin(SourceLocation DirectiveLocModule *Mod);
2184  /// The parser has left a submodule.
2185  void ActOnModuleEnd(SourceLocation DirectiveLocModule *Mod);
2186
2187  /// Create an implicit import of the given module at the given
2188  /// source location, for error recovery, if possible.
2189  ///
2190  /// This routine is typically used when an entity found by name lookup
2191  /// is actually hidden within a module that we know about but the user
2192  /// has forgotten to import.
2193  void createImplicitModuleImportForErrorRecovery(SourceLocation Loc,
2194                                                  Module *Mod);
2195
2196  /// Kinds of missing import. Note, the values of these enumerators correspond
2197  /// to %select values in diagnostics.
2198  enum class MissingImportKind {
2199    Declaration,
2200    Definition,
2201    DefaultArgument,
2202    ExplicitSpecialization,
2203    PartialSpecialization
2204  };
2205
2206  /// Diagnose that the specified declaration needs to be visible but
2207  /// isn't, and suggest a module import that would resolve the problem.
2208  void diagnoseMissingImport(SourceLocation LocNamedDecl *Decl,
2209                             MissingImportKind MIKbool Recover = true);
2210  void diagnoseMissingImport(SourceLocation LocNamedDecl *Decl,
2211                             SourceLocation DeclLocArrayRef<Module *> Modules,
2212                             MissingImportKind MIKbool Recover);
2213
2214  Decl *ActOnStartExportDecl(Scope *SSourceLocation ExportLoc,
2215                             SourceLocation LBraceLoc);
2216  Decl *ActOnFinishExportDecl(Scope *SDecl *ExportDecl,
2217                              SourceLocation RBraceLoc);
2218
2219  /// We've found a use of a templated declaration that would trigger an
2220  /// implicit instantiation. Check that any relevant explicit specializations
2221  /// and partial specializations are visible, and diagnose if not.
2222  void checkSpecializationVisibility(SourceLocation LocNamedDecl *Spec);
2223
2224  /// We've found a use of a template specialization that would select a
2225  /// partial specialization. Check that the partial specialization is visible,
2226  /// and diagnose if not.
2227  void checkPartialSpecializationVisibility(SourceLocation Loc,
2228                                            NamedDecl *Spec);
2229
2230  /// Retrieve a suitable printing policy for diagnostics.
2231  PrintingPolicy getPrintingPolicy() const {
2232    return getPrintingPolicy(ContextPP);
2233  }
2234
2235  /// Retrieve a suitable printing policy for diagnostics.
2236  static PrintingPolicy getPrintingPolicy(const ASTContext &Ctx,
2237                                          const Preprocessor &PP);
2238
2239  /// Scope actions.
2240  void ActOnPopScope(SourceLocation LocScope *S);
2241  void ActOnTranslationUnitScope(Scope *S);
2242
2243  Decl *ParsedFreeStandingDeclSpec(Scope *SAccessSpecifier ASDeclSpec &DS,
2244                                   RecordDecl *&AnonRecord);
2245  Decl *ParsedFreeStandingDeclSpec(Scope *SAccessSpecifier ASDeclSpec &DS,
2246                                   MultiTemplateParamsArg TemplateParams,
2247                                   bool IsExplicitInstantiation,
2248                                   RecordDecl *&AnonRecord);
2249
2250  Decl *BuildAnonymousStructOrUnion(Scope *SDeclSpec &DS,
2251                                    AccessSpecifier AS,
2252                                    RecordDecl *Record,
2253                                    const PrintingPolicy &Policy);
2254
2255  Decl *BuildMicrosoftCAnonymousStruct(Scope *SDeclSpec &DS,
2256                                       RecordDecl *Record);
2257
2258  /// Common ways to introduce type names without a tag for use in diagnostics.
2259  /// Keep in sync with err_tag_reference_non_tag.
2260  enum NonTagKind {
2261    NTK_NonStruct,
2262    NTK_NonClass,
2263    NTK_NonUnion,
2264    NTK_NonEnum,
2265    NTK_Typedef,
2266    NTK_TypeAlias,
2267    NTK_Template,
2268    NTK_TypeAliasTemplate,
2269    NTK_TemplateTemplateArgument,
2270  };
2271
2272  /// Given a non-tag type declaration, returns an enum useful for indicating
2273  /// what kind of non-tag type this is.
2274  NonTagKind getNonTagTypeDeclKind(const Decl *DTagTypeKind TTK);
2275
2276  bool isAcceptableTagRedeclaration(const TagDecl *Previous,
2277                                    TagTypeKind NewTagbool isDefinition,
2278                                    SourceLocation NewTagLoc,
2279                                    const IdentifierInfo *Name);
2280
2281  enum TagUseKind {
2282    TUK_Reference,   // Reference to a tag:  'struct foo *X;'
2283    TUK_Declaration// Fwd decl of a tag:   'struct foo;'
2284    TUK_Definition,  // Definition of a tag: 'struct foo { int X; } Y;'
2285    TUK_Friend       // Friend declaration:  'friend struct foo;'
2286  };
2287
2288  Decl *ActOnTag(Scope *Sunsigned TagSpecTagUseKind TUK,
2289                 SourceLocation KWLocCXXScopeSpec &SSIdentifierInfo *Name,
2290                 SourceLocation NameLocconst ParsedAttributesView &Attr,
2291                 AccessSpecifier ASSourceLocation ModulePrivateLoc,
2292                 MultiTemplateParamsArg TemplateParameterListsbool &OwnedDecl,
2293                 bool &IsDependentSourceLocation ScopedEnumKWLoc,
2294                 bool ScopedEnumUsesClassTagTypeResult UnderlyingType,
2295                 bool IsTypeSpecifierbool IsTemplateParamOrArg,
2296                 SkipBodyInfo *SkipBody = nullptr);
2297
2298  Decl *ActOnTemplatedFriendTag(Scope *SSourceLocation FriendLoc,
2299                                unsigned TagSpecSourceLocation TagLoc,
2300                                CXXScopeSpec &SSIdentifierInfo *Name,
2301                                SourceLocation NameLoc,
2302                                const ParsedAttributesView &Attr,
2303                                MultiTemplateParamsArg TempParamLists);
2304
2305  TypeResult ActOnDependentTag(Scope *S,
2306                               unsigned TagSpec,
2307                               TagUseKind TUK,
2308                               const CXXScopeSpec &SS,
2309                               IdentifierInfo *Name,
2310                               SourceLocation TagLoc,
2311                               SourceLocation NameLoc);
2312
2313  void ActOnDefs(Scope *SDecl *TagDSourceLocation DeclStart,
2314                 IdentifierInfo *ClassName,
2315                 SmallVectorImpl<Decl *> &Decls);
2316  Decl *ActOnField(Scope *SDecl *TagDSourceLocation DeclStart,
2317                   Declarator &DExpr *BitfieldWidth);
2318
2319  FieldDecl *HandleField(Scope *SRecordDecl *TagDSourceLocation DeclStart,
2320                         Declarator &DExpr *BitfieldWidth,
2321                         InClassInitStyle InitStyle,
2322                         AccessSpecifier AS);
2323  MSPropertyDecl *HandleMSProperty(Scope *SRecordDecl *TagD,
2324                                   SourceLocation DeclStartDeclarator &D,
2325                                   Expr *BitfieldWidth,
2326                                   InClassInitStyle InitStyle,
2327                                   AccessSpecifier AS,
2328                                   const ParsedAttr &MSPropertyAttr);
2329
2330  FieldDecl *CheckFieldDecl(DeclarationName NameQualType T,
2331                            TypeSourceInfo *TInfo,
2332                            RecordDecl *RecordSourceLocation Loc,
2333                            bool MutableExpr *BitfieldWidth,
2334                            InClassInitStyle InitStyle,
2335                            SourceLocation TSSL,
2336                            AccessSpecifier ASNamedDecl *PrevDecl,
2337                            Declarator *D = nullptr);
2338
2339  bool CheckNontrivialField(FieldDecl *FD);
2340  void DiagnoseNontrivial(const CXXRecordDecl *RecordCXXSpecialMember CSM);
2341
2342  enum TrivialABIHandling {
2343    /// The triviality of a method unaffected by "trivial_abi".
2344    TAH_IgnoreTrivialABI,
2345
2346    /// The triviality of a method affected by "trivial_abi".
2347    TAH_ConsiderTrivialABI
2348  };
2349
2350  bool SpecialMemberIsTrivial(CXXMethodDecl *MDCXXSpecialMember CSM,
2351                              TrivialABIHandling TAH = TAH_IgnoreTrivialABI,
2352                              bool Diagnose = false);
2353  CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD);
2354  void ActOnLastBitfield(SourceLocation DeclStart,
2355                         SmallVectorImpl<Decl *> &AllIvarDecls);
2356  Decl *ActOnIvar(Scope *SSourceLocation DeclStart,
2357                  Declarator &DExpr *BitfieldWidth,
2358                  tok::ObjCKeywordKind visibility);
2359
2360  // This is used for both record definitions and ObjC interface declarations.
2361  void ActOnFields(Scope *SSourceLocation RecLocDecl *TagDecl,
2362                   ArrayRef<Decl *> FieldsSourceLocation LBrac,
2363                   SourceLocation RBracconst ParsedAttributesView &AttrList);
2364
2365  /// ActOnTagStartDefinition - Invoked when we have entered the
2366  /// scope of a tag's definition (e.g., for an enumeration, class,
2367  /// struct, or union).
2368  void ActOnTagStartDefinition(Scope *SDecl *TagDecl);
2369
2370  /// Perform ODR-like check for C/ObjC when merging tag types from modules.
2371  /// Differently from C++, actually parse the body and reject / error out
2372  /// in case of a structural mismatch.
2373  bool ActOnDuplicateDefinition(DeclSpec &DSDecl *Prev,
2374                                SkipBodyInfo &SkipBody);
2375
2376  typedef void *SkippedDefinitionContext;
2377
2378  /// Invoked when we enter a tag definition that we're skipping.
2379  SkippedDefinitionContext ActOnTagStartSkippedDefinition(Scope *SDecl *TD);
2380
2381  Decl *ActOnObjCContainerStartDefinition(Decl *IDecl);
2382
2383  /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
2384  /// C++ record definition's base-specifiers clause and are starting its
2385  /// member declarations.
2386  void ActOnStartCXXMemberDeclarations(Scope *SDecl *TagDecl,
2387                                       SourceLocation FinalLoc,
2388                                       bool IsFinalSpelledSealed,
2389                                       SourceLocation LBraceLoc);
2390
2391  /// ActOnTagFinishDefinition - Invoked once we have finished parsing
2392  /// the definition of a tag (enumeration, class, struct, or union).
2393  void ActOnTagFinishDefinition(Scope *SDecl *TagDecl,
2394                                SourceRange BraceRange);
2395
2396  void ActOnTagFinishSkippedDefinition(SkippedDefinitionContext Context);
2397
2398  void ActOnObjCContainerFinishDefinition();
2399
2400  /// Invoked when we must temporarily exit the objective-c container
2401  /// scope for parsing/looking-up C constructs.
2402  ///
2403  /// Must be followed by a call to \see ActOnObjCReenterContainerContext
2404  void ActOnObjCTemporaryExitContainerContext(DeclContext *DC);
2405  void ActOnObjCReenterContainerContext(DeclContext *DC);
2406
2407  /// ActOnTagDefinitionError - Invoked when there was an unrecoverable
2408  /// error parsing the definition of a tag.
2409  void ActOnTagDefinitionError(Scope *SDecl *TagDecl);
2410
2411  EnumConstantDecl *CheckEnumConstant(EnumDecl *Enum,
2412                                      EnumConstantDecl *LastEnumConst,
2413                                      SourceLocation IdLoc,
2414                                      IdentifierInfo *Id,
2415                                      Expr *val);
2416  bool CheckEnumUnderlyingType(TypeSourceInfo *TI);
2417  bool CheckEnumRedeclaration(SourceLocation EnumLocbool IsScoped,
2418                              QualType EnumUnderlyingTybool IsFixed,
2419                              const EnumDecl *Prev);
2420
2421  /// Determine whether the body of an anonymous enumeration should be skipped.
2422  /// \param II The name of the first enumerator.
2423  SkipBodyInfo shouldSkipAnonEnumBody(Scope *SIdentifierInfo *II,
2424                                      SourceLocation IILoc);
2425
2426  Decl *ActOnEnumConstant(Scope *SDecl *EnumDeclDecl *LastEnumConstant,
2427                          SourceLocation IdLocIdentifierInfo *Id,
2428                          const ParsedAttributesView &Attrs,
2429                          SourceLocation EqualLocExpr *Val);
2430  void ActOnEnumBody(SourceLocation EnumLocSourceRange BraceRange,
2431                     Decl *EnumDeclArrayRef<Decl *> ElementsScope *S,
2432                     const ParsedAttributesView &Attr);
2433
2434  DeclContext *getContainingDC(DeclContext *DC);
2435
2436  /// Set the current declaration context until it gets popped.
2437  void PushDeclContext(Scope *SDeclContext *DC);
2438  void PopDeclContext();
2439
2440  /// EnterDeclaratorContext - Used when we must lookup names in the context
2441  /// of a declarator's nested name specifier.
2442  void EnterDeclaratorContext(Scope *SDeclContext *DC);
2443  void ExitDeclaratorContext(Scope *S);
2444
2445  /// Push the parameters of D, which must be a function, into scope.
2446  void ActOnReenterFunctionContext(ScopeSDeclD);
2447  void ActOnExitFunctionContext();
2448
2449  DeclContext *getFunctionLevelDeclContext();
2450
2451  /// getCurFunctionDecl - If inside of a function body, this returns a pointer
2452  /// to the function decl for the function being parsed.  If we're currently
2453  /// in a 'block', this returns the containing context.
2454  FunctionDecl *getCurFunctionDecl();
2455
2456  /// getCurMethodDecl - If inside of a method body, this returns a pointer to
2457  /// the method decl for the method being parsed.  If we're currently
2458  /// in a 'block', this returns the containing context.
2459  ObjCMethodDecl *getCurMethodDecl();
2460
2461  /// getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method
2462  /// or C function we're in, otherwise return null.  If we're currently
2463  /// in a 'block', this returns the containing context.
2464  NamedDecl *getCurFunctionOrMethodDecl();
2465
2466  /// Add this decl to the scope shadowed decl chains.
2467  void PushOnScopeChains(NamedDecl *DScope *Sbool AddToContext = true);
2468
2469  /// Make the given externally-produced declaration visible at the
2470  /// top level scope.
2471  ///
2472  /// \param D The externally-produced declaration to push.
2473  ///
2474  /// \param Name The name of the externally-produced declaration.
2475  void pushExternalDeclIntoScope(NamedDecl *DDeclarationName Name);
2476
2477  /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true
2478  /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns
2479  /// true if 'D' belongs to the given declaration context.
2480  ///
2481  /// \param AllowInlineNamespace If \c true, allow the declaration to be in the
2482  ///        enclosing namespace set of the context, rather than contained
2483  ///        directly within it.
2484  bool isDeclInScope(NamedDecl *DDeclContext *CtxScope *S = nullptr,
2485                     bool AllowInlineNamespace = false);
2486
2487  /// Finds the scope corresponding to the given decl context, if it
2488  /// happens to be an enclosing scope.  Otherwise return NULL.
2489  static Scope *getScopeForDeclContext(Scope *SDeclContext *DC);
2490
2491  /// Subroutines of ActOnDeclarator().
2492  TypedefDecl *ParseTypedefDecl(Scope *SDeclarator &DQualType T,
2493                                TypeSourceInfo *TInfo);
2494  bool isIncompatibleTypedef(TypeDecl *OldTypedefNameDecl *New);
2495
2496  /// Describes the kind of merge to perform for availability
2497  /// attributes (including "deprecated", "unavailable", and "availability").
2498  enum AvailabilityMergeKind {
2499    /// Don't merge availability attributes at all.
2500    AMK_None,
2501    /// Merge availability attributes for a redeclaration, which requires
2502    /// an exact match.
2503    AMK_Redeclaration,
2504    /// Merge availability attributes for an override, which requires
2505    /// an exact match or a weakening of constraints.
2506    AMK_Override,
2507    /// Merge availability attributes for an implementation of
2508    /// a protocol requirement.
2509    AMK_ProtocolImplementation,
2510  };
2511
2512  /// Describes the kind of priority given to an availability attribute.
2513  ///
2514  /// The sum of priorities deteremines the final priority of the attribute.
2515  /// The final priority determines how the attribute will be merged.
2516  /// An attribute with a lower priority will always remove higher priority
2517  /// attributes for the specified platform when it is being applied. An
2518  /// attribute with a higher priority will not be applied if the declaration
2519  /// already has an availability attribute with a lower priority for the
2520  /// specified platform. The final prirority values are not expected to match
2521  /// the values in this enumeration, but instead should be treated as a plain
2522  /// integer value. This enumeration just names the priority weights that are
2523  /// used to calculate that final vaue.
2524  enum AvailabilityPriority : int {
2525    /// The availability attribute was specified explicitly next to the
2526    /// declaration.
2527    AP_Explicit = 0,
2528
2529    /// The availability attribute was applied using '#pragma clang attribute'.
2530    AP_PragmaClangAttribute = 1,
2531
2532    /// The availability attribute for a specific platform was inferred from
2533    /// an availability attribute for another platform.
2534    AP_InferredFromOtherPlatform = 2
2535  };
2536
2537  /// Attribute merging methods. Return true if a new attribute was added.
2538  AvailabilityAttr *mergeAvailabilityAttr(
2539      NamedDecl *D, SourceRange Range, IdentifierInfo *Platform, bool Implicit,
2540      VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted,
2541      bool IsUnavailable, StringRef Message, bool IsStrict,
2542      StringRef Replacement, AvailabilityMergeKind AMK, int Priority,
2543      unsigned AttrSpellingListIndex);
2544  TypeVisibilityAttr *mergeTypeVisibilityAttr(Decl *D, SourceRange Range,
2545                                       TypeVisibilityAttr::VisibilityType Vis,
2546                                              unsigned AttrSpellingListIndex);
2547  VisibilityAttr *mergeVisibilityAttr(Decl *DSourceRange Range,
2548                                      VisibilityAttr::VisibilityType Vis,
2549                                      unsigned AttrSpellingListIndex);
2550  UuidAttr *mergeUuidAttr(Decl *D, SourceRange Range,
2551                          unsigned AttrSpellingListIndex, StringRef Uuid);
2552  DLLImportAttr *mergeDLLImportAttr(Decl *D, SourceRange Range,
2553                                    unsigned AttrSpellingListIndex);
2554  DLLExportAttr *mergeDLLExportAttr(Decl *D, SourceRange Range,
2555                                    unsigned AttrSpellingListIndex);
2556  MSInheritanceAttr *
2557  mergeMSInheritanceAttr(Decl *D, SourceRange Range, bool BestCase,
2558                         unsigned AttrSpellingListIndex,
2559                         MSInheritanceAttr::Spelling SemanticSpelling);
2560  FormatAttr *mergeFormatAttr(Decl *DSourceRange Range,
2561                              IdentifierInfo *Formatint FormatIdx,
2562                              int FirstArgunsigned AttrSpellingListIndex);
2563  SectionAttr *mergeSectionAttr(Decl *D, SourceRange Range, StringRef Name,
2564                                unsigned AttrSpellingListIndex);
2565  CodeSegAttr *mergeCodeSegAttr(Decl *D, SourceRange Range, StringRef Name,
2566                                unsigned AttrSpellingListIndex);
2567  AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D, SourceRange Range,
2568                                          IdentifierInfo *Ident,
2569                                          unsigned AttrSpellingListIndex);
2570  MinSizeAttr *mergeMinSizeAttr(Decl *D, SourceRange Range,
2571                                unsigned AttrSpellingListIndex);
2572  NoSpeculativeLoadHardeningAttr *
2573  mergeNoSpeculativeLoadHardeningAttr(Decl *D,
2574                                      const NoSpeculativeLoadHardeningAttr &AL);
2575  SpeculativeLoadHardeningAttr *
2576  mergeSpeculativeLoadHardeningAttr(Decl *D,
2577                                    const SpeculativeLoadHardeningAttr &AL);
2578  OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D, SourceRange Range,
2579                                          unsigned AttrSpellingListIndex);
2580  InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL);
2581  InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D,
2582                                                const InternalLinkageAttr &AL);
2583  CommonAttr *mergeCommonAttr(Decl *D, const ParsedAttr &AL);
2584  CommonAttr *mergeCommonAttr(Decl *D, const CommonAttr &AL);
2585
2586  void mergeDeclAttributes(NamedDecl *NewDecl *Old,
2587                           AvailabilityMergeKind AMK = AMK_Redeclaration);
2588  void MergeTypedefNameDecl(Scope *STypedefNameDecl *New,
2589                            LookupResult &OldDecls);
2590  bool MergeFunctionDecl(FunctionDecl *NewNamedDecl *&OldScope *S,
2591                         bool MergeTypeWithOld);
2592  bool MergeCompatibleFunctionDecls(FunctionDecl *NewFunctionDecl *Old,
2593                                    Scope *Sbool MergeTypeWithOld);
2594  void mergeObjCMethodDecls(ObjCMethodDecl *NewObjCMethodDecl *Old);
2595  void MergeVarDecl(VarDecl *NewLookupResult &Previous);
2596  void MergeVarDeclTypes(VarDecl *NewVarDecl *Oldbool MergeTypeWithOld);
2597  void MergeVarDeclExceptionSpecs(VarDecl *NewVarDecl *Old);
2598  bool checkVarDeclRedefinition(VarDecl *OldDefnVarDecl *NewDefn);
2599  void notePreviousDefinition(const NamedDecl *OldSourceLocation New);
2600  bool MergeCXXFunctionDecl(FunctionDecl *NewFunctionDecl *OldScope *S);
2601
2602  // AssignmentAction - This is used by all the assignment diagnostic functions
2603  // to represent what is actually causing the operation
2604  enum AssignmentAction {
2605    AA_Assigning,
2606    AA_Passing,
2607    AA_Returning,
2608    AA_Converting,
2609    AA_Initializing,
2610    AA_Sending,
2611    AA_Casting,
2612    AA_Passing_CFAudited
2613  };
2614
2615  /// C++ Overloading.
2616  enum OverloadKind {
2617    /// This is a legitimate overload: the existing declarations are
2618    /// functions or function templates with different signatures.
2619    Ovl_Overload,
2620
2621    /// This is not an overload because the signature exactly matches
2622    /// an existing declaration.
2623    Ovl_Match,
2624
2625    /// This is not an overload because the lookup results contain a
2626    /// non-function.
2627    Ovl_NonFunction
2628  };
2629  OverloadKind CheckOverload(Scope *S,
2630                             FunctionDecl *New,
2631                             const LookupResult &OldDecls,
2632                             NamedDecl *&OldDecl,
2633                             bool IsForUsingDecl);
2634  bool IsOverload(FunctionDecl *NewFunctionDecl *Oldbool IsForUsingDecl,
2635                  bool ConsiderCudaAttrs = true);
2636
2637  ImplicitConversionSequence
2638  TryImplicitConversion(Expr *FromQualType ToType,
2639                        bool SuppressUserConversions,
2640                        bool AllowExplicit,
2641                        bool InOverloadResolution,
2642                        bool CStyle,
2643                        bool AllowObjCWritebackConversion);
2644
2645  bool IsIntegralPromotion(Expr *FromQualType FromTypeQualType ToType);
2646  bool IsFloatingPointPromotion(QualType FromTypeQualType ToType);
2647  bool IsComplexPromotion(QualType FromTypeQualType ToType);
2648  bool IsPointerConversion(Expr *FromQualType FromTypeQualType ToType,
2649                           bool InOverloadResolution,
2650                           QualTypeConvertedTypebool &IncompatibleObjC);
2651  bool isObjCPointerConversion(QualType FromTypeQualType ToType,
2652                               QualTypeConvertedTypebool &IncompatibleObjC);
2653  bool isObjCWritebackConversion(QualType FromTypeQualType ToType,
2654                                 QualType &ConvertedType);
2655  bool IsBlockPointerConversion(QualType FromTypeQualType ToType,
2656                                QualTypeConvertedType);
2657  bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType,
2658                                  const FunctionProtoType *NewType,
2659                                  unsigned *ArgPos = nullptr);
2660  void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag,
2661                                  QualType FromTypeQualType ToType);
2662
2663  void maybeExtendBlockObject(ExprResult &E);
2664  CastKind PrepareCastToObjCObjectPointer(ExprResult &E);
2665  bool CheckPointerConversion(Expr *FromQualType ToType,
2666                              CastKind &Kind,
2667                              CXXCastPathBasePath,
2668                              bool IgnoreBaseAccess,
2669                              bool Diagnose = true);
2670  bool IsMemberPointerConversion(Expr *FromQualType FromTypeQualType ToType,
2671                                 bool InOverloadResolution,
2672                                 QualType &ConvertedType);
2673  bool CheckMemberPointerConversion(Expr *FromQualType ToType,
2674                                    CastKind &Kind,
2675                                    CXXCastPath &BasePath,
2676                                    bool IgnoreBaseAccess);
2677  bool IsQualificationConversion(QualType FromTypeQualType ToType,
2678                                 bool CStylebool &ObjCLifetimeConversion);
2679  bool IsFunctionConversion(QualType FromTypeQualType ToType,
2680                            QualType &ResultTy);
2681  bool DiagnoseMultipleUserDefinedConversion(Expr *FromQualType ToType);
2682  bool isSameOrCompatibleFunctionType(CanQualType ParamCanQualType Arg);
2683
2684  ExprResult PerformMoveOrCopyInitialization(const InitializedEntity &Entity,
2685                                             const VarDecl *NRVOCandidate,
2686                                             QualType ResultType,
2687                                             Expr *Value,
2688                                             bool AllowNRVO = true);
2689
2690  bool CanPerformCopyInitialization(const InitializedEntity &Entity,
2691                                    ExprResult Init);
2692  ExprResult PerformCopyInitialization(const InitializedEntity &Entity,
2693                                       SourceLocation EqualLoc,
2694                                       ExprResult Init,
2695                                       bool TopLevelOfInitList = false,
2696                                       bool AllowExplicit = false);
2697  ExprResult PerformObjectArgumentInitialization(Expr *From,
2698                                                 NestedNameSpecifier *Qualifier,
2699                                                 NamedDecl *FoundDecl,
2700                                                 CXXMethodDecl *Method);
2701
2702  /// Check that the lifetime of the initializer (and its subobjects) is
2703  /// sufficient for initializing the entity, and perform lifetime extension
2704  /// (when permitted) if not.
2705  void checkInitializerLifetime(const InitializedEntity &EntityExpr *Init);
2706
2707  ExprResult PerformContextuallyConvertToBool(Expr *From);
2708  ExprResult PerformContextuallyConvertToObjCPointer(Expr *From);
2709
2710  /// Contexts in which a converted constant expression is required.
2711  enum CCEKind {
2712    CCEK_CaseValue,   ///< Expression in a case label.
2713    CCEK_Enumerator,  ///< Enumerator value with fixed underlying type.
2714    CCEK_TemplateArg///< Value of a non-type template parameter.
2715    CCEK_NewExpr,     ///< Constant expression in a noptr-new-declarator.
2716    CCEK_ConstexprIf  ///< Condition in a constexpr if statement.
2717  };
2718  ExprResult CheckConvertedConstantExpression(Expr *FromQualType T,
2719                                              llvm::APSInt &ValueCCEKind CCE);
2720  ExprResult CheckConvertedConstantExpression(Expr *FromQualType T,
2721                                              APValue &ValueCCEKind CCE);
2722
2723  /// Abstract base class used to perform a contextual implicit
2724  /// conversion from an expression to any type passing a filter.
2725  class ContextualImplicitConverter {
2726  public:
2727    bool Suppress;
2728    bool SuppressConversion;
2729
2730    ContextualImplicitConverter(bool Suppress = false,
2731                                bool SuppressConversion = false)
2732        : Suppress(Suppress), SuppressConversion(SuppressConversion) {}
2733
2734    /// Determine whether the specified type is a valid destination type
2735    /// for this conversion.
2736    virtual bool match(QualType T) = 0;
2737
2738    /// Emits a diagnostic complaining that the expression does not have
2739    /// integral or enumeration type.
2740    virtual SemaDiagnosticBuilder
2741    diagnoseNoMatch(Sema &SSourceLocation LocQualType T) = 0;
2742
2743    /// Emits a diagnostic when the expression has incomplete class type.
2744    virtual SemaDiagnosticBuilder
2745    diagnoseIncomplete(Sema &SSourceLocation LocQualType T) = 0;
2746
2747    /// Emits a diagnostic when the only matching conversion function
2748    /// is explicit.
2749    virtual SemaDiagnosticBuilder diagnoseExplicitConv(
2750        Sema &SSourceLocation LocQualType TQualType ConvTy) = 0;
2751
2752    /// Emits a note for the explicit conversion function.
2753    virtual SemaDiagnosticBuilder
2754    noteExplicitConv(Sema &SCXXConversionDecl *ConvQualType ConvTy) = 0;
2755
2756    /// Emits a diagnostic when there are multiple possible conversion
2757    /// functions.
2758    virtual SemaDiagnosticBuilder
2759    diagnoseAmbiguous(Sema &SSourceLocation LocQualType T) = 0;
2760
2761    /// Emits a note for one of the candidate conversions.
2762    virtual SemaDiagnosticBuilder
2763    noteAmbiguous(Sema &SCXXConversionDecl *ConvQualType ConvTy) = 0;
2764
2765    /// Emits a diagnostic when we picked a conversion function
2766    /// (for cases when we are not allowed to pick a conversion function).
2767    virtual SemaDiagnosticBuilder diagnoseConversion(
2768        Sema &SSourceLocation LocQualType TQualType ConvTy) = 0;
2769
2770    virtual ~ContextualImplicitConverter() {}
2771  };
2772
2773  class ICEConvertDiagnoser : public ContextualImplicitConverter {
2774    bool AllowScopedEnumerations;
2775
2776  public:
2777    ICEConvertDiagnoser(bool AllowScopedEnumerations,
2778                        bool Suppressbool SuppressConversion)
2779        : ContextualImplicitConverter(SuppressSuppressConversion),
2780          AllowScopedEnumerations(AllowScopedEnumerations) {}
2781
2782    /// Match an integral or (possibly scoped) enumeration type.
2783    bool match(QualType T) override;
2784
2785    SemaDiagnosticBuilder
2786    diagnoseNoMatch(Sema &SSourceLocation LocQualType T) override {
2787      return diagnoseNotInt(SLocT);
2788    }
2789
2790    /// Emits a diagnostic complaining that the expression does not have
2791    /// integral or enumeration type.
2792    virtual SemaDiagnosticBuilder
2793    diagnoseNotInt(Sema &SSourceLocation LocQualType T) = 0;
2794  };
2795
2796  /// Perform a contextual implicit conversion.
2797  ExprResult PerformContextualImplicitConversion(
2798      SourceLocation LocExpr *FromEContextualImplicitConverter &Converter);
2799
2800
2801  enum ObjCSubscriptKind {
2802    OS_Array,
2803    OS_Dictionary,
2804    OS_Error
2805  };
2806  ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE);
2807
2808  // Note that LK_String is intentionally after the other literals, as
2809  // this is used for diagnostics logic.
2810  enum ObjCLiteralKind {
2811    LK_Array,
2812    LK_Dictionary,
2813    LK_Numeric,
2814    LK_Boxed,
2815    LK_String,
2816    LK_Block,
2817    LK_None
2818  };
2819  ObjCLiteralKind CheckLiteralKind(Expr *FromE);
2820
2821  ExprResult PerformObjectMemberConversion(Expr *From,
2822                                           NestedNameSpecifier *Qualifier,
2823                                           NamedDecl *FoundDecl,
2824                                           NamedDecl *Member);
2825
2826  // Members have to be NamespaceDecl* or TranslationUnitDecl*.
2827  // TODO: make this is a typesafe union.
2828  typedef llvm::SmallSetVector<DeclContext   *, 16AssociatedNamespaceSet;
2829  typedef llvm::SmallSetVector<CXXRecordDecl *, 16AssociatedClassSet;
2830
2831  using ADLCallKind = CallExpr::ADLCallKind;
2832
2833  void AddOverloadCandidate(FunctionDecl *FunctionDeclAccessPair FoundDecl,
2834                            ArrayRef<Expr *> Args,
2835                            OverloadCandidateSet &CandidateSet,
2836                            bool SuppressUserConversions = false,
2837                            bool PartialOverloading = false,
2838                            bool AllowExplicit = false,
2839                            ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
2840                            ConversionSequenceList EarlyConversions = None);
2841  void AddFunctionCandidates(const UnresolvedSetImpl &Functions,
2842                      ArrayRef<Expr *> Args,
2843                      OverloadCandidateSet &CandidateSet,
2844                      TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
2845                      bool SuppressUserConversions = false,
2846                      bool PartialOverloading = false,
2847                      bool FirstArgumentIsBase = false);
2848  void AddMethodCandidate(DeclAccessPair FoundDecl,
2849                          QualType ObjectType,
2850                          Expr::Classification ObjectClassification,
2851                          ArrayRef<Expr *> Args,
2852                          OverloadCandidateSetCandidateSet,
2853                          bool SuppressUserConversion = false);
2854  void AddMethodCandidate(CXXMethodDecl *Method,
2855                          DeclAccessPair FoundDecl,
2856                          CXXRecordDecl *ActingContextQualType ObjectType,
2857                          Expr::Classification ObjectClassification,
2858                          ArrayRef<Expr *> Args,
2859                          OverloadCandidateSetCandidateSet,
2860                          bool SuppressUserConversions = false,
2861                          bool PartialOverloading = false,
2862                          ConversionSequenceList EarlyConversions = None);
2863  void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl,
2864                                  DeclAccessPair FoundDecl,
2865                                  CXXRecordDecl *ActingContext,
2866                                 TemplateArgumentListInfo *ExplicitTemplateArgs,
2867                                  QualType ObjectType,
2868                                  Expr::Classification ObjectClassification,
2869                                  ArrayRef<Expr *> Args,
2870                                  OverloadCandidateSetCandidateSet,
2871                                  bool SuppressUserConversions = false,
2872                                  bool PartialOverloading = false);
2873  void AddTemplateOverloadCandidate(
2874      FunctionTemplateDecl *FunctionTemplateDeclAccessPair FoundDecl,
2875      TemplateArgumentListInfo *ExplicitTemplateArgsArrayRef<Expr *> Args,
2876      OverloadCandidateSet &CandidateSetbool SuppressUserConversions = false,
2877      bool PartialOverloading = false,
2878      ADLCallKind IsADLCandidate = ADLCallKind::NotADL);
2879  bool CheckNonDependentConversions(FunctionTemplateDecl *FunctionTemplate,
2880                                    ArrayRef<QualTypeParamTypes,
2881                                    ArrayRef<Expr *> Args,
2882                                    OverloadCandidateSet &CandidateSet,
2883                                    ConversionSequenceList &Conversions,
2884                                    bool SuppressUserConversions,
2885                                    CXXRecordDecl *ActingContext = nullptr,
2886                                    QualType ObjectType = QualType(),
2887                                    Expr::Classification
2888                                        ObjectClassification = {});
2889  void AddConversionCandidate(CXXConversionDecl *Conversion,
2890                              DeclAccessPair FoundDecl,
2891                              CXXRecordDecl *ActingContext,
2892                              Expr *FromQualType ToType,
2893                              OverloadCandidateSetCandidateSet,
2894                              bool AllowObjCConversionOnExplicit,
2895                              bool AllowResultConversion = true);
2896  void AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate,
2897                                      DeclAccessPair FoundDecl,
2898                                      CXXRecordDecl *ActingContext,
2899                                      Expr *FromQualType ToType,
2900                                      OverloadCandidateSet &CandidateSet,
2901                                      bool AllowObjCConversionOnExplicit,
2902                                      bool AllowResultConversion = true);
2903  void AddSurrogateCandidate(CXXConversionDecl *Conversion,
2904                             DeclAccessPair FoundDecl,
2905                             CXXRecordDecl *ActingContext,
2906                             const FunctionProtoType *Proto,
2907                             Expr *ObjectArrayRef<Expr *> Args,
2908                             OverloadCandidateSetCandidateSet);
2909  void AddMemberOperatorCandidates(OverloadedOperatorKind Op,
2910                                   SourceLocation OpLocArrayRef<Expr *> Args,
2911                                   OverloadCandidateSetCandidateSet,
2912                                   SourceRange OpRange = SourceRange());
2913  void AddBuiltinCandidate(QualType *ParamTysArrayRef<Expr *> Args,
2914                           OverloadCandidateSetCandidateSet,
2915                           bool IsAssignmentOperator = false,
2916                           unsigned NumContextualBoolArguments = 0);
2917  void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
2918                                    SourceLocation OpLocArrayRef<Expr *> Args,
2919                                    OverloadCandidateSetCandidateSet);
2920  void AddArgumentDependentLookupCandidates(DeclarationName Name,
2921                                            SourceLocation Loc,
2922                                            ArrayRef<Expr *> Args,
2923                                TemplateArgumentListInfo *ExplicitTemplateArgs,
2924                                            OverloadCandidateSetCandidateSet,
2925                                            bool PartialOverloading = false);
2926
2927  // Emit as a 'note' the specific overload candidate
2928  void NoteOverloadCandidate(NamedDecl *FoundFunctionDecl *Fn,
2929                             QualType DestType = QualType(),
2930                             bool TakingAddress = false);
2931
2932  // Emit as a series of 'note's all template and non-templates identified by
2933  // the expression Expr
2934  void NoteAllOverloadCandidates(Expr *EQualType DestType = QualType(),
2935                                 bool TakingAddress = false);
2936
2937  /// Check the enable_if expressions on the given function. Returns the first
2938  /// failing attribute, or NULL if they were all successful.
2939  EnableIfAttr *CheckEnableIf(FunctionDecl *FunctionArrayRef<Expr *> Args,
2940                              bool MissingImplicitThis = false);
2941
2942  /// Find the failed Boolean condition within a given Boolean
2943  /// constant expression, and describe it with a string.
2944  std::pair<Expr *, std::stringfindFailedBooleanCondition(Expr *Cond);
2945
2946  /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
2947  /// non-ArgDependent DiagnoseIfAttrs.
2948  ///
2949  /// Argument-dependent diagnose_if attributes should be checked each time a
2950  /// function is used as a direct callee of a function call.
2951  ///
2952  /// Returns true if any errors were emitted.
2953  bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function,
2954                                           const Expr *ThisArg,
2955                                           ArrayRef<const Expr *> Args,
2956                                           SourceLocation Loc);
2957
2958  /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
2959  /// ArgDependent DiagnoseIfAttrs.
2960  ///
2961  /// Argument-independent diagnose_if attributes should be checked on every use
2962  /// of a function.
2963  ///
2964  /// Returns true if any errors were emitted.
2965  bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND,
2966                                             SourceLocation Loc);
2967
2968  /// Returns whether the given function's address can be taken or not,
2969  /// optionally emitting a diagnostic if the address can't be taken.
2970  ///
2971  /// Returns false if taking the address of the function is illegal.
2972  bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function,
2973                                         bool Complain = false,
2974                                         SourceLocation Loc = SourceLocation());
2975
2976  // [PossiblyAFunctionType]  -->   [Return]
2977  // NonFunctionType --> NonFunctionType
2978  // R (A) --> R(A)
2979  // R (*)(A) --> R (A)
2980  // R (&)(A) --> R (A)
2981  // R (S::*)(A) --> R (A)
2982  QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType);
2983
2984  FunctionDecl *
2985  ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr,
2986                                     QualType TargetType,
2987                                     bool Complain,
2988                                     DeclAccessPair &Found,
2989                                     bool *pHadMultipleCandidates = nullptr);
2990
2991  FunctionDecl *
2992  resolveAddressOfOnlyViableOverloadCandidate(Expr *E,
2993                                              DeclAccessPair &FoundResult);
2994
2995  bool resolveAndFixAddressOfOnlyViableOverloadCandidate(
2996      ExprResult &SrcExprbool DoFunctionPointerConversion = false);
2997
2998  FunctionDecl *
2999  ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl,
3000                                              bool Complain = false,
3001                                              DeclAccessPair *Found = nullptr);
3002
3003  bool ResolveAndFixSingleFunctionTemplateSpecialization(
3004                      ExprResult &SrcExpr,
3005                      bool DoFunctionPointerConverion = false,
3006                      bool Complain = false,
3007                      SourceRange OpRangeForComplaining = SourceRange(),
3008                      QualType DestTypeForComplaining = QualType(),
3009                      unsigned DiagIDForComplaining = 0);
3010
3011
3012  Expr *FixOverloadedFunctionReference(Expr *E,
3013                                       DeclAccessPair FoundDecl,
3014                                       FunctionDecl *Fn);
3015  ExprResult FixOverloadedFunctionReference(ExprResult,
3016                                            DeclAccessPair FoundDecl,
3017                                            FunctionDecl *Fn);
3018
3019  void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
3020                                   ArrayRef<Expr *> Args,
3021                                   OverloadCandidateSet &CandidateSet,
3022                                   bool PartialOverloading = false);
3023
3024  // An enum used to represent the different possible results of building a
3025  // range-based for loop.
3026  enum ForRangeStatus {
3027    FRS_Success,
3028    FRS_NoViableFunction,
3029    FRS_DiagnosticIssued
3030  };
3031
3032  ForRangeStatus BuildForRangeBeginEndCall(SourceLocation Loc,
3033                                           SourceLocation RangeLoc,
3034                                           const DeclarationNameInfo &NameInfo,
3035                                           LookupResult &MemberLookup,
3036                                           OverloadCandidateSet *CandidateSet,
3037                                           Expr *RangeExprResult *CallExpr);
3038
3039  ExprResult BuildOverloadedCallExpr(Scope *SExpr *Fn,
3040                                     UnresolvedLookupExpr *ULE,
3041                                     SourceLocation LParenLoc,
3042                                     MultiExprArg Args,
3043                                     SourceLocation RParenLoc,
3044                                     Expr *ExecConfig,
3045                                     bool AllowTypoCorrection=true,
3046                                     bool CalleesAddressIsTaken=false);
3047
3048  bool buildOverloadedCallSet(Scope *SExpr *FnUnresolvedLookupExpr *ULE,
3049                              MultiExprArg ArgsSourceLocation RParenLoc,
3050                              OverloadCandidateSet *CandidateSet,
3051                              ExprResult *Result);
3052
3053  ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc,
3054                                     UnaryOperatorKind Opc,
3055                                     const UnresolvedSetImpl &Fns,
3056                                     Expr *inputbool RequiresADL = true);
3057
3058  ExprResult CreateOverloadedBinOp(SourceLocation OpLoc,
3059                                   BinaryOperatorKind Opc,
3060                                   const UnresolvedSetImpl &Fns,
3061                                   Expr *LHSExpr *RHS,
3062                                   bool RequiresADL = true);
3063
3064  ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
3065                                                SourceLocation RLoc,
3066                                                Expr *Base,Expr *Idx);
3067
3068  ExprResult
3069  BuildCallToMemberFunction(Scope *SExpr *MemExpr,
3070                            SourceLocation LParenLoc,
3071                            MultiExprArg Args,
3072                            SourceLocation RParenLoc);
3073  ExprResult
3074  BuildCallToObjectOfClassType(Scope *SExpr *ObjectSourceLocation LParenLoc,
3075                               MultiExprArg Args,
3076                               SourceLocation RParenLoc);
3077
3078  ExprResult BuildOverloadedArrowExpr(Scope *SExpr *Base,
3079                                      SourceLocation OpLoc,
3080                                      bool *NoArrowOperatorFound = nullptr);
3081
3082  /// CheckCallReturnType - Checks that a call expression's return type is
3083  /// complete. Returns true on failure. The location passed in is the location
3084  /// that best represents the call.
3085  bool CheckCallReturnType(QualType ReturnTypeSourceLocation Loc,
3086                           CallExpr *CEFunctionDecl *FD);
3087
3088  /// Helpers for dealing with blocks and functions.
3089  bool CheckParmsForFunctionDef(ArrayRef<ParmVarDecl *> Parameters,
3090                                bool CheckParameterNames);
3091  void CheckCXXDefaultArguments(FunctionDecl *FD);
3092  void CheckExtraCXXDefaultArguments(Declarator &D);
3093  Scope *getNonFieldDeclScope(Scope *S);
3094
3095  /// \name Name lookup
3096  ///
3097  /// These routines provide name lookup that is used during semantic
3098  /// analysis to resolve the various kinds of names (identifiers,
3099  /// overloaded operator names, constructor names, etc.) into zero or
3100  /// more declarations within a particular scope. The major entry
3101  /// points are LookupName, which performs unqualified name lookup,
3102  /// and LookupQualifiedName, which performs qualified name lookup.
3103  ///
3104  /// All name lookup is performed based on some specific criteria,
3105  /// which specify what names will be visible to name lookup and how
3106  /// far name lookup should work. These criteria are important both
3107  /// for capturing language semantics (certain lookups will ignore
3108  /// certain names, for example) and for performance, since name
3109  /// lookup is often a bottleneck in the compilation of C++. Name
3110  /// lookup criteria is specified via the LookupCriteria enumeration.
3111  ///
3112  /// The results of name lookup can vary based on the kind of name
3113  /// lookup performed, the current language, and the translation
3114  /// unit. In C, for example, name lookup will either return nothing
3115  /// (no entity found) or a single declaration. In C++, name lookup
3116  /// can additionally refer to a set of overloaded functions or
3117  /// result in an ambiguity. All of the possible results of name
3118  /// lookup are captured by the LookupResult class, which provides
3119  /// the ability to distinguish among them.
3120  //@{
3121
3122  /// Describes the kind of name lookup to perform.
3123  enum LookupNameKind {
3124    /// Ordinary name lookup, which finds ordinary names (functions,
3125    /// variables, typedefs, etc.) in C and most kinds of names
3126    /// (functions, variables, members, types, etc.) in C++.
3127    LookupOrdinaryName = 0,
3128    /// Tag name lookup, which finds the names of enums, classes,
3129    /// structs, and unions.
3130    LookupTagName,
3131    /// Label name lookup.
3132    LookupLabel,
3133    /// Member name lookup, which finds the names of
3134    /// class/struct/union members.
3135    LookupMemberName,
3136    /// Look up of an operator name (e.g., operator+) for use with
3137    /// operator overloading. This lookup is similar to ordinary name
3138    /// lookup, but will ignore any declarations that are class members.
3139    LookupOperatorName,
3140    /// Look up of a name that precedes the '::' scope resolution
3141    /// operator in C++. This lookup completely ignores operator, object,
3142    /// function, and enumerator names (C++ [basic.lookup.qual]p1).
3143    LookupNestedNameSpecifierName,
3144    /// Look up a namespace name within a C++ using directive or
3145    /// namespace alias definition, ignoring non-namespace names (C++
3146    /// [basic.lookup.udir]p1).
3147    LookupNamespaceName,
3148    /// Look up all declarations in a scope with the given name,
3149    /// including resolved using declarations.  This is appropriate
3150    /// for checking redeclarations for a using declaration.
3151    LookupUsingDeclName,
3152    /// Look up an ordinary name that is going to be redeclared as a
3153    /// name with linkage. This lookup ignores any declarations that
3154    /// are outside of the current scope unless they have linkage. See
3155    /// C99 6.2.2p4-5 and C++ [basic.link]p6.
3156    LookupRedeclarationWithLinkage,
3157    /// Look up a friend of a local class. This lookup does not look
3158    /// outside the innermost non-class scope. See C++11 [class.friend]p11.
3159    LookupLocalFriendName,
3160    /// Look up the name of an Objective-C protocol.
3161    LookupObjCProtocolName,
3162    /// Look up implicit 'self' parameter of an objective-c method.
3163    LookupObjCImplicitSelfParam,
3164    /// Look up the name of an OpenMP user-defined reduction operation.
3165    LookupOMPReductionName,
3166    /// Look up the name of an OpenMP user-defined mapper.
3167    LookupOMPMapperName,
3168    /// Look up any declaration with any name.
3169    LookupAnyName
3170  };
3171
3172  /// Specifies whether (or how) name lookup is being performed for a
3173  /// redeclaration (vs. a reference).
3174  enum RedeclarationKind {
3175    /// The lookup is a reference to this name that is not for the
3176    /// purpose of redeclaring the name.
3177    NotForRedeclaration = 0,
3178    /// The lookup results will be used for redeclaration of a name,
3179    /// if an entity by that name already exists and is visible.
3180    ForVisibleRedeclaration,
3181    /// The lookup results will be used for redeclaration of a name
3182    /// with external linkage; non-visible lookup results with external linkage
3183    /// may also be found.
3184    ForExternalRedeclaration
3185  };
3186
3187  RedeclarationKind forRedeclarationInCurContext() {
3188    // A declaration with an owning module for linkage can never link against
3189    // anything that is not visible. We don't need to check linkage here; if
3190    // the context has internal linkage, redeclaration lookup won't find things
3191    // from other TUs, and we can't safely compute linkage yet in general.
3192    if (cast<Decl>(CurContext)
3193            ->getOwningModuleForLinkage(/*IgnoreLinkage*/true))
3194      return ForVisibleRedeclaration;
3195    return ForExternalRedeclaration;
3196  }
3197
3198  /// The possible outcomes of name lookup for a literal operator.
3199  enum LiteralOperatorLookupResult {
3200    /// The lookup resulted in an error.
3201    LOLR_Error,
3202    /// The lookup found no match but no diagnostic was issued.
3203    LOLR_ErrorNoDiagnostic,
3204    /// The lookup found a single 'cooked' literal operator, which
3205    /// expects a normal literal to be built and passed to it.
3206    LOLR_Cooked,
3207    /// The lookup found a single 'raw' literal operator, which expects
3208    /// a string literal containing the spelling of the literal token.
3209    LOLR_Raw,
3210    /// The lookup found an overload set of literal operator templates,
3211    /// which expect the characters of the spelling of the literal token to be
3212    /// passed as a non-type template argument pack.
3213    LOLR_Template,
3214    /// The lookup found an overload set of literal operator templates,
3215    /// which expect the character type and characters of the spelling of the
3216    /// string literal token to be passed as template arguments.
3217    LOLR_StringTemplate
3218  };
3219
3220  SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D,
3221                                                  CXXSpecialMember SM,
3222                                                  bool ConstArg,
3223                                                  bool VolatileArg,
3224                                                  bool RValueThis,
3225                                                  bool ConstThis,
3226                                                  bool VolatileThis);
3227
3228  typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
3229  typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
3230      TypoRecoveryCallback;
3231
3232private:
3233  bool CppLookupName(LookupResult &RScope *S);
3234
3235  struct TypoExprState {
3236    std::unique_ptr<TypoCorrectionConsumerConsumer;
3237    TypoDiagnosticGenerator DiagHandler;
3238    TypoRecoveryCallback RecoveryHandler;
3239    TypoExprState();
3240    TypoExprState(TypoExprState &&othernoexcept;
3241    TypoExprState &operator=(TypoExprState &&othernoexcept;
3242  };
3243
3244  /// The set of unhandled TypoExprs and their associated state.
3245  llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos;
3246
3247  /// Creates a new TypoExpr AST node.
3248  TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumerTCC,
3249                              TypoDiagnosticGenerator TDG,
3250                              TypoRecoveryCallback TRC);
3251
3252  // The set of known/encountered (unique, canonicalized) NamespaceDecls.
3253  //
3254  // The boolean value will be true to indicate that the namespace was loaded
3255  // from an AST/PCH file, or false otherwise.
3256  llvm::MapVector<NamespaceDecl*, boolKnownNamespaces;
3257
3258  /// Whether we have already loaded known namespaces from an extenal
3259  /// source.
3260  bool LoadedExternalKnownNamespaces;
3261
3262  /// Helper for CorrectTypo and CorrectTypoDelayed used to create and
3263  /// populate a new TypoCorrectionConsumer. Returns nullptr if typo correction
3264  /// should be skipped entirely.
3265  std::unique_ptr<TypoCorrectionConsumer>
3266  makeTypoCorrectionConsumer(const DeclarationNameInfo &Typo,
3267                             Sema::LookupNameKind LookupKindScope *S,
3268                             CXXScopeSpec *SS,
3269                             CorrectionCandidateCallback &CCC,
3270                             DeclContext *MemberContextbool EnteringContext,
3271                             const ObjCObjectPointerType *OPT,
3272                             bool ErrorRecovery);
3273
3274public:
3275  const TypoExprState &getTypoExprState(TypoExpr *TEconst;
3276
3277  /// Clears the state of the given TypoExpr.
3278  void clearDelayedTypo(TypoExpr *TE);
3279
3280  /// Look up a name, looking for a single declaration.  Return
3281  /// null if the results were absent, ambiguous, or overloaded.
3282  ///
3283  /// It is preferable to use the elaborated form and explicitly handle
3284  /// ambiguity and overloaded.
3285  NamedDecl *LookupSingleName(Scope *SDeclarationName Name,
3286                              SourceLocation Loc,
3287                              LookupNameKind NameKind,
3288                              RedeclarationKind Redecl
3289                                = NotForRedeclaration);
3290  bool LookupName(LookupResult &RScope *S,
3291                  bool AllowBuiltinCreation = false);
3292  bool LookupQualifiedName(LookupResult &RDeclContext *LookupCtx,
3293                           bool InUnqualifiedLookup = false);
3294  bool LookupQualifiedName(LookupResult &RDeclContext *LookupCtx,
3295                           CXXScopeSpec &SS);
3296  bool LookupParsedName(LookupResult &RScope *SCXXScopeSpec *SS,
3297                        bool AllowBuiltinCreation = false,
3298                        bool EnteringContext = false);
3299  ObjCProtocolDecl *LookupProtocol(IdentifierInfo *IISourceLocation IdLoc,
3300                                   RedeclarationKind Redecl
3301                                     = NotForRedeclaration);
3302  bool LookupInSuper(LookupResult &RCXXRecordDecl *Class);
3303
3304  void LookupOverloadedOperatorName(OverloadedOperatorKind OpScope *S,
3305                                    QualType T1QualType T2,
3306                                    UnresolvedSetImpl &Functions);
3307
3308  LabelDecl *LookupOrCreateLabel(IdentifierInfo *IISourceLocation IdentLoc,
3309                                 SourceLocation GnuLabelLoc = SourceLocation());
3310
3311  DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class);
3312  CXXConstructorDecl *LookupDefaultConstructor(CXXRecordDecl *Class);
3313  CXXConstructorDecl *LookupCopyingConstructor(CXXRecordDecl *Class,
3314                                               unsigned Quals);
3315  CXXMethodDecl *LookupCopyingAssignment(CXXRecordDecl *Classunsigned Quals,
3316                                         bool RValueThisunsigned ThisQuals);
3317  CXXConstructorDecl *LookupMovingConstructor(CXXRecordDecl *Class,
3318                                              unsigned Quals);
3319  CXXMethodDecl *LookupMovingAssignment(CXXRecordDecl *Classunsigned Quals,
3320                                        bool RValueThisunsigned ThisQuals);
3321  CXXDestructorDecl *LookupDestructor(CXXRecordDecl *Class);
3322
3323  bool checkLiteralOperatorId(const CXXScopeSpec &SSconst UnqualifiedId &Id);
3324  LiteralOperatorLookupResult LookupLiteralOperator(Scope *SLookupResult &R,
3325                                                    ArrayRef<QualTypeArgTys,
3326                                                    bool AllowRaw,
3327                                                    bool AllowTemplate,
3328                                                    bool AllowStringTemplate,
3329                                                    bool DiagnoseMissing);
3330  bool isKnownName(StringRef name);
3331
3332  void ArgumentDependentLookup(DeclarationName NameSourceLocation Loc,
3333                               ArrayRef<Expr *> ArgsADLResult &Functions);
3334
3335  void LookupVisibleDecls(Scope *SLookupNameKind Kind,
3336                          VisibleDeclConsumer &Consumer,
3337                          bool IncludeGlobalScope = true,
3338                          bool LoadExternal = true);
3339  void LookupVisibleDecls(DeclContext *CtxLookupNameKind Kind,
3340                          VisibleDeclConsumer &Consumer,
3341                          bool IncludeGlobalScope = true,
3342                          bool IncludeDependentBases = false,
3343                          bool LoadExternal = true);
3344
3345  enum CorrectTypoKind {
3346    CTK_NonError,     // CorrectTypo used in a non error recovery situation.
3347    CTK_ErrorRecovery // CorrectTypo used in normal error recovery.
3348  };
3349
3350  TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo,
3351                             Sema::LookupNameKind LookupKind,
3352                             Scope *SCXXScopeSpec *SS,
3353                             CorrectionCandidateCallback &CCC,
3354                             CorrectTypoKind Mode,
3355                             DeclContext *MemberContext = nullptr,
3356                             bool EnteringContext = false,
3357                             const ObjCObjectPointerType *OPT = nullptr,
3358                             bool RecordFailure = true);
3359
3360  TypoExpr *CorrectTypoDelayed(const DeclarationNameInfo &Typo,
3361                               Sema::LookupNameKind LookupKindScope *S,
3362                               CXXScopeSpec *SS,
3363                               CorrectionCandidateCallback &CCC,
3364                               TypoDiagnosticGenerator TDG,
3365                               TypoRecoveryCallback TRCCorrectTypoKind Mode,
3366                               DeclContext *MemberContext = nullptr,
3367                               bool EnteringContext = false,
3368                               const ObjCObjectPointerType *OPT = nullptr);
3369
3370  /// Process any TypoExprs in the given Expr and its children,
3371  /// generating diagnostics as appropriate and returning a new Expr if there
3372  /// were typos that were all successfully corrected and ExprError if one or
3373  /// more typos could not be corrected.
3374  ///
3375  /// \param E The Expr to check for TypoExprs.
3376  ///
3377  /// \param InitDecl A VarDecl to avoid because the Expr being corrected is its
3378  /// initializer.
3379  ///
3380  /// \param Filter A function applied to a newly rebuilt Expr to determine if
3381  /// it is an acceptable/usable result from a single combination of typo
3382  /// corrections. As long as the filter returns ExprError, different
3383  /// combinations of corrections will be tried until all are exhausted.
3384  ExprResult
3385  CorrectDelayedTyposInExpr(Expr *EVarDecl *InitDecl = nullptr,
3386                            llvm::function_ref<ExprResult(Expr *)> Filter =
3387                                [](Expr *E) -> ExprResult { return E; });
3388
3389  ExprResult
3390  CorrectDelayedTyposInExpr(Expr *E,
3391                            llvm::function_ref<ExprResult(Expr *)> Filter) {
3392    return CorrectDelayedTyposInExpr(E, nullptr, Filter);
3393  }
3394
3395  ExprResult
3396  CorrectDelayedTyposInExpr(ExprResult ERVarDecl *InitDecl = nullptr,
3397                            llvm::function_ref<ExprResult(Expr *)> Filter =
3398                                [](Expr *E) -> ExprResult { return E; }) {
3399    return ER.isInvalid() ? ER : CorrectDelayedTyposInExpr(ER.get(), Filter);
3400  }
3401
3402  ExprResult
3403  CorrectDelayedTyposInExpr(ExprResult ER,
3404                            llvm::function_ref<ExprResult(Expr *)> Filter) {
3405    return CorrectDelayedTyposInExpr(ER, nullptr, Filter);
3406  }
3407
3408  void diagnoseTypo(const TypoCorrection &Correction,
3409                    const PartialDiagnostic &TypoDiag,
3410                    bool ErrorRecovery = true);
3411
3412  void diagnoseTypo(const TypoCorrection &Correction,
3413                    const PartialDiagnostic &TypoDiag,
3414                    const PartialDiagnostic &PrevNote,
3415                    bool ErrorRecovery = true);
3416
3417  void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F);
3418
3419  void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc,
3420                                          ArrayRef<Expr *> Args,
3421                                   AssociatedNamespaceSet &AssociatedNamespaces,
3422                                   AssociatedClassSet &AssociatedClasses);
3423
3424  void FilterLookupForScope(LookupResult &RDeclContext *CtxScope *S,
3425                            bool ConsiderLinkagebool AllowInlineNamespace);
3426
3427  bool CheckRedeclarationModuleOwnership(NamedDecl *NewNamedDecl *Old);
3428
3429  void DiagnoseAmbiguousLookup(LookupResult &Result);
3430  //@}
3431
3432  ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *&Id,
3433                                          SourceLocation IdLoc,
3434                                          bool TypoCorrection = false);
3435  NamedDecl *LazilyCreateBuiltin(IdentifierInfo *IIunsigned ID,
3436                                 Scope *Sbool ForRedeclaration,
3437                                 SourceLocation Loc);
3438  NamedDecl *ImplicitlyDefineFunction(SourceLocation LocIdentifierInfo &II,
3439                                      Scope *S);
3440  void AddKnownFunctionAttributes(FunctionDecl *FD);
3441
3442  // More parsing and symbol table subroutines.
3443
3444  void ProcessPragmaWeak(Scope *SDecl *D);
3445  // Decl attributes - this routine is the top level dispatcher.
3446  void ProcessDeclAttributes(Scope *SDecl *Dconst Declarator &PD);
3447  // Helper for delayed processing of attributes.
3448  void ProcessDeclAttributeDelayed(Decl *D,
3449                                   const ParsedAttributesView &AttrList);
3450  void ProcessDeclAttributeList(Scope *SDecl *Dconst ParsedAttributesView &AL,
3451                             bool IncludeCXX11Attributes = true);
3452  bool ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl,
3453                                   const ParsedAttributesView &AttrList);
3454
3455  void checkUnusedDeclAttributes(Declarator &D);
3456
3457  /// Determine if type T is a valid subject for a nonnull and similar
3458  /// attributes. By default, we look through references (the behavior used by
3459  /// nonnull), but if the second parameter is true, then we treat a reference
3460  /// type as valid.
3461  bool isValidPointerAttrType(QualType Tbool RefOkay = false);
3462
3463  bool CheckRegparmAttr(const ParsedAttr &attrunsigned &value);
3464  bool CheckCallingConvAttr(const ParsedAttr &attrCallingConv &CC,
3465                            const FunctionDecl *FD = nullptr);
3466  bool CheckAttrTarget(const ParsedAttr &CurrAttr);
3467  bool CheckAttrNoArgs(const ParsedAttr &CurrAttr);
3468  bool checkStringLiteralArgumentAttr(const ParsedAttr &Attrunsigned ArgNum,
3469                                      StringRef &Str,
3470                                      SourceLocation *ArgLocation = nullptr);
3471  bool checkSectionName(SourceLocation LiteralLocStringRef Str);
3472  bool checkTargetAttr(SourceLocation LiteralLocStringRef Str);
3473  bool checkMSInheritanceAttrOnDefinition(
3474      CXXRecordDecl *RDSourceRange Rangebool BestCase,
3475      MSInheritanceAttr::Spelling SemanticSpelling);
3476
3477  void CheckAlignasUnderalignment(Decl *D);
3478
3479  /// Adjust the calling convention of a method to be the ABI default if it
3480  /// wasn't specified explicitly.  This handles method types formed from
3481  /// function type typedefs and typename template arguments.
3482  void adjustMemberFunctionCC(QualType &Tbool IsStaticbool IsCtorOrDtor,
3483                              SourceLocation Loc);
3484
3485  // Check if there is an explicit attribute, but only look through parens.
3486  // The intent is to look for an attribute on the current declarator, but not
3487  // one that came from a typedef.
3488  bool hasExplicitCallingConv(QualType &T);
3489
3490  /// Get the outermost AttributedType node that sets a calling convention.
3491  /// Valid types should not have multiple attributes with different CCs.
3492  const AttributedType *getCallingConvAttributedType(QualType Tconst;
3493
3494  /// Stmt attributes - this routine is the top level dispatcher.
3495  StmtResult ProcessStmtAttributes(Stmt *Stmt,
3496                                   const ParsedAttributesView &Attrs,
3497                                   SourceRange Range);
3498
3499  void WarnConflictingTypedMethods(ObjCMethodDecl *Method,
3500                                   ObjCMethodDecl *MethodDecl,
3501                                   bool IsProtocolMethodDecl);
3502
3503  void CheckConflictingOverridingMethod(ObjCMethodDecl *Method,
3504                                   ObjCMethodDecl *Overridden,
3505                                   bool IsProtocolMethodDecl);
3506
3507  /// WarnExactTypedMethods - This routine issues a warning if method
3508  /// implementation declaration matches exactly that of its declaration.
3509  void WarnExactTypedMethods(ObjCMethodDecl *Method,
3510                             ObjCMethodDecl *MethodDecl,
3511                             bool IsProtocolMethodDecl);
3512
3513  typedef llvm::SmallPtrSet<Selector, 8SelectorSet;
3514
3515  /// CheckImplementationIvars - This routine checks if the instance variables
3516  /// listed in the implelementation match those listed in the interface.
3517  void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
3518                                ObjCIvarDecl **Fieldsunsigned nIvars,
3519                                SourceLocation Loc);
3520
3521  /// ImplMethodsVsClassMethods - This is main routine to warn if any method
3522  /// remains unimplemented in the class or category \@implementation.
3523  void ImplMethodsVsClassMethods(Scope *SObjCImplDeclIMPDecl,
3524                                 ObjCContainerDeclIDecl,
3525                                 bool IncompleteImpl = false);
3526
3527  /// DiagnoseUnimplementedProperties - This routine warns on those properties
3528  /// which must be implemented by this implementation.
3529  void DiagnoseUnimplementedProperties(Scope *SObjCImplDeclIMPDecl,
3530                                       ObjCContainerDecl *CDecl,
3531                                       bool SynthesizeProperties);
3532
3533  /// Diagnose any null-resettable synthesized setters.
3534  void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl);
3535
3536  /// DefaultSynthesizeProperties - This routine default synthesizes all
3537  /// properties which must be synthesized in the class's \@implementation.
3538  void DefaultSynthesizeProperties(Scope *SObjCImplDecl *IMPDecl,
3539                                   ObjCInterfaceDecl *IDecl,
3540                                   SourceLocation AtEnd);
3541  void DefaultSynthesizeProperties(Scope *SDecl *DSourceLocation AtEnd);
3542
3543  /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
3544  /// an ivar synthesized for 'Method' and 'Method' is a property accessor
3545  /// declared in class 'IFace'.
3546  bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace,
3547                                      ObjCMethodDecl *MethodObjCIvarDecl *IV);
3548
3549  /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which
3550  /// backs the property is not used in the property's accessor.
3551  void DiagnoseUnusedBackingIvarInAccessor(Scope *S,
3552                                           const ObjCImplementationDecl *ImplD);
3553
3554  /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
3555  /// it property has a backing ivar, returns this ivar; otherwise, returns NULL.
3556  /// It also returns ivar's property on success.
3557  ObjCIvarDecl *GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method,
3558                                               const ObjCPropertyDecl *&PDeclconst;
3559
3560  /// Called by ActOnProperty to handle \@property declarations in
3561  /// class extensions.
3562  ObjCPropertyDecl *HandlePropertyInClassExtension(Scope *S,
3563                      SourceLocation AtLoc,
3564                      SourceLocation LParenLoc,
3565                      FieldDeclarator &FD,
3566                      Selector GetterSel,
3567                      SourceLocation GetterNameLoc,
3568                      Selector SetterSel,
3569                      SourceLocation SetterNameLoc,
3570                      const bool isReadWrite,
3571                      unsigned &Attributes,
3572                      const unsigned AttributesAsWritten,
3573                      QualType T,
3574                      TypeSourceInfo *TSI,
3575                      tok::ObjCKeywordKind MethodImplKind);
3576
3577  /// Called by ActOnProperty and HandlePropertyInClassExtension to
3578  /// handle creating the ObjcPropertyDecl for a category or \@interface.
3579  ObjCPropertyDecl *CreatePropertyDecl(Scope *S,
3580                                       ObjCContainerDecl *CDecl,
3581                                       SourceLocation AtLoc,
3582                                       SourceLocation LParenLoc,
3583                                       FieldDeclarator &FD,
3584                                       Selector GetterSel,
3585                                       SourceLocation GetterNameLoc,
3586                                       Selector SetterSel,
3587                                       SourceLocation SetterNameLoc,
3588                                       const bool isReadWrite,
3589                                       const unsigned Attributes,
3590                                       const unsigned AttributesAsWritten,
3591                                       QualType T,
3592                                       TypeSourceInfo *TSI,
3593                                       tok::ObjCKeywordKind MethodImplKind,
3594                                       DeclContext *lexicalDC = nullptr);
3595
3596  /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
3597  /// warning) when atomic property has one but not the other user-declared
3598  /// setter or getter.
3599  void AtomicPropertySetterGetterRules(ObjCImplDeclIMPDecl,
3600                                       ObjCInterfaceDeclIDecl);
3601
3602  void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D);
3603
3604  void DiagnoseMissingDesignatedInitOverrides(
3605                                          const ObjCImplementationDecl *ImplD,
3606                                          const ObjCInterfaceDecl *IFD);
3607
3608  void DiagnoseDuplicateIvars(ObjCInterfaceDecl *IDObjCInterfaceDecl *SID);
3609
3610  enum MethodMatchStrategy {
3611    MMS_loose,
3612    MMS_strict
3613  };
3614
3615  /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
3616  /// true, or false, accordingly.
3617  bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
3618                                  const ObjCMethodDecl *PrevMethod,
3619                                  MethodMatchStrategy strategy = MMS_strict);
3620
3621  /// MatchAllMethodDeclarations - Check methods declaraed in interface or
3622  /// or protocol against those declared in their implementations.
3623  void MatchAllMethodDeclarations(const SelectorSet &InsMap,
3624                                  const SelectorSet &ClsMap,
3625                                  SelectorSet &InsMapSeen,
3626                                  SelectorSet &ClsMapSeen,
3627                                  ObjCImplDeclIMPDecl,
3628                                  ObjCContainerDeclIDecl,
3629                                  bool &IncompleteImpl,
3630                                  bool ImmediateClass,
3631                                  bool WarnCategoryMethodImpl=false);
3632
3633  /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
3634  /// category matches with those implemented in its primary class and
3635  /// warns each time an exact match is found.
3636  void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP);
3637
3638  /// Add the given method to the list of globally-known methods.
3639  void addMethodToGlobalList(ObjCMethodList *ListObjCMethodDecl *Method);
3640
3641private:
3642  /// AddMethodToGlobalPool - Add an instance or factory method to the global
3643  /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
3644  void AddMethodToGlobalPool(ObjCMethodDecl *Methodbool implbool instance);
3645
3646  /// LookupMethodInGlobalPool - Returns the instance or factory method and
3647  /// optionally warns if there are multiple signatures.
3648  ObjCMethodDecl *LookupMethodInGlobalPool(Selector SelSourceRange R,
3649                                           bool receiverIdOrClass,
3650                                           bool instance);
3651
3652public:
3653  /// - Returns instance or factory methods in global method pool for
3654  /// given selector. It checks the desired kind first, if none is found, and
3655  /// parameter checkTheOther is set, it then checks the other kind. If no such
3656  /// method or only one method is found, function returns false; otherwise, it
3657  /// returns true.
3658  bool
3659  CollectMultipleMethodsInGlobalPool(Selector Sel,
3660                                     SmallVectorImpl<ObjCMethodDecl*>& Methods,
3661                                     bool InstanceFirstbool CheckTheOther,
3662                                     const ObjCObjectType *TypeBound = nullptr);
3663
3664  bool
3665  AreMultipleMethodsInGlobalPool(Selector SelObjCMethodDecl *BestMethod,
3666                                 SourceRange Rbool receiverIdOrClass,
3667                                 SmallVectorImpl<ObjCMethodDecl*>& Methods);
3668
3669  void
3670  DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl<ObjCMethodDecl*> &Methods,
3671                                     Selector SelSourceRange R,
3672                                     bool receiverIdOrClass);
3673
3674private:
3675  /// - Returns a selector which best matches given argument list or
3676  /// nullptr if none could be found
3677  ObjCMethodDecl *SelectBestMethod(Selector SelMultiExprArg Args,
3678                                   bool IsInstance,
3679                                   SmallVectorImpl<ObjCMethodDecl*>& Methods);
3680
3681
3682  /// Record the typo correction failure and return an empty correction.
3683  TypoCorrection FailedCorrection(IdentifierInfo *TypoSourceLocation TypoLoc,
3684                                  bool RecordFailure = true) {
3685    if (RecordFailure)
3686      TypoCorrectionFailures[Typo].insert(TypoLoc);
3687    return TypoCorrection();
3688  }
3689
3690public:
3691  /// AddInstanceMethodToGlobalPool - All instance methods in a translation
3692  /// unit are added to a global pool. This allows us to efficiently associate
3693  /// a selector with a method declaraation for purposes of typechecking
3694  /// messages sent to "id" (where the class of the object is unknown).
3695  void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Methodbool impl=false) {
3696    AddMethodToGlobalPool(Methodimpl/*instance*/true);
3697  }
3698
3699  /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
3700  void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Methodbool impl=false) {
3701    AddMethodToGlobalPool(Methodimpl/*instance*/false);
3702  }
3703
3704  /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
3705  /// pool.
3706  void AddAnyMethodToGlobalPool(Decl *D);
3707
3708  /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
3709  /// there are multiple signatures.
3710  ObjCMethodDecl *LookupInstanceMethodInGlobalPool(Selector SelSourceRange R,
3711                                                   bool receiverIdOrClass=false) {
3712    return LookupMethodInGlobalPool(SelRreceiverIdOrClass,
3713                                    /*instance*/true);
3714  }
3715
3716  /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
3717  /// there are multiple signatures.
3718  ObjCMethodDecl *LookupFactoryMethodInGlobalPool(Selector SelSourceRange R,
3719                                                  bool receiverIdOrClass=false) {
3720    return LookupMethodInGlobalPool(SelRreceiverIdOrClass,
3721                                    /*instance*/false);
3722  }
3723
3724  const ObjCMethodDecl *SelectorsForTypoCorrection(Selector Sel,
3725                              QualType ObjectType=QualType());
3726  /// LookupImplementedMethodInGlobalPool - Returns the method which has an
3727  /// implementation.
3728  ObjCMethodDecl *LookupImplementedMethodInGlobalPool(Selector Sel);
3729
3730  /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
3731  /// initialization.
3732  void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI,
3733                                  SmallVectorImpl<ObjCIvarDecl*> &Ivars);
3734
3735  //===--------------------------------------------------------------------===//
3736  // Statement Parsing Callbacks: SemaStmt.cpp.
3737public:
3738  class FullExprArg {
3739  public:
3740    FullExprArg() : E(nullptr) { }
3741    FullExprArg(Sema &actions) : E(nullptr) { }
3742
3743    ExprResult release() {
3744      return E;
3745    }
3746
3747    Expr *get() const { return E; }
3748
3749    Expr *operator->() {
3750      return E;
3751    }
3752
3753  private:
3754    // FIXME: No need to make the entire Sema class a friend when it's just
3755    // Sema::MakeFullExpr that needs access to the constructor below.
3756    friend class Sema;
3757
3758    explicit FullExprArg(Expr *expr) : E(expr) {}
3759
3760    Expr *E;
3761  };
3762
3763  FullExprArg MakeFullExpr(Expr *Arg) {
3764    return MakeFullExpr(ArgArg ? Arg->getExprLoc() : SourceLocation());
3765  }
3766  FullExprArg MakeFullExpr(Expr *ArgSourceLocation CC) {
3767    return FullExprArg(
3768        ActOnFinishFullExpr(ArgCC/*DiscardedValue*/ false).get());
3769  }
3770  FullExprArg MakeFullDiscardedValueExpr(Expr *Arg) {
3771    ExprResult FE =
3772        ActOnFinishFullExpr(ArgArg ? Arg->getExprLoc() : SourceLocation(),
3773                            /*DiscardedValue*/ true);
3774    return FullExprArg(FE.get());
3775  }
3776
3777  StmtResult ActOnExprStmt(ExprResult Argbool DiscardedValue = true);
3778  StmtResult ActOnExprStmtError();
3779
3780  StmtResult ActOnNullStmt(SourceLocation SemiLoc,
3781                           bool HasLeadingEmptyMacro = false);
3782
3783  void ActOnStartOfCompoundStmt(bool IsStmtExpr);
3784  void ActOnFinishOfCompoundStmt();
3785  StmtResult ActOnCompoundStmt(SourceLocation LSourceLocation R,
3786                               ArrayRef<Stmt *> Eltsbool isStmtExpr);
3787
3788  /// A RAII object to enter scope of a compound statement.
3789  class CompoundScopeRAII {
3790  public:
3791    CompoundScopeRAII(Sema &Sbool IsStmtExpr = false) : S(S) {
3792      S.ActOnStartOfCompoundStmt(IsStmtExpr);
3793    }
3794
3795    ~CompoundScopeRAII() {
3796      S.ActOnFinishOfCompoundStmt();
3797    }
3798
3799  private:
3800    Sema &S;
3801  };
3802
3803  /// An RAII helper that pops function a function scope on exit.
3804  struct FunctionScopeRAII {
3805    Sema &S;
3806    bool Active;
3807    FunctionScopeRAII(Sema &S) : S(S), Active(true) {}
3808    ~FunctionScopeRAII() {
3809      if (Active)
3810        S.PopFunctionScopeInfo();
3811    }
3812    void disable() { Active = false; }
3813  };
3814
3815  StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
3816                                   SourceLocation StartLoc,
3817                                   SourceLocation EndLoc);
3818  void ActOnForEachDeclStmt(DeclGroupPtrTy Decl);
3819  StmtResult ActOnForEachLValueExpr(Expr *E);
3820  ExprResult ActOnCaseExpr(SourceLocation CaseLocExprResult Val);
3821  StmtResult ActOnCaseStmt(SourceLocation CaseLocExprResult LHS,
3822                           SourceLocation DotDotDotLocExprResult RHS,
3823                           SourceLocation ColonLoc);
3824  void ActOnCaseStmtBody(Stmt *CaseStmtStmt *SubStmt);
3825
3826  StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
3827                                      SourceLocation ColonLoc,
3828                                      Stmt *SubStmtScope *CurScope);
3829  StmtResult ActOnLabelStmt(SourceLocation IdentLocLabelDecl *TheDecl,
3830                            SourceLocation ColonLocStmt *SubStmt);
3831
3832  StmtResult ActOnAttributedStmt(SourceLocation AttrLoc,
3833                                 ArrayRef<const Attr*> Attrs,
3834                                 Stmt *SubStmt);
3835
3836  class ConditionResult;
3837  StmtResult ActOnIfStmt(SourceLocation IfLocbool IsConstexpr,
3838                         Stmt *InitStmt,
3839                         ConditionResult CondStmt *ThenVal,
3840                         SourceLocation ElseLocStmt *ElseVal);
3841  StmtResult BuildIfStmt(SourceLocation IfLocbool IsConstexpr,
3842                         Stmt *InitStmt,
3843                         ConditionResult CondStmt *ThenVal,
3844                         SourceLocation ElseLocStmt *ElseVal);
3845  StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
3846                                    Stmt *InitStmt,
3847                                    ConditionResult Cond);
3848  StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
3849                                           Stmt *SwitchStmt *Body);
3850  StmtResult ActOnWhileStmt(SourceLocation WhileLocConditionResult Cond,
3851                            Stmt *Body);
3852  StmtResult ActOnDoStmt(SourceLocation DoLocStmt *Body,
3853                         SourceLocation WhileLocSourceLocation CondLParen,
3854                         Expr *CondSourceLocation CondRParen);
3855
3856  StmtResult ActOnForStmt(SourceLocation ForLoc,
3857                          SourceLocation LParenLoc,
3858                          Stmt *First,
3859                          ConditionResult Second,
3860                          FullExprArg Third,
3861                          SourceLocation RParenLoc,
3862                          Stmt *Body);
3863  ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc,
3864                                           Expr *collection);
3865  StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
3866                                        Stmt *FirstExpr *collection,
3867                                        SourceLocation RParenLoc);
3868  StmtResult FinishObjCForCollectionStmt(Stmt *ForCollectionStmt *Body);
3869
3870  enum BuildForRangeKind {
3871    /// Initial building of a for-range statement.
3872    BFRK_Build,
3873    /// Instantiation or recovery rebuild of a for-range statement. Don't
3874    /// attempt any typo-correction.
3875    BFRK_Rebuild,
3876    /// Determining whether a for-range statement could be built. Avoid any
3877    /// unnecessary or irreversible actions.
3878    BFRK_Check
3879  };
3880
3881  StmtResult ActOnCXXForRangeStmt(Scope *SSourceLocation ForLoc,
3882                                  SourceLocation CoawaitLoc,
3883                                  Stmt *InitStmt,
3884                                  Stmt *LoopVar,
3885                                  SourceLocation ColonLocExpr *Collection,
3886                                  SourceLocation RParenLoc,
3887                                  BuildForRangeKind Kind);
3888  StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc,
3889                                  SourceLocation CoawaitLoc,
3890                                  Stmt *InitStmt,
3891                                  SourceLocation ColonLoc,
3892                                  Stmt *RangeDeclStmt *BeginStmt *End,
3893                                  Expr *CondExpr *Inc,
3894                                  Stmt *LoopVarDecl,
3895                                  SourceLocation RParenLoc,
3896                                  BuildForRangeKind Kind);
3897  StmtResult FinishCXXForRangeStmt(Stmt *ForRangeStmt *Body);
3898
3899  StmtResult ActOnGotoStmt(SourceLocation GotoLoc,
3900                           SourceLocation LabelLoc,
3901                           LabelDecl *TheDecl);
3902  StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
3903                                   SourceLocation StarLoc,
3904                                   Expr *DestExp);
3905  StmtResult ActOnContinueStmt(SourceLocation ContinueLocScope *CurScope);
3906  StmtResult ActOnBreakStmt(SourceLocation BreakLocScope *CurScope);
3907
3908  void ActOnCapturedRegionStart(SourceLocation LocScope *CurScope,
3909                                CapturedRegionKind Kindunsigned NumParams);
3910  typedef std::pair<StringRefQualTypeCapturedParamNameType;
3911  void ActOnCapturedRegionStart(SourceLocation LocScope *CurScope,
3912                                CapturedRegionKind Kind,
3913                                ArrayRef<CapturedParamNameTypeParams);
3914  StmtResult ActOnCapturedRegionEnd(Stmt *S);
3915  void ActOnCapturedRegionError();
3916  RecordDecl *CreateCapturedStmtRecordDecl(CapturedDecl *&CD,
3917                                           SourceLocation Loc,
3918                                           unsigned NumParams);
3919
3920  enum CopyElisionSemanticsKind {
3921    CES_Strict = 0,
3922    CES_AllowParameters = 1,
3923    CES_AllowDifferentTypes = 2,
3924    CES_AllowExceptionVariables = 4,
3925    CES_FormerDefault = (CES_AllowParameters),
3926    CES_Default = (CES_AllowParameters | CES_AllowDifferentTypes),
3927    CES_AsIfByStdMove = (CES_AllowParameters | CES_AllowDifferentTypes |
3928                         CES_AllowExceptionVariables),
3929  };
3930
3931  VarDecl *getCopyElisionCandidate(QualType ReturnTypeExpr *E,
3932                                   CopyElisionSemanticsKind CESK);
3933  bool isCopyElisionCandidate(QualType ReturnTypeconst VarDecl *VD,
3934                              CopyElisionSemanticsKind CESK);
3935
3936  StmtResult ActOnReturnStmt(SourceLocation ReturnLocExpr *RetValExp,
3937                             Scope *CurScope);
3938  StmtResult BuildReturnStmt(SourceLocation ReturnLocExpr *RetValExp);
3939  StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLocExpr *RetValExp);
3940
3941  StmtResult ActOnGCCAsmStmt(SourceLocation AsmLocbool IsSimple,
3942                             bool IsVolatileunsigned NumOutputs,
3943                             unsigned NumInputsIdentifierInfo **Names,
3944                             MultiExprArg ConstraintsMultiExprArg Exprs,
3945                             Expr *AsmStringMultiExprArg Clobbers,
3946                             SourceLocation RParenLoc);
3947
3948  void FillInlineAsmIdentifierInfo(Expr *Res,
3949                                   llvm::InlineAsmIdentifierInfo &Info);
3950  ExprResult LookupInlineAsmIdentifier(CXXScopeSpec &SS,
3951                                       SourceLocation TemplateKWLoc,
3952                                       UnqualifiedId &Id,
3953                                       bool IsUnevaluatedContext);
3954  bool LookupInlineAsmField(StringRef BaseStringRef Member,
3955                            unsigned &OffsetSourceLocation AsmLoc);
3956  ExprResult LookupInlineAsmVarDeclField(Expr *RefExprStringRef Member,
3957                                         SourceLocation AsmLoc);
3958  StmtResult ActOnMSAsmStmt(SourceLocation AsmLocSourceLocation LBraceLoc,
3959                            ArrayRef<TokenAsmToks,
3960                            StringRef AsmString,
3961                            unsigned NumOutputsunsigned NumInputs,
3962                            ArrayRef<StringRefConstraints,
3963                            ArrayRef<StringRefClobbers,
3964                            ArrayRef<Expr*> Exprs,
3965                            SourceLocation EndLoc);
3966  LabelDecl *GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
3967                                   SourceLocation Location,
3968                                   bool AlwaysCreate);
3969
3970  VarDecl *BuildObjCExceptionDecl(TypeSourceInfo *TInfoQualType ExceptionType,
3971                                  SourceLocation StartLoc,
3972                                  SourceLocation IdLocIdentifierInfo *Id,
3973                                  bool Invalid = false);
3974
3975  Decl *ActOnObjCExceptionDecl(Scope *SDeclarator &D);
3976
3977  StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLocSourceLocation RParen,
3978                                  Decl *ParmStmt *Body);
3979
3980  StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLocStmt *Body);
3981
3982  StmtResult ActOnObjCAtTryStmt(SourceLocation AtLocStmt *Try,
3983                                MultiStmtArg CatchStmt *Finally);
3984
3985  StmtResult BuildObjCAtThrowStmt(SourceLocation AtLocExpr *Throw);
3986  StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLocExpr *Throw,
3987                                  Scope *CurScope);
3988  ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc,
3989                                            Expr *operand);
3990  StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
3991                                         Expr *SynchExpr,
3992                                         Stmt *SynchBody);
3993
3994  StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLocStmt *Body);
3995
3996  VarDecl *BuildExceptionDeclaration(Scope *STypeSourceInfo *TInfo,
3997                                     SourceLocation StartLoc,
3998                                     SourceLocation IdLoc,
3999                                     IdentifierInfo *Id);
4000
4001  Decl *ActOnExceptionDeclarator(Scope *SDeclarator &D);
4002
4003  StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
4004                                Decl *ExDeclStmt *HandlerBlock);
4005  StmtResult ActOnCXXTryBlock(SourceLocation TryLocStmt *TryBlock,
4006                              ArrayRef<Stmt *> Handlers);
4007
4008  StmtResult ActOnSEHTryBlock(bool IsCXXTry// try (true) or __try (false) ?
4009                              SourceLocation TryLocStmt *TryBlock,
4010                              Stmt *Handler);
4011  StmtResult ActOnSEHExceptBlock(SourceLocation Loc,
4012                                 Expr *FilterExpr,
4013                                 Stmt *Block);
4014  void ActOnStartSEHFinallyBlock();
4015  void ActOnAbortSEHFinallyBlock();
4016  StmtResult ActOnFinishSEHFinallyBlock(SourceLocation LocStmt *Block);
4017  StmtResult ActOnSEHLeaveStmt(SourceLocation LocScope *CurScope);
4018
4019  void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock);
4020
4021  bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *Dconst;
4022
4023  /// If it's a file scoped decl that must warn if not used, keep track
4024  /// of it.
4025  void MarkUnusedFileScopedDecl(const DeclaratorDecl *D);
4026
4027  /// DiagnoseUnusedExprResult - If the statement passed in is an expression
4028  /// whose result is unused, warn.
4029  void DiagnoseUnusedExprResult(const Stmt *S);
4030  void DiagnoseUnusedNestedTypedefs(const RecordDecl *D);
4031  void DiagnoseUnusedDecl(const NamedDecl *ND);
4032
4033  /// Emit \p DiagID if statement located on \p StmtLoc has a suspicious null
4034  /// statement as a \p Body, and it is located on the same line.
4035  ///
4036  /// This helps prevent bugs due to typos, such as:
4037  ///     if (condition);
4038  ///       do_stuff();
4039  void DiagnoseEmptyStmtBody(SourceLocation StmtLoc,
4040                             const Stmt *Body,
4041                             unsigned DiagID);
4042
4043  /// Warn if a for/while loop statement \p S, which is followed by
4044  /// \p PossibleBody, has a suspicious null statement as a body.
4045  void DiagnoseEmptyLoopBody(const Stmt *S,
4046                             const Stmt *PossibleBody);
4047
4048  /// Warn if a value is moved to itself.
4049  void DiagnoseSelfMove(const Expr *LHSExprconst Expr *RHSExpr,
4050                        SourceLocation OpLoc);
4051
4052  /// Warn if we're implicitly casting from a _Nullable pointer type to a
4053  /// _Nonnull one.
4054  void diagnoseNullableToNonnullConversion(QualType DstTypeQualType SrcType,
4055                                           SourceLocation Loc);
4056
4057  /// Warn when implicitly casting 0 to nullptr.
4058  void diagnoseZeroToNullptrConversion(CastKind Kindconst Expr *E);
4059
4060  ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool) {
4061    return DelayedDiagnostics.push(pool);
4062  }
4063  void PopParsingDeclaration(ParsingDeclState stateDecl *decl);
4064
4065  typedef ProcessingContextState ParsingClassState;
4066  ParsingClassState PushParsingClass() {
4067    return DelayedDiagnostics.pushUndelayed();
4068  }
4069  void PopParsingClass(ParsingClassState state) {
4070    DelayedDiagnostics.popUndelayed(state);
4071  }
4072
4073  void redelayDiagnostics(sema::DelayedDiagnosticPool &pool);
4074
4075  void DiagnoseAvailabilityOfDecl(NamedDecl *DArrayRef<SourceLocationLocs,
4076                                  const ObjCInterfaceDecl *UnknownObjCClass,
4077                                  bool ObjCPropertyAccess,
4078                                  bool AvoidPartialAvailabilityChecks = false,
4079                                  ObjCInterfaceDecl *ClassReceiver = nullptr);
4080
4081  bool makeUnavailableInSystemHeader(SourceLocation loc,
4082                                     UnavailableAttr::ImplicitReason reason);
4083
4084  /// Issue any -Wunguarded-availability warnings in \c FD
4085  void DiagnoseUnguardedAvailabilityViolations(Decl *FD);
4086
4087  //===--------------------------------------------------------------------===//
4088  // Expression Parsing Callbacks: SemaExpr.cpp.
4089
4090  bool CanUseDecl(NamedDecl *Dbool TreatUnavailableAsInvalid);
4091  bool DiagnoseUseOfDecl(NamedDecl *DArrayRef<SourceLocationLocs,
4092                         const ObjCInterfaceDecl *UnknownObjCClass = nullptr,
4093                         bool ObjCPropertyAccess = false,
4094                         bool AvoidPartialAvailabilityChecks = false,
4095                         ObjCInterfaceDecl *ClassReciever = nullptr);
4096  void NoteDeletedFunction(FunctionDecl *FD);
4097  void NoteDeletedInheritingConstructor(CXXConstructorDecl *CD);
4098  bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD,
4099                                        ObjCMethodDecl *Getter,
4100                                        SourceLocation Loc);
4101  void DiagnoseSentinelCalls(NamedDecl *DSourceLocation Loc,
4102                             ArrayRef<Expr *> Args);
4103
4104  void PushExpressionEvaluationContext(
4105      ExpressionEvaluationContext NewContextDecl *LambdaContextDecl = nullptr,
4106      ExpressionEvaluationContextRecord::ExpressionKind Type =
4107          ExpressionEvaluationContextRecord::EK_Other);
4108  enum ReuseLambdaContextDecl_t { ReuseLambdaContextDecl };
4109  void PushExpressionEvaluationContext(
4110      ExpressionEvaluationContext NewContextReuseLambdaContextDecl_t,
4111      ExpressionEvaluationContextRecord::ExpressionKind Type =
4112          ExpressionEvaluationContextRecord::EK_Other);
4113  void PopExpressionEvaluationContext();
4114
4115  void DiscardCleanupsInEvaluationContext();
4116
4117  ExprResult TransformToPotentiallyEvaluated(Expr *E);
4118  ExprResult HandleExprEvaluationContextForTypeof(Expr *E);
4119
4120  ExprResult ActOnConstantExpression(ExprResult Res);
4121
4122  // Functions for marking a declaration referenced.  These functions also
4123  // contain the relevant logic for marking if a reference to a function or
4124  // variable is an odr-use (in the C++11 sense).  There are separate variants
4125  // for expressions referring to a decl; these exist because odr-use marking
4126  // needs to be delayed for some constant variables when we build one of the
4127  // named expressions.
4128  //
4129  // MightBeOdrUse indicates whether the use could possibly be an odr-use, and
4130  // should usually be true. This only needs to be set to false if the lack of
4131  // odr-use cannot be determined from the current context (for instance,
4132  // because the name denotes a virtual function and was written without an
4133  // explicit nested-name-specifier).
4134  void MarkAnyDeclReferenced(SourceLocation LocDecl *Dbool MightBeOdrUse);
4135  void MarkFunctionReferenced(SourceLocation LocFunctionDecl *Func,
4136                              bool MightBeOdrUse = true);
4137  void MarkVariableReferenced(SourceLocation LocVarDecl *Var);
4138  void MarkDeclRefReferenced(DeclRefExpr *Econst Expr *Base = nullptr);
4139  void MarkMemberReferenced(MemberExpr *E);
4140
4141  void UpdateMarkingForLValueToRValue(Expr *E);
4142  void CleanupVarDeclMarking();
4143
4144  enum TryCaptureKind {
4145    TryCapture_ImplicitTryCapture_ExplicitByValTryCapture_ExplicitByRef
4146  };
4147
4148  /// Try to capture the given variable.
4149  ///
4150  /// \param Var The variable to capture.
4151  ///
4152  /// \param Loc The location at which the capture occurs.
4153  ///
4154  /// \param Kind The kind of capture, which may be implicit (for either a
4155  /// block or a lambda), or explicit by-value or by-reference (for a lambda).
4156  ///
4157  /// \param EllipsisLoc The location of the ellipsis, if one is provided in
4158  /// an explicit lambda capture.
4159  ///
4160  /// \param BuildAndDiagnose Whether we are actually supposed to add the
4161  /// captures or diagnose errors. If false, this routine merely check whether
4162  /// the capture can occur without performing the capture itself or complaining
4163  /// if the variable cannot be captured.
4164  ///
4165  /// \param CaptureType Will be set to the type of the field used to capture
4166  /// this variable in the innermost block or lambda. Only valid when the
4167  /// variable can be captured.
4168  ///
4169  /// \param DeclRefType Will be set to the type of a reference to the capture
4170  /// from within the current scope. Only valid when the variable can be
4171  /// captured.
4172  ///
4173  /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
4174  /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
4175  /// This is useful when enclosing lambdas must speculatively capture
4176  /// variables that may or may not be used in certain specializations of
4177  /// a nested generic lambda.
4178  ///
4179  /// \returns true if an error occurred (i.e., the variable cannot be
4180  /// captured) and false if the capture succeeded.
4181  bool tryCaptureVariable(VarDecl *VarSourceLocation LocTryCaptureKind Kind,
4182                          SourceLocation EllipsisLocbool BuildAndDiagnose,
4183                          QualType &CaptureType,
4184                          QualType &DeclRefType,
4185                          const unsigned *const FunctionScopeIndexToStopAt);
4186
4187  /// Try to capture the given variable.
4188  bool tryCaptureVariable(VarDecl *VarSourceLocation Loc,
4189                          TryCaptureKind Kind = TryCapture_Implicit,
4190                          SourceLocation EllipsisLoc = SourceLocation());
4191
4192  /// Checks if the variable must be captured.
4193  bool NeedToCaptureVariable(VarDecl *VarSourceLocation Loc);
4194
4195  /// Given a variable, determine the type that a reference to that
4196  /// variable will have in the given scope.
4197  QualType getCapturedDeclRefType(VarDecl *VarSourceLocation Loc);
4198
4199  /// Mark all of the declarations referenced within a particular AST node as
4200  /// referenced. Used when template instantiation instantiates a non-dependent
4201  /// type -- entities referenced by the type are now referenced.
4202  void MarkDeclarationsReferencedInType(SourceLocation LocQualType T);
4203  void MarkDeclarationsReferencedInExpr(Expr *E,
4204                                        bool SkipLocalVariables = false);
4205
4206  /// Try to recover by turning the given expression into a
4207  /// call.  Returns true if recovery was attempted or an error was
4208  /// emitted; this may also leave the ExprResult invalid.
4209  bool tryToRecoverWithCall(ExprResult &Econst PartialDiagnostic &PD,
4210                            bool ForceComplain = false,
4211                            bool (*IsPlausibleResult)(QualType) = nullptr);
4212
4213  /// Figure out if an expression could be turned into a call.
4214  bool tryExprAsCall(Expr &EQualType &ZeroArgCallReturnTy,
4215                     UnresolvedSetImpl &NonTemplateOverloads);
4216
4217  /// Conditionally issue a diagnostic based on the current
4218  /// evaluation context.
4219  ///
4220  /// \param Statement If Statement is non-null, delay reporting the
4221  /// diagnostic until the function body is parsed, and then do a basic
4222  /// reachability analysis to determine if the statement is reachable.
4223  /// If it is unreachable, the diagnostic will not be emitted.
4224  bool DiagRuntimeBehavior(SourceLocation Locconst Stmt *Statement,
4225                           const PartialDiagnostic &PD);
4226
4227  // Primary Expressions.
4228  SourceRange getExprRange(Expr *Econst;
4229
4230  ExprResult ActOnIdExpression(
4231      Scope *SCXXScopeSpec &SSSourceLocation TemplateKWLoc,
4232      UnqualifiedId &Idbool HasTrailingLParenbool IsAddressOfOperand,
4233      CorrectionCandidateCallback *CCC = nullptr,
4234      bool IsInlineAsmIdentifier = falseToken *KeywordReplacement = nullptr);
4235
4236  void DecomposeUnqualifiedId(const UnqualifiedId &Id,
4237                              TemplateArgumentListInfo &Buffer,
4238                              DeclarationNameInfo &NameInfo,
4239                              const TemplateArgumentListInfo *&TemplateArgs);
4240
4241  bool
4242  DiagnoseEmptyLookup(Scope *SCXXScopeSpec &SSLookupResult &R,
4243                      CorrectionCandidateCallback &CCC,
4244                      TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
4245                      ArrayRef<Expr *> Args = None, TypoExpr **Out = nullptr);
4246
4247  ExprResult LookupInObjCMethod(LookupResult &LookUpScope *S,
4248                                IdentifierInfo *II,
4249                                bool AllowBuiltinCreation=false);
4250
4251  ExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS,
4252                                        SourceLocation TemplateKWLoc,
4253                                        const DeclarationNameInfo &NameInfo,
4254                                        bool isAddressOfOperand,
4255                                const TemplateArgumentListInfo *TemplateArgs);
4256
4257  ExprResult BuildDeclRefExpr(ValueDecl *DQualType Ty,
4258                              ExprValueKind VK,
4259                              SourceLocation Loc,
4260                              const CXXScopeSpec *SS = nullptr);
4261  ExprResult
4262  BuildDeclRefExpr(ValueDecl *DQualType TyExprValueKind VK,
4263                   const DeclarationNameInfo &NameInfo,
4264                   const CXXScopeSpec *SS = nullptr,
4265                   NamedDecl *FoundD = nullptr,
4266                   const TemplateArgumentListInfo *TemplateArgs = nullptr);
4267  ExprResult
4268  BuildAnonymousStructUnionMemberReference(
4269      const CXXScopeSpec &SS,
4270      SourceLocation nameLoc,
4271      IndirectFieldDecl *indirectField,
4272      DeclAccessPair FoundDecl = DeclAccessPair::make(nullptrAS_none),
4273      Expr *baseObjectExpr = nullptr,
4274      SourceLocation opLoc = SourceLocation());
4275
4276  ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS,
4277                                             SourceLocation TemplateKWLoc,
4278                                             LookupResult &R,
4279                                const TemplateArgumentListInfo *TemplateArgs,
4280                                             const Scope *S);
4281  ExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS,
4282                                     SourceLocation TemplateKWLoc,
4283                                     LookupResult &R,
4284                                const TemplateArgumentListInfo *TemplateArgs,
4285                                     bool IsDefiniteInstance,
4286                                     const Scope *S);
4287  bool UseArgumentDependentLookup(const CXXScopeSpec &SS,
4288                                  const LookupResult &R,
4289                                  bool HasTrailingLParen);
4290
4291  ExprResult
4292  BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS,
4293                                    const DeclarationNameInfo &NameInfo,
4294                                    bool IsAddressOfOperandconst Scope *S,
4295                                    TypeSourceInfo **RecoveryTSI = nullptr);
4296
4297  ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS,
4298                                       SourceLocation TemplateKWLoc,
4299                                const DeclarationNameInfo &NameInfo,
4300                                const TemplateArgumentListInfo *TemplateArgs);
4301
4302  ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS,
4303                                      LookupResult &R,
4304                                      bool NeedsADL,
4305                                      bool AcceptInvalidDecl = false);
4306  ExprResult BuildDeclarationNameExpr(
4307      const CXXScopeSpec &SSconst DeclarationNameInfo &NameInfoNamedDecl *D,
4308      NamedDecl *FoundD = nullptr,
4309      const TemplateArgumentListInfo *TemplateArgs = nullptr,
4310      bool AcceptInvalidDecl = false);
4311
4312  ExprResult BuildLiteralOperatorCall(LookupResult &R,
4313                      DeclarationNameInfo &SuffixInfo,
4314                      ArrayRef<Expr *> Args,
4315                      SourceLocation LitEndLoc,
4316                      TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
4317
4318  ExprResult BuildPredefinedExpr(SourceLocation Loc,
4319                                 PredefinedExpr::IdentKind IK);
4320  ExprResult ActOnPredefinedExpr(SourceLocation Loctok::TokenKind Kind);
4321  ExprResult ActOnIntegerConstant(SourceLocation Locuint64_t Val);
4322
4323  bool CheckLoopHintExpr(Expr *ESourceLocation Loc);
4324
4325  ExprResult ActOnNumericConstant(const Token &TokScope *UDLScope = nullptr);
4326  ExprResult ActOnCharacterConstant(const Token &Tok,
4327                                    Scope *UDLScope = nullptr);
4328  ExprResult ActOnParenExpr(SourceLocation LSourceLocation RExpr *E);
4329  ExprResult ActOnParenListExpr(SourceLocation L,
4330                                SourceLocation R,
4331                                MultiExprArg Val);
4332
4333  /// ActOnStringLiteral - The specified tokens were lexed as pasted string
4334  /// fragments (e.g. "foo" "bar" L"baz").
4335  ExprResult ActOnStringLiteral(ArrayRef<TokenStringToks,
4336                                Scope *UDLScope = nullptr);
4337
4338  ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc,
4339                                       SourceLocation DefaultLoc,
4340                                       SourceLocation RParenLoc,
4341                                       Expr *ControllingExpr,
4342                                       ArrayRef<ParsedTypeArgTypes,
4343                                       ArrayRef<Expr *> ArgExprs);
4344  ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc,
4345                                        SourceLocation DefaultLoc,
4346                                        SourceLocation RParenLoc,
4347                                        Expr *ControllingExpr,
4348                                        ArrayRef<TypeSourceInfo *> Types,
4349                                        ArrayRef<Expr *> Exprs);
4350
4351  // Binary/Unary Operators.  'Tok' is the token for the operator.
4352  ExprResult CreateBuiltinUnaryOp(SourceLocation OpLocUnaryOperatorKind Opc,
4353                                  Expr *InputExpr);
4354  ExprResult BuildUnaryOp(Scope *SSourceLocation OpLoc,
4355                          UnaryOperatorKind OpcExpr *Input);
4356  ExprResult ActOnUnaryOp(Scope *SSourceLocation OpLoc,
4357                          tok::TokenKind OpExpr *Input);
4358
4359  bool isQualifiedMemberAccess(Expr *E);
4360  QualType CheckAddressOfOperand(ExprResult &OperandSourceLocation OpLoc);
4361
4362  ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo,
4363                                            SourceLocation OpLoc,
4364                                            UnaryExprOrTypeTrait ExprKind,
4365                                            SourceRange R);
4366  ExprResult CreateUnaryExprOrTypeTraitExpr(Expr *ESourceLocation OpLoc,
4367                                            UnaryExprOrTypeTrait ExprKind);
4368  ExprResult
4369    ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc,
4370                                  UnaryExprOrTypeTrait ExprKind,
4371                                  bool IsTypevoid *TyOrEx,
4372                                  SourceRange ArgRange);
4373
4374  ExprResult CheckPlaceholderExpr(Expr *E);
4375  bool CheckVecStepExpr(Expr *E);
4376
4377  bool CheckUnaryExprOrTypeTraitOperand(Expr *EUnaryExprOrTypeTrait ExprKind);
4378  bool CheckUnaryExprOrTypeTraitOperand(QualType ExprTypeSourceLocation OpLoc,
4379                                        SourceRange ExprRange,
4380                                        UnaryExprOrTypeTrait ExprKind);
4381  ExprResult ActOnSizeofParameterPackExpr(Scope *S,
4382                                          SourceLocation OpLoc,
4383                                          IdentifierInfo &Name,
4384                                          SourceLocation NameLoc,
4385                                          SourceLocation RParenLoc);
4386  ExprResult ActOnPostfixUnaryOp(Scope *SSourceLocation OpLoc,
4387                                 tok::TokenKind KindExpr *Input);
4388
4389  ExprResult ActOnArraySubscriptExpr(Scope *SExpr *BaseSourceLocation LLoc,
4390                                     Expr *IdxSourceLocation RLoc);
4391  ExprResult CreateBuiltinArraySubscriptExpr(Expr *BaseSourceLocation LLoc,
4392                                             Expr *IdxSourceLocation RLoc);
4393  ExprResult ActOnOMPArraySectionExpr(Expr *BaseSourceLocation LBLoc,
4394                                      Expr *LowerBoundSourceLocation ColonLoc,
4395                                      Expr *LengthSourceLocation RBLoc);
4396
4397  // This struct is for use by ActOnMemberAccess to allow
4398  // BuildMemberReferenceExpr to be able to reinvoke ActOnMemberAccess after
4399  // changing the access operator from a '.' to a '->' (to see if that is the
4400  // change needed to fix an error about an unknown member, e.g. when the class
4401  // defines a custom operator->).
4402  struct ActOnMemberAccessExtraArgs {
4403    Scope *S;
4404    UnqualifiedId &Id;
4405    Decl *ObjCImpDecl;
4406  };
4407
4408  ExprResult BuildMemberReferenceExpr(
4409      Expr *BaseQualType BaseTypeSourceLocation OpLocbool IsArrow,
4410      CXXScopeSpec &SSSourceLocation TemplateKWLoc,
4411      NamedDecl *FirstQualifierInScopeconst DeclarationNameInfo &NameInfo,
4412      const TemplateArgumentListInfo *TemplateArgs,
4413      const Scope *S,
4414      ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
4415
4416  ExprResult
4417  BuildMemberReferenceExpr(Expr *BaseQualType BaseTypeSourceLocation OpLoc,
4418                           bool IsArrowconst CXXScopeSpec &SS,
4419                           SourceLocation TemplateKWLoc,
4420                           NamedDecl *FirstQualifierInScopeLookupResult &R,
4421                           const TemplateArgumentListInfo *TemplateArgs,
4422                           const Scope *S,
4423                           bool SuppressQualifierCheck = false,
4424                           ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
4425
4426  ExprResult BuildFieldReferenceExpr(Expr *BaseExprbool IsArrow,
4427                                     SourceLocation OpLoc,
4428                                     const CXXScopeSpec &SSFieldDecl *Field,
4429                                     DeclAccessPair FoundDecl,
4430                                     const DeclarationNameInfo &MemberNameInfo);
4431
4432  ExprResult PerformMemberExprBaseConversion(Expr *Basebool IsArrow);
4433
4434  bool CheckQualifiedMemberReference(Expr *BaseExprQualType BaseType,
4435                                     const CXXScopeSpec &SS,
4436                                     const LookupResult &R);
4437
4438  ExprResult ActOnDependentMemberExpr(Expr *BaseQualType BaseType,
4439                                      bool IsArrowSourceLocation OpLoc,
4440                                      const CXXScopeSpec &SS,
4441                                      SourceLocation TemplateKWLoc,
4442                                      NamedDecl *FirstQualifierInScope,
4443                               const DeclarationNameInfo &NameInfo,
4444                               const TemplateArgumentListInfo *TemplateArgs);
4445
4446  ExprResult ActOnMemberAccessExpr(Scope *SExpr *Base,
4447                                   SourceLocation OpLoc,
4448                                   tok::TokenKind OpKind,
4449                                   CXXScopeSpec &SS,
4450                                   SourceLocation TemplateKWLoc,
4451                                   UnqualifiedId &Member,
4452                                   Decl *ObjCImpDecl);
4453
4454  void ActOnDefaultCtorInitializers(Decl *CDtorDecl);
4455  bool ConvertArgumentsForCall(CallExpr *CallExpr *Fn,
4456                               FunctionDecl *FDecl,
4457                               const FunctionProtoType *Proto,
4458                               ArrayRef<Expr *> Args,
4459                               SourceLocation RParenLoc,
4460                               bool ExecConfig = false);
4461  void CheckStaticArrayArgument(SourceLocation CallLoc,
4462                                ParmVarDecl *Param,
4463                                const Expr *ArgExpr);
4464
4465  /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
4466  /// This provides the location of the left/right parens and a list of comma
4467  /// locations.
4468  ExprResult ActOnCallExpr(Scope *SExpr *FnSourceLocation LParenLoc,
4469                           MultiExprArg ArgExprsSourceLocation RParenLoc,
4470                           Expr *ExecConfig = nullptr,
4471                           bool IsExecConfig = false);
4472  ExprResult
4473  BuildResolvedCallExpr(Expr *FnNamedDecl *NDeclSourceLocation LParenLoc,
4474                        ArrayRef<Expr *> ArgSourceLocation RParenLoc,
4475                        Expr *Config = nullptrbool IsExecConfig = false,
4476                        ADLCallKind UsesADL = ADLCallKind::NotADL);
4477
4478  ExprResult ActOnCUDAExecConfigExpr(Scope *SSourceLocation LLLLoc,
4479                                     MultiExprArg ExecConfig,
4480                                     SourceLocation GGGLoc);
4481
4482  ExprResult ActOnCastExpr(Scope *SSourceLocation LParenLoc,
4483                           Declarator &DParsedType &Ty,
4484                           SourceLocation RParenLocExpr *CastExpr);
4485  ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc,
4486                                 TypeSourceInfo *Ty,
4487                                 SourceLocation RParenLoc,
4488                                 Expr *Op);
4489  CastKind PrepareScalarCast(ExprResult &srcQualType destType);
4490
4491  /// Build an altivec or OpenCL literal.
4492  ExprResult BuildVectorLiteral(SourceLocation LParenLoc,
4493                                SourceLocation RParenLocExpr *E,
4494                                TypeSourceInfo *TInfo);
4495
4496  ExprResult MaybeConvertParenListExprToParenExpr(Scope *SExpr *ME);
4497
4498  ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc,
4499                                  ParsedType Ty,
4500                                  SourceLocation RParenLoc,
4501                                  Expr *InitExpr);
4502
4503  ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc,
4504                                      TypeSourceInfo *TInfo,
4505                                      SourceLocation RParenLoc,
4506                                      Expr *LiteralExpr);
4507
4508  ExprResult ActOnInitList(SourceLocation LBraceLoc,
4509                           MultiExprArg InitArgList,
4510                           SourceLocation RBraceLoc);
4511
4512  ExprResult ActOnDesignatedInitializer(Designation &Desig,
4513                                        SourceLocation Loc,
4514                                        bool GNUSyntax,
4515                                        ExprResult Init);
4516
4517private:
4518  static BinaryOperatorKind ConvertTokenKindToBinaryOpcode(tok::TokenKind Kind);
4519
4520public:
4521  ExprResult ActOnBinOp(Scope *SSourceLocation TokLoc,
4522                        tok::TokenKind KindExpr *LHSExprExpr *RHSExpr);
4523  ExprResult BuildBinOp(Scope *SSourceLocation OpLoc,
4524                        BinaryOperatorKind OpcExpr *LHSExprExpr *RHSExpr);
4525  ExprResult CreateBuiltinBinOp(SourceLocation OpLocBinaryOperatorKind Opc,
4526                                Expr *LHSExprExpr *RHSExpr);
4527
4528  void DiagnoseCommaOperator(const Expr *LHSSourceLocation Loc);
4529
4530  /// ActOnConditionalOp - Parse a ?: operation.  Note that 'LHS' may be null
4531  /// in the case of a the GNU conditional expr extension.
4532  ExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
4533                                SourceLocation ColonLoc,
4534                                Expr *CondExprExpr *LHSExprExpr *RHSExpr);
4535
4536  /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
4537  ExprResult ActOnAddrLabel(SourceLocation OpLocSourceLocation LabLoc,
4538                            LabelDecl *TheDecl);
4539
4540  void ActOnStartStmtExpr();
4541  ExprResult ActOnStmtExpr(SourceLocation LPLocStmt *SubStmt,
4542                           SourceLocation RPLoc); // "({..})"
4543  // Handle the final expression in a statement expression.
4544  ExprResult ActOnStmtExprResult(ExprResult E);
4545  void ActOnStmtExprError();
4546
4547  // __builtin_offsetof(type, identifier(.identifier|[expr])*)
4548  struct OffsetOfComponent {
4549    SourceLocation LocStartLocEnd;
4550    bool isBrackets;  // true if [expr], false if .ident
4551    union {
4552      IdentifierInfo *IdentInfo;
4553      Expr *E;
4554    } U;
4555  };
4556
4557  /// __builtin_offsetof(type, a.b[123][456].c)
4558  ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
4559                                  TypeSourceInfo *TInfo,
4560                                  ArrayRef<OffsetOfComponentComponents,
4561                                  SourceLocation RParenLoc);
4562  ExprResult ActOnBuiltinOffsetOf(Scope *S,
4563                                  SourceLocation BuiltinLoc,
4564                                  SourceLocation TypeLoc,
4565                                  ParsedType ParsedArgTy,
4566                                  ArrayRef<OffsetOfComponentComponents,
4567                                  SourceLocation RParenLoc);
4568
4569  // __builtin_choose_expr(constExpr, expr1, expr2)
4570  ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
4571                             Expr *CondExprExpr *LHSExpr,
4572                             Expr *RHSExprSourceLocation RPLoc);
4573
4574  // __builtin_va_arg(expr, type)
4575  ExprResult ActOnVAArg(SourceLocation BuiltinLocExpr *EParsedType Ty,
4576                        SourceLocation RPLoc);
4577  ExprResult BuildVAArgExpr(SourceLocation BuiltinLocExpr *E,
4578                            TypeSourceInfo *TInfoSourceLocation RPLoc);
4579
4580  // __null
4581  ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc);
4582
4583  bool CheckCaseExpression(Expr *E);
4584
4585  /// Describes the result of an "if-exists" condition check.
4586  enum IfExistsResult {
4587    /// The symbol exists.
4588    IER_Exists,
4589
4590    /// The symbol does not exist.
4591    IER_DoesNotExist,
4592
4593    /// The name is a dependent name, so the results will differ
4594    /// from one instantiation to the next.
4595    IER_Dependent,
4596
4597    /// An error occurred.
4598    IER_Error
4599  };
4600
4601  IfExistsResult
4602  CheckMicrosoftIfExistsSymbol(Scope *SCXXScopeSpec &SS,
4603                               const DeclarationNameInfo &TargetNameInfo);
4604
4605  IfExistsResult
4606  CheckMicrosoftIfExistsSymbol(Scope *SSourceLocation KeywordLoc,
4607                               bool IsIfExistsCXXScopeSpec &SS,
4608                               UnqualifiedId &Name);
4609
4610  StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc,
4611                                        bool IsIfExists,
4612                                        NestedNameSpecifierLoc QualifierLoc,
4613                                        DeclarationNameInfo NameInfo,
4614                                        Stmt *Nested);
4615  StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc,
4616                                        bool IsIfExists,
4617                                        CXXScopeSpec &SSUnqualifiedId &Name,
4618                                        Stmt *Nested);
4619
4620  //===------------------------- "Block" Extension ------------------------===//
4621
4622  /// ActOnBlockStart - This callback is invoked when a block literal is
4623  /// started.
4624  void ActOnBlockStart(SourceLocation CaretLocScope *CurScope);
4625
4626  /// ActOnBlockArguments - This callback allows processing of block arguments.
4627  /// If there are no arguments, this is still invoked.
4628  void ActOnBlockArguments(SourceLocation CaretLocDeclarator &ParamInfo,
4629                           Scope *CurScope);
4630
4631  /// ActOnBlockError - If there is an error parsing a block, this callback
4632  /// is invoked to pop the information about the block from the action impl.
4633  void ActOnBlockError(SourceLocation CaretLocScope *CurScope);
4634
4635  /// ActOnBlockStmtExpr - This is called when the body of a block statement
4636  /// literal was successfully completed.  ^(int x){...}
4637  ExprResult ActOnBlockStmtExpr(SourceLocation CaretLocStmt *Body,
4638                                Scope *CurScope);
4639
4640  //===---------------------------- Clang Extensions ----------------------===//
4641
4642  /// __builtin_convertvector(...)
4643  ExprResult ActOnConvertVectorExpr(Expr *EParsedType ParsedDestTy,
4644                                    SourceLocation BuiltinLoc,
4645                                    SourceLocation RParenLoc);
4646
4647  //===---------------------------- OpenCL Features -----------------------===//
4648
4649  /// __builtin_astype(...)
4650  ExprResult ActOnAsTypeExpr(Expr *EParsedType ParsedDestTy,
4651                             SourceLocation BuiltinLoc,
4652                             SourceLocation RParenLoc);
4653
4654  //===---------------------------- C++ Features --------------------------===//
4655
4656  // Act on C++ namespaces
4657  Decl *ActOnStartNamespaceDef(Scope *SSourceLocation InlineLoc,
4658                               SourceLocation NamespaceLoc,
4659                               SourceLocation IdentLocIdentifierInfo *Ident,
4660                               SourceLocation LBrace,
4661                               const ParsedAttributesView &AttrList,
4662                               UsingDirectiveDecl *&UsingDecl);
4663  void ActOnFinishNamespaceDef(Decl *DclSourceLocation RBrace);
4664
4665  NamespaceDecl *getStdNamespace() const;
4666  NamespaceDecl *getOrCreateStdNamespace();
4667
4668  NamespaceDecl *lookupStdExperimentalNamespace();
4669
4670  CXXRecordDecl *getStdBadAlloc() const;
4671  EnumDecl *getStdAlignValT() const;
4672
4673private:
4674  // A cache representing if we've fully checked the various comparison category
4675  // types stored in ASTContext. The bit-index corresponds to the integer value
4676  // of a ComparisonCategoryType enumerator.
4677  llvm::SmallBitVector FullyCheckedComparisonCategories;
4678
4679  ValueDecl *tryLookupCtorInitMemberDecl(CXXRecordDecl *ClassDecl,
4680                                         CXXScopeSpec &SS,
4681                                         ParsedType TemplateTypeTy,
4682                                         IdentifierInfo *MemberOrBase);
4683
4684public:
4685  /// Lookup the specified comparison category types in the standard
4686  ///   library, an check the VarDecls possibly returned by the operator<=>
4687  ///   builtins for that type.
4688  ///
4689  /// \return The type of the comparison category type corresponding to the
4690  ///   specified Kind, or a null type if an error occurs
4691  QualType CheckComparisonCategoryType(ComparisonCategoryType Kind,
4692                                       SourceLocation Loc);
4693
4694  /// Tests whether Ty is an instance of std::initializer_list and, if
4695  /// it is and Element is not NULL, assigns the element type to Element.
4696  bool isStdInitializerList(QualType TyQualType *Element);
4697
4698  /// Looks for the std::initializer_list template and instantiates it
4699  /// with Element, or emits an error if it's not found.
4700  ///
4701  /// \returns The instantiated template, or null on error.
4702  QualType BuildStdInitializerList(QualType ElementSourceLocation Loc);
4703
4704  /// Determine whether Ctor is an initializer-list constructor, as
4705  /// defined in [dcl.init.list]p2.
4706  bool isInitListConstructor(const FunctionDecl *Ctor);
4707
4708  Decl *ActOnUsingDirective(Scope *CurScopeSourceLocation UsingLoc,
4709                            SourceLocation NamespcLocCXXScopeSpec &SS,
4710                            SourceLocation IdentLoc,
4711                            IdentifierInfo *NamespcName,
4712                            const ParsedAttributesView &AttrList);
4713
4714  void PushUsingDirective(Scope *SUsingDirectiveDecl *UDir);
4715
4716  Decl *ActOnNamespaceAliasDef(Scope *CurScope,
4717                               SourceLocation NamespaceLoc,
4718                               SourceLocation AliasLoc,
4719                               IdentifierInfo *Alias,
4720                               CXXScopeSpec &SS,
4721                               SourceLocation IdentLoc,
4722                               IdentifierInfo *Ident);
4723
4724  void HideUsingShadowDecl(Scope *SUsingShadowDecl *Shadow);
4725  bool CheckUsingShadowDecl(UsingDecl *UDNamedDecl *Target,
4726                            const LookupResult &PreviousDecls,
4727                            UsingShadowDecl *&PrevShadow);
4728  UsingShadowDecl *BuildUsingShadowDecl(Scope *SUsingDecl *UD,
4729                                        NamedDecl *Target,
4730                                        UsingShadowDecl *PrevDecl);
4731
4732  bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc,
4733                                   bool HasTypenameKeyword,
4734                                   const CXXScopeSpec &SS,
4735                                   SourceLocation NameLoc,
4736                                   const LookupResult &Previous);
4737  bool CheckUsingDeclQualifier(SourceLocation UsingLoc,
4738                               bool HasTypename,
4739                               const CXXScopeSpec &SS,
4740                               const DeclarationNameInfo &NameInfo,
4741                               SourceLocation NameLoc);
4742
4743  NamedDecl *BuildUsingDeclaration(
4744      Scope *SAccessSpecifier ASSourceLocation UsingLoc,
4745      bool HasTypenameKeywordSourceLocation TypenameLocCXXScopeSpec &SS,
4746      DeclarationNameInfo NameInfoSourceLocation EllipsisLoc,
4747      const ParsedAttributesView &AttrListbool IsInstantiation);
4748  NamedDecl *BuildUsingPackDecl(NamedDecl *InstantiatedFrom,
4749                                ArrayRef<NamedDecl *> Expansions);
4750
4751  bool CheckInheritingConstructorUsingDecl(UsingDecl *UD);
4752
4753  /// Given a derived-class using shadow declaration for a constructor and the
4754  /// correspnding base class constructor, find or create the implicit
4755  /// synthesized derived class constructor to use for this initialization.
4756  CXXConstructorDecl *
4757  findInheritingConstructor(SourceLocation LocCXXConstructorDecl *BaseCtor,
4758                            ConstructorUsingShadowDecl *DerivedShadow);
4759
4760  Decl *ActOnUsingDeclaration(Scope *CurScopeAccessSpecifier AS,
4761                              SourceLocation UsingLoc,
4762                              SourceLocation TypenameLocCXXScopeSpec &SS,
4763                              UnqualifiedId &NameSourceLocation EllipsisLoc,
4764                              const ParsedAttributesView &AttrList);
4765  Decl *ActOnAliasDeclaration(Scope *CurScopeAccessSpecifier AS,
4766                              MultiTemplateParamsArg TemplateParams,
4767                              SourceLocation UsingLocUnqualifiedId &Name,
4768                              const ParsedAttributesView &AttrList,
4769                              TypeResult TypeDecl *DeclFromDeclSpec);
4770
4771  /// BuildCXXConstructExpr - Creates a complete call to a constructor,
4772  /// including handling of its default argument expressions.
4773  ///
4774  /// \param ConstructKind - a CXXConstructExpr::ConstructionKind
4775  ExprResult
4776  BuildCXXConstructExpr(SourceLocation ConstructLocQualType DeclInitType,
4777                        NamedDecl *FoundDecl,
4778                        CXXConstructorDecl *ConstructorMultiExprArg Exprs,
4779                        bool HadMultipleCandidatesbool IsListInitialization,
4780                        bool IsStdInitListInitialization,
4781                        bool RequiresZeroInitunsigned ConstructKind,
4782                        SourceRange ParenRange);
4783
4784  /// Build a CXXConstructExpr whose constructor has already been resolved if
4785  /// it denotes an inherited constructor.
4786  ExprResult
4787  BuildCXXConstructExpr(SourceLocation ConstructLocQualType DeclInitType,
4788                        CXXConstructorDecl *Constructorbool Elidable,
4789                        MultiExprArg Exprs,
4790                        bool HadMultipleCandidatesbool IsListInitialization,
4791                        bool IsStdInitListInitialization,
4792                        bool RequiresZeroInitunsigned ConstructKind,
4793                        SourceRange ParenRange);
4794
4795  // FIXME: Can we remove this and have the above BuildCXXConstructExpr check if
4796  // the constructor can be elidable?
4797  ExprResult
4798  BuildCXXConstructExpr(SourceLocation ConstructLocQualType DeclInitType,
4799                        NamedDecl *FoundDecl,
4800                        CXXConstructorDecl *Constructorbool Elidable,
4801                        MultiExprArg Exprsbool HadMultipleCandidates,
4802                        bool IsListInitialization,
4803                        bool IsStdInitListInitializationbool RequiresZeroInit,
4804                        unsigned ConstructKindSourceRange ParenRange);
4805
4806  ExprResult BuildCXXDefaultInitExpr(SourceLocation LocFieldDecl *Field);
4807
4808
4809  /// Instantiate or parse a C++ default argument expression as necessary.
4810  /// Return true on error.
4811  bool CheckCXXDefaultArgExpr(SourceLocation CallLocFunctionDecl *FD,
4812                              ParmVarDecl *Param);
4813
4814  /// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
4815  /// the default expr if needed.
4816  ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc,
4817                                    FunctionDecl *FD,
4818                                    ParmVarDecl *Param);
4819
4820  /// FinalizeVarWithDestructor - Prepare for calling destructor on the
4821  /// constructed variable.
4822  void FinalizeVarWithDestructor(VarDecl *VDconst RecordType *DeclInitType);
4823
4824  /// Helper class that collects exception specifications for
4825  /// implicitly-declared special member functions.
4826  class ImplicitExceptionSpecification {
4827    // Pointer to allow copying
4828    Sema *Self;
4829    // We order exception specifications thus:
4830    // noexcept is the most restrictive, but is only used in C++11.
4831    // throw() comes next.
4832    // Then a throw(collected exceptions)
4833    // Finally no specification, which is expressed as noexcept(false).
4834    // throw(...) is used instead if any called function uses it.
4835    ExceptionSpecificationType ComputedEST;
4836    llvm::SmallPtrSet<CanQualType, 4ExceptionsSeen;
4837    SmallVector<QualType4Exceptions;
4838
4839    void ClearExceptions() {
4840      ExceptionsSeen.clear();
4841      Exceptions.clear();
4842    }
4843
4844  public:
4845    explicit ImplicitExceptionSpecification(Sema &Self)
4846      : Self(&Self), ComputedEST(EST_BasicNoexcept) {
4847      if (!Self.getLangOpts().CPlusPlus11)
4848        ComputedEST = EST_DynamicNone;
4849    }
4850
4851    /// Get the computed exception specification type.
4852    ExceptionSpecificationType getExceptionSpecType() const {
4853       (0) . __assert_fail ("!isComputedNoexcept(ComputedEST) && \"noexcept(expr) should not be a possible result\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 4854, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!isComputedNoexcept(ComputedEST) &&
4854 (0) . __assert_fail ("!isComputedNoexcept(ComputedEST) && \"noexcept(expr) should not be a possible result\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 4854, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">             "noexcept(expr) should not be a possible result");
4855      return ComputedEST;
4856    }
4857
4858    /// The number of exceptions in the exception specification.
4859    unsigned size() const { return Exceptions.size(); }
4860
4861    /// The set of exceptions in the exception specification.
4862    const QualType *data() const { return Exceptions.data(); }
4863
4864    /// Integrate another called method into the collected data.
4865    void CalledDecl(SourceLocation CallLocconst CXXMethodDecl *Method);
4866
4867    /// Integrate an invoked expression into the collected data.
4868    void CalledExpr(Expr *E);
4869
4870    /// Overwrite an EPI's exception specification with this
4871    /// computed exception specification.
4872    FunctionProtoType::ExceptionSpecInfo getExceptionSpec() const {
4873      FunctionProtoType::ExceptionSpecInfo ESI;
4874      ESI.Type = getExceptionSpecType();
4875      if (ESI.Type == EST_Dynamic) {
4876        ESI.Exceptions = Exceptions;
4877      } else if (ESI.Type == EST_None) {
4878        /// C++11 [except.spec]p14:
4879        ///   The exception-specification is noexcept(false) if the set of
4880        ///   potential exceptions of the special member function contains "any"
4881        ESI.Type = EST_NoexceptFalse;
4882        ESI.NoexceptExpr = Self->ActOnCXXBoolLiteral(SourceLocation(),
4883                                                     tok::kw_false).get();
4884      }
4885      return ESI;
4886    }
4887  };
4888
4889  /// Determine what sort of exception specification a defaulted
4890  /// copy constructor of a class will have.
4891  ImplicitExceptionSpecification
4892  ComputeDefaultedDefaultCtorExceptionSpec(SourceLocation Loc,
4893                                           CXXMethodDecl *MD);
4894
4895  /// Determine what sort of exception specification a defaulted
4896  /// default constructor of a class will have, and whether the parameter
4897  /// will be const.
4898  ImplicitExceptionSpecification
4899  ComputeDefaultedCopyCtorExceptionSpec(CXXMethodDecl *MD);
4900
4901  /// Determine what sort of exception specification a defaulted
4902  /// copy assignment operator of a class will have, and whether the
4903  /// parameter will be const.
4904  ImplicitExceptionSpecification
4905  ComputeDefaultedCopyAssignmentExceptionSpec(CXXMethodDecl *MD);
4906
4907  /// Determine what sort of exception specification a defaulted move
4908  /// constructor of a class will have.
4909  ImplicitExceptionSpecification
4910  ComputeDefaultedMoveCtorExceptionSpec(CXXMethodDecl *MD);
4911
4912  /// Determine what sort of exception specification a defaulted move
4913  /// assignment operator of a class will have.
4914  ImplicitExceptionSpecification
4915  ComputeDefaultedMoveAssignmentExceptionSpec(CXXMethodDecl *MD);
4916
4917  /// Determine what sort of exception specification a defaulted
4918  /// destructor of a class will have.
4919  ImplicitExceptionSpecification
4920  ComputeDefaultedDtorExceptionSpec(CXXMethodDecl *MD);
4921
4922  /// Determine what sort of exception specification an inheriting
4923  /// constructor of a class will have.
4924  ImplicitExceptionSpecification
4925  ComputeInheritingCtorExceptionSpec(SourceLocation Loc,
4926                                     CXXConstructorDecl *CD);
4927
4928  /// Evaluate the implicit exception specification for a defaulted
4929  /// special member function.
4930  void EvaluateImplicitExceptionSpec(SourceLocation LocCXXMethodDecl *MD);
4931
4932  /// Check the given noexcept-specifier, convert its expression, and compute
4933  /// the appropriate ExceptionSpecificationType.
4934  ExprResult ActOnNoexceptSpec(SourceLocation NoexceptLocExpr *NoexceptExpr,
4935                               ExceptionSpecificationType &EST);
4936
4937  /// Check the given exception-specification and update the
4938  /// exception specification information with the results.
4939  void checkExceptionSpecification(bool IsTopLevel,
4940                                   ExceptionSpecificationType EST,
4941                                   ArrayRef<ParsedTypeDynamicExceptions,
4942                                   ArrayRef<SourceRangeDynamicExceptionRanges,
4943                                   Expr *NoexceptExpr,
4944                                   SmallVectorImpl<QualType> &Exceptions,
4945                                   FunctionProtoType::ExceptionSpecInfo &ESI);
4946
4947  /// Determine if we're in a case where we need to (incorrectly) eagerly
4948  /// parse an exception specification to work around a libstdc++ bug.
4949  bool isLibstdcxxEagerExceptionSpecHack(const Declarator &D);
4950
4951  /// Add an exception-specification to the given member function
4952  /// (or member function template). The exception-specification was parsed
4953  /// after the method itself was declared.
4954  void actOnDelayedExceptionSpecification(Decl *Method,
4955         ExceptionSpecificationType EST,
4956         SourceRange SpecificationRange,
4957         ArrayRef<ParsedTypeDynamicExceptions,
4958         ArrayRef<SourceRangeDynamicExceptionRanges,
4959         Expr *NoexceptExpr);
4960
4961  class InheritedConstructorInfo;
4962
4963  /// Determine if a special member function should have a deleted
4964  /// definition when it is defaulted.
4965  bool ShouldDeleteSpecialMember(CXXMethodDecl *MDCXXSpecialMember CSM,
4966                                 InheritedConstructorInfo *ICI = nullptr,
4967                                 bool Diagnose = false);
4968
4969  /// Declare the implicit default constructor for the given class.
4970  ///
4971  /// \param ClassDecl The class declaration into which the implicit
4972  /// default constructor will be added.
4973  ///
4974  /// \returns The implicitly-declared default constructor.
4975  CXXConstructorDecl *DeclareImplicitDefaultConstructor(
4976                                                     CXXRecordDecl *ClassDecl);
4977
4978  /// DefineImplicitDefaultConstructor - Checks for feasibility of
4979  /// defining this constructor as the default constructor.
4980  void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
4981                                        CXXConstructorDecl *Constructor);
4982
4983  /// Declare the implicit destructor for the given class.
4984  ///
4985  /// \param ClassDecl The class declaration into which the implicit
4986  /// destructor will be added.
4987  ///
4988  /// \returns The implicitly-declared destructor.
4989  CXXDestructorDecl *DeclareImplicitDestructor(CXXRecordDecl *ClassDecl);
4990
4991  /// DefineImplicitDestructor - Checks for feasibility of
4992  /// defining this destructor as the default destructor.
4993  void DefineImplicitDestructor(SourceLocation CurrentLocation,
4994                                CXXDestructorDecl *Destructor);
4995
4996  /// Build an exception spec for destructors that don't have one.
4997  ///
4998  /// C++11 says that user-defined destructors with no exception spec get one
4999  /// that looks as if the destructor was implicitly declared.
5000  void AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor);
5001
5002  /// Define the specified inheriting constructor.
5003  void DefineInheritingConstructor(SourceLocation UseLoc,
5004                                   CXXConstructorDecl *Constructor);
5005
5006  /// Declare the implicit copy constructor for the given class.
5007  ///
5008  /// \param ClassDecl The class declaration into which the implicit
5009  /// copy constructor will be added.
5010  ///
5011  /// \returns The implicitly-declared copy constructor.
5012  CXXConstructorDecl *DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl);
5013
5014  /// DefineImplicitCopyConstructor - Checks for feasibility of
5015  /// defining this constructor as the copy constructor.
5016  void DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
5017                                     CXXConstructorDecl *Constructor);
5018
5019  /// Declare the implicit move constructor for the given class.
5020  ///
5021  /// \param ClassDecl The Class declaration into which the implicit
5022  /// move constructor will be added.
5023  ///
5024  /// \returns The implicitly-declared move constructor, or NULL if it wasn't
5025  /// declared.
5026  CXXConstructorDecl *DeclareImplicitMoveConstructor(CXXRecordDecl *ClassDecl);
5027
5028  /// DefineImplicitMoveConstructor - Checks for feasibility of
5029  /// defining this constructor as the move constructor.
5030  void DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
5031                                     CXXConstructorDecl *Constructor);
5032
5033  /// Declare the implicit copy assignment operator for the given class.
5034  ///
5035  /// \param ClassDecl The class declaration into which the implicit
5036  /// copy assignment operator will be added.
5037  ///
5038  /// \returns The implicitly-declared copy assignment operator.
5039  CXXMethodDecl *DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl);
5040
5041  /// Defines an implicitly-declared copy assignment operator.
5042  void DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
5043                                    CXXMethodDecl *MethodDecl);
5044
5045  /// Declare the implicit move assignment operator for the given class.
5046  ///
5047  /// \param ClassDecl The Class declaration into which the implicit
5048  /// move assignment operator will be added.
5049  ///
5050  /// \returns The implicitly-declared move assignment operator, or NULL if it
5051  /// wasn't declared.
5052  CXXMethodDecl *DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl);
5053
5054  /// Defines an implicitly-declared move assignment operator.
5055  void DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
5056                                    CXXMethodDecl *MethodDecl);
5057
5058  /// Force the declaration of any implicitly-declared members of this
5059  /// class.
5060  void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class);
5061
5062  /// Check a completed declaration of an implicit special member.
5063  void CheckImplicitSpecialMemberDeclaration(Scope *SFunctionDecl *FD);
5064
5065  /// Determine whether the given function is an implicitly-deleted
5066  /// special member function.
5067  bool isImplicitlyDeleted(FunctionDecl *FD);
5068
5069  /// Check whether 'this' shows up in the type of a static member
5070  /// function after the (naturally empty) cv-qualifier-seq would be.
5071  ///
5072  /// \returns true if an error occurred.
5073  bool checkThisInStaticMemberFunctionType(CXXMethodDecl *Method);
5074
5075  /// Whether this' shows up in the exception specification of a static
5076  /// member function.
5077  bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method);
5078
5079  /// Check whether 'this' shows up in the attributes of the given
5080  /// static member function.
5081  ///
5082  /// \returns true if an error occurred.
5083  bool checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method);
5084
5085  /// MaybeBindToTemporary - If the passed in expression has a record type with
5086  /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
5087  /// it simply returns the passed in expression.
5088  ExprResult MaybeBindToTemporary(Expr *E);
5089
5090  bool CompleteConstructorCall(CXXConstructorDecl *Constructor,
5091                               MultiExprArg ArgsPtr,
5092                               SourceLocation Loc,
5093                               SmallVectorImpl<Expr*> &ConvertedArgs,
5094                               bool AllowExplicit = false,
5095                               bool IsListInitialization = false);
5096
5097  ParsedType getInheritingConstructorName(CXXScopeSpec &SS,
5098                                          SourceLocation NameLoc,
5099                                          IdentifierInfo &Name);
5100
5101  ParsedType getConstructorName(IdentifierInfo &IISourceLocation NameLoc,
5102                                Scope *SCXXScopeSpec &SS,
5103                                bool EnteringContext);
5104  ParsedType getDestructorName(SourceLocation TildeLoc,
5105                               IdentifierInfo &IISourceLocation NameLoc,
5106                               Scope *SCXXScopeSpec &SS,
5107                               ParsedType ObjectType,
5108                               bool EnteringContext);
5109
5110  ParsedType getDestructorTypeForDecltype(const DeclSpec &DS,
5111                                          ParsedType ObjectType);
5112
5113  // Checks that reinterpret casts don't have undefined behavior.
5114  void CheckCompatibleReinterpretCast(QualType SrcTypeQualType DestType,
5115                                      bool IsDereferenceSourceRange Range);
5116
5117  /// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
5118  ExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
5119                               tok::TokenKind Kind,
5120                               SourceLocation LAngleBracketLoc,
5121                               Declarator &D,
5122                               SourceLocation RAngleBracketLoc,
5123                               SourceLocation LParenLoc,
5124                               Expr *E,
5125                               SourceLocation RParenLoc);
5126
5127  ExprResult BuildCXXNamedCast(SourceLocation OpLoc,
5128                               tok::TokenKind Kind,
5129                               TypeSourceInfo *Ty,
5130                               Expr *E,
5131                               SourceRange AngleBrackets,
5132                               SourceRange Parens);
5133
5134  ExprResult BuildCXXTypeId(QualType TypeInfoType,
5135                            SourceLocation TypeidLoc,
5136                            TypeSourceInfo *Operand,
5137                            SourceLocation RParenLoc);
5138  ExprResult BuildCXXTypeId(QualType TypeInfoType,
5139                            SourceLocation TypeidLoc,
5140                            Expr *Operand,
5141                            SourceLocation RParenLoc);
5142
5143  /// ActOnCXXTypeid - Parse typeid( something ).
5144  ExprResult ActOnCXXTypeid(SourceLocation OpLoc,
5145                            SourceLocation LParenLocbool isType,
5146                            void *TyOrExpr,
5147                            SourceLocation RParenLoc);
5148
5149  ExprResult BuildCXXUuidof(QualType TypeInfoType,
5150                            SourceLocation TypeidLoc,
5151                            TypeSourceInfo *Operand,
5152                            SourceLocation RParenLoc);
5153  ExprResult BuildCXXUuidof(QualType TypeInfoType,
5154                            SourceLocation TypeidLoc,
5155                            Expr *Operand,
5156                            SourceLocation RParenLoc);
5157
5158  /// ActOnCXXUuidof - Parse __uuidof( something ).
5159  ExprResult ActOnCXXUuidof(SourceLocation OpLoc,
5160                            SourceLocation LParenLocbool isType,
5161                            void *TyOrExpr,
5162                            SourceLocation RParenLoc);
5163
5164  /// Handle a C++1z fold-expression: ( expr op ... op expr ).
5165  ExprResult ActOnCXXFoldExpr(SourceLocation LParenLocExpr *LHS,
5166                              tok::TokenKind Operator,
5167                              SourceLocation EllipsisLocExpr *RHS,
5168                              SourceLocation RParenLoc);
5169  ExprResult BuildCXXFoldExpr(SourceLocation LParenLocExpr *LHS,
5170                              BinaryOperatorKind Operator,
5171                              SourceLocation EllipsisLocExpr *RHS,
5172                              SourceLocation RParenLoc);
5173  ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc,
5174                                   BinaryOperatorKind Operator);
5175
5176  //// ActOnCXXThis -  Parse 'this' pointer.
5177  ExprResult ActOnCXXThis(SourceLocation loc);
5178
5179  /// Try to retrieve the type of the 'this' pointer.
5180  ///
5181  /// \returns The type of 'this', if possible. Otherwise, returns a NULL type.
5182  QualType getCurrentThisType();
5183
5184  /// When non-NULL, the C++ 'this' expression is allowed despite the
5185  /// current context not being a non-static member function. In such cases,
5186  /// this provides the type used for 'this'.
5187  QualType CXXThisTypeOverride;
5188
5189  /// RAII object used to temporarily allow the C++ 'this' expression
5190  /// to be used, with the given qualifiers on the current class type.
5191  class CXXThisScopeRAII {
5192    Sema &S;
5193    QualType OldCXXThisTypeOverride;
5194    bool Enabled;
5195
5196  public:
5197    /// Introduce a new scope where 'this' may be allowed (when enabled),
5198    /// using the given declaration (which is either a class template or a
5199    /// class) along with the given qualifiers.
5200    /// along with the qualifiers placed on '*this'.
5201    CXXThisScopeRAII(Sema &SDecl *ContextDeclQualifiers CXXThisTypeQuals,
5202                     bool Enabled = true);
5203
5204    ~CXXThisScopeRAII();
5205  };
5206
5207  /// Make sure the value of 'this' is actually available in the current
5208  /// context, if it is a potentially evaluated context.
5209  ///
5210  /// \param Loc The location at which the capture of 'this' occurs.
5211  ///
5212  /// \param Explicit Whether 'this' is explicitly captured in a lambda
5213  /// capture list.
5214  ///
5215  /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
5216  /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
5217  /// This is useful when enclosing lambdas must speculatively capture
5218  /// 'this' that may or may not be used in certain specializations of
5219  /// a nested generic lambda (depending on whether the name resolves to
5220  /// a non-static member function or a static function).
5221  /// \return returns 'true' if failed, 'false' if success.
5222  bool CheckCXXThisCapture(SourceLocation Locbool Explicit = false,
5223      bool BuildAndDiagnose = true,
5224      const unsigned *const FunctionScopeIndexToStopAt = nullptr,
5225      bool ByCopy = false);
5226
5227  /// Determine whether the given type is the type of *this that is used
5228  /// outside of the body of a member function for a type that is currently
5229  /// being defined.
5230  bool isThisOutsideMemberFunctionBody(QualType BaseType);
5231
5232  /// ActOnCXXBoolLiteral - Parse {true,false} literals.
5233  ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoctok::TokenKind Kind);
5234
5235
5236  /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
5237  ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoctok::TokenKind Kind);
5238
5239  ExprResult
5240  ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef<AvailabilitySpecAvailSpecs,
5241                                 SourceLocation AtLocSourceLocation RParen);
5242
5243  /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
5244  ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc);
5245
5246  //// ActOnCXXThrow -  Parse throw expressions.
5247  ExprResult ActOnCXXThrow(Scope *SSourceLocation OpLocExpr *expr);
5248  ExprResult BuildCXXThrow(SourceLocation OpLocExpr *Ex,
5249                           bool IsThrownVarInScope);
5250  bool CheckCXXThrowOperand(SourceLocation ThrowLocQualType ThrowTyExpr *E);
5251
5252  /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
5253  /// Can be interpreted either as function-style casting ("int(x)")
5254  /// or class type construction ("ClassType(x,y,z)")
5255  /// or creation of a value-initialized type ("int()").
5256  ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep,
5257                                       SourceLocation LParenOrBraceLoc,
5258                                       MultiExprArg Exprs,
5259                                       SourceLocation RParenOrBraceLoc,
5260                                       bool ListInitialization);
5261
5262  ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type,
5263                                       SourceLocation LParenLoc,
5264                                       MultiExprArg Exprs,
5265                                       SourceLocation RParenLoc,
5266                                       bool ListInitialization);
5267
5268  /// ActOnCXXNew - Parsed a C++ 'new' expression.
5269  ExprResult ActOnCXXNew(SourceLocation StartLocbool UseGlobal,
5270                         SourceLocation PlacementLParen,
5271                         MultiExprArg PlacementArgs,
5272                         SourceLocation PlacementRParen,
5273                         SourceRange TypeIdParensDeclarator &D,
5274                         Expr *Initializer);
5275  ExprResult BuildCXXNew(SourceRange Rangebool UseGlobal,
5276                         SourceLocation PlacementLParen,
5277                         MultiExprArg PlacementArgs,
5278                         SourceLocation PlacementRParen,
5279                         SourceRange TypeIdParens,
5280                         QualType AllocType,
5281                         TypeSourceInfo *AllocTypeInfo,
5282                         Expr *ArraySize,
5283                         SourceRange DirectInitRange,
5284                         Expr *Initializer);
5285
5286  /// Determine whether \p FD is an aligned allocation or deallocation
5287  /// function that is unavailable.
5288  bool isUnavailableAlignedAllocationFunction(const FunctionDecl &FDconst;
5289
5290  /// Produce diagnostics if \p FD is an aligned allocation or deallocation
5291  /// function that is unavailable.
5292  void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD,
5293                                            SourceLocation Loc);
5294
5295  bool CheckAllocatedType(QualType AllocTypeSourceLocation Loc,
5296                          SourceRange R);
5297
5298  /// The scope in which to find allocation functions.
5299  enum AllocationFunctionScope {
5300    /// Only look for allocation functions in the global scope.
5301    AFS_Global,
5302    /// Only look for allocation functions in the scope of the
5303    /// allocated class.
5304    AFS_Class,
5305    /// Look for allocation functions in both the global scope
5306    /// and in the scope of the allocated class.
5307    AFS_Both
5308  };
5309
5310  /// Finds the overloads of operator new and delete that are appropriate
5311  /// for the allocation.
5312  bool FindAllocationFunctions(SourceLocation StartLocSourceRange Range,
5313                               AllocationFunctionScope NewScope,
5314                               AllocationFunctionScope DeleteScope,
5315                               QualType AllocTypebool IsArray,
5316                               bool &PassAlignmentMultiExprArg PlaceArgs,
5317                               FunctionDecl *&OperatorNew,
5318                               FunctionDecl *&OperatorDelete,
5319                               bool Diagnose = true);
5320  void DeclareGlobalNewDelete();
5321  void DeclareGlobalAllocationFunction(DeclarationName NameQualType Return,
5322                                       ArrayRef<QualTypeParams);
5323
5324  bool FindDeallocationFunction(SourceLocation StartLocCXXRecordDecl *RD,
5325                                DeclarationName NameFunctionDecl* &Operator,
5326                                bool Diagnose = true);
5327  FunctionDecl *FindUsualDeallocationFunction(SourceLocation StartLoc,
5328                                              bool CanProvideSize,
5329                                              bool Overaligned,
5330                                              DeclarationName Name);
5331  FunctionDecl *FindDeallocationFunctionForDestructor(SourceLocation StartLoc,
5332                                                      CXXRecordDecl *RD);
5333
5334  /// ActOnCXXDelete - Parsed a C++ 'delete' expression
5335  ExprResult ActOnCXXDelete(SourceLocation StartLoc,
5336                            bool UseGlobalbool ArrayForm,
5337                            Expr *Operand);
5338  void CheckVirtualDtorCall(CXXDestructorDecl *dtorSourceLocation Loc,
5339                            bool IsDeletebool CallCanBeVirtual,
5340                            bool WarnOnNonAbstractTypes,
5341                            SourceLocation DtorLoc);
5342
5343  ExprResult ActOnNoexceptExpr(SourceLocation KeyLocSourceLocation LParen,
5344                               Expr *OperandSourceLocation RParen);
5345  ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLocExpr *Operand,
5346                                  SourceLocation RParen);
5347
5348  /// Parsed one of the type trait support pseudo-functions.
5349  ExprResult ActOnTypeTrait(TypeTrait KindSourceLocation KWLoc,
5350                            ArrayRef<ParsedTypeArgs,
5351                            SourceLocation RParenLoc);
5352  ExprResult BuildTypeTrait(TypeTrait KindSourceLocation KWLoc,
5353                            ArrayRef<TypeSourceInfo *> Args,
5354                            SourceLocation RParenLoc);
5355
5356  /// ActOnArrayTypeTrait - Parsed one of the binary type trait support
5357  /// pseudo-functions.
5358  ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT,
5359                                 SourceLocation KWLoc,
5360                                 ParsedType LhsTy,
5361                                 Expr *DimExpr,
5362                                 SourceLocation RParen);
5363
5364  ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT,
5365                                 SourceLocation KWLoc,
5366                                 TypeSourceInfo *TSInfo,
5367                                 Expr *DimExpr,
5368                                 SourceLocation RParen);
5369
5370  /// ActOnExpressionTrait - Parsed one of the unary type trait support
5371  /// pseudo-functions.
5372  ExprResult ActOnExpressionTrait(ExpressionTrait OET,
5373                                  SourceLocation KWLoc,
5374                                  Expr *Queried,
5375                                  SourceLocation RParen);
5376
5377  ExprResult BuildExpressionTrait(ExpressionTrait OET,
5378                                  SourceLocation KWLoc,
5379                                  Expr *Queried,
5380                                  SourceLocation RParen);
5381
5382  ExprResult ActOnStartCXXMemberReference(Scope *S,
5383                                          Expr *Base,
5384                                          SourceLocation OpLoc,
5385                                          tok::TokenKind OpKind,
5386                                          ParsedType &ObjectType,
5387                                          bool &MayBePseudoDestructor);
5388
5389  ExprResult BuildPseudoDestructorExpr(Expr *Base,
5390                                       SourceLocation OpLoc,
5391                                       tok::TokenKind OpKind,
5392                                       const CXXScopeSpec &SS,
5393                                       TypeSourceInfo *ScopeType,
5394                                       SourceLocation CCLoc,
5395                                       SourceLocation TildeLoc,
5396                                     PseudoDestructorTypeStorage DestroyedType);
5397
5398  ExprResult ActOnPseudoDestructorExpr(Scope *SExpr *Base,
5399                                       SourceLocation OpLoc,
5400                                       tok::TokenKind OpKind,
5401                                       CXXScopeSpec &SS,
5402                                       UnqualifiedId &FirstTypeName,
5403                                       SourceLocation CCLoc,
5404                                       SourceLocation TildeLoc,
5405                                       UnqualifiedId &SecondTypeName);
5406
5407  ExprResult ActOnPseudoDestructorExpr(Scope *SExpr *Base,
5408                                       SourceLocation OpLoc,
5409                                       tok::TokenKind OpKind,
5410                                       SourceLocation TildeLoc,
5411                                       const DeclSpecDS);
5412
5413  /// MaybeCreateExprWithCleanups - If the current full-expression
5414  /// requires any cleanups, surround it with a ExprWithCleanups node.
5415  /// Otherwise, just returns the passed-in expression.
5416  Expr *MaybeCreateExprWithCleanups(Expr *SubExpr);
5417  Stmt *MaybeCreateStmtWithCleanups(Stmt *SubStmt);
5418  ExprResult MaybeCreateExprWithCleanups(ExprResult SubExpr);
5419
5420  MaterializeTemporaryExpr *
5421  CreateMaterializeTemporaryExpr(QualType TExpr *Temporary,
5422                                 bool BoundToLvalueReference);
5423
5424  ExprResult ActOnFinishFullExpr(Expr *Exprbool DiscardedValue) {
5425    return ActOnFinishFullExpr(
5426        ExprExpr ? Expr->getExprLoc() : SourceLocation(), DiscardedValue);
5427  }
5428  ExprResult ActOnFinishFullExpr(Expr *ExprSourceLocation CC,
5429                                 bool DiscardedValuebool IsConstexpr = false);
5430  StmtResult ActOnFinishFullStmt(Stmt *Stmt);
5431
5432  // Marks SS invalid if it represents an incomplete type.
5433  bool RequireCompleteDeclContext(CXXScopeSpec &SSDeclContext *DC);
5434
5435  DeclContext *computeDeclContext(QualType T);
5436  DeclContext *computeDeclContext(const CXXScopeSpec &SS,
5437                                  bool EnteringContext = false);
5438  bool isDependentScopeSpecifier(const CXXScopeSpec &SS);
5439  CXXRecordDecl *getCurrentInstantiationOf(NestedNameSpecifier *NNS);
5440
5441  /// The parser has parsed a global nested-name-specifier '::'.
5442  ///
5443  /// \param CCLoc The location of the '::'.
5444  ///
5445  /// \param SS The nested-name-specifier, which will be updated in-place
5446  /// to reflect the parsed nested-name-specifier.
5447  ///
5448  /// \returns true if an error occurred, false otherwise.
5449  bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLocCXXScopeSpec &SS);
5450
5451  /// The parser has parsed a '__super' nested-name-specifier.
5452  ///
5453  /// \param SuperLoc The location of the '__super' keyword.
5454  ///
5455  /// \param ColonColonLoc The location of the '::'.
5456  ///
5457  /// \param SS The nested-name-specifier, which will be updated in-place
5458  /// to reflect the parsed nested-name-specifier.
5459  ///
5460  /// \returns true if an error occurred, false otherwise.
5461  bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc,
5462                                SourceLocation ColonColonLocCXXScopeSpec &SS);
5463
5464  bool isAcceptableNestedNameSpecifier(const NamedDecl *SD,
5465                                       bool *CanCorrect = nullptr);
5466  NamedDecl *FindFirstQualifierInScope(Scope *SNestedNameSpecifier *NNS);
5467
5468  /// Keeps information about an identifier in a nested-name-spec.
5469  ///
5470  struct NestedNameSpecInfo {
5471    /// The type of the object, if we're parsing nested-name-specifier in
5472    /// a member access expression.
5473    ParsedType ObjectType;
5474
5475    /// The identifier preceding the '::'.
5476    IdentifierInfo *Identifier;
5477
5478    /// The location of the identifier.
5479    SourceLocation IdentifierLoc;
5480
5481    /// The location of the '::'.
5482    SourceLocation CCLoc;
5483
5484    /// Creates info object for the most typical case.
5485    NestedNameSpecInfo(IdentifierInfo *IISourceLocation IdLoc,
5486             SourceLocation ColonColonLocParsedType ObjectType = ParsedType())
5487      : ObjectType(ObjectType), Identifier(II), IdentifierLoc(IdLoc),
5488        CCLoc(ColonColonLoc) {
5489    }
5490
5491    NestedNameSpecInfo(IdentifierInfo *IISourceLocation IdLoc,
5492                       SourceLocation ColonColonLocQualType ObjectType)
5493      : ObjectType(ParsedType::make(ObjectType)), Identifier(II),
5494        IdentifierLoc(IdLoc), CCLoc(ColonColonLoc) {
5495    }
5496  };
5497
5498  bool isNonTypeNestedNameSpecifier(Scope *SCXXScopeSpec &SS,
5499                                    NestedNameSpecInfo &IdInfo);
5500
5501  bool BuildCXXNestedNameSpecifier(Scope *S,
5502                                   NestedNameSpecInfo &IdInfo,
5503                                   bool EnteringContext,
5504                                   CXXScopeSpec &SS,
5505                                   NamedDecl *ScopeLookupResult,
5506                                   bool ErrorRecoveryLookup,
5507                                   bool *IsCorrectedToColon = nullptr,
5508                                   bool OnlyNamespace = false);
5509
5510  /// The parser has parsed a nested-name-specifier 'identifier::'.
5511  ///
5512  /// \param S The scope in which this nested-name-specifier occurs.
5513  ///
5514  /// \param IdInfo Parser information about an identifier in the
5515  /// nested-name-spec.
5516  ///
5517  /// \param EnteringContext Whether we're entering the context nominated by
5518  /// this nested-name-specifier.
5519  ///
5520  /// \param SS The nested-name-specifier, which is both an input
5521  /// parameter (the nested-name-specifier before this type) and an
5522  /// output parameter (containing the full nested-name-specifier,
5523  /// including this new type).
5524  ///
5525  /// \param ErrorRecoveryLookup If true, then this method is called to improve
5526  /// error recovery. In this case do not emit error message.
5527  ///
5528  /// \param IsCorrectedToColon If not null, suggestions to replace '::' -> ':'
5529  /// are allowed.  The bool value pointed by this parameter is set to 'true'
5530  /// if the identifier is treated as if it was followed by ':', not '::'.
5531  ///
5532  /// \param OnlyNamespace If true, only considers namespaces in lookup.
5533  ///
5534  /// \returns true if an error occurred, false otherwise.
5535  bool ActOnCXXNestedNameSpecifier(Scope *S,
5536                                   NestedNameSpecInfo &IdInfo,
5537                                   bool EnteringContext,
5538                                   CXXScopeSpec &SS,
5539                                   bool ErrorRecoveryLookup = false,
5540                                   bool *IsCorrectedToColon = nullptr,
5541                                   bool OnlyNamespace = false);
5542
5543  ExprResult ActOnDecltypeExpression(Expr *E);
5544
5545  bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS,
5546                                           const DeclSpec &DS,
5547                                           SourceLocation ColonColonLoc);
5548
5549  bool IsInvalidUnlessNestedName(Scope *SCXXScopeSpec &SS,
5550                                 NestedNameSpecInfo &IdInfo,
5551                                 bool EnteringContext);
5552
5553  /// The parser has parsed a nested-name-specifier
5554  /// 'template[opt] template-name < template-args >::'.
5555  ///
5556  /// \param S The scope in which this nested-name-specifier occurs.
5557  ///
5558  /// \param SS The nested-name-specifier, which is both an input
5559  /// parameter (the nested-name-specifier before this type) and an
5560  /// output parameter (containing the full nested-name-specifier,
5561  /// including this new type).
5562  ///
5563  /// \param TemplateKWLoc the location of the 'template' keyword, if any.
5564  /// \param TemplateName the template name.
5565  /// \param TemplateNameLoc The location of the template name.
5566  /// \param LAngleLoc The location of the opening angle bracket  ('<').
5567  /// \param TemplateArgs The template arguments.
5568  /// \param RAngleLoc The location of the closing angle bracket  ('>').
5569  /// \param CCLoc The location of the '::'.
5570  ///
5571  /// \param EnteringContext Whether we're entering the context of the
5572  /// nested-name-specifier.
5573  ///
5574  ///
5575  /// \returns true if an error occurred, false otherwise.
5576  bool ActOnCXXNestedNameSpecifier(Scope *S,
5577                                   CXXScopeSpec &SS,
5578                                   SourceLocation TemplateKWLoc,
5579                                   TemplateTy TemplateName,
5580                                   SourceLocation TemplateNameLoc,
5581                                   SourceLocation LAngleLoc,
5582                                   ASTTemplateArgsPtr TemplateArgs,
5583                                   SourceLocation RAngleLoc,
5584                                   SourceLocation CCLoc,
5585                                   bool EnteringContext);
5586
5587  /// Given a C++ nested-name-specifier, produce an annotation value
5588  /// that the parser can use later to reconstruct the given
5589  /// nested-name-specifier.
5590  ///
5591  /// \param SS A nested-name-specifier.
5592  ///
5593  /// \returns A pointer containing all of the information in the
5594  /// nested-name-specifier \p SS.
5595  void *SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS);
5596
5597  /// Given an annotation pointer for a nested-name-specifier, restore
5598  /// the nested-name-specifier structure.
5599  ///
5600  /// \param Annotation The annotation pointer, produced by
5601  /// \c SaveNestedNameSpecifierAnnotation().
5602  ///
5603  /// \param AnnotationRange The source range corresponding to the annotation.
5604  ///
5605  /// \param SS The nested-name-specifier that will be updated with the contents
5606  /// of the annotation pointer.
5607  void RestoreNestedNameSpecifierAnnotation(void *Annotation,
5608                                            SourceRange AnnotationRange,
5609                                            CXXScopeSpec &SS);
5610
5611  bool ShouldEnterDeclaratorScope(Scope *Sconst CXXScopeSpec &SS);
5612
5613  /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
5614  /// scope or nested-name-specifier) is parsed, part of a declarator-id.
5615  /// After this method is called, according to [C++ 3.4.3p3], names should be
5616  /// looked up in the declarator-id's scope, until the declarator is parsed and
5617  /// ActOnCXXExitDeclaratorScope is called.
5618  /// The 'SS' should be a non-empty valid CXXScopeSpec.
5619  bool ActOnCXXEnterDeclaratorScope(Scope *SCXXScopeSpec &SS);
5620
5621  /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
5622  /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
5623  /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
5624  /// Used to indicate that names should revert to being looked up in the
5625  /// defining scope.
5626  void ActOnCXXExitDeclaratorScope(Scope *Sconst CXXScopeSpec &SS);
5627
5628  /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
5629  /// initializer for the declaration 'Dcl'.
5630  /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
5631  /// static data member of class X, names should be looked up in the scope of
5632  /// class X.
5633  void ActOnCXXEnterDeclInitializer(Scope *SDecl *Dcl);
5634
5635  /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
5636  /// initializer for the declaration 'Dcl'.
5637  void ActOnCXXExitDeclInitializer(Scope *SDecl *Dcl);
5638
5639  /// Create a new lambda closure type.
5640  CXXRecordDecl *createLambdaClosureType(SourceRange IntroducerRange,
5641                                         TypeSourceInfo *Info,
5642                                         bool KnownDependent,
5643                                         LambdaCaptureDefault CaptureDefault);
5644
5645  /// Start the definition of a lambda expression.
5646  CXXMethodDecl *startLambdaDefinition(CXXRecordDecl *Class,
5647                                       SourceRange IntroducerRange,
5648                                       TypeSourceInfo *MethodType,
5649                                       SourceLocation EndLoc,
5650                                       ArrayRef<ParmVarDecl *> Params,
5651                                       bool IsConstexprSpecified);
5652
5653  /// Endow the lambda scope info with the relevant properties.
5654  void buildLambdaScope(sema::LambdaScopeInfo *LSI,
5655                        CXXMethodDecl *CallOperator,
5656                        SourceRange IntroducerRange,
5657                        LambdaCaptureDefault CaptureDefault,
5658                        SourceLocation CaptureDefaultLoc,
5659                        bool ExplicitParams,
5660                        bool ExplicitResultType,
5661                        bool Mutable);
5662
5663  /// Perform initialization analysis of the init-capture and perform
5664  /// any implicit conversions such as an lvalue-to-rvalue conversion if
5665  /// not being used to initialize a reference.
5666  ParsedType actOnLambdaInitCaptureInitialization(
5667      SourceLocation Locbool ByRefIdentifierInfo *Id,
5668      LambdaCaptureInitKind InitKindExpr *&Init) {
5669    return ParsedType::make(buildLambdaInitCaptureInitialization(
5670        LocByRefIdInitKind != LambdaCaptureInitKind::CopyInitInit));
5671  }
5672  QualType buildLambdaInitCaptureInitialization(SourceLocation Locbool ByRef,
5673                                                IdentifierInfo *Id,
5674                                                bool DirectInitExpr *&Init);
5675
5676  /// Create a dummy variable within the declcontext of the lambda's
5677  ///  call operator, for name lookup purposes for a lambda init capture.
5678  ///
5679  ///  CodeGen handles emission of lambda captures, ignoring these dummy
5680  ///  variables appropriately.
5681  VarDecl *createLambdaInitCaptureVarDecl(SourceLocation Loc,
5682                                          QualType InitCaptureType,
5683                                          IdentifierInfo *Id,
5684                                          unsigned InitStyleExpr *Init);
5685
5686  /// Build the implicit field for an init-capture.
5687  FieldDecl *buildInitCaptureField(sema::LambdaScopeInfo *LSIVarDecl *Var);
5688
5689  /// Note that we have finished the explicit captures for the
5690  /// given lambda.
5691  void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI);
5692
5693  /// Introduce the lambda parameters into scope.
5694  void addLambdaParameters(
5695      ArrayRef<LambdaIntroducer::LambdaCaptureCaptures,
5696      CXXMethodDecl *CallOperatorScope *CurScope);
5697
5698  /// Deduce a block or lambda's return type based on the return
5699  /// statements present in the body.
5700  void deduceClosureReturnType(sema::CapturingScopeInfo &CSI);
5701
5702  /// ActOnStartOfLambdaDefinition - This is called just before we start
5703  /// parsing the body of a lambda; it analyzes the explicit captures and
5704  /// arguments, and sets up various data-structures for the body of the
5705  /// lambda.
5706  void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
5707                                    Declarator &ParamInfoScope *CurScope);
5708
5709  /// ActOnLambdaError - If there is an error parsing a lambda, this callback
5710  /// is invoked to pop the information about the lambda.
5711  void ActOnLambdaError(SourceLocation StartLocScope *CurScope,
5712                        bool IsInstantiation = false);
5713
5714  /// ActOnLambdaExpr - This is called when the body of a lambda expression
5715  /// was successfully completed.
5716  ExprResult ActOnLambdaExpr(SourceLocation StartLocStmt *Body,
5717                             Scope *CurScope);
5718
5719  /// Does copying/destroying the captured variable have side effects?
5720  bool CaptureHasSideEffects(const sema::Capture &From);
5721
5722  /// Diagnose if an explicit lambda capture is unused. Returns true if a
5723  /// diagnostic is emitted.
5724  bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange,
5725                                   const sema::Capture &From);
5726
5727  /// Complete a lambda-expression having processed and attached the
5728  /// lambda body.
5729  ExprResult BuildLambdaExpr(SourceLocation StartLocSourceLocation EndLoc,
5730                             sema::LambdaScopeInfo *LSI);
5731
5732  /// Get the return type to use for a lambda's conversion function(s) to
5733  /// function pointer type, given the type of the call operator.
5734  QualType
5735  getLambdaConversionFunctionResultType(const FunctionProtoType *CallOpType);
5736
5737  /// Define the "body" of the conversion from a lambda object to a
5738  /// function pointer.
5739  ///
5740  /// This routine doesn't actually define a sensible body; rather, it fills
5741  /// in the initialization expression needed to copy the lambda object into
5742  /// the block, and IR generation actually generates the real body of the
5743  /// block pointer conversion.
5744  void DefineImplicitLambdaToFunctionPointerConversion(
5745         SourceLocation CurrentLocCXXConversionDecl *Conv);
5746
5747  /// Define the "body" of the conversion from a lambda object to a
5748  /// block pointer.
5749  ///
5750  /// This routine doesn't actually define a sensible body; rather, it fills
5751  /// in the initialization expression needed to copy the lambda object into
5752  /// the block, and IR generation actually generates the real body of the
5753  /// block pointer conversion.
5754  void DefineImplicitLambdaToBlockPointerConversion(SourceLocation CurrentLoc,
5755                                                    CXXConversionDecl *Conv);
5756
5757  ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation,
5758                                           SourceLocation ConvLocation,
5759                                           CXXConversionDecl *Conv,
5760                                           Expr *Src);
5761
5762  // ParseObjCStringLiteral - Parse Objective-C string literals.
5763  ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
5764                                    ArrayRef<Expr *> Strings);
5765
5766  ExprResult BuildObjCStringLiteral(SourceLocation AtLocStringLiteral *S);
5767
5768  /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
5769  /// numeric literal expression. Type of the expression will be "NSNumber *"
5770  /// or "id" if NSNumber is unavailable.
5771  ExprResult BuildObjCNumericLiteral(SourceLocation AtLocExpr *Number);
5772  ExprResult ActOnObjCBoolLiteral(SourceLocation AtLocSourceLocation ValueLoc,
5773                                  bool Value);
5774  ExprResult BuildObjCArrayLiteral(SourceRange SRMultiExprArg Elements);
5775
5776  /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
5777  /// '@' prefixed parenthesized expression. The type of the expression will
5778  /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
5779  /// of ValueType, which is allowed to be a built-in numeric type, "char *",
5780  /// "const char *" or C structure with attribute 'objc_boxable'.
5781  ExprResult BuildObjCBoxedExpr(SourceRange SRExpr *ValueExpr);
5782
5783  ExprResult BuildObjCSubscriptExpression(SourceLocation RBExpr *BaseExpr,
5784                                          Expr *IndexExpr,
5785                                          ObjCMethodDecl *getterMethod,
5786                                          ObjCMethodDecl *setterMethod);
5787
5788  ExprResult BuildObjCDictionaryLiteral(SourceRange SR,
5789                               MutableArrayRef<ObjCDictionaryElementElements);
5790
5791  ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc,
5792                                  TypeSourceInfo *EncodedTypeInfo,
5793                                  SourceLocation RParenLoc);
5794  ExprResult BuildCXXMemberCallExpr(Expr *ExpNamedDecl *FoundDecl,
5795                                    CXXConversionDecl *Method,
5796                                    bool HadMultipleCandidates);
5797
5798  ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc,
5799                                       SourceLocation EncodeLoc,
5800                                       SourceLocation LParenLoc,
5801                                       ParsedType Ty,
5802                                       SourceLocation RParenLoc);
5803
5804  /// ParseObjCSelectorExpression - Build selector expression for \@selector
5805  ExprResult ParseObjCSelectorExpression(Selector Sel,
5806                                         SourceLocation AtLoc,
5807                                         SourceLocation SelLoc,
5808                                         SourceLocation LParenLoc,
5809                                         SourceLocation RParenLoc,
5810                                         bool WarnMultipleSelectors);
5811
5812  /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
5813  ExprResult ParseObjCProtocolExpression(IdentifierInfo * ProtocolName,
5814                                         SourceLocation AtLoc,
5815                                         SourceLocation ProtoLoc,
5816                                         SourceLocation LParenLoc,
5817                                         SourceLocation ProtoIdLoc,
5818                                         SourceLocation RParenLoc);
5819
5820  //===--------------------------------------------------------------------===//
5821  // C++ Declarations
5822  //
5823  Decl *ActOnStartLinkageSpecification(Scope *S,
5824                                       SourceLocation ExternLoc,
5825                                       Expr *LangStr,
5826                                       SourceLocation LBraceLoc);
5827  Decl *ActOnFinishLinkageSpecification(Scope *S,
5828                                        Decl *LinkageSpec,
5829                                        SourceLocation RBraceLoc);
5830
5831
5832  //===--------------------------------------------------------------------===//
5833  // C++ Classes
5834  //
5835  CXXRecordDecl *getCurrentClass(Scope *Sconst CXXScopeSpec *SS);
5836  bool isCurrentClassName(const IdentifierInfo &IIScope *S,
5837                          const CXXScopeSpec *SS = nullptr);
5838  bool isCurrentClassNameTypo(IdentifierInfo *&IIconst CXXScopeSpec *SS);
5839
5840  bool ActOnAccessSpecifier(AccessSpecifier AccessSourceLocation ASLoc,
5841                            SourceLocation ColonLoc,
5842                            const ParsedAttributesView &Attrs);
5843
5844  NamedDecl *ActOnCXXMemberDeclarator(Scope *SAccessSpecifier AS,
5845                                 Declarator &D,
5846                                 MultiTemplateParamsArg TemplateParameterLists,
5847                                 Expr *BitfieldWidthconst VirtSpecifiers &VS,
5848                                 InClassInitStyle InitStyle);
5849
5850  void ActOnStartCXXInClassMemberInitializer();
5851  void ActOnFinishCXXInClassMemberInitializer(Decl *VarDecl,
5852                                              SourceLocation EqualLoc,
5853                                              Expr *Init);
5854
5855  MemInitResult ActOnMemInitializer(Decl *ConstructorD,
5856                                    Scope *S,
5857                                    CXXScopeSpec &SS,
5858                                    IdentifierInfo *MemberOrBase,
5859                                    ParsedType TemplateTypeTy,
5860                                    const DeclSpec &DS,
5861                                    SourceLocation IdLoc,
5862                                    SourceLocation LParenLoc,
5863                                    ArrayRef<Expr *> Args,
5864                                    SourceLocation RParenLoc,
5865                                    SourceLocation EllipsisLoc);
5866
5867  MemInitResult ActOnMemInitializer(Decl *ConstructorD,
5868                                    Scope *S,
5869                                    CXXScopeSpec &SS,
5870                                    IdentifierInfo *MemberOrBase,
5871                                    ParsedType TemplateTypeTy,
5872                                    const DeclSpec &DS,
5873                                    SourceLocation IdLoc,
5874                                    Expr *InitList,
5875                                    SourceLocation EllipsisLoc);
5876
5877  MemInitResult BuildMemInitializer(Decl *ConstructorD,
5878                                    Scope *S,
5879                                    CXXScopeSpec &SS,
5880                                    IdentifierInfo *MemberOrBase,
5881                                    ParsedType TemplateTypeTy,
5882                                    const DeclSpec &DS,
5883                                    SourceLocation IdLoc,
5884                                    Expr *Init,
5885                                    SourceLocation EllipsisLoc);
5886
5887  MemInitResult BuildMemberInitializer(ValueDecl *Member,
5888                                       Expr *Init,
5889                                       SourceLocation IdLoc);
5890
5891  MemInitResult BuildBaseInitializer(QualType BaseType,
5892                                     TypeSourceInfo *BaseTInfo,
5893                                     Expr *Init,
5894                                     CXXRecordDecl *ClassDecl,
5895                                     SourceLocation EllipsisLoc);
5896
5897  MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo,
5898                                           Expr *Init,
5899                                           CXXRecordDecl *ClassDecl);
5900
5901  bool SetDelegatingInitializer(CXXConstructorDecl *Constructor,
5902                                CXXCtorInitializer *Initializer);
5903
5904  bool SetCtorInitializers(CXXConstructorDecl *Constructorbool AnyErrors,
5905                           ArrayRef<CXXCtorInitializer *> Initializers = None);
5906
5907  void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
5908
5909
5910  /// MarkBaseAndMemberDestructorsReferenced - Given a record decl,
5911  /// mark all the non-trivial destructors of its members and bases as
5912  /// referenced.
5913  void MarkBaseAndMemberDestructorsReferenced(SourceLocation Loc,
5914                                              CXXRecordDecl *Record);
5915
5916  /// The list of classes whose vtables have been used within
5917  /// this translation unit, and the source locations at which the
5918  /// first use occurred.
5919  typedef std::pair<CXXRecordDecl*, SourceLocationVTableUse;
5920
5921  /// The list of vtables that are required but have not yet been
5922  /// materialized.
5923  SmallVector<VTableUse16VTableUses;
5924
5925  /// The set of classes whose vtables have been used within
5926  /// this translation unit, and a bit that will be true if the vtable is
5927  /// required to be emitted (otherwise, it should be emitted only if needed
5928  /// by code generation).
5929  llvm::DenseMap<CXXRecordDecl *, boolVTablesUsed;
5930
5931  /// Load any externally-stored vtable uses.
5932  void LoadExternalVTableUses();
5933
5934  /// Note that the vtable for the given class was used at the
5935  /// given location.
5936  void MarkVTableUsed(SourceLocation LocCXXRecordDecl *Class,
5937                      bool DefinitionRequired = false);
5938
5939  /// Mark the exception specifications of all virtual member functions
5940  /// in the given class as needed.
5941  void MarkVirtualMemberExceptionSpecsNeeded(SourceLocation Loc,
5942                                             const CXXRecordDecl *RD);
5943
5944  /// MarkVirtualMembersReferenced - Will mark all members of the given
5945  /// CXXRecordDecl referenced.
5946  void MarkVirtualMembersReferenced(SourceLocation Loc,
5947                                    const CXXRecordDecl *RD);
5948
5949  /// Define all of the vtables that have been used in this
5950  /// translation unit and reference any virtual members used by those
5951  /// vtables.
5952  ///
5953  /// \returns true if any work was done, false otherwise.
5954  bool DefineUsedVTables();
5955
5956  void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl);
5957
5958  void ActOnMemInitializers(Decl *ConstructorDecl,
5959                            SourceLocation ColonLoc,
5960                            ArrayRef<CXXCtorInitializer*> MemInits,
5961                            bool AnyErrors);
5962
5963  /// Check class-level dllimport/dllexport attribute. The caller must
5964  /// ensure that referenceDLLExportedClassMethods is called some point later
5965  /// when all outer classes of Class are complete.
5966  void checkClassLevelDLLAttribute(CXXRecordDecl *Class);
5967  void checkClassLevelCodeSegAttribute(CXXRecordDecl *Class);
5968
5969  void referenceDLLExportedClassMethods();
5970
5971  void propagateDLLAttrToBaseClassTemplate(
5972      CXXRecordDecl *ClassAttr *ClassAttr,
5973      ClassTemplateSpecializationDecl *BaseTemplateSpec,
5974      SourceLocation BaseLoc);
5975
5976  void CheckCompletedCXXClass(CXXRecordDecl *Record);
5977
5978  /// Check that the C++ class annoated with "trivial_abi" satisfies all the
5979  /// conditions that are needed for the attribute to have an effect.
5980  void checkIllFormedTrivialABIStruct(CXXRecordDecl &RD);
5981
5982  void ActOnFinishCXXMemberSpecification(Scope *SSourceLocation RLoc,
5983                                         Decl *TagDeclSourceLocation LBrac,
5984                                         SourceLocation RBrac,
5985                                         const ParsedAttributesView &AttrList);
5986  void ActOnFinishCXXMemberDecls();
5987  void ActOnFinishCXXNonNestedClass(Decl *D);
5988
5989  void ActOnReenterCXXMethodParameter(Scope *SParmVarDecl *Param);
5990  unsigned ActOnReenterTemplateScope(Scope *SDecl *Template);
5991  void ActOnStartDelayedMemberDeclarations(Scope *SDecl *Record);
5992  void ActOnStartDelayedCXXMethodDeclaration(Scope *SDecl *Method);
5993  void ActOnDelayedCXXMethodParameter(Scope *SDecl *Param);
5994  void ActOnFinishDelayedMemberDeclarations(Scope *SDecl *Record);
5995  void ActOnFinishDelayedCXXMethodDeclaration(Scope *SDecl *Method);
5996  void ActOnFinishDelayedMemberInitializers(Decl *Record);
5997  void MarkAsLateParsedTemplate(FunctionDecl *FDDecl *FnD,
5998                                CachedTokens &Toks);
5999  void UnmarkAsLateParsedTemplate(FunctionDecl *FD);
6000  bool IsInsideALocalClassWithinATemplateFunction();
6001
6002  Decl *ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc,
6003                                     Expr *AssertExpr,
6004                                     Expr *AssertMessageExpr,
6005                                     SourceLocation RParenLoc);
6006  Decl *BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc,
6007                                     Expr *AssertExpr,
6008                                     StringLiteral *AssertMessageExpr,
6009                                     SourceLocation RParenLoc,
6010                                     bool Failed);
6011
6012  FriendDecl *CheckFriendTypeDecl(SourceLocation LocStart,
6013                                  SourceLocation FriendLoc,
6014                                  TypeSourceInfo *TSInfo);
6015  Decl *ActOnFriendTypeDecl(Scope *Sconst DeclSpec &DS,
6016                            MultiTemplateParamsArg TemplateParams);
6017  NamedDecl *ActOnFriendFunctionDecl(Scope *SDeclarator &D,
6018                                     MultiTemplateParamsArg TemplateParams);
6019
6020  QualType CheckConstructorDeclarator(Declarator &DQualType R,
6021                                      StorageClassSC);
6022  void CheckConstructor(CXXConstructorDecl *Constructor);
6023  QualType CheckDestructorDeclarator(Declarator &DQualType R,
6024                                     StorageClassSC);
6025  bool CheckDestructor(CXXDestructorDecl *Destructor);
6026  void CheckConversionDeclarator(Declarator &DQualType &R,
6027                                 StorageClassSC);
6028  Decl *ActOnConversionDeclarator(CXXConversionDecl *Conversion);
6029  void CheckDeductionGuideDeclarator(Declarator &DQualType &R,
6030                                     StorageClass &SC);
6031  void CheckDeductionGuideTemplate(FunctionTemplateDecl *TD);
6032
6033  void CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD);
6034  void CheckExplicitlyDefaultedMemberExceptionSpec(CXXMethodDecl *MD,
6035                                                   const FunctionProtoType *T);
6036  void CheckDelayedMemberExceptionSpecs();
6037
6038  //===--------------------------------------------------------------------===//
6039  // C++ Derived Classes
6040  //
6041
6042  /// ActOnBaseSpecifier - Parsed a base specifier
6043  CXXBaseSpecifier *CheckBaseSpecifier(CXXRecordDecl *Class,
6044                                       SourceRange SpecifierRange,
6045                                       bool VirtualAccessSpecifier Access,
6046                                       TypeSourceInfo *TInfo,
6047                                       SourceLocation EllipsisLoc);
6048
6049  BaseResult ActOnBaseSpecifier(Decl *classdecl,
6050                                SourceRange SpecifierRange,
6051                                ParsedAttributes &Attrs,
6052                                bool VirtualAccessSpecifier Access,
6053                                ParsedType basetype,
6054                                SourceLocation BaseLoc,
6055                                SourceLocation EllipsisLoc);
6056
6057  bool AttachBaseSpecifiers(CXXRecordDecl *Class,
6058                            MutableArrayRef<CXXBaseSpecifier *> Bases);
6059  void ActOnBaseSpecifiers(Decl *ClassDecl,
6060                           MutableArrayRef<CXXBaseSpecifier *> Bases);
6061
6062  bool IsDerivedFrom(SourceLocation LocQualType DerivedQualType Base);
6063  bool IsDerivedFrom(SourceLocation LocQualType DerivedQualType Base,
6064                     CXXBasePaths &Paths);
6065
6066  // FIXME: I don't like this name.
6067  void BuildBasePathArray(const CXXBasePaths &PathsCXXCastPath &BasePath);
6068
6069  bool CheckDerivedToBaseConversion(QualType DerivedQualType Base,
6070                                    SourceLocation LocSourceRange Range,
6071                                    CXXCastPath *BasePath = nullptr,
6072                                    bool IgnoreAccess = false);
6073  bool CheckDerivedToBaseConversion(QualType DerivedQualType Base,
6074                                    unsigned InaccessibleBaseID,
6075                                    unsigned AmbigiousBaseConvID,
6076                                    SourceLocation LocSourceRange Range,
6077                                    DeclarationName Name,
6078                                    CXXCastPath *BasePath,
6079                                    bool IgnoreAccess = false);
6080
6081  std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths);
6082
6083  bool CheckOverridingFunctionAttributes(const CXXMethodDecl *New,
6084                                         const CXXMethodDecl *Old);
6085
6086  /// CheckOverridingFunctionReturnType - Checks whether the return types are
6087  /// covariant, according to C++ [class.virtual]p5.
6088  bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New,
6089                                         const CXXMethodDecl *Old);
6090
6091  /// CheckOverridingFunctionExceptionSpec - Checks whether the exception
6092  /// spec is a subset of base spec.
6093  bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New,
6094                                            const CXXMethodDecl *Old);
6095
6096  bool CheckPureMethod(CXXMethodDecl *MethodSourceRange InitRange);
6097
6098  /// CheckOverrideControl - Check C++11 override control semantics.
6099  void CheckOverrideControl(NamedDecl *D);
6100
6101  /// DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was
6102  /// not used in the declaration of an overriding method.
6103  void DiagnoseAbsenceOfOverrideControl(NamedDecl *D);
6104
6105  /// CheckForFunctionMarkedFinal - Checks whether a virtual member function
6106  /// overrides a virtual member function marked 'final', according to
6107  /// C++11 [class.virtual]p4.
6108  bool CheckIfOverriddenFunctionIsMarkedFinal(const CXXMethodDecl *New,
6109                                              const CXXMethodDecl *Old);
6110
6111
6112  //===--------------------------------------------------------------------===//
6113  // C++ Access Control
6114  //
6115
6116  enum AccessResult {
6117    AR_accessible,
6118    AR_inaccessible,
6119    AR_dependent,
6120    AR_delayed
6121  };
6122
6123  bool SetMemberAccessSpecifier(NamedDecl *MemberDecl,
6124                                NamedDecl *PrevMemberDecl,
6125                                AccessSpecifier LexicalAS);
6126
6127  AccessResult CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E,
6128                                           DeclAccessPair FoundDecl);
6129  AccessResult CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E,
6130                                           DeclAccessPair FoundDecl);
6131  AccessResult CheckAllocationAccess(SourceLocation OperatorLoc,
6132                                     SourceRange PlacementRange,
6133                                     CXXRecordDecl *NamingClass,
6134                                     DeclAccessPair FoundDecl,
6135                                     bool Diagnose = true);
6136  AccessResult CheckConstructorAccess(SourceLocation Loc,
6137                                      CXXConstructorDecl *D,
6138                                      DeclAccessPair FoundDecl,
6139                                      const InitializedEntity &Entity,
6140                                      bool IsCopyBindingRefToTemp = false);
6141  AccessResult CheckConstructorAccess(SourceLocation Loc,
6142                                      CXXConstructorDecl *D,
6143                                      DeclAccessPair FoundDecl,
6144                                      const InitializedEntity &Entity,
6145                                      const PartialDiagnostic &PDiag);
6146  AccessResult CheckDestructorAccess(SourceLocation Loc,
6147                                     CXXDestructorDecl *Dtor,
6148                                     const PartialDiagnostic &PDiag,
6149                                     QualType objectType = QualType());
6150  AccessResult CheckFriendAccess(NamedDecl *D);
6151  AccessResult CheckMemberAccess(SourceLocation UseLoc,
6152                                 CXXRecordDecl *NamingClass,
6153                                 DeclAccessPair Found);
6154  AccessResult
6155  CheckStructuredBindingMemberAccess(SourceLocation UseLoc,
6156                                     CXXRecordDecl *DecomposedClass,
6157                                     DeclAccessPair Field);
6158  AccessResult CheckMemberOperatorAccess(SourceLocation Loc,
6159                                         Expr *ObjectExpr,
6160                                         Expr *ArgExpr,
6161                                         DeclAccessPair FoundDecl);
6162  AccessResult CheckAddressOfMemberAccess(Expr *OvlExpr,
6163                                          DeclAccessPair FoundDecl);
6164  AccessResult CheckBaseClassAccess(SourceLocation AccessLoc,
6165                                    QualType BaseQualType Derived,
6166                                    const CXXBasePath &Path,
6167                                    unsigned DiagID,
6168                                    bool ForceCheck = false,
6169                                    bool ForceUnprivileged = false);
6170  void CheckLookupAccess(const LookupResult &R);
6171  bool IsSimplyAccessible(NamedDecl *DeclCXXRecordDecl *NamingClass,
6172                          QualType BaseType);
6173  bool isSpecialMemberAccessibleForDeletion(CXXMethodDecl *decl,
6174                                            AccessSpecifier access,
6175                                            QualType objectType);
6176
6177  void HandleDependentAccessCheck(const DependentDiagnostic &DD,
6178                         const MultiLevelTemplateArgumentList &TemplateArgs);
6179  void PerformDependentDiagnostics(const DeclContext *Pattern,
6180                        const MultiLevelTemplateArgumentList &TemplateArgs);
6181
6182  void HandleDelayedAccessCheck(sema::DelayedDiagnostic &DDDecl *Ctx);
6183
6184  /// When true, access checking violations are treated as SFINAE
6185  /// failures rather than hard errors.
6186  bool AccessCheckingSFINAE;
6187
6188  enum AbstractDiagSelID {
6189    AbstractNone = -1,
6190    AbstractReturnType,
6191    AbstractParamType,
6192    AbstractVariableType,
6193    AbstractFieldType,
6194    AbstractIvarType,
6195    AbstractSynthesizedIvarType,
6196    AbstractArrayType
6197  };
6198
6199  bool isAbstractType(SourceLocation LocQualType T);
6200  bool RequireNonAbstractType(SourceLocation LocQualType T,
6201                              TypeDiagnoser &Diagnoser);
6202  template <typename... Ts>
6203  bool RequireNonAbstractType(SourceLocation LocQualType Tunsigned DiagID,
6204                              const Ts &...Args) {
6205    BoundTypeDiagnoser<Ts...> Diagnoser(DiagIDArgs...);
6206    return RequireNonAbstractType(LocTDiagnoser);
6207  }
6208
6209  void DiagnoseAbstractType(const CXXRecordDecl *RD);
6210
6211  //===--------------------------------------------------------------------===//
6212  // C++ Overloaded Operators [C++ 13.5]
6213  //
6214
6215  bool CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl);
6216
6217  bool CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl);
6218
6219  //===--------------------------------------------------------------------===//
6220  // C++ Templates [C++ 14]
6221  //
6222  void FilterAcceptableTemplateNames(LookupResult &R,
6223                                     bool AllowFunctionTemplates = true,
6224                                     bool AllowDependent = true);
6225  bool hasAnyAcceptableTemplateNames(LookupResult &R,
6226                                     bool AllowFunctionTemplates = true,
6227                                     bool AllowDependent = true);
6228  /// Try to interpret the lookup result D as a template-name.
6229  ///
6230  /// \param D A declaration found by name lookup.
6231  /// \param AllowFunctionTemplates Whether function templates should be
6232  ///        considered valid results.
6233  /// \param AllowDependent Whether unresolved using declarations (that might
6234  ///        name templates) should be considered valid results.
6235  NamedDecl *getAsTemplateNameDecl(NamedDecl *D,
6236                                   bool AllowFunctionTemplates = true,
6237                                   bool AllowDependent = true);
6238
6239  bool LookupTemplateName(LookupResult &RScope *SCXXScopeSpec &SS,
6240                          QualType ObjectTypebool EnteringContext,
6241                          bool &MemberOfUnknownSpecialization,
6242                          SourceLocation TemplateKWLoc = SourceLocation());
6243
6244  TemplateNameKind isTemplateName(Scope *S,
6245                                  CXXScopeSpec &SS,
6246                                  bool hasTemplateKeyword,
6247                                  const UnqualifiedId &Name,
6248                                  ParsedType ObjectType,
6249                                  bool EnteringContext,
6250                                  TemplateTy &Template,
6251                                  bool &MemberOfUnknownSpecialization);
6252
6253  /// Determine whether a particular identifier might be the name in a C++1z
6254  /// deduction-guide declaration.
6255  bool isDeductionGuideName(Scope *Sconst IdentifierInfo &Name,
6256                            SourceLocation NameLoc,
6257                            ParsedTemplateTy *Template = nullptr);
6258
6259  bool DiagnoseUnknownTemplateName(const IdentifierInfo &II,
6260                                   SourceLocation IILoc,
6261                                   Scope *S,
6262                                   const CXXScopeSpec *SS,
6263                                   TemplateTy &SuggestedTemplate,
6264                                   TemplateNameKind &SuggestedKind);
6265
6266  bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation,
6267                                      NamedDecl *Instantiation,
6268                                      bool InstantiatedFromMember,
6269                                      const NamedDecl *Pattern,
6270                                      const NamedDecl *PatternDef,
6271                                      TemplateSpecializationKind TSK,
6272                                      bool Complain = true);
6273
6274  void DiagnoseTemplateParameterShadow(SourceLocation LocDecl *PrevDecl);
6275  TemplateDecl *AdjustDeclIfTemplate(Decl *&Decl);
6276
6277  NamedDecl *ActOnTypeParameter(Scope *Sbool Typename,
6278                           SourceLocation EllipsisLoc,
6279                           SourceLocation KeyLoc,
6280                           IdentifierInfo *ParamName,
6281                           SourceLocation ParamNameLoc,
6282                           unsigned Depthunsigned Position,
6283                           SourceLocation EqualLoc,
6284                           ParsedType DefaultArg);
6285
6286  QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI,
6287                                             SourceLocation Loc);
6288  QualType CheckNonTypeTemplateParameterType(QualType TSourceLocation Loc);
6289
6290  NamedDecl *ActOnNonTypeTemplateParameter(Scope *SDeclarator &D,
6291                                      unsigned Depth,
6292                                      unsigned Position,
6293                                      SourceLocation EqualLoc,
6294                                      Expr *DefaultArg);
6295  NamedDecl *ActOnTemplateTemplateParameter(Scope *S,
6296                                       SourceLocation TmpLoc,
6297                                       TemplateParameterList *Params,
6298                                       SourceLocation EllipsisLoc,
6299                                       IdentifierInfo *ParamName,
6300                                       SourceLocation ParamNameLoc,
6301                                       unsigned Depth,
6302                                       unsigned Position,
6303                                       SourceLocation EqualLoc,
6304                                       ParsedTemplateArgument DefaultArg);
6305
6306  TemplateParameterList *
6307  ActOnTemplateParameterList(unsigned Depth,
6308                             SourceLocation ExportLoc,
6309                             SourceLocation TemplateLoc,
6310                             SourceLocation LAngleLoc,
6311                             ArrayRef<NamedDecl *> Params,
6312                             SourceLocation RAngleLoc,
6313                             Expr *RequiresClause);
6314
6315  /// The context in which we are checking a template parameter list.
6316  enum TemplateParamListContext {
6317    TPC_ClassTemplate,
6318    TPC_VarTemplate,
6319    TPC_FunctionTemplate,
6320    TPC_ClassTemplateMember,
6321    TPC_FriendClassTemplate,
6322    TPC_FriendFunctionTemplate,
6323    TPC_FriendFunctionTemplateDefinition,
6324    TPC_TypeAliasTemplate
6325  };
6326
6327  bool CheckTemplateParameterList(TemplateParameterList *NewParams,
6328                                  TemplateParameterList *OldParams,
6329                                  TemplateParamListContext TPC,
6330                                  SkipBodyInfo *SkipBody = nullptr);
6331  TemplateParameterList *MatchTemplateParametersToScopeSpecifier(
6332      SourceLocation DeclStartLocSourceLocation DeclLoc,
6333      const CXXScopeSpec &SSTemplateIdAnnotation *TemplateId,
6334      ArrayRef<TemplateParameterList *> ParamLists,
6335      bool IsFriendbool &IsMemberSpecializationbool &Invalid);
6336
6337  DeclResult CheckClassTemplate(
6338      Scope *Sunsigned TagSpecTagUseKind TUKSourceLocation KWLoc,
6339      CXXScopeSpec &SSIdentifierInfo *NameSourceLocation NameLoc,
6340      const ParsedAttributesView &AttrTemplateParameterList *TemplateParams,
6341      AccessSpecifier ASSourceLocation ModulePrivateLoc,
6342      SourceLocation FriendLocunsigned NumOuterTemplateParamLists,
6343      TemplateParameterList **OuterTemplateParamLists,
6344      SkipBodyInfo *SkipBody = nullptr);
6345
6346  TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg,
6347                                                    QualType NTTPType,
6348                                                    SourceLocation Loc);
6349
6350  void translateTemplateArguments(const ASTTemplateArgsPtr &In,
6351                                  TemplateArgumentListInfo &Out);
6352
6353  ParsedTemplateArgument ActOnTemplateTypeArgument(TypeResult ParsedType);
6354
6355  void NoteAllFoundTemplates(TemplateName Name);
6356
6357  QualType CheckTemplateIdType(TemplateName Template,
6358                               SourceLocation TemplateLoc,
6359                              TemplateArgumentListInfo &TemplateArgs);
6360
6361  TypeResult
6362  ActOnTemplateIdType(CXXScopeSpec &SSSourceLocation TemplateKWLoc,
6363                      TemplateTy TemplateIdentifierInfo *TemplateII,
6364                      SourceLocation TemplateIILoc,
6365                      SourceLocation LAngleLoc,
6366                      ASTTemplateArgsPtr TemplateArgs,
6367                      SourceLocation RAngleLoc,
6368                      bool IsCtorOrDtorName = false,
6369                      bool IsClassName = false);
6370
6371  /// Parsed an elaborated-type-specifier that refers to a template-id,
6372  /// such as \c class T::template apply<U>.
6373  TypeResult ActOnTagTemplateIdType(TagUseKind TUK,
6374                                    TypeSpecifierType TagSpec,
6375                                    SourceLocation TagLoc,
6376                                    CXXScopeSpec &SS,
6377                                    SourceLocation TemplateKWLoc,
6378                                    TemplateTy TemplateD,
6379                                    SourceLocation TemplateLoc,
6380                                    SourceLocation LAngleLoc,
6381                                    ASTTemplateArgsPtr TemplateArgsIn,
6382                                    SourceLocation RAngleLoc);
6383
6384  DeclResult ActOnVarTemplateSpecialization(
6385      Scope *SDeclarator &DTypeSourceInfo *DI,
6386      SourceLocation TemplateKWLocTemplateParameterList *TemplateParams,
6387      StorageClass SCbool IsPartialSpecialization);
6388
6389  DeclResult CheckVarTemplateId(VarTemplateDecl *Template,
6390                                SourceLocation TemplateLoc,
6391                                SourceLocation TemplateNameLoc,
6392                                const TemplateArgumentListInfo &TemplateArgs);
6393
6394  ExprResult CheckVarTemplateId(const CXXScopeSpec &SS,
6395                                const DeclarationNameInfo &NameInfo,
6396                                VarTemplateDecl *Template,
6397                                SourceLocation TemplateLoc,
6398                                const TemplateArgumentListInfo *TemplateArgs);
6399
6400  void diagnoseMissingTemplateArguments(TemplateName NameSourceLocation Loc);
6401
6402  ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS,
6403                                 SourceLocation TemplateKWLoc,
6404                                 LookupResult &R,
6405                                 bool RequiresADL,
6406                               const TemplateArgumentListInfo *TemplateArgs);
6407
6408  ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS,
6409                                          SourceLocation TemplateKWLoc,
6410                               const DeclarationNameInfo &NameInfo,
6411                               const TemplateArgumentListInfo *TemplateArgs);
6412
6413  TemplateNameKind ActOnDependentTemplateName(
6414      Scope *SCXXScopeSpec &SSSourceLocation TemplateKWLoc,
6415      const UnqualifiedId &NameParsedType ObjectTypebool EnteringContext,
6416      TemplateTy &Templatebool AllowInjectedClassName = false);
6417
6418  DeclResult ActOnClassTemplateSpecialization(
6419      Scope *Sunsigned TagSpecTagUseKind TUKSourceLocation KWLoc,
6420      SourceLocation ModulePrivateLocTemplateIdAnnotation &TemplateId,
6421      const ParsedAttributesView &Attr,
6422      MultiTemplateParamsArg TemplateParameterLists,
6423      SkipBodyInfo *SkipBody = nullptr);
6424
6425  bool CheckTemplatePartialSpecializationArgs(SourceLocation Loc,
6426                                              TemplateDecl *PrimaryTemplate,
6427                                              unsigned NumExplicitArgs,
6428                                              ArrayRef<TemplateArgumentArgs);
6429  void CheckTemplatePartialSpecialization(
6430      ClassTemplatePartialSpecializationDecl *Partial);
6431  void CheckTemplatePartialSpecialization(
6432      VarTemplatePartialSpecializationDecl *Partial);
6433
6434  Decl *ActOnTemplateDeclarator(Scope *S,
6435                                MultiTemplateParamsArg TemplateParameterLists,
6436                                Declarator &D);
6437
6438  bool
6439  CheckSpecializationInstantiationRedecl(SourceLocation NewLoc,
6440                                         TemplateSpecializationKind NewTSK,
6441                                         NamedDecl *PrevDecl,
6442                                         TemplateSpecializationKind PrevTSK,
6443                                         SourceLocation PrevPtOfInstantiation,
6444                                         bool &SuppressNew);
6445
6446  bool CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD,
6447                    const TemplateArgumentListInfo &ExplicitTemplateArgs,
6448                                                    LookupResult &Previous);
6449
6450  bool CheckFunctionTemplateSpecialization(
6451      FunctionDecl *FDTemplateArgumentListInfo *ExplicitTemplateArgs,
6452      LookupResult &Previousbool QualifiedFriend = false);
6453  bool CheckMemberSpecialization(NamedDecl *MemberLookupResult &Previous);
6454  void CompleteMemberSpecialization(NamedDecl *MemberLookupResult &Previous);
6455
6456  DeclResult ActOnExplicitInstantiation(
6457      Scope *SSourceLocation ExternLocSourceLocation TemplateLoc,
6458      unsigned TagSpecSourceLocation KWLocconst CXXScopeSpec &SS,
6459      TemplateTy TemplateSourceLocation TemplateNameLoc,
6460      SourceLocation LAngleLocASTTemplateArgsPtr TemplateArgs,
6461      SourceLocation RAngleLocconst ParsedAttributesView &Attr);
6462
6463  DeclResult ActOnExplicitInstantiation(Scope *SSourceLocation ExternLoc,
6464                                        SourceLocation TemplateLoc,
6465                                        unsigned TagSpecSourceLocation KWLoc,
6466                                        CXXScopeSpec &SSIdentifierInfo *Name,
6467                                        SourceLocation NameLoc,
6468                                        const ParsedAttributesView &Attr);
6469
6470  DeclResult ActOnExplicitInstantiation(Scope *S,
6471                                        SourceLocation ExternLoc,
6472                                        SourceLocation TemplateLoc,
6473                                        Declarator &D);
6474
6475  TemplateArgumentLoc
6476  SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template,
6477                                          SourceLocation TemplateLoc,
6478                                          SourceLocation RAngleLoc,
6479                                          Decl *Param,
6480                                          SmallVectorImpl<TemplateArgument>
6481                                            &Converted,
6482                                          bool &HasDefaultArg);
6483
6484  /// Specifies the context in which a particular template
6485  /// argument is being checked.
6486  enum CheckTemplateArgumentKind {
6487    /// The template argument was specified in the code or was
6488    /// instantiated with some deduced template arguments.
6489    CTAK_Specified,
6490
6491    /// The template argument was deduced via template argument
6492    /// deduction.
6493    CTAK_Deduced,
6494
6495    /// The template argument was deduced from an array bound
6496    /// via template argument deduction.
6497    CTAK_DeducedFromArrayBound
6498  };
6499
6500  bool CheckTemplateArgument(NamedDecl *Param,
6501                             TemplateArgumentLoc &Arg,
6502                             NamedDecl *Template,
6503                             SourceLocation TemplateLoc,
6504                             SourceLocation RAngleLoc,
6505                             unsigned ArgumentPackIndex,
6506                           SmallVectorImpl<TemplateArgument> &Converted,
6507                             CheckTemplateArgumentKind CTAK = CTAK_Specified);
6508
6509  /// Check that the given template arguments can be be provided to
6510  /// the given template, converting the arguments along the way.
6511  ///
6512  /// \param Template The template to which the template arguments are being
6513  /// provided.
6514  ///
6515  /// \param TemplateLoc The location of the template name in the source.
6516  ///
6517  /// \param TemplateArgs The list of template arguments. If the template is
6518  /// a template template parameter, this function may extend the set of
6519  /// template arguments to also include substituted, defaulted template
6520  /// arguments.
6521  ///
6522  /// \param PartialTemplateArgs True if the list of template arguments is
6523  /// intentionally partial, e.g., because we're checking just the initial
6524  /// set of template arguments.
6525  ///
6526  /// \param Converted Will receive the converted, canonicalized template
6527  /// arguments.
6528  ///
6529  /// \param UpdateArgsWithConversions If \c true, update \p TemplateArgs to
6530  /// contain the converted forms of the template arguments as written.
6531  /// Otherwise, \p TemplateArgs will not be modified.
6532  ///
6533  /// \returns true if an error occurred, false otherwise.
6534  bool CheckTemplateArgumentList(TemplateDecl *Template,
6535                                 SourceLocation TemplateLoc,
6536                                 TemplateArgumentListInfo &TemplateArgs,
6537                                 bool PartialTemplateArgs,
6538                                 SmallVectorImpl<TemplateArgument> &Converted,
6539                                 bool UpdateArgsWithConversions = true);
6540
6541  bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param,
6542                                 TemplateArgumentLoc &Arg,
6543                           SmallVectorImpl<TemplateArgument> &Converted);
6544
6545  bool CheckTemplateArgument(TemplateTypeParmDecl *Param,
6546                             TypeSourceInfo *Arg);
6547  ExprResult CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
6548                                   QualType InstantiatedParamTypeExpr *Arg,
6549                                   TemplateArgument &Converted,
6550                               CheckTemplateArgumentKind CTAK = CTAK_Specified);
6551  bool CheckTemplateTemplateArgument(TemplateParameterList *Params,
6552                                     TemplateArgumentLoc &Arg);
6553
6554  ExprResult
6555  BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
6556                                          QualType ParamType,
6557                                          SourceLocation Loc);
6558  ExprResult
6559  BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg,
6560                                              SourceLocation Loc);
6561
6562  /// Enumeration describing how template parameter lists are compared
6563  /// for equality.
6564  enum TemplateParameterListEqualKind {
6565    /// We are matching the template parameter lists of two templates
6566    /// that might be redeclarations.
6567    ///
6568    /// \code
6569    /// template<typename T> struct X;
6570    /// template<typename T> struct X;
6571    /// \endcode
6572    TPL_TemplateMatch,
6573
6574    /// We are matching the template parameter lists of two template
6575    /// template parameters as part of matching the template parameter lists
6576    /// of two templates that might be redeclarations.
6577    ///
6578    /// \code
6579    /// template<template<int I> class TT> struct X;
6580    /// template<template<int Value> class Other> struct X;
6581    /// \endcode
6582    TPL_TemplateTemplateParmMatch,
6583
6584    /// We are matching the template parameter lists of a template
6585    /// template argument against the template parameter lists of a template
6586    /// template parameter.
6587    ///
6588    /// \code
6589    /// template<template<int Value> class Metafun> struct X;
6590    /// template<int Value> struct integer_c;
6591    /// X<integer_c> xic;
6592    /// \endcode
6593    TPL_TemplateTemplateArgumentMatch
6594  };
6595
6596  bool TemplateParameterListsAreEqual(TemplateParameterList *New,
6597                                      TemplateParameterList *Old,
6598                                      bool Complain,
6599                                      TemplateParameterListEqualKind Kind,
6600                                      SourceLocation TemplateArgLoc
6601                                        = SourceLocation());
6602
6603  bool CheckTemplateDeclScope(Scope *STemplateParameterList *TemplateParams);
6604
6605  /// Called when the parser has parsed a C++ typename
6606  /// specifier, e.g., "typename T::type".
6607  ///
6608  /// \param S The scope in which this typename type occurs.
6609  /// \param TypenameLoc the location of the 'typename' keyword
6610  /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
6611  /// \param II the identifier we're retrieving (e.g., 'type' in the example).
6612  /// \param IdLoc the location of the identifier.
6613  TypeResult
6614  ActOnTypenameType(Scope *SSourceLocation TypenameLoc,
6615                    const CXXScopeSpec &SSconst IdentifierInfo &II,
6616                    SourceLocation IdLoc);
6617
6618  /// Called when the parser has parsed a C++ typename
6619  /// specifier that ends in a template-id, e.g.,
6620  /// "typename MetaFun::template apply<T1, T2>".
6621  ///
6622  /// \param S The scope in which this typename type occurs.
6623  /// \param TypenameLoc the location of the 'typename' keyword
6624  /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
6625  /// \param TemplateLoc the location of the 'template' keyword, if any.
6626  /// \param TemplateName The template name.
6627  /// \param TemplateII The identifier used to name the template.
6628  /// \param TemplateIILoc The location of the template name.
6629  /// \param LAngleLoc The location of the opening angle bracket  ('<').
6630  /// \param TemplateArgs The template arguments.
6631  /// \param RAngleLoc The location of the closing angle bracket  ('>').
6632  TypeResult
6633  ActOnTypenameType(Scope *SSourceLocation TypenameLoc,
6634                    const CXXScopeSpec &SS,
6635                    SourceLocation TemplateLoc,
6636                    TemplateTy TemplateName,
6637                    IdentifierInfo *TemplateII,
6638                    SourceLocation TemplateIILoc,
6639                    SourceLocation LAngleLoc,
6640                    ASTTemplateArgsPtr TemplateArgs,
6641                    SourceLocation RAngleLoc);
6642
6643  QualType CheckTypenameType(ElaboratedTypeKeyword Keyword,
6644                             SourceLocation KeywordLoc,
6645                             NestedNameSpecifierLoc QualifierLoc,
6646                             const IdentifierInfo &II,
6647                             SourceLocation IILoc);
6648
6649  TypeSourceInfo *RebuildTypeInCurrentInstantiation(TypeSourceInfo *T,
6650                                                    SourceLocation Loc,
6651                                                    DeclarationName Name);
6652  bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS);
6653
6654  ExprResult RebuildExprInCurrentInstantiation(Expr *E);
6655  bool RebuildTemplateParamsInCurrentInstantiation(
6656                                                TemplateParameterList *Params);
6657
6658  std::string
6659  getTemplateArgumentBindingsText(const TemplateParameterList *Params,
6660                                  const TemplateArgumentList &Args);
6661
6662  std::string
6663  getTemplateArgumentBindingsText(const TemplateParameterList *Params,
6664                                  const TemplateArgument *Args,
6665                                  unsigned NumArgs);
6666
6667  //===--------------------------------------------------------------------===//
6668  // C++ Variadic Templates (C++0x [temp.variadic])
6669  //===--------------------------------------------------------------------===//
6670
6671  /// Determine whether an unexpanded parameter pack might be permitted in this
6672  /// location. Useful for error recovery.
6673  bool isUnexpandedParameterPackPermitted();
6674
6675  /// The context in which an unexpanded parameter pack is
6676  /// being diagnosed.
6677  ///
6678  /// Note that the values of this enumeration line up with the first
6679  /// argument to the \c err_unexpanded_parameter_pack diagnostic.
6680  enum UnexpandedParameterPackContext {
6681    /// An arbitrary expression.
6682    UPPC_Expression = 0,
6683
6684    /// The base type of a class type.
6685    UPPC_BaseType,
6686
6687    /// The type of an arbitrary declaration.
6688    UPPC_DeclarationType,
6689
6690    /// The type of a data member.
6691    UPPC_DataMemberType,
6692
6693    /// The size of a bit-field.
6694    UPPC_BitFieldWidth,
6695
6696    /// The expression in a static assertion.
6697    UPPC_StaticAssertExpression,
6698
6699    /// The fixed underlying type of an enumeration.
6700    UPPC_FixedUnderlyingType,
6701
6702    /// The enumerator value.
6703    UPPC_EnumeratorValue,
6704
6705    /// A using declaration.
6706    UPPC_UsingDeclaration,
6707
6708    /// A friend declaration.
6709    UPPC_FriendDeclaration,
6710
6711    /// A declaration qualifier.
6712    UPPC_DeclarationQualifier,
6713
6714    /// An initializer.
6715    UPPC_Initializer,
6716
6717    /// A default argument.
6718    UPPC_DefaultArgument,
6719
6720    /// The type of a non-type template parameter.
6721    UPPC_NonTypeTemplateParameterType,
6722
6723    /// The type of an exception.
6724    UPPC_ExceptionType,
6725
6726    /// Partial specialization.
6727    UPPC_PartialSpecialization,
6728
6729    /// Microsoft __if_exists.
6730    UPPC_IfExists,
6731
6732    /// Microsoft __if_not_exists.
6733    UPPC_IfNotExists,
6734
6735    /// Lambda expression.
6736    UPPC_Lambda,
6737
6738    /// Block expression,
6739    UPPC_Block
6740  };
6741
6742  /// Diagnose unexpanded parameter packs.
6743  ///
6744  /// \param Loc The location at which we should emit the diagnostic.
6745  ///
6746  /// \param UPPC The context in which we are diagnosing unexpanded
6747  /// parameter packs.
6748  ///
6749  /// \param Unexpanded the set of unexpanded parameter packs.
6750  ///
6751  /// \returns true if an error occurred, false otherwise.
6752  bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc,
6753                                        UnexpandedParameterPackContext UPPC,
6754                                  ArrayRef<UnexpandedParameterPack> Unexpanded);
6755
6756  /// If the given type contains an unexpanded parameter pack,
6757  /// diagnose the error.
6758  ///
6759  /// \param Loc The source location where a diagnostc should be emitted.
6760  ///
6761  /// \param T The type that is being checked for unexpanded parameter
6762  /// packs.
6763  ///
6764  /// \returns true if an error occurred, false otherwise.
6765  bool DiagnoseUnexpandedParameterPack(SourceLocation LocTypeSourceInfo *T,
6766                                       UnexpandedParameterPackContext UPPC);
6767
6768  /// If the given expression contains an unexpanded parameter
6769  /// pack, diagnose the error.
6770  ///
6771  /// \param E The expression that is being checked for unexpanded
6772  /// parameter packs.
6773  ///
6774  /// \returns true if an error occurred, false otherwise.
6775  bool DiagnoseUnexpandedParameterPack(Expr *E,
6776                       UnexpandedParameterPackContext UPPC = UPPC_Expression);
6777
6778  /// If the given nested-name-specifier contains an unexpanded
6779  /// parameter pack, diagnose the error.
6780  ///
6781  /// \param SS The nested-name-specifier that is being checked for
6782  /// unexpanded parameter packs.
6783  ///
6784  /// \returns true if an error occurred, false otherwise.
6785  bool DiagnoseUnexpandedParameterPack(const CXXScopeSpec &SS,
6786                                       UnexpandedParameterPackContext UPPC);
6787
6788  /// If the given name contains an unexpanded parameter pack,
6789  /// diagnose the error.
6790  ///
6791  /// \param NameInfo The name (with source location information) that
6792  /// is being checked for unexpanded parameter packs.
6793  ///
6794  /// \returns true if an error occurred, false otherwise.
6795  bool DiagnoseUnexpandedParameterPack(const DeclarationNameInfo &NameInfo,
6796                                       UnexpandedParameterPackContext UPPC);
6797
6798  /// If the given template name contains an unexpanded parameter pack,
6799  /// diagnose the error.
6800  ///
6801  /// \param Loc The location of the template name.
6802  ///
6803  /// \param Template The template name that is being checked for unexpanded
6804  /// parameter packs.
6805  ///
6806  /// \returns true if an error occurred, false otherwise.
6807  bool DiagnoseUnexpandedParameterPack(SourceLocation Loc,
6808                                       TemplateName Template,
6809                                       UnexpandedParameterPackContext UPPC);
6810
6811  /// If the given template argument contains an unexpanded parameter
6812  /// pack, diagnose the error.
6813  ///
6814  /// \param Arg The template argument that is being checked for unexpanded
6815  /// parameter packs.
6816  ///
6817  /// \returns true if an error occurred, false otherwise.
6818  bool DiagnoseUnexpandedParameterPack(TemplateArgumentLoc Arg,
6819                                       UnexpandedParameterPackContext UPPC);
6820
6821  /// Collect the set of unexpanded parameter packs within the given
6822  /// template argument.
6823  ///
6824  /// \param Arg The template argument that will be traversed to find
6825  /// unexpanded parameter packs.
6826  void collectUnexpandedParameterPacks(TemplateArgument Arg,
6827                   SmallVectorImpl<UnexpandedParameterPack> &Unexpanded);
6828
6829  /// Collect the set of unexpanded parameter packs within the given
6830  /// template argument.
6831  ///
6832  /// \param Arg The template argument that will be traversed to find
6833  /// unexpanded parameter packs.
6834  void collectUnexpandedParameterPacks(TemplateArgumentLoc Arg,
6835                    SmallVectorImpl<UnexpandedParameterPack> &Unexpanded);
6836
6837  /// Collect the set of unexpanded parameter packs within the given
6838  /// type.
6839  ///
6840  /// \param T The type that will be traversed to find
6841  /// unexpanded parameter packs.
6842  void collectUnexpandedParameterPacks(QualType T,
6843                   SmallVectorImpl<UnexpandedParameterPack> &Unexpanded);
6844
6845  /// Collect the set of unexpanded parameter packs within the given
6846  /// type.
6847  ///
6848  /// \param TL The type that will be traversed to find
6849  /// unexpanded parameter packs.
6850  void collectUnexpandedParameterPacks(TypeLoc TL,
6851                   SmallVectorImpl<UnexpandedParameterPack> &Unexpanded);
6852
6853  /// Collect the set of unexpanded parameter packs within the given
6854  /// nested-name-specifier.
6855  ///
6856  /// \param NNS The nested-name-specifier that will be traversed to find
6857  /// unexpanded parameter packs.
6858  void collectUnexpandedParameterPacks(NestedNameSpecifierLoc NNS,
6859                         SmallVectorImpl<UnexpandedParameterPack> &Unexpanded);
6860
6861  /// Collect the set of unexpanded parameter packs within the given
6862  /// name.
6863  ///
6864  /// \param NameInfo The name that will be traversed to find
6865  /// unexpanded parameter packs.
6866  void collectUnexpandedParameterPacks(const DeclarationNameInfo &NameInfo,
6867                         SmallVectorImpl<UnexpandedParameterPack> &Unexpanded);
6868
6869  /// Invoked when parsing a template argument followed by an
6870  /// ellipsis, which creates a pack expansion.
6871  ///
6872  /// \param Arg The template argument preceding the ellipsis, which
6873  /// may already be invalid.
6874  ///
6875  /// \param EllipsisLoc The location of the ellipsis.
6876  ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg,
6877                                            SourceLocation EllipsisLoc);
6878
6879  /// Invoked when parsing a type followed by an ellipsis, which
6880  /// creates a pack expansion.
6881  ///
6882  /// \param Type The type preceding the ellipsis, which will become
6883  /// the pattern of the pack expansion.
6884  ///
6885  /// \param EllipsisLoc The location of the ellipsis.
6886  TypeResult ActOnPackExpansion(ParsedType TypeSourceLocation EllipsisLoc);
6887
6888  /// Construct a pack expansion type from the pattern of the pack
6889  /// expansion.
6890  TypeSourceInfo *CheckPackExpansion(TypeSourceInfo *Pattern,
6891                                     SourceLocation EllipsisLoc,
6892                                     Optional<unsignedNumExpansions);
6893
6894  /// Construct a pack expansion type from the pattern of the pack
6895  /// expansion.
6896  QualType CheckPackExpansion(QualType Pattern,
6897                              SourceRange PatternRange,
6898                              SourceLocation EllipsisLoc,
6899                              Optional<unsignedNumExpansions);
6900
6901  /// Invoked when parsing an expression followed by an ellipsis, which
6902  /// creates a pack expansion.
6903  ///
6904  /// \param Pattern The expression preceding the ellipsis, which will become
6905  /// the pattern of the pack expansion.
6906  ///
6907  /// \param EllipsisLoc The location of the ellipsis.
6908  ExprResult ActOnPackExpansion(Expr *PatternSourceLocation EllipsisLoc);
6909
6910  /// Invoked when parsing an expression followed by an ellipsis, which
6911  /// creates a pack expansion.
6912  ///
6913  /// \param Pattern The expression preceding the ellipsis, which will become
6914  /// the pattern of the pack expansion.
6915  ///
6916  /// \param EllipsisLoc The location of the ellipsis.
6917  ExprResult CheckPackExpansion(Expr *PatternSourceLocation EllipsisLoc,
6918                                Optional<unsignedNumExpansions);
6919
6920  /// Determine whether we could expand a pack expansion with the
6921  /// given set of parameter packs into separate arguments by repeatedly
6922  /// transforming the pattern.
6923  ///
6924  /// \param EllipsisLoc The location of the ellipsis that identifies the
6925  /// pack expansion.
6926  ///
6927  /// \param PatternRange The source range that covers the entire pattern of
6928  /// the pack expansion.
6929  ///
6930  /// \param Unexpanded The set of unexpanded parameter packs within the
6931  /// pattern.
6932  ///
6933  /// \param ShouldExpand Will be set to \c true if the transformer should
6934  /// expand the corresponding pack expansions into separate arguments. When
6935  /// set, \c NumExpansions must also be set.
6936  ///
6937  /// \param RetainExpansion Whether the caller should add an unexpanded
6938  /// pack expansion after all of the expanded arguments. This is used
6939  /// when extending explicitly-specified template argument packs per
6940  /// C++0x [temp.arg.explicit]p9.
6941  ///
6942  /// \param NumExpansions The number of separate arguments that will be in
6943  /// the expanded form of the corresponding pack expansion. This is both an
6944  /// input and an output parameter, which can be set by the caller if the
6945  /// number of expansions is known a priori (e.g., due to a prior substitution)
6946  /// and will be set by the callee when the number of expansions is known.
6947  /// The callee must set this value when \c ShouldExpand is \c true; it may
6948  /// set this value in other cases.
6949  ///
6950  /// \returns true if an error occurred (e.g., because the parameter packs
6951  /// are to be instantiated with arguments of different lengths), false
6952  /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions)
6953  /// must be set.
6954  bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc,
6955                                       SourceRange PatternRange,
6956                             ArrayRef<UnexpandedParameterPack> Unexpanded,
6957                             const MultiLevelTemplateArgumentList &TemplateArgs,
6958                                       bool &ShouldExpand,
6959                                       bool &RetainExpansion,
6960                                       Optional<unsigned> &NumExpansions);
6961
6962  /// Determine the number of arguments in the given pack expansion
6963  /// type.
6964  ///
6965  /// This routine assumes that the number of arguments in the expansion is
6966  /// consistent across all of the unexpanded parameter packs in its pattern.
6967  ///
6968  /// Returns an empty Optional if the type can't be expanded.
6969  Optional<unsignedgetNumArgumentsInExpansion(QualType T,
6970      const MultiLevelTemplateArgumentList &TemplateArgs);
6971
6972  /// Determine whether the given declarator contains any unexpanded
6973  /// parameter packs.
6974  ///
6975  /// This routine is used by the parser to disambiguate function declarators
6976  /// with an ellipsis prior to the ')', e.g.,
6977  ///
6978  /// \code
6979  ///   void f(T...);
6980  /// \endcode
6981  ///
6982  /// To determine whether we have an (unnamed) function parameter pack or
6983  /// a variadic function.
6984  ///
6985  /// \returns true if the declarator contains any unexpanded parameter packs,
6986  /// false otherwise.
6987  bool containsUnexpandedParameterPacks(Declarator &D);
6988
6989  /// Returns the pattern of the pack expansion for a template argument.
6990  ///
6991  /// \param OrigLoc The template argument to expand.
6992  ///
6993  /// \param Ellipsis Will be set to the location of the ellipsis.
6994  ///
6995  /// \param NumExpansions Will be set to the number of expansions that will
6996  /// be generated from this pack expansion, if known a priori.
6997  TemplateArgumentLoc getTemplateArgumentPackExpansionPattern(
6998      TemplateArgumentLoc OrigLoc,
6999      SourceLocation &Ellipsis,
7000      Optional<unsigned> &NumExpansionsconst;
7001
7002  /// Given a template argument that contains an unexpanded parameter pack, but
7003  /// which has already been substituted, attempt to determine the number of
7004  /// elements that will be produced once this argument is fully-expanded.
7005  ///
7006  /// This is intended for use when transforming 'sizeof...(Arg)' in order to
7007  /// avoid actually expanding the pack where possible.
7008  Optional<unsignedgetFullyPackExpandedSize(TemplateArgument Arg);
7009
7010  //===--------------------------------------------------------------------===//
7011  // C++ Template Argument Deduction (C++ [temp.deduct])
7012  //===--------------------------------------------------------------------===//
7013
7014  /// Adjust the type \p ArgFunctionType to match the calling convention,
7015  /// noreturn, and optionally the exception specification of \p FunctionType.
7016  /// Deduction often wants to ignore these properties when matching function
7017  /// types.
7018  QualType adjustCCAndNoReturn(QualType ArgFunctionTypeQualType FunctionType,
7019                               bool AdjustExceptionSpec = false);
7020
7021  /// Describes the result of template argument deduction.
7022  ///
7023  /// The TemplateDeductionResult enumeration describes the result of
7024  /// template argument deduction, as returned from
7025  /// DeduceTemplateArguments(). The separate TemplateDeductionInfo
7026  /// structure provides additional information about the results of
7027  /// template argument deduction, e.g., the deduced template argument
7028  /// list (if successful) or the specific template parameters or
7029  /// deduced arguments that were involved in the failure.
7030  enum TemplateDeductionResult {
7031    /// Template argument deduction was successful.
7032    TDK_Success = 0,
7033    /// The declaration was invalid; do nothing.
7034    TDK_Invalid,
7035    /// Template argument deduction exceeded the maximum template
7036    /// instantiation depth (which has already been diagnosed).
7037    TDK_InstantiationDepth,
7038    /// Template argument deduction did not deduce a value
7039    /// for every template parameter.
7040    TDK_Incomplete,
7041    /// Template argument deduction did not deduce a value for every
7042    /// expansion of an expanded template parameter pack.
7043    TDK_IncompletePack,
7044    /// Template argument deduction produced inconsistent
7045    /// deduced values for the given template parameter.
7046    TDK_Inconsistent,
7047    /// Template argument deduction failed due to inconsistent
7048    /// cv-qualifiers on a template parameter type that would
7049    /// otherwise be deduced, e.g., we tried to deduce T in "const T"
7050    /// but were given a non-const "X".
7051    TDK_Underqualified,
7052    /// Substitution of the deduced template argument values
7053    /// resulted in an error.
7054    TDK_SubstitutionFailure,
7055    /// After substituting deduced template arguments, a dependent
7056    /// parameter type did not match the corresponding argument.
7057    TDK_DeducedMismatch,
7058    /// After substituting deduced template arguments, an element of
7059    /// a dependent parameter type did not match the corresponding element
7060    /// of the corresponding argument (when deducing from an initializer list).
7061    TDK_DeducedMismatchNested,
7062    /// A non-depnedent component of the parameter did not match the
7063    /// corresponding component of the argument.
7064    TDK_NonDeducedMismatch,
7065    /// When performing template argument deduction for a function
7066    /// template, there were too many call arguments.
7067    TDK_TooManyArguments,
7068    /// When performing template argument deduction for a function
7069    /// template, there were too few call arguments.
7070    TDK_TooFewArguments,
7071    /// The explicitly-specified template arguments were not valid
7072    /// template arguments for the given template.
7073    TDK_InvalidExplicitArguments,
7074    /// Checking non-dependent argument conversions failed.
7075    TDK_NonDependentConversionFailure,
7076    /// Deduction failed; that's all we know.
7077    TDK_MiscellaneousDeductionFailure,
7078    /// CUDA Target attributes do not match.
7079    TDK_CUDATargetMismatch
7080  };
7081
7082  TemplateDeductionResult
7083  DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial,
7084                          const TemplateArgumentList &TemplateArgs,
7085                          sema::TemplateDeductionInfo &Info);
7086
7087  TemplateDeductionResult
7088  DeduceTemplateArguments(VarTemplatePartialSpecializationDecl *Partial,
7089                          const TemplateArgumentList &TemplateArgs,
7090                          sema::TemplateDeductionInfo &Info);
7091
7092  TemplateDeductionResult SubstituteExplicitTemplateArguments(
7093      FunctionTemplateDecl *FunctionTemplate,
7094      TemplateArgumentListInfo &ExplicitTemplateArgs,
7095      SmallVectorImpl<DeducedTemplateArgument> &Deduced,
7096      SmallVectorImpl<QualType> &ParamTypesQualType *FunctionType,
7097      sema::TemplateDeductionInfo &Info);
7098
7099  /// brief A function argument from which we performed template argument
7100  // deduction for a call.
7101  struct OriginalCallArg {
7102    OriginalCallArg(QualType OriginalParamTypebool DecomposedParam,
7103                    unsigned ArgIdxQualType OriginalArgType)
7104        : OriginalParamType(OriginalParamType),
7105          DecomposedParam(DecomposedParam), ArgIdx(ArgIdx),
7106          OriginalArgType(OriginalArgType) {}
7107
7108    QualType OriginalParamType;
7109    bool DecomposedParam;
7110    unsigned ArgIdx;
7111    QualType OriginalArgType;
7112  };
7113
7114  TemplateDeductionResult FinishTemplateArgumentDeduction(
7115      FunctionTemplateDecl *FunctionTemplate,
7116      SmallVectorImpl<DeducedTemplateArgument> &Deduced,
7117      unsigned NumExplicitlySpecifiedFunctionDecl *&Specialization,
7118      sema::TemplateDeductionInfo &Info,
7119      SmallVectorImpl<OriginalCallArgconst *OriginalCallArgs = nullptr,
7120      bool PartialOverloading = false,
7121      llvm::function_ref<bool()> CheckNonDependent = []{ return false; });
7122
7123  TemplateDeductionResult DeduceTemplateArguments(
7124      FunctionTemplateDecl *FunctionTemplate,
7125      TemplateArgumentListInfo *ExplicitTemplateArgsArrayRef<Expr *> Args,
7126      FunctionDecl *&Specializationsema::TemplateDeductionInfo &Info,
7127      bool PartialOverloading,
7128      llvm::function_ref<bool(ArrayRef<QualType>)> CheckNonDependent);
7129
7130  TemplateDeductionResult
7131  DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
7132                          TemplateArgumentListInfo *ExplicitTemplateArgs,
7133                          QualType ArgFunctionType,
7134                          FunctionDecl *&Specialization,
7135                          sema::TemplateDeductionInfo &Info,
7136                          bool IsAddressOfFunction = false);
7137
7138  TemplateDeductionResult
7139  DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
7140                          QualType ToType,
7141                          CXXConversionDecl *&Specialization,
7142                          sema::TemplateDeductionInfo &Info);
7143
7144  TemplateDeductionResult
7145  DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
7146                          TemplateArgumentListInfo *ExplicitTemplateArgs,
7147                          FunctionDecl *&Specialization,
7148                          sema::TemplateDeductionInfo &Info,
7149                          bool IsAddressOfFunction = false);
7150
7151  /// Substitute Replacement for \p auto in \p TypeWithAuto
7152  QualType SubstAutoType(QualType TypeWithAutoQualType Replacement);
7153  /// Substitute Replacement for auto in TypeWithAuto
7154  TypeSourceInfoSubstAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto,
7155                                          QualType Replacement);
7156  /// Completely replace the \c auto in \p TypeWithAuto by
7157  /// \p Replacement. This does not retain any \c auto type sugar.
7158  QualType ReplaceAutoType(QualType TypeWithAutoQualType Replacement);
7159
7160  /// Result type of DeduceAutoType.
7161  enum DeduceAutoResult {
7162    DAR_Succeeded,
7163    DAR_Failed,
7164    DAR_FailedAlreadyDiagnosed
7165  };
7166
7167  DeduceAutoResult
7168  DeduceAutoType(TypeSourceInfo *AutoTypeExpr *&InitializerQualType &Result,
7169                 Optional<unsignedDependentDeductionDepth = None);
7170  DeduceAutoResult
7171  DeduceAutoType(TypeLoc AutoTypeLocExpr *&InitializerQualType &Result,
7172                 Optional<unsignedDependentDeductionDepth = None);
7173  void DiagnoseAutoDeductionFailure(VarDecl *VDeclExpr *Init);
7174  bool DeduceReturnType(FunctionDecl *FDSourceLocation Loc,
7175                        bool Diagnose = true);
7176
7177  /// Declare implicit deduction guides for a class template if we've
7178  /// not already done so.
7179  void DeclareImplicitDeductionGuides(TemplateDecl *Template,
7180                                      SourceLocation Loc);
7181
7182  QualType DeduceTemplateSpecializationFromInitializer(
7183      TypeSourceInfo *TInfoconst InitializedEntity &Entity,
7184      const InitializationKind &KindMultiExprArg Init);
7185
7186  QualType deduceVarTypeFromInitializer(VarDecl *VDeclDeclarationName Name,
7187                                        QualType TypeTypeSourceInfo *TSI,
7188                                        SourceRange Rangebool DirectInit,
7189                                        Expr *&Init);
7190
7191  TypeLoc getReturnTypeLoc(FunctionDecl *FDconst;
7192
7193  bool DeduceFunctionTypeFromReturnExpr(FunctionDecl *FD,
7194                                        SourceLocation ReturnLoc,
7195                                        Expr *&RetExprAutoType *AT);
7196
7197  FunctionTemplateDecl *getMoreSpecializedTemplate(FunctionTemplateDecl *FT1,
7198                                                   FunctionTemplateDecl *FT2,
7199                                                   SourceLocation Loc,
7200                                           TemplatePartialOrderingContext TPOC,
7201                                                   unsigned NumCallArguments1,
7202                                                   unsigned NumCallArguments2);
7203  UnresolvedSetIterator
7204  getMostSpecialized(UnresolvedSetIterator SBeginUnresolvedSetIterator SEnd,
7205                     TemplateSpecCandidateSet &FailedCandidates,
7206                     SourceLocation Loc,
7207                     const PartialDiagnostic &NoneDiag,
7208                     const PartialDiagnostic &AmbigDiag,
7209                     const PartialDiagnostic &CandidateDiag,
7210                     bool Complain = trueQualType TargetType = QualType());
7211
7212  ClassTemplatePartialSpecializationDecl *
7213  getMoreSpecializedPartialSpecialization(
7214                                  ClassTemplatePartialSpecializationDecl *PS1,
7215                                  ClassTemplatePartialSpecializationDecl *PS2,
7216                                  SourceLocation Loc);
7217
7218  bool isMoreSpecializedThanPrimary(ClassTemplatePartialSpecializationDecl *T,
7219                                    sema::TemplateDeductionInfo &Info);
7220
7221  VarTemplatePartialSpecializationDecl *getMoreSpecializedPartialSpecialization(
7222      VarTemplatePartialSpecializationDecl *PS1,
7223      VarTemplatePartialSpecializationDecl *PS2SourceLocation Loc);
7224
7225  bool isMoreSpecializedThanPrimary(VarTemplatePartialSpecializationDecl *T,
7226                                    sema::TemplateDeductionInfo &Info);
7227
7228  bool isTemplateTemplateParameterAtLeastAsSpecializedAs(
7229      TemplateParameterList *PTemplateDecl *AArgSourceLocation Loc);
7230
7231  void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs,
7232                                  bool OnlyDeduced,
7233                                  unsigned Depth,
7234                                  llvm::SmallBitVector &Used);
7235  void MarkDeducedTemplateParameters(
7236                                  const FunctionTemplateDecl *FunctionTemplate,
7237                                  llvm::SmallBitVector &Deduced) {
7238    return MarkDeducedTemplateParameters(ContextFunctionTemplateDeduced);
7239  }
7240  static void MarkDeducedTemplateParameters(ASTContext &Ctx,
7241                                  const FunctionTemplateDecl *FunctionTemplate,
7242                                  llvm::SmallBitVector &Deduced);
7243
7244  //===--------------------------------------------------------------------===//
7245  // C++ Template Instantiation
7246  //
7247
7248  MultiLevelTemplateArgumentList
7249  getTemplateInstantiationArgs(NamedDecl *D,
7250                               const TemplateArgumentList *Innermost = nullptr,
7251                               bool RelativeToPrimary = false,
7252                               const FunctionDecl *Pattern = nullptr);
7253
7254  /// A context in which code is being synthesized (where a source location
7255  /// alone is not sufficient to identify the context). This covers template
7256  /// instantiation and various forms of implicitly-generated functions.
7257  struct CodeSynthesisContext {
7258    /// The kind of template instantiation we are performing
7259    enum SynthesisKind {
7260      /// We are instantiating a template declaration. The entity is
7261      /// the declaration we're instantiating (e.g., a CXXRecordDecl).
7262      TemplateInstantiation,
7263
7264      /// We are instantiating a default argument for a template
7265      /// parameter. The Entity is the template parameter whose argument is
7266      /// being instantiated, the Template is the template, and the
7267      /// TemplateArgs/NumTemplateArguments provide the template arguments as
7268      /// specified.
7269      DefaultTemplateArgumentInstantiation,
7270
7271      /// We are instantiating a default argument for a function.
7272      /// The Entity is the ParmVarDecl, and TemplateArgs/NumTemplateArgs
7273      /// provides the template arguments as specified.
7274      DefaultFunctionArgumentInstantiation,
7275
7276      /// We are substituting explicit template arguments provided for
7277      /// a function template. The entity is a FunctionTemplateDecl.
7278      ExplicitTemplateArgumentSubstitution,
7279
7280      /// We are substituting template argument determined as part of
7281      /// template argument deduction for either a class template
7282      /// partial specialization or a function template. The
7283      /// Entity is either a {Class|Var}TemplatePartialSpecializationDecl or
7284      /// a TemplateDecl.
7285      DeducedTemplateArgumentSubstitution,
7286
7287      /// We are substituting prior template arguments into a new
7288      /// template parameter. The template parameter itself is either a
7289      /// NonTypeTemplateParmDecl or a TemplateTemplateParmDecl.
7290      PriorTemplateArgumentSubstitution,
7291
7292      /// We are checking the validity of a default template argument that
7293      /// has been used when naming a template-id.
7294      DefaultTemplateArgumentChecking,
7295
7296      /// We are computing the exception specification for a defaulted special
7297      /// member function.
7298      ExceptionSpecEvaluation,
7299
7300      /// We are instantiating the exception specification for a function
7301      /// template which was deferred until it was needed.
7302      ExceptionSpecInstantiation,
7303
7304      /// We are declaring an implicit special member function.
7305      DeclaringSpecialMember,
7306
7307      /// We are defining a synthesized function (such as a defaulted special
7308      /// member).
7309      DefiningSynthesizedFunction,
7310
7311      /// Added for Template instantiation observation.
7312      /// Memoization means we are _not_ instantiating a template because
7313      /// it is already instantiated (but we entered a context where we
7314      /// would have had to if it was not already instantiated).
7315      Memoization
7316    } Kind;
7317
7318    /// Was the enclosing context a non-instantiation SFINAE context?
7319    bool SavedInNonInstantiationSFINAEContext;
7320
7321    /// The point of instantiation or synthesis within the source code.
7322    SourceLocation PointOfInstantiation;
7323
7324    /// The entity that is being synthesized.
7325    Decl *Entity;
7326
7327    /// The template (or partial specialization) in which we are
7328    /// performing the instantiation, for substitutions of prior template
7329    /// arguments.
7330    NamedDecl *Template;
7331
7332    /// The list of template arguments we are substituting, if they
7333    /// are not part of the entity.
7334    const TemplateArgument *TemplateArgs;
7335
7336    // FIXME: Wrap this union around more members, or perhaps store the
7337    // kind-specific members in the RAII object owning the context.
7338    union {
7339      /// The number of template arguments in TemplateArgs.
7340      unsigned NumTemplateArgs;
7341
7342      /// The special member being declared or defined.
7343      CXXSpecialMember SpecialMember;
7344    };
7345
7346    ArrayRef<TemplateArgumenttemplate_arguments() const {
7347      assert(Kind != DeclaringSpecialMember);
7348      return {TemplateArgs, NumTemplateArgs};
7349    }
7350
7351    /// The template deduction info object associated with the
7352    /// substitution or checking of explicit or deduced template arguments.
7353    sema::TemplateDeductionInfo *DeductionInfo;
7354
7355    /// The source range that covers the construct that cause
7356    /// the instantiation, e.g., the template-id that causes a class
7357    /// template instantiation.
7358    SourceRange InstantiationRange;
7359
7360    CodeSynthesisContext()
7361      : Kind(TemplateInstantiation), Entity(nullptr), Template(nullptr),
7362        TemplateArgs(nullptr), NumTemplateArgs(0), DeductionInfo(nullptr) {}
7363
7364    /// Determines whether this template is an actual instantiation
7365    /// that should be counted toward the maximum instantiation depth.
7366    bool isInstantiationRecord() const;
7367  };
7368
7369  /// List of active code synthesis contexts.
7370  ///
7371  /// This vector is treated as a stack. As synthesis of one entity requires
7372  /// synthesis of another, additional contexts are pushed onto the stack.
7373  SmallVector<CodeSynthesisContext16CodeSynthesisContexts;
7374
7375  /// Specializations whose definitions are currently being instantiated.
7376  llvm::DenseSet<std::pair<Decl *, unsigned>> InstantiatingSpecializations;
7377
7378  /// Non-dependent types used in templates that have already been instantiated
7379  /// by some template instantiation.
7380  llvm::DenseSet<QualType> InstantiatedNonDependentTypes;
7381
7382  /// Extra modules inspected when performing a lookup during a template
7383  /// instantiation. Computed lazily.
7384  SmallVector<Module*, 16CodeSynthesisContextLookupModules;
7385
7386  /// Cache of additional modules that should be used for name lookup
7387  /// within the current template instantiation. Computed lazily; use
7388  /// getLookupModules() to get a complete set.
7389  llvm::DenseSet<Module*> LookupModulesCache;
7390
7391  /// Get the set of additional modules that should be checked during
7392  /// name lookup. A module and its imports become visible when instanting a
7393  /// template defined within it.
7394  llvm::DenseSet<Module*> &getLookupModules();
7395
7396  /// Map from the most recent declaration of a namespace to the most
7397  /// recent visible declaration of that namespace.
7398  llvm::DenseMap<NamedDecl*, NamedDecl*> VisibleNamespaceCache;
7399
7400  /// Whether we are in a SFINAE context that is not associated with
7401  /// template instantiation.
7402  ///
7403  /// This is used when setting up a SFINAE trap (\c see SFINAETrap) outside
7404  /// of a template instantiation or template argument deduction.
7405  bool InNonInstantiationSFINAEContext;
7406
7407  /// The number of \p CodeSynthesisContexts that are not template
7408  /// instantiations and, therefore, should not be counted as part of the
7409  /// instantiation depth.
7410  ///
7411  /// When the instantiation depth reaches the user-configurable limit
7412  /// \p LangOptions::InstantiationDepth we will abort instantiation.
7413  // FIXME: Should we have a similar limit for other forms of synthesis?
7414  unsigned NonInstantiationEntries;
7415
7416  /// The depth of the context stack at the point when the most recent
7417  /// error or warning was produced.
7418  ///
7419  /// This value is used to suppress printing of redundant context stacks
7420  /// when there are multiple errors or warnings in the same instantiation.
7421  // FIXME: Does this belong in Sema? It's tough to implement it anywhere else.
7422  unsigned LastEmittedCodeSynthesisContextDepth = 0;
7423
7424  /// The template instantiation callbacks to trace or track
7425  /// instantiations (objects can be chained).
7426  ///
7427  /// This callbacks is used to print, trace or track template
7428  /// instantiations as they are being constructed.
7429  std::vector<std::unique_ptr<TemplateInstantiationCallback>>
7430      TemplateInstCallbacks;
7431
7432  /// The current index into pack expansion arguments that will be
7433  /// used for substitution of parameter packs.
7434  ///
7435  /// The pack expansion index will be -1 to indicate that parameter packs
7436  /// should be instantiated as themselves. Otherwise, the index specifies
7437  /// which argument within the parameter pack will be used for substitution.
7438  int ArgumentPackSubstitutionIndex;
7439
7440  /// RAII object used to change the argument pack substitution index
7441  /// within a \c Sema object.
7442  ///
7443  /// See \c ArgumentPackSubstitutionIndex for more information.
7444  class ArgumentPackSubstitutionIndexRAII {
7445    Sema &Self;
7446    int OldSubstitutionIndex;
7447
7448  public:
7449    ArgumentPackSubstitutionIndexRAII(Sema &Selfint NewSubstitutionIndex)
7450      : Self(Self), OldSubstitutionIndex(Self.ArgumentPackSubstitutionIndex) {
7451      Self.ArgumentPackSubstitutionIndex = NewSubstitutionIndex;
7452    }
7453
7454    ~ArgumentPackSubstitutionIndexRAII() {
7455      Self.ArgumentPackSubstitutionIndex = OldSubstitutionIndex;
7456    }
7457  };
7458
7459  friend class ArgumentPackSubstitutionRAII;
7460
7461  /// For each declaration that involved template argument deduction, the
7462  /// set of diagnostics that were suppressed during that template argument
7463  /// deduction.
7464  ///
7465  /// FIXME: Serialize this structure to the AST file.
7466  typedef llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> >
7467    SuppressedDiagnosticsMap;
7468  SuppressedDiagnosticsMap SuppressedDiagnostics;
7469
7470  /// A stack object to be created when performing template
7471  /// instantiation.
7472  ///
7473  /// Construction of an object of type \c InstantiatingTemplate
7474  /// pushes the current instantiation onto the stack of active
7475  /// instantiations. If the size of this stack exceeds the maximum
7476  /// number of recursive template instantiations, construction
7477  /// produces an error and evaluates true.
7478  ///
7479  /// Destruction of this object will pop the named instantiation off
7480  /// the stack.
7481  struct InstantiatingTemplate {
7482    /// Note that we are instantiating a class template,
7483    /// function template, variable template, alias template,
7484    /// or a member thereof.
7485    InstantiatingTemplate(Sema &SemaRefSourceLocation PointOfInstantiation,
7486                          Decl *Entity,
7487                          SourceRange InstantiationRange = SourceRange());
7488
7489    struct ExceptionSpecification {};
7490    /// Note that we are instantiating an exception specification
7491    /// of a function template.
7492    InstantiatingTemplate(Sema &SemaRefSourceLocation PointOfInstantiation,
7493                          FunctionDecl *EntityExceptionSpecification,
7494                          SourceRange InstantiationRange = SourceRange());
7495
7496    /// Note that we are instantiating a default argument in a
7497    /// template-id.
7498    InstantiatingTemplate(Sema &SemaRefSourceLocation PointOfInstantiation,
7499                          TemplateParameter ParamTemplateDecl *Template,
7500                          ArrayRef<TemplateArgumentTemplateArgs,
7501                          SourceRange InstantiationRange = SourceRange());
7502
7503    /// Note that we are substituting either explicitly-specified or
7504    /// deduced template arguments during function template argument deduction.
7505    InstantiatingTemplate(Sema &SemaRefSourceLocation PointOfInstantiation,
7506                          FunctionTemplateDecl *FunctionTemplate,
7507                          ArrayRef<TemplateArgumentTemplateArgs,
7508                          CodeSynthesisContext::SynthesisKind Kind,
7509                          sema::TemplateDeductionInfo &DeductionInfo,
7510                          SourceRange InstantiationRange = SourceRange());
7511
7512    /// Note that we are instantiating as part of template
7513    /// argument deduction for a class template declaration.
7514    InstantiatingTemplate(Sema &SemaRefSourceLocation PointOfInstantiation,
7515                          TemplateDecl *Template,
7516                          ArrayRef<TemplateArgumentTemplateArgs,
7517                          sema::TemplateDeductionInfo &DeductionInfo,
7518                          SourceRange InstantiationRange = SourceRange());
7519
7520    /// Note that we are instantiating as part of template
7521    /// argument deduction for a class template partial
7522    /// specialization.
7523    InstantiatingTemplate(Sema &SemaRefSourceLocation PointOfInstantiation,
7524                          ClassTemplatePartialSpecializationDecl *PartialSpec,
7525                          ArrayRef<TemplateArgumentTemplateArgs,
7526                          sema::TemplateDeductionInfo &DeductionInfo,
7527                          SourceRange InstantiationRange = SourceRange());
7528
7529    /// Note that we are instantiating as part of template
7530    /// argument deduction for a variable template partial
7531    /// specialization.
7532    InstantiatingTemplate(Sema &SemaRefSourceLocation PointOfInstantiation,
7533                          VarTemplatePartialSpecializationDecl *PartialSpec,
7534                          ArrayRef<TemplateArgumentTemplateArgs,
7535                          sema::TemplateDeductionInfo &DeductionInfo,
7536                          SourceRange InstantiationRange = SourceRange());
7537
7538    /// Note that we are instantiating a default argument for a function
7539    /// parameter.
7540    InstantiatingTemplate(Sema &SemaRefSourceLocation PointOfInstantiation,
7541                          ParmVarDecl *Param,
7542                          ArrayRef<TemplateArgumentTemplateArgs,
7543                          SourceRange InstantiationRange = SourceRange());
7544
7545    /// Note that we are substituting prior template arguments into a
7546    /// non-type parameter.
7547    InstantiatingTemplate(Sema &SemaRefSourceLocation PointOfInstantiation,
7548                          NamedDecl *Template,
7549                          NonTypeTemplateParmDecl *Param,
7550                          ArrayRef<TemplateArgumentTemplateArgs,
7551                          SourceRange InstantiationRange);
7552
7553    /// Note that we are substituting prior template arguments into a
7554    /// template template parameter.
7555    InstantiatingTemplate(Sema &SemaRefSourceLocation PointOfInstantiation,
7556                          NamedDecl *Template,
7557                          TemplateTemplateParmDecl *Param,
7558                          ArrayRef<TemplateArgumentTemplateArgs,
7559                          SourceRange InstantiationRange);
7560
7561    /// Note that we are checking the default template argument
7562    /// against the template parameter for a given template-id.
7563    InstantiatingTemplate(Sema &SemaRefSourceLocation PointOfInstantiation,
7564                          TemplateDecl *Template,
7565                          NamedDecl *Param,
7566                          ArrayRef<TemplateArgumentTemplateArgs,
7567                          SourceRange InstantiationRange);
7568
7569
7570    /// Note that we have finished instantiating this template.
7571    void Clear();
7572
7573    ~InstantiatingTemplate() { Clear(); }
7574
7575    /// Determines whether we have exceeded the maximum
7576    /// recursive template instantiations.
7577    bool isInvalid() const { return Invalid; }
7578
7579    /// Determine whether we are already instantiating this
7580    /// specialization in some surrounding active instantiation.
7581    bool isAlreadyInstantiating() const { return AlreadyInstantiating; }
7582
7583  private:
7584    Sema &SemaRef;
7585    bool Invalid;
7586    bool AlreadyInstantiating;
7587    bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
7588                                 SourceRange InstantiationRange);
7589
7590    InstantiatingTemplate(
7591        Sema &SemaRefCodeSynthesisContext::SynthesisKind Kind,
7592        SourceLocation PointOfInstantiationSourceRange InstantiationRange,
7593        Decl *EntityNamedDecl *Template = nullptr,
7594        ArrayRef<TemplateArgumentTemplateArgs = None,
7595        sema::TemplateDeductionInfo *DeductionInfo = nullptr);
7596
7597    InstantiatingTemplate(const InstantiatingTemplate&) = delete;
7598
7599    InstantiatingTemplate&
7600    operator=(const InstantiatingTemplate&) = delete;
7601  };
7602
7603  void pushCodeSynthesisContext(CodeSynthesisContext Ctx);
7604  void popCodeSynthesisContext();
7605
7606  /// Determine whether we are currently performing template instantiation.
7607  bool inTemplateInstantiation() const {
7608    return CodeSynthesisContexts.size() > NonInstantiationEntries;
7609  }
7610
7611  void PrintContextStack() {
7612    if (!CodeSynthesisContexts.empty() &&
7613        CodeSynthesisContexts.size() != LastEmittedCodeSynthesisContextDepth) {
7614      PrintInstantiationStack();
7615      LastEmittedCodeSynthesisContextDepth = CodeSynthesisContexts.size();
7616    }
7617    if (PragmaAttributeCurrentTargetDecl)
7618      PrintPragmaAttributeInstantiationPoint();
7619  }
7620  void PrintInstantiationStack();
7621
7622  void PrintPragmaAttributeInstantiationPoint();
7623
7624  /// Determines whether we are currently in a context where
7625  /// template argument substitution failures are not considered
7626  /// errors.
7627  ///
7628  /// \returns An empty \c Optional if we're not in a SFINAE context.
7629  /// Otherwise, contains a pointer that, if non-NULL, contains the nearest
7630  /// template-deduction context object, which can be used to capture
7631  /// diagnostics that will be suppressed.
7632  Optional<sema::TemplateDeductionInfo *> isSFINAEContext() const;
7633
7634  /// Determines whether we are currently in a context that
7635  /// is not evaluated as per C++ [expr] p5.
7636  bool isUnevaluatedContext() const {
7637     (0) . __assert_fail ("!ExprEvalContexts.empty() && \"Must be in an expression evaluation context\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7638, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!ExprEvalContexts.empty() &&
7638 (0) . __assert_fail ("!ExprEvalContexts.empty() && \"Must be in an expression evaluation context\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7638, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">           "Must be in an expression evaluation context");
7639    return ExprEvalContexts.back().isUnevaluated();
7640  }
7641
7642  /// RAII class used to determine whether SFINAE has
7643  /// trapped any errors that occur during template argument
7644  /// deduction.
7645  class SFINAETrap {
7646    Sema &SemaRef;
7647    unsigned PrevSFINAEErrors;
7648    bool PrevInNonInstantiationSFINAEContext;
7649    bool PrevAccessCheckingSFINAE;
7650    bool PrevLastDiagnosticIgnored;
7651
7652  public:
7653    explicit SFINAETrap(Sema &SemaRefbool AccessCheckingSFINAE = false)
7654      : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors),
7655        PrevInNonInstantiationSFINAEContext(
7656                                      SemaRef.InNonInstantiationSFINAEContext),
7657        PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE),
7658        PrevLastDiagnosticIgnored(
7659            SemaRef.getDiagnostics().isLastDiagnosticIgnored())
7660    {
7661      if (!SemaRef.isSFINAEContext())
7662        SemaRef.InNonInstantiationSFINAEContext = true;
7663      SemaRef.AccessCheckingSFINAE = AccessCheckingSFINAE;
7664    }
7665
7666    ~SFINAETrap() {
7667      SemaRef.NumSFINAEErrors = PrevSFINAEErrors;
7668      SemaRef.InNonInstantiationSFINAEContext
7669        = PrevInNonInstantiationSFINAEContext;
7670      SemaRef.AccessCheckingSFINAE = PrevAccessCheckingSFINAE;
7671      SemaRef.getDiagnostics().setLastDiagnosticIgnored(
7672          PrevLastDiagnosticIgnored);
7673    }
7674
7675    /// Determine whether any SFINAE errors have been trapped.
7676    bool hasErrorOccurred() const {
7677      return SemaRef.NumSFINAEErrors > PrevSFINAEErrors;
7678    }
7679  };
7680
7681  /// RAII class used to indicate that we are performing provisional
7682  /// semantic analysis to determine the validity of a construct, so
7683  /// typo-correction and diagnostics in the immediate context (not within
7684  /// implicitly-instantiated templates) should be suppressed.
7685  class TentativeAnalysisScope {
7686    Sema &SemaRef;
7687    // FIXME: Using a SFINAETrap for this is a hack.
7688    SFINAETrap Trap;
7689    bool PrevDisableTypoCorrection;
7690  public:
7691    explicit TentativeAnalysisScope(Sema &SemaRef)
7692        : SemaRef(SemaRef), Trap(SemaReftrue),
7693          PrevDisableTypoCorrection(SemaRef.DisableTypoCorrection) {
7694      SemaRef.DisableTypoCorrection = true;
7695    }
7696    ~TentativeAnalysisScope() {
7697      SemaRef.DisableTypoCorrection = PrevDisableTypoCorrection;
7698    }
7699  };
7700
7701  /// The current instantiation scope used to store local
7702  /// variables.
7703  LocalInstantiationScope *CurrentInstantiationScope;
7704
7705  /// Tracks whether we are in a context where typo correction is
7706  /// disabled.
7707  bool DisableTypoCorrection;
7708
7709  /// The number of typos corrected by CorrectTypo.
7710  unsigned TyposCorrected;
7711
7712  typedef llvm::SmallSet<SourceLocation, 2SrcLocSet;
7713  typedef llvm::DenseMap<IdentifierInfo *, SrcLocSet> IdentifierSourceLocations;
7714
7715  /// A cache containing identifiers for which typo correction failed and
7716  /// their locations, so that repeated attempts to correct an identifier in a
7717  /// given location are ignored if typo correction already failed for it.
7718  IdentifierSourceLocations TypoCorrectionFailures;
7719
7720  /// Worker object for performing CFG-based warnings.
7721  sema::AnalysisBasedWarnings AnalysisWarnings;
7722  threadSafety::BeforeSet *ThreadSafetyDeclCache;
7723
7724  /// An entity for which implicit template instantiation is required.
7725  ///
7726  /// The source location associated with the declaration is the first place in
7727  /// the source code where the declaration was "used". It is not necessarily
7728  /// the point of instantiation (which will be either before or after the
7729  /// namespace-scope declaration that triggered this implicit instantiation),
7730  /// However, it is the location that diagnostics should generally refer to,
7731  /// because users will need to know what code triggered the instantiation.
7732  typedef std::pair<ValueDecl *, SourceLocationPendingImplicitInstantiation;
7733
7734  /// The queue of implicit template instantiations that are required
7735  /// but have not yet been performed.
7736  std::deque<PendingImplicitInstantiationPendingInstantiations;
7737
7738  /// Queue of implicit template instantiations that cannot be performed
7739  /// eagerly.
7740  SmallVector<PendingImplicitInstantiation1LateParsedInstantiations;
7741
7742  class GlobalEagerInstantiationScope {
7743  public:
7744    GlobalEagerInstantiationScope(Sema &Sbool Enabled)
7745        : S(S), Enabled(Enabled) {
7746      if (!Enabledreturn;
7747
7748      SavedPendingInstantiations.swap(S.PendingInstantiations);
7749      SavedVTableUses.swap(S.VTableUses);
7750    }
7751
7752    void perform() {
7753      if (Enabled) {
7754        S.DefineUsedVTables();
7755        S.PerformPendingInstantiations();
7756      }
7757    }
7758
7759    ~GlobalEagerInstantiationScope() {
7760      if (!Enabledreturn;
7761
7762      // Restore the set of pending vtables.
7763       (0) . __assert_fail ("S.VTableUses.empty() && \"VTableUses should be empty before it is discarded.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7764, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.VTableUses.empty() &&
7764 (0) . __assert_fail ("S.VTableUses.empty() && \"VTableUses should be empty before it is discarded.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7764, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">             "VTableUses should be empty before it is discarded.");
7765      S.VTableUses.swap(SavedVTableUses);
7766
7767      // Restore the set of pending implicit instantiations.
7768       (0) . __assert_fail ("S.PendingInstantiations.empty() && \"PendingInstantiations should be empty before it is discarded.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7769, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.PendingInstantiations.empty() &&
7769 (0) . __assert_fail ("S.PendingInstantiations.empty() && \"PendingInstantiations should be empty before it is discarded.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7769, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">             "PendingInstantiations should be empty before it is discarded.");
7770      S.PendingInstantiations.swap(SavedPendingInstantiations);
7771    }
7772
7773  private:
7774    Sema &S;
7775    SmallVector<VTableUse16SavedVTableUses;
7776    std::deque<PendingImplicitInstantiationSavedPendingInstantiations;
7777    bool Enabled;
7778  };
7779
7780  /// The queue of implicit template instantiations that are required
7781  /// and must be performed within the current local scope.
7782  ///
7783  /// This queue is only used for member functions of local classes in
7784  /// templates, which must be instantiated in the same scope as their
7785  /// enclosing function, so that they can reference function-local
7786  /// types, static variables, enumerators, etc.
7787  std::deque<PendingImplicitInstantiationPendingLocalImplicitInstantiations;
7788
7789  class LocalEagerInstantiationScope {
7790  public:
7791    LocalEagerInstantiationScope(Sema &S) : S(S) {
7792      SavedPendingLocalImplicitInstantiations.swap(
7793          S.PendingLocalImplicitInstantiations);
7794    }
7795
7796    void perform() { S.PerformPendingInstantiations(/*LocalOnly=*/true); }
7797
7798    ~LocalEagerInstantiationScope() {
7799       (0) . __assert_fail ("S.PendingLocalImplicitInstantiations.empty() && \"there shouldn't be any pending local implicit instantiations\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7800, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.PendingLocalImplicitInstantiations.empty() &&
7800 (0) . __assert_fail ("S.PendingLocalImplicitInstantiations.empty() && \"there shouldn't be any pending local implicit instantiations\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7800, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">             "there shouldn't be any pending local implicit instantiations");
7801      SavedPendingLocalImplicitInstantiations.swap(
7802          S.PendingLocalImplicitInstantiations);
7803    }
7804
7805  private:
7806    Sema &S;
7807    std::deque<PendingImplicitInstantiation>
7808        SavedPendingLocalImplicitInstantiations;
7809  };
7810
7811  /// A helper class for building up ExtParameterInfos.
7812  class ExtParameterInfoBuilder {
7813    SmallVector<FunctionProtoType::ExtParameterInfo16Infos;
7814    bool HasInteresting = false;
7815
7816  public:
7817    /// Set the ExtParameterInfo for the parameter at the given index,
7818    ///
7819    void set(unsigned indexFunctionProtoType::ExtParameterInfo info) {
7820      assert(Infos.size() <= index);
7821      Infos.resize(index);
7822      Infos.push_back(info);
7823
7824      if (!HasInteresting)
7825        HasInteresting = (info != FunctionProtoType::ExtParameterInfo());
7826    }
7827
7828    /// Return a pointer (suitable for setting in an ExtProtoInfo) to the
7829    /// ExtParameterInfo array we've built up.
7830    const FunctionProtoType::ExtParameterInfo *
7831    getPointerOrNull(unsigned numParams) {
7832      if (!HasInterestingreturn nullptr;
7833      Infos.resize(numParams);
7834      return Infos.data();
7835    }
7836  };
7837
7838  void PerformPendingInstantiations(bool LocalOnly = false);
7839
7840  TypeSourceInfo *SubstType(TypeSourceInfo *T,
7841                            const MultiLevelTemplateArgumentList &TemplateArgs,
7842                            SourceLocation LocDeclarationName Entity,
7843                            bool AllowDeducedTST = false);
7844
7845  QualType SubstType(QualType T,
7846                     const MultiLevelTemplateArgumentList &TemplateArgs,
7847                     SourceLocation LocDeclarationName Entity);
7848
7849  TypeSourceInfo *SubstType(TypeLoc TL,
7850                            const MultiLevelTemplateArgumentList &TemplateArgs,
7851                            SourceLocation LocDeclarationName Entity);
7852
7853  TypeSourceInfo *SubstFunctionDeclType(TypeSourceInfo *T,
7854                            const MultiLevelTemplateArgumentList &TemplateArgs,
7855                                        SourceLocation Loc,
7856                                        DeclarationName Entity,
7857                                        CXXRecordDecl *ThisContext,
7858                                        Qualifiers ThisTypeQuals);
7859  void SubstExceptionSpec(FunctionDecl *Newconst FunctionProtoType *Proto,
7860                          const MultiLevelTemplateArgumentList &Args);
7861  bool SubstExceptionSpec(SourceLocation Loc,
7862                          FunctionProtoType::ExceptionSpecInfo &ESI,
7863                          SmallVectorImpl<QualType> &ExceptionStorage,
7864                          const MultiLevelTemplateArgumentList &Args);
7865  ParmVarDecl *SubstParmVarDecl(ParmVarDecl *D,
7866                            const MultiLevelTemplateArgumentList &TemplateArgs,
7867                                int indexAdjustment,
7868                                Optional<unsignedNumExpansions,
7869                                bool ExpectParameterPack);
7870  bool SubstParmTypes(SourceLocation LocArrayRef<ParmVarDecl *> Params,
7871                      const FunctionProtoType::ExtParameterInfo *ExtParamInfos,
7872                      const MultiLevelTemplateArgumentList &TemplateArgs,
7873                      SmallVectorImpl<QualType> &ParamTypes,
7874                      SmallVectorImpl<ParmVarDecl *> *OutParams,
7875                      ExtParameterInfoBuilder &ParamInfos);
7876  ExprResult SubstExpr(Expr *E,
7877                       const MultiLevelTemplateArgumentList &TemplateArgs);
7878
7879  /// Substitute the given template arguments into a list of
7880  /// expressions, expanding pack expansions if required.
7881  ///
7882  /// \param Exprs The list of expressions to substitute into.
7883  ///
7884  /// \param IsCall Whether this is some form of call, in which case
7885  /// default arguments will be dropped.
7886  ///
7887  /// \param TemplateArgs The set of template arguments to substitute.
7888  ///
7889  /// \param Outputs Will receive all of the substituted arguments.
7890  ///
7891  /// \returns true if an error occurred, false otherwise.
7892  bool SubstExprs(ArrayRef<Expr *> Exprsbool IsCall,
7893                  const MultiLevelTemplateArgumentList &TemplateArgs,
7894                  SmallVectorImpl<Expr *> &Outputs);
7895
7896  StmtResult SubstStmt(Stmt *S,
7897                       const MultiLevelTemplateArgumentList &TemplateArgs);
7898
7899  TemplateParameterList *
7900  SubstTemplateParams(TemplateParameterList *ParamsDeclContext *Owner,
7901                      const MultiLevelTemplateArgumentList &TemplateArgs);
7902
7903  Decl *SubstDecl(Decl *DDeclContext *Owner,
7904                  const MultiLevelTemplateArgumentList &TemplateArgs);
7905
7906  ExprResult SubstInitializer(Expr *E,
7907                       const MultiLevelTemplateArgumentList &TemplateArgs,
7908                       bool CXXDirectInit);
7909
7910  bool
7911  SubstBaseSpecifiers(CXXRecordDecl *Instantiation,
7912                      CXXRecordDecl *Pattern,
7913                      const MultiLevelTemplateArgumentList &TemplateArgs);
7914
7915  bool
7916  InstantiateClass(SourceLocation PointOfInstantiation,
7917                   CXXRecordDecl *InstantiationCXXRecordDecl *Pattern,
7918                   const MultiLevelTemplateArgumentList &TemplateArgs,
7919                   TemplateSpecializationKind TSK,
7920                   bool Complain = true);
7921
7922  bool InstantiateEnum(SourceLocation PointOfInstantiation,
7923                       EnumDecl *InstantiationEnumDecl *Pattern,
7924                       const MultiLevelTemplateArgumentList &TemplateArgs,
7925                       TemplateSpecializationKind TSK);
7926
7927  bool InstantiateInClassInitializer(
7928      SourceLocation PointOfInstantiationFieldDecl *Instantiation,
7929      FieldDecl *Patternconst MultiLevelTemplateArgumentList &TemplateArgs);
7930
7931  struct LateInstantiatedAttribute {
7932    const Attr *TmplAttr;
7933    LocalInstantiationScope *Scope;
7934    Decl *NewDecl;
7935
7936    LateInstantiatedAttribute(const Attr *ALocalInstantiationScope *S,
7937                              Decl *D)
7938      : TmplAttr(A), Scope(S), NewDecl(D)
7939    { }
7940  };
7941  typedef SmallVector<LateInstantiatedAttribute16LateInstantiatedAttrVec;
7942
7943  void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
7944                        const Decl *PatternDecl *Inst,
7945                        LateInstantiatedAttrVec *LateAttrs = nullptr,
7946                        LocalInstantiationScope *OuterMostScope = nullptr);
7947
7948  void
7949  InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs,
7950                          const Decl *PatternDecl *Inst,
7951                          LateInstantiatedAttrVec *LateAttrs = nullptr,
7952                          LocalInstantiationScope *OuterMostScope = nullptr);
7953
7954  bool usesPartialOrExplicitSpecialization(
7955      SourceLocation LocClassTemplateSpecializationDecl *ClassTemplateSpec);
7956
7957  bool
7958  InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation,
7959                           ClassTemplateSpecializationDecl *ClassTemplateSpec,
7960                           TemplateSpecializationKind TSK,
7961                           bool Complain = true);
7962
7963  void InstantiateClassMembers(SourceLocation PointOfInstantiation,
7964                               CXXRecordDecl *Instantiation,
7965                            const MultiLevelTemplateArgumentList &TemplateArgs,
7966                               TemplateSpecializationKind TSK);
7967
7968  void InstantiateClassTemplateSpecializationMembers(
7969                                          SourceLocation PointOfInstantiation,
7970                           ClassTemplateSpecializationDecl *ClassTemplateSpec,
7971                                                TemplateSpecializationKind TSK);
7972
7973  NestedNameSpecifierLoc
7974  SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS,
7975                           const MultiLevelTemplateArgumentList &TemplateArgs);
7976
7977  DeclarationNameInfo
7978  SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo,
7979                           const MultiLevelTemplateArgumentList &TemplateArgs);
7980  TemplateName
7981  SubstTemplateName(NestedNameSpecifierLoc QualifierLocTemplateName Name,
7982                    SourceLocation Loc,
7983                    const MultiLevelTemplateArgumentList &TemplateArgs);
7984  bool Subst(const TemplateArgumentLoc *Argsunsigned NumArgs,
7985             TemplateArgumentListInfo &Result,
7986             const MultiLevelTemplateArgumentList &TemplateArgs);
7987
7988  void InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
7989                                FunctionDecl *Function);
7990  FunctionDecl *InstantiateFunctionDeclaration(FunctionTemplateDecl *FTD,
7991                                               const TemplateArgumentList *Args,
7992                                               SourceLocation Loc);
7993  void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
7994                                     FunctionDecl *Function,
7995                                     bool Recursive = false,
7996                                     bool DefinitionRequired = false,
7997                                     bool AtEndOfTU = false);
7998  VarTemplateSpecializationDecl *BuildVarTemplateInstantiation(
7999      VarTemplateDecl *VarTemplateVarDecl *FromVar,
8000      const TemplateArgumentList &TemplateArgList,
8001      const TemplateArgumentListInfo &TemplateArgsInfo,
8002      SmallVectorImpl<TemplateArgument> &Converted,
8003      SourceLocation PointOfInstantiationvoid *InsertPos,
8004      LateInstantiatedAttrVec *LateAttrs = nullptr,
8005      LocalInstantiationScope *StartingScope = nullptr);
8006  VarTemplateSpecializationDecl *CompleteVarTemplateSpecializationDecl(
8007      VarTemplateSpecializationDecl *VarSpecVarDecl *PatternDecl,
8008      const MultiLevelTemplateArgumentList &TemplateArgs);
8009  void
8010  BuildVariableInstantiation(VarDecl *NewVarVarDecl *OldVar,
8011                             const MultiLevelTemplateArgumentList &TemplateArgs,
8012                             LateInstantiatedAttrVec *LateAttrs,
8013                             DeclContext *Owner,
8014                             LocalInstantiationScope *StartingScope,
8015                             bool InstantiatingVarTemplate = false);
8016  void InstantiateVariableInitializer(
8017      VarDecl *VarVarDecl *OldVar,
8018      const MultiLevelTemplateArgumentList &TemplateArgs);
8019  void InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
8020                                     VarDecl *Varbool Recursive = false,
8021                                     bool DefinitionRequired = false,
8022                                     bool AtEndOfTU = false);
8023
8024  void InstantiateMemInitializers(CXXConstructorDecl *New,
8025                                  const CXXConstructorDecl *Tmpl,
8026                            const MultiLevelTemplateArgumentList &TemplateArgs);
8027
8028  NamedDecl *FindInstantiatedDecl(SourceLocation LocNamedDecl *D,
8029                          const MultiLevelTemplateArgumentList &TemplateArgs,
8030                          bool FindingInstantiatedContext = false);
8031  DeclContext *FindInstantiatedContext(SourceLocation LocDeclContext *DC,
8032                          const MultiLevelTemplateArgumentList &TemplateArgs);
8033
8034  // Objective-C declarations.
8035  enum ObjCContainerKind {
8036    OCK_None = -1,
8037    OCK_Interface = 0,
8038    OCK_Protocol,
8039    OCK_Category,
8040    OCK_ClassExtension,
8041    OCK_Implementation,
8042    OCK_CategoryImplementation
8043  };
8044  ObjCContainerKind getObjCContainerKind() const;
8045
8046  DeclResult actOnObjCTypeParam(Scope *S,
8047                                ObjCTypeParamVariance variance,
8048                                SourceLocation varianceLoc,
8049                                unsigned index,
8050                                IdentifierInfo *paramName,
8051                                SourceLocation paramLoc,
8052                                SourceLocation colonLoc,
8053                                ParsedType typeBound);
8054
8055  ObjCTypeParamList *actOnObjCTypeParamList(Scope *SSourceLocation lAngleLoc,
8056                                            ArrayRef<Decl *> typeParams,
8057                                            SourceLocation rAngleLoc);
8058  void popObjCTypeParamList(Scope *SObjCTypeParamList *typeParamList);
8059
8060  Decl *ActOnStartClassInterface(
8061      Scope *SSourceLocation AtInterfaceLocIdentifierInfo *ClassName,
8062      SourceLocation ClassLocObjCTypeParamList *typeParamList,
8063      IdentifierInfo *SuperNameSourceLocation SuperLoc,
8064      ArrayRef<ParsedTypeSuperTypeArgsSourceRange SuperTypeArgsRange,
8065      Decl *const *ProtoRefsunsigned NumProtoRefs,
8066      const SourceLocation *ProtoLocsSourceLocation EndProtoLoc,
8067      const ParsedAttributesView &AttrList);
8068
8069  void ActOnSuperClassOfClassInterface(Scope *S,
8070                                       SourceLocation AtInterfaceLoc,
8071                                       ObjCInterfaceDecl *IDecl,
8072                                       IdentifierInfo *ClassName,
8073                                       SourceLocation ClassLoc,
8074                                       IdentifierInfo *SuperName,
8075                                       SourceLocation SuperLoc,
8076                                       ArrayRef<ParsedTypeSuperTypeArgs,
8077                                       SourceRange SuperTypeArgsRange);
8078
8079  void ActOnTypedefedProtocols(SmallVectorImpl<Decl *> &ProtocolRefs,
8080                               SmallVectorImpl<SourceLocation> &ProtocolLocs,
8081                               IdentifierInfo *SuperName,
8082                               SourceLocation SuperLoc);
8083
8084  Decl *ActOnCompatibilityAlias(
8085                    SourceLocation AtCompatibilityAliasLoc,
8086                    IdentifierInfo *AliasName,  SourceLocation AliasLocation,
8087                    IdentifierInfo *ClassNameSourceLocation ClassLocation);
8088
8089  bool CheckForwardProtocolDeclarationForCircularDependency(
8090    IdentifierInfo *PName,
8091    SourceLocation &PLocSourceLocation PrevLoc,
8092    const ObjCList<ObjCProtocolDecl> &PList);
8093
8094  Decl *ActOnStartProtocolInterface(
8095      SourceLocation AtProtoInterfaceLocIdentifierInfo *ProtocolName,
8096      SourceLocation ProtocolLocDecl *const *ProtoRefNames,
8097      unsigned NumProtoRefsconst SourceLocation *ProtoLocs,
8098      SourceLocation EndProtoLocconst ParsedAttributesView &AttrList);
8099
8100  Decl *ActOnStartCategoryInterface(
8101      SourceLocation AtInterfaceLocIdentifierInfo *ClassName,
8102      SourceLocation ClassLocObjCTypeParamList *typeParamList,
8103      IdentifierInfo *CategoryNameSourceLocation CategoryLoc,
8104      Decl *const *ProtoRefsunsigned NumProtoRefs,
8105      const SourceLocation *ProtoLocsSourceLocation EndProtoLoc,
8106      const ParsedAttributesView &AttrList);
8107
8108  Decl *ActOnStartClassImplementation(
8109                    SourceLocation AtClassImplLoc,
8110                    IdentifierInfo *ClassNameSourceLocation ClassLoc,
8111                    IdentifierInfo *SuperClassname,
8112                    SourceLocation SuperClassLoc);
8113
8114  Decl *ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc,
8115                                         IdentifierInfo *ClassName,
8116                                         SourceLocation ClassLoc,
8117                                         IdentifierInfo *CatName,
8118                                         SourceLocation CatLoc);
8119
8120  DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl,
8121                                               ArrayRef<Decl *> Decls);
8122
8123  DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc,
8124                   IdentifierInfo **IdentList,
8125                   SourceLocation *IdentLocs,
8126                   ArrayRef<ObjCTypeParamList *> TypeParamLists,
8127                   unsigned NumElts);
8128
8129  DeclGroupPtrTy
8130  ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc,
8131                                  ArrayRef<IdentifierLocPairIdentList,
8132                                  const ParsedAttributesView &attrList);
8133
8134  void FindProtocolDeclaration(bool WarnOnDeclarationsbool ForObjCContainer,
8135                               ArrayRef<IdentifierLocPairProtocolId,
8136                               SmallVectorImpl<Decl *> &Protocols);
8137
8138  void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId,
8139                                    SourceLocation ProtocolLoc,
8140                                    IdentifierInfo *TypeArgId,
8141                                    SourceLocation TypeArgLoc,
8142                                    bool SelectProtocolFirst = false);
8143
8144  /// Given a list of identifiers (and their locations), resolve the
8145  /// names to either Objective-C protocol qualifiers or type
8146  /// arguments, as appropriate.
8147  void actOnObjCTypeArgsOrProtocolQualifiers(
8148         Scope *S,
8149         ParsedType baseType,
8150         SourceLocation lAngleLoc,
8151         ArrayRef<IdentifierInfo *> identifiers,
8152         ArrayRef<SourceLocationidentifierLocs,
8153         SourceLocation rAngleLoc,
8154         SourceLocation &typeArgsLAngleLoc,
8155         SmallVectorImpl<ParsedType> &typeArgs,
8156         SourceLocation &typeArgsRAngleLoc,
8157         SourceLocation &protocolLAngleLoc,
8158         SmallVectorImpl<Decl *> &protocols,
8159         SourceLocation &protocolRAngleLoc,
8160         bool warnOnIncompleteProtocols);
8161
8162  /// Build a an Objective-C protocol-qualified 'id' type where no
8163  /// base type was specified.
8164  TypeResult actOnObjCProtocolQualifierType(
8165               SourceLocation lAngleLoc,
8166               ArrayRef<Decl *> protocols,
8167               ArrayRef<SourceLocationprotocolLocs,
8168               SourceLocation rAngleLoc);
8169
8170  /// Build a specialized and/or protocol-qualified Objective-C type.
8171  TypeResult actOnObjCTypeArgsAndProtocolQualifiers(
8172               Scope *S,
8173               SourceLocation Loc,
8174               ParsedType BaseType,
8175               SourceLocation TypeArgsLAngleLoc,
8176               ArrayRef<ParsedTypeTypeArgs,
8177               SourceLocation TypeArgsRAngleLoc,
8178               SourceLocation ProtocolLAngleLoc,
8179               ArrayRef<Decl *> Protocols,
8180               ArrayRef<SourceLocationProtocolLocs,
8181               SourceLocation ProtocolRAngleLoc);
8182
8183  /// Build an Objective-C type parameter type.
8184  QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl,
8185                                  SourceLocation ProtocolLAngleLoc,
8186                                  ArrayRef<ObjCProtocolDecl *> Protocols,
8187                                  ArrayRef<SourceLocationProtocolLocs,
8188                                  SourceLocation ProtocolRAngleLoc,
8189                                  bool FailOnError = false);
8190
8191  /// Build an Objective-C object pointer type.
8192  QualType BuildObjCObjectType(QualType BaseType,
8193                               SourceLocation Loc,
8194                               SourceLocation TypeArgsLAngleLoc,
8195                               ArrayRef<TypeSourceInfo *> TypeArgs,
8196                               SourceLocation TypeArgsRAngleLoc,
8197                               SourceLocation ProtocolLAngleLoc,
8198                               ArrayRef<ObjCProtocolDecl *> Protocols,
8199                               ArrayRef<SourceLocationProtocolLocs,
8200                               SourceLocation ProtocolRAngleLoc,
8201                               bool FailOnError = false);
8202
8203  /// Ensure attributes are consistent with type.
8204  /// \param [in, out] Attributes The attributes to check; they will
8205  /// be modified to be consistent with \p PropertyTy.
8206  void CheckObjCPropertyAttributes(Decl *PropertyPtrTy,
8207                                   SourceLocation Loc,
8208                                   unsigned &Attributes,
8209                                   bool propertyInPrimaryClass);
8210
8211  /// Process the specified property declaration and create decls for the
8212  /// setters and getters as needed.
8213  /// \param property The property declaration being processed
8214  void ProcessPropertyDecl(ObjCPropertyDecl *property);
8215
8216
8217  void DiagnosePropertyMismatch(ObjCPropertyDecl *Property,
8218                                ObjCPropertyDecl *SuperProperty,
8219                                const IdentifierInfo *Name,
8220                                bool OverridingProtocolProperty);
8221
8222  void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT,
8223                                        ObjCInterfaceDecl *ID);
8224
8225  Decl *ActOnAtEnd(Scope *SSourceRange AtEnd,
8226                   ArrayRef<Decl *> allMethods = None,
8227                   ArrayRef<DeclGroupPtrTyallTUVars = None);
8228
8229  Decl *ActOnProperty(Scope *SSourceLocation AtLoc,
8230                      SourceLocation LParenLoc,
8231                      FieldDeclarator &FDObjCDeclSpec &ODS,
8232                      Selector GetterSelSelector SetterSel,
8233                      tok::ObjCKeywordKind MethodImplKind,
8234                      DeclContext *lexicalDC = nullptr);
8235
8236  Decl *ActOnPropertyImplDecl(Scope *S,
8237                              SourceLocation AtLoc,
8238                              SourceLocation PropertyLoc,
8239                              bool ImplKind,
8240                              IdentifierInfo *PropertyId,
8241                              IdentifierInfo *PropertyIvar,
8242                              SourceLocation PropertyIvarLoc,
8243                              ObjCPropertyQueryKind QueryKind);
8244
8245  enum ObjCSpecialMethodKind {
8246    OSMK_None,
8247    OSMK_Alloc,
8248    OSMK_New,
8249    OSMK_Copy,
8250    OSMK_RetainingInit,
8251    OSMK_NonRetainingInit
8252  };
8253
8254  struct ObjCArgInfo {
8255    IdentifierInfo *Name;
8256    SourceLocation NameLoc;
8257    // The Type is null if no type was specified, and the DeclSpec is invalid
8258    // in this case.
8259    ParsedType Type;
8260    ObjCDeclSpec DeclSpec;
8261
8262    /// ArgAttrs - Attribute list for this argument.
8263    ParsedAttributesView ArgAttrs;
8264  };
8265
8266  Decl *ActOnMethodDeclaration(
8267      Scope *S,
8268      SourceLocation BeginLoc// location of the + or -.
8269      SourceLocation EndLoc,   // location of the ; or {.
8270      tok::TokenKind MethodTypeObjCDeclSpec &ReturnQTParsedType ReturnType,
8271      ArrayRef<SourceLocationSelectorLocsSelector Sel,
8272      // optional arguments. The number of types/arguments is obtained
8273      // from the Sel.getNumArgs().
8274      ObjCArgInfo *ArgInfoDeclaratorChunk::ParamInfo *CParamInfo,
8275      unsigned CNumArgs// c-style args
8276      const ParsedAttributesView &AttrListtok::ObjCKeywordKind MethodImplKind,
8277      bool isVariadicbool MethodDefinition);
8278
8279  ObjCMethodDecl *LookupMethodInQualifiedType(Selector Sel,
8280                                              const ObjCObjectPointerType *OPT,
8281                                              bool IsInstance);
8282  ObjCMethodDecl *LookupMethodInObjectType(Selector SelQualType Ty,
8283                                           bool IsInstance);
8284
8285  bool CheckARCMethodDecl(ObjCMethodDecl *method);
8286  bool inferObjCARCLifetime(ValueDecl *decl);
8287
8288  ExprResult
8289  HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
8290                            Expr *BaseExpr,
8291                            SourceLocation OpLoc,
8292                            DeclarationName MemberName,
8293                            SourceLocation MemberLoc,
8294                            SourceLocation SuperLocQualType SuperType,
8295                            bool Super);
8296
8297  ExprResult
8298  ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
8299                            IdentifierInfo &propertyName,
8300                            SourceLocation receiverNameLoc,
8301                            SourceLocation propertyNameLoc);
8302
8303  ObjCMethodDecl *tryCaptureObjCSelf(SourceLocation Loc);
8304
8305  /// Describes the kind of message expression indicated by a message
8306  /// send that starts with an identifier.
8307  enum ObjCMessageKind {
8308    /// The message is sent to 'super'.
8309    ObjCSuperMessage,
8310    /// The message is an instance message.
8311    ObjCInstanceMessage,
8312    /// The message is a class message, and the identifier is a type
8313    /// name.
8314    ObjCClassMessage
8315  };
8316
8317  ObjCMessageKind getObjCMessageKind(Scope *S,
8318                                     IdentifierInfo *Name,
8319                                     SourceLocation NameLoc,
8320                                     bool IsSuper,
8321                                     bool HasTrailingDot,
8322                                     ParsedType &ReceiverType);
8323
8324  ExprResult ActOnSuperMessage(Scope *SSourceLocation SuperLoc,
8325                               Selector Sel,
8326                               SourceLocation LBracLoc,
8327                               ArrayRef<SourceLocationSelectorLocs,
8328                               SourceLocation RBracLoc,
8329                               MultiExprArg Args);
8330
8331  ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
8332                               QualType ReceiverType,
8333                               SourceLocation SuperLoc,
8334                               Selector Sel,
8335                               ObjCMethodDecl *Method,
8336                               SourceLocation LBracLoc,
8337                               ArrayRef<SourceLocationSelectorLocs,
8338                               SourceLocation RBracLoc,
8339                               MultiExprArg Args,
8340                               bool isImplicit = false);
8341
8342  ExprResult BuildClassMessageImplicit(QualType ReceiverType,
8343                                       bool isSuperReceiver,
8344                                       SourceLocation Loc,
8345                                       Selector Sel,
8346                                       ObjCMethodDecl *Method,
8347                                       MultiExprArg Args);
8348
8349  ExprResult ActOnClassMessage(Scope *S,
8350                               ParsedType Receiver,
8351                               Selector Sel,
8352                               SourceLocation LBracLoc,
8353                               ArrayRef<SourceLocationSelectorLocs,
8354                               SourceLocation RBracLoc,
8355                               MultiExprArg Args);
8356
8357  ExprResult BuildInstanceMessage(Expr *Receiver,
8358                                  QualType ReceiverType,
8359                                  SourceLocation SuperLoc,
8360                                  Selector Sel,
8361                                  ObjCMethodDecl *Method,
8362                                  SourceLocation LBracLoc,
8363                                  ArrayRef<SourceLocationSelectorLocs,
8364                                  SourceLocation RBracLoc,
8365                                  MultiExprArg Args,
8366                                  bool isImplicit = false);
8367
8368  ExprResult BuildInstanceMessageImplicit(Expr *Receiver,
8369                                          QualType ReceiverType,
8370                                          SourceLocation Loc,
8371                                          Selector Sel,
8372                                          ObjCMethodDecl *Method,
8373                                          MultiExprArg Args);
8374
8375  ExprResult ActOnInstanceMessage(Scope *S,
8376                                  Expr *Receiver,
8377                                  Selector Sel,
8378                                  SourceLocation LBracLoc,
8379                                  ArrayRef<SourceLocationSelectorLocs,
8380                                  SourceLocation RBracLoc,
8381                                  MultiExprArg Args);
8382
8383  ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc,
8384                                  ObjCBridgeCastKind Kind,
8385                                  SourceLocation BridgeKeywordLoc,
8386                                  TypeSourceInfo *TSInfo,
8387                                  Expr *SubExpr);
8388
8389  ExprResult ActOnObjCBridgedCast(Scope *S,
8390                                  SourceLocation LParenLoc,
8391                                  ObjCBridgeCastKind Kind,
8392                                  SourceLocation BridgeKeywordLoc,
8393                                  ParsedType Type,
8394                                  SourceLocation RParenLoc,
8395                                  Expr *SubExpr);
8396
8397  void CheckTollFreeBridgeCast(QualType castTypeExpr *castExpr);
8398
8399  void CheckObjCBridgeRelatedCast(QualType castTypeExpr *castExpr);
8400
8401  bool CheckTollFreeBridgeStaticCast(QualType castTypeExpr *castExpr,
8402                                     CastKind &Kind);
8403
8404  bool checkObjCBridgeRelatedComponents(SourceLocation Loc,
8405                                        QualType DestTypeQualType SrcType,
8406                                        ObjCInterfaceDecl *&RelatedClass,
8407                                        ObjCMethodDecl *&ClassMethod,
8408                                        ObjCMethodDecl *&InstanceMethod,
8409                                        TypedefNameDecl *&TDNDecl,
8410                                        bool CfToNsbool Diagnose = true);
8411
8412  bool CheckObjCBridgeRelatedConversions(SourceLocation Loc,
8413                                         QualType DestTypeQualType SrcType,
8414                                         Expr *&SrcExprbool Diagnose = true);
8415
8416  bool ConversionToObjCStringLiteralCheck(QualType DstTypeExpr *&SrcExpr,
8417                                          bool Diagnose = true);
8418
8419  bool checkInitMethod(ObjCMethodDecl *methodQualType receiverTypeIfCall);
8420
8421  /// Check whether the given new method is a valid override of the
8422  /// given overridden method, and set any properties that should be inherited.
8423  void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod,
8424                               const ObjCMethodDecl *Overridden);
8425
8426  /// Describes the compatibility of a result type with its method.
8427  enum ResultTypeCompatibilityKind {
8428    RTC_Compatible,
8429    RTC_Incompatible,
8430    RTC_Unknown
8431  };
8432
8433  void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod,
8434                                ObjCInterfaceDecl *CurrentClass,
8435                                ResultTypeCompatibilityKind RTC);
8436
8437  enum PragmaOptionsAlignKind {
8438    POAK_Native,  // #pragma options align=native
8439    POAK_Natural// #pragma options align=natural
8440    POAK_Packed,  // #pragma options align=packed
8441    POAK_Power,   // #pragma options align=power
8442    POAK_Mac68k,  // #pragma options align=mac68k
8443    POAK_Reset    // #pragma options align=reset
8444  };
8445
8446  /// ActOnPragmaClangSection - Called on well formed \#pragma clang section
8447  void ActOnPragmaClangSection(SourceLocation PragmaLoc,
8448                               PragmaClangSectionAction Action,
8449                               PragmaClangSectionKind SecKindStringRef SecName);
8450
8451  /// ActOnPragmaOptionsAlign - Called on well formed \#pragma options align.
8452  void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind,
8453                               SourceLocation PragmaLoc);
8454
8455  /// ActOnPragmaPack - Called on well formed \#pragma pack(...).
8456  void ActOnPragmaPack(SourceLocation PragmaLocPragmaMsStackAction Action,
8457                       StringRef SlotLabelExpr *Alignment);
8458
8459  enum class PragmaPackDiagnoseKind {
8460    NonDefaultStateAtInclude,
8461    ChangedStateAtExit
8462  };
8463
8464  void DiagnoseNonDefaultPragmaPack(PragmaPackDiagnoseKind Kind,
8465                                    SourceLocation IncludeLoc);
8466  void DiagnoseUnterminatedPragmaPack();
8467
8468  /// ActOnPragmaMSStruct - Called on well formed \#pragma ms_struct [on|off].
8469  void ActOnPragmaMSStruct(PragmaMSStructKind Kind);
8470
8471  /// ActOnPragmaMSComment - Called on well formed
8472  /// \#pragma comment(kind, "arg").
8473  void ActOnPragmaMSComment(SourceLocation CommentLocPragmaMSCommentKind Kind,
8474                            StringRef Arg);
8475
8476  /// ActOnPragmaMSPointersToMembers - called on well formed \#pragma
8477  /// pointers_to_members(representation method[, general purpose
8478  /// representation]).
8479  void ActOnPragmaMSPointersToMembers(
8480      LangOptions::PragmaMSPointersToMembersKind Kind,
8481      SourceLocation PragmaLoc);
8482
8483  /// Called on well formed \#pragma vtordisp().
8484  void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action,
8485                             SourceLocation PragmaLoc,
8486                             MSVtorDispAttr::Mode Value);
8487
8488  enum PragmaSectionKind {
8489    PSK_DataSeg,
8490    PSK_BSSSeg,
8491    PSK_ConstSeg,
8492    PSK_CodeSeg,
8493  };
8494
8495  bool UnifySection(StringRef SectionName,
8496                    int SectionFlags,
8497                    DeclaratorDecl *TheDecl);
8498  bool UnifySection(StringRef SectionName,
8499                    int SectionFlags,
8500                    SourceLocation PragmaSectionLocation);
8501
8502  /// Called on well formed \#pragma bss_seg/data_seg/const_seg/code_seg.
8503  void ActOnPragmaMSSeg(SourceLocation PragmaLocation,
8504                        PragmaMsStackAction Action,
8505                        llvm::StringRef StackSlotLabel,
8506                        StringLiteral *SegmentName,
8507                        llvm::StringRef PragmaName);
8508
8509  /// Called on well formed \#pragma section().
8510  void ActOnPragmaMSSection(SourceLocation PragmaLocation,
8511                            int SectionFlagsStringLiteral *SegmentName);
8512
8513  /// Called on well-formed \#pragma init_seg().
8514  void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation,
8515                            StringLiteral *SegmentName);
8516
8517  /// Called on #pragma clang __debug dump II
8518  void ActOnPragmaDump(Scope *SSourceLocation LocIdentifierInfo *II);
8519
8520  /// ActOnPragmaDetectMismatch - Call on well-formed \#pragma detect_mismatch
8521  void ActOnPragmaDetectMismatch(SourceLocation LocStringRef Name,
8522                                 StringRef Value);
8523
8524  /// ActOnPragmaUnused - Called on well-formed '\#pragma unused'.
8525  void ActOnPragmaUnused(const Token &Identifier,
8526                         Scope *curScope,
8527                         SourceLocation PragmaLoc);
8528
8529  /// ActOnPragmaVisibility - Called on well formed \#pragma GCC visibility... .
8530  void ActOnPragmaVisibility(const IdentifierInfoVisType,
8531                             SourceLocation PragmaLoc);
8532
8533  NamedDecl *DeclClonePragmaWeak(NamedDecl *NDIdentifierInfo *II,
8534                                 SourceLocation Loc);
8535  void DeclApplyPragmaWeak(Scope *SNamedDecl *NDWeakInfo &W);
8536
8537  /// ActOnPragmaWeakID - Called on well formed \#pragma weak ident.
8538  void ActOnPragmaWeakID(IdentifierInfoWeakName,
8539                         SourceLocation PragmaLoc,
8540                         SourceLocation WeakNameLoc);
8541
8542  /// ActOnPragmaRedefineExtname - Called on well formed
8543  /// \#pragma redefine_extname oldname newname.
8544  void ActOnPragmaRedefineExtname(IdentifierInfoWeakName,
8545                                  IdentifierInfoAliasName,
8546                                  SourceLocation PragmaLoc,
8547                                  SourceLocation WeakNameLoc,
8548                                  SourceLocation AliasNameLoc);
8549
8550  /// ActOnPragmaWeakAlias - Called on well formed \#pragma weak ident = ident.
8551  void ActOnPragmaWeakAlias(IdentifierInfoWeakName,
8552                            IdentifierInfoAliasName,
8553                            SourceLocation PragmaLoc,
8554                            SourceLocation WeakNameLoc,
8555                            SourceLocation AliasNameLoc);
8556
8557  /// ActOnPragmaFPContract - Called on well formed
8558  /// \#pragma {STDC,OPENCL} FP_CONTRACT and
8559  /// \#pragma clang fp contract
8560  void ActOnPragmaFPContract(LangOptions::FPContractModeKind FPC);
8561
8562  /// ActOnPragmaFenvAccess - Called on well formed
8563  /// \#pragma STDC FENV_ACCESS
8564  void ActOnPragmaFEnvAccess(LangOptions::FEnvAccessModeKind FPC);
8565
8566  /// AddAlignmentAttributesForRecord - Adds any needed alignment attributes to
8567  /// a the record decl, to handle '\#pragma pack' and '\#pragma options align'.
8568  void AddAlignmentAttributesForRecord(RecordDecl *RD);
8569
8570  /// AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
8571  void AddMsStructLayoutForRecord(RecordDecl *RD);
8572
8573  /// FreePackedContext - Deallocate and null out PackContext.
8574  void FreePackedContext();
8575
8576  /// PushNamespaceVisibilityAttr - Note that we've entered a
8577  /// namespace with a visibility attribute.
8578  void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr,
8579                                   SourceLocation Loc);
8580
8581  /// AddPushedVisibilityAttribute - If '\#pragma GCC visibility' was used,
8582  /// add an appropriate visibility attribute.
8583  void AddPushedVisibilityAttribute(Decl *RD);
8584
8585  /// PopPragmaVisibility - Pop the top element of the visibility stack; used
8586  /// for '\#pragma GCC visibility' and visibility attributes on namespaces.
8587  void PopPragmaVisibility(bool IsNamespaceEndSourceLocation EndLoc);
8588
8589  /// FreeVisContext - Deallocate and null out VisContext.
8590  void FreeVisContext();
8591
8592  /// AddCFAuditedAttribute - Check whether we're currently within
8593  /// '\#pragma clang arc_cf_code_audited' and, if so, consider adding
8594  /// the appropriate attribute.
8595  void AddCFAuditedAttribute(Decl *D);
8596
8597  void ActOnPragmaAttributeAttribute(ParsedAttr &Attribute,
8598                                     SourceLocation PragmaLoc,
8599                                     attr::ParsedSubjectMatchRuleSet Rules);
8600  void ActOnPragmaAttributeEmptyPush(SourceLocation PragmaLoc,
8601                                     const IdentifierInfo *Namespace);
8602
8603  /// Called on well-formed '\#pragma clang attribute pop'.
8604  void ActOnPragmaAttributePop(SourceLocation PragmaLoc,
8605                               const IdentifierInfo *Namespace);
8606
8607  /// Adds the attributes that have been specified using the
8608  /// '\#pragma clang attribute push' directives to the given declaration.
8609  void AddPragmaAttributes(Scope *SDecl *D);
8610
8611  void DiagnoseUnterminatedPragmaAttribute();
8612
8613  /// Called on well formed \#pragma clang optimize.
8614  void ActOnPragmaOptimize(bool OnSourceLocation PragmaLoc);
8615
8616  /// Get the location for the currently active "\#pragma clang optimize
8617  /// off". If this location is invalid, then the state of the pragma is "on".
8618  SourceLocation getOptimizeOffPragmaLocation() const {
8619    return OptimizeOffPragmaLocation;
8620  }
8621
8622  /// Only called on function definitions; if there is a pragma in scope
8623  /// with the effect of a range-based optnone, consider marking the function
8624  /// with attribute optnone.
8625  void AddRangeBasedOptnone(FunctionDecl *FD);
8626
8627  /// Adds the 'optnone' attribute to the function declaration if there
8628  /// are no conflicts; Loc represents the location causing the 'optnone'
8629  /// attribute to be added (usually because of a pragma).
8630  void AddOptnoneAttributeIfNoConflicts(FunctionDecl *FDSourceLocation Loc);
8631
8632  /// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
8633  void AddAlignedAttr(SourceRange AttrRangeDecl *DExpr *E,
8634                      unsigned SpellingListIndexbool IsPackExpansion);
8635  void AddAlignedAttr(SourceRange AttrRangeDecl *DTypeSourceInfo *T,
8636                      unsigned SpellingListIndexbool IsPackExpansion);
8637
8638  /// AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular
8639  /// declaration.
8640  void AddAssumeAlignedAttr(SourceRange AttrRangeDecl *DExpr *EExpr *OE,
8641                            unsigned SpellingListIndex);
8642
8643  /// AddAllocAlignAttr - Adds an alloc_align attribute to a particular
8644  /// declaration.
8645  void AddAllocAlignAttr(SourceRange AttrRangeDecl *DExpr *ParamExpr,
8646                         unsigned SpellingListIndex);
8647
8648  /// AddAlignValueAttr - Adds an align_value attribute to a particular
8649  /// declaration.
8650  void AddAlignValueAttr(SourceRange AttrRangeDecl *DExpr *E,
8651                         unsigned SpellingListIndex);
8652
8653  /// AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular
8654  /// declaration.
8655  void AddLaunchBoundsAttr(SourceRange AttrRangeDecl *DExpr *MaxThreads,
8656                           Expr *MinBlocksunsigned SpellingListIndex);
8657
8658  /// AddModeAttr - Adds a mode attribute to a particular declaration.
8659  void AddModeAttr(SourceRange AttrRangeDecl *DIdentifierInfo *Name,
8660                   unsigned SpellingListIndexbool InInstantiation = false);
8661
8662  void AddParameterABIAttr(SourceRange AttrRangeDecl *D,
8663                           ParameterABI ABIunsigned SpellingListIndex);
8664
8665  enum class RetainOwnershipKind {NSCFOS};
8666  void AddXConsumedAttr(Decl *DSourceRange SRunsigned SpellingIndex,
8667                        RetainOwnershipKind Kbool IsTemplateInstantiation);
8668
8669  /// addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size
8670  /// attribute to a particular declaration.
8671  void addAMDGPUFlatWorkGroupSizeAttr(SourceRange AttrRangeDecl *DExpr *Min,
8672                                      Expr *Maxunsigned SpellingListIndex);
8673
8674  /// addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a
8675  /// particular declaration.
8676  void addAMDGPUWavesPerEUAttr(SourceRange AttrRangeDecl *DExpr *Min,
8677                               Expr *Maxunsigned SpellingListIndex);
8678
8679  bool checkNSReturnsRetainedReturnType(SourceLocation locQualType type);
8680
8681  //===--------------------------------------------------------------------===//
8682  // C++ Coroutines TS
8683  //
8684  bool ActOnCoroutineBodyStart(Scope *SSourceLocation KwLoc,
8685                               StringRef Keyword);
8686  ExprResult ActOnCoawaitExpr(Scope *SSourceLocation KwLocExpr *E);
8687  ExprResult ActOnCoyieldExpr(Scope *SSourceLocation KwLocExpr *E);
8688  StmtResult ActOnCoreturnStmt(Scope *SSourceLocation KwLocExpr *E);
8689
8690  ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLocExpr *E,
8691                                      bool IsImplicit = false);
8692  ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLocExpr *E,
8693                                        UnresolvedLookupExprLookup);
8694  ExprResult BuildCoyieldExpr(SourceLocation KwLocExpr *E);
8695  StmtResult BuildCoreturnStmt(SourceLocation KwLocExpr *E,
8696                               bool IsImplicit = false);
8697  StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs);
8698  bool buildCoroutineParameterMoves(SourceLocation Loc);
8699  VarDecl *buildCoroutinePromise(SourceLocation Loc);
8700  void CheckCompletedCoroutineBody(FunctionDecl *FDStmt *&Body);
8701  ClassTemplateDecl *lookupCoroutineTraits(SourceLocation KwLoc,
8702                                           SourceLocation FuncLoc);
8703
8704  //===--------------------------------------------------------------------===//
8705  // OpenCL extensions.
8706  //
8707private:
8708  std::string CurrOpenCLExtension;
8709  /// Extensions required by an OpenCL type.
8710  llvm::DenseMap<const Type*, std::set<std::string>> OpenCLTypeExtMap;
8711  /// Extensions required by an OpenCL declaration.
8712  llvm::DenseMap<const Decl*, std::set<std::string>> OpenCLDeclExtMap;
8713public:
8714  llvm::StringRef getCurrentOpenCLExtension() const {
8715    return CurrOpenCLExtension;
8716  }
8717
8718  /// Check if a function declaration \p FD associates with any
8719  /// extensions present in OpenCLDeclExtMap and if so return the
8720  /// extension(s) name(s).
8721  std::string getOpenCLExtensionsFromDeclExtMap(FunctionDecl *FD);
8722
8723  /// Check if a function type \p FT associates with any
8724  /// extensions present in OpenCLTypeExtMap and if so return the
8725  /// extension(s) name(s).
8726  std::string getOpenCLExtensionsFromTypeExtMap(FunctionType *FT);
8727
8728  /// Find an extension in an appropriate extension map and return its name
8729  template<typename T, typename MapT>
8730  std::string getOpenCLExtensionsFromExtMap(T* FT, MapT &Map);
8731
8732  void setCurrentOpenCLExtension(llvm::StringRef Ext) {
8733    CurrOpenCLExtension = Ext;
8734  }
8735
8736  /// Set OpenCL extensions for a type which can only be used when these
8737  /// OpenCL extensions are enabled. If \p Exts is empty, do nothing.
8738  /// \param Exts A space separated list of OpenCL extensions.
8739  void setOpenCLExtensionForType(QualType Tllvm::StringRef Exts);
8740
8741  /// Set OpenCL extensions for a declaration which can only be
8742  /// used when these OpenCL extensions are enabled. If \p Exts is empty, do
8743  /// nothing.
8744  /// \param Exts A space separated list of OpenCL extensions.
8745  void setOpenCLExtensionForDecl(Decl *FDllvm::StringRef Exts);
8746
8747  /// Set current OpenCL extensions for a type which can only be used
8748  /// when these OpenCL extensions are enabled. If current OpenCL extension is
8749  /// empty, do nothing.
8750  void setCurrentOpenCLExtensionForType(QualType T);
8751
8752  /// Set current OpenCL extensions for a declaration which
8753  /// can only be used when these OpenCL extensions are enabled. If current
8754  /// OpenCL extension is empty, do nothing.
8755  void setCurrentOpenCLExtensionForDecl(Decl *FD);
8756
8757  bool isOpenCLDisabledDecl(Decl *FD);
8758
8759  /// Check if type \p T corresponding to declaration specifier \p DS
8760  /// is disabled due to required OpenCL extensions being disabled. If so,
8761  /// emit diagnostics.
8762  /// \return true if type is disabled.
8763  bool checkOpenCLDisabledTypeDeclSpec(const DeclSpec &DSQualType T);
8764
8765  /// Check if declaration \p D used by expression \p E
8766  /// is disabled due to required OpenCL extensions being disabled. If so,
8767  /// emit diagnostics.
8768  /// \return true if type is disabled.
8769  bool checkOpenCLDisabledDecl(const NamedDecl &Dconst Expr &E);
8770
8771  //===--------------------------------------------------------------------===//
8772  // OpenMP directives and clauses.
8773  //
8774private:
8775  void *VarDataSharingAttributesStack;
8776  /// Number of nested '#pragma omp declare target' directives.
8777  unsigned DeclareTargetNestingLevel = 0;
8778  /// Initialization of data-sharing attributes stack.
8779  void InitDataSharingAttributesStack();
8780  void DestroyDataSharingAttributesStack();
8781  ExprResult
8782  VerifyPositiveIntegerConstantInClause(Expr *OpOpenMPClauseKind CKind,
8783                                        bool StrictlyPositive = true);
8784  /// Returns OpenMP nesting level for current directive.
8785  unsigned getOpenMPNestingLevel() const;
8786
8787  /// Adjusts the function scopes index for the target-based regions.
8788  void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex,
8789                                    unsigned Levelconst;
8790
8791  /// Push new OpenMP function region for non-capturing function.
8792  void pushOpenMPFunctionRegion();
8793
8794  /// Pop OpenMP function region for non-capturing function.
8795  void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
8796
8797  /// Check whether we're allowed to call Callee from the current function.
8798  void checkOpenMPDeviceFunction(SourceLocation LocFunctionDecl *Callee);
8799
8800  /// Check if the expression is allowed to be used in expressions for the
8801  /// OpenMP devices.
8802  void checkOpenMPDeviceExpr(const Expr *E);
8803
8804  /// Checks if a type or a declaration is disabled due to the owning extension
8805  /// being disabled, and emits diagnostic messages if it is disabled.
8806  /// \param D type or declaration to be checked.
8807  /// \param DiagLoc source location for the diagnostic message.
8808  /// \param DiagInfo information to be emitted for the diagnostic message.
8809  /// \param SrcRange source range of the declaration.
8810  /// \param Map maps type or declaration to the extensions.
8811  /// \param Selector selects diagnostic message: 0 for type and 1 for
8812  ///        declaration.
8813  /// \return true if the type or declaration is disabled.
8814  template <typename T, typename DiagLocT, typename DiagInfoT, typename MapT>
8815  bool checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc, DiagInfoT DiagInfo,
8816                                     MapT &Mapunsigned Selector = 0,
8817                                     SourceRange SrcRange = SourceRange());
8818
8819public:
8820  /// Return true if the provided declaration \a VD should be captured by
8821  /// reference.
8822  /// \param Level Relative level of nested OpenMP construct for that the check
8823  /// is performed.
8824  bool isOpenMPCapturedByRef(const ValueDecl *Dunsigned Levelconst;
8825
8826  /// Check if the specified variable is used in one of the private
8827  /// clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP
8828  /// constructs.
8829  VarDecl *isOpenMPCapturedDecl(ValueDecl *D);
8830  ExprResult getOpenMPCapturedExpr(VarDecl *CaptureExprValueKind VK,
8831                                   ExprObjectKind OKSourceLocation Loc);
8832
8833  /// If the current region is a loop-based region, mark the start of the loop
8834  /// construct.
8835  void startOpenMPLoop();
8836
8837  /// Check if the specified variable is used in 'private' clause.
8838  /// \param Level Relative level of nested OpenMP construct for that the check
8839  /// is performed.
8840  bool isOpenMPPrivateDecl(const ValueDecl *Dunsigned Levelconst;
8841
8842  /// Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.)
8843  /// for \p FD based on DSA for the provided corresponding captured declaration
8844  /// \p D.
8845  void setOpenMPCaptureKind(FieldDecl *FDconst ValueDecl *Dunsigned Level);
8846
8847  /// Check if the specified variable is captured  by 'target' directive.
8848  /// \param Level Relative level of nested OpenMP construct for that the check
8849  /// is performed.
8850  bool isOpenMPTargetCapturedDecl(const ValueDecl *Dunsigned Levelconst;
8851
8852  ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc,
8853                                                    Expr *Op);
8854  /// Called on start of new data sharing attribute block.
8855  void StartOpenMPDSABlock(OpenMPDirectiveKind K,
8856                           const DeclarationNameInfo &DirNameScope *CurScope,
8857                           SourceLocation Loc);
8858  /// Start analysis of clauses.
8859  void StartOpenMPClause(OpenMPClauseKind K);
8860  /// End analysis of clauses.
8861  void EndOpenMPClause();
8862  /// Called on end of data sharing attribute block.
8863  void EndOpenMPDSABlock(Stmt *CurDirective);
8864
8865  /// Check if the current region is an OpenMP loop region and if it is,
8866  /// mark loop control variable, used in \p Init for loop initialization, as
8867  /// private by default.
8868  /// \param Init First part of the for loop.
8869  void ActOnOpenMPLoopInitialization(SourceLocation ForLocStmt *Init);
8870
8871  // OpenMP directives and clauses.
8872  /// Called on correct id-expression from the '#pragma omp
8873  /// threadprivate'.
8874  ExprResult ActOnOpenMPIdExpression(Scope *CurScopeCXXScopeSpec &ScopeSpec,
8875                                     const DeclarationNameInfo &Id,
8876                                     OpenMPDirectiveKind Kind);
8877  /// Called on well-formed '#pragma omp threadprivate'.
8878  DeclGroupPtrTy ActOnOpenMPThreadprivateDirective(
8879                                     SourceLocation Loc,
8880                                     ArrayRef<Expr *> VarList);
8881  /// Builds a new OpenMPThreadPrivateDecl and checks its correctness.
8882  OMPThreadPrivateDecl *CheckOMPThreadPrivateDecl(SourceLocation Loc,
8883                                                  ArrayRef<Expr *> VarList);
8884  /// Called on well-formed '#pragma omp allocate'.
8885  DeclGroupPtrTy ActOnOpenMPAllocateDirective(SourceLocation Loc,
8886                                              ArrayRef<Expr *> VarList,
8887                                              ArrayRef<OMPClause *> Clauses,
8888                                              DeclContext *Owner = nullptr);
8889  /// Called on well-formed '#pragma omp requires'.
8890  DeclGroupPtrTy ActOnOpenMPRequiresDirective(SourceLocation Loc,
8891                                              ArrayRef<OMPClause *> ClauseList);
8892  /// Check restrictions on Requires directive
8893  OMPRequiresDecl *CheckOMPRequiresDecl(SourceLocation Loc,
8894                                        ArrayRef<OMPClause *> Clauses);
8895  /// Check if the specified type is allowed to be used in 'omp declare
8896  /// reduction' construct.
8897  QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc,
8898                                           TypeResult ParsedType);
8899  /// Called on start of '#pragma omp declare reduction'.
8900  DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveStart(
8901      Scope *SDeclContext *DCDeclarationName Name,
8902      ArrayRef<std::pair<QualTypeSourceLocation>> ReductionTypes,
8903      AccessSpecifier ASDecl *PrevDeclInScope = nullptr);
8904  /// Initialize declare reduction construct initializer.
8905  void ActOnOpenMPDeclareReductionCombinerStart(Scope *SDecl *D);
8906  /// Finish current declare reduction construct initializer.
8907  void ActOnOpenMPDeclareReductionCombinerEnd(Decl *DExpr *Combiner);
8908  /// Initialize declare reduction construct initializer.
8909  /// \return omp_priv variable.
8910  VarDecl *ActOnOpenMPDeclareReductionInitializerStart(Scope *SDecl *D);
8911  /// Finish current declare reduction construct initializer.
8912  void ActOnOpenMPDeclareReductionInitializerEnd(Decl *DExpr *Initializer,
8913                                                 VarDecl *OmpPrivParm);
8914  /// Called at the end of '#pragma omp declare reduction'.
8915  DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(
8916      Scope *SDeclGroupPtrTy DeclReductionsbool IsValid);
8917
8918  /// Check variable declaration in 'omp declare mapper' construct.
8919  TypeResult ActOnOpenMPDeclareMapperVarDecl(Scope *SDeclarator &D);
8920  /// Check if the specified type is allowed to be used in 'omp declare
8921  /// mapper' construct.
8922  QualType ActOnOpenMPDeclareMapperType(SourceLocation TyLoc,
8923                                        TypeResult ParsedType);
8924  /// Called on start of '#pragma omp declare mapper'.
8925  OMPDeclareMapperDecl *ActOnOpenMPDeclareMapperDirectiveStart(
8926      Scope *SDeclContext *DCDeclarationName NameQualType MapperType,
8927      SourceLocation StartLocDeclarationName VNAccessSpecifier AS,
8928      Decl *PrevDeclInScope = nullptr);
8929  /// Build the mapper variable of '#pragma omp declare mapper'.
8930  void ActOnOpenMPDeclareMapperDirectiveVarDecl(OMPDeclareMapperDecl *DMD,
8931                                                Scope *SQualType MapperType,
8932                                                SourceLocation StartLoc,
8933                                                DeclarationName VN);
8934  /// Called at the end of '#pragma omp declare mapper'.
8935  DeclGroupPtrTy
8936  ActOnOpenMPDeclareMapperDirectiveEnd(OMPDeclareMapperDecl *DScope *S,
8937                                       ArrayRef<OMPClause *> ClauseList);
8938
8939  /// Called on the start of target region i.e. '#pragma omp declare target'.
8940  bool ActOnStartOpenMPDeclareTargetDirective(SourceLocation Loc);
8941  /// Called at the end of target region i.e. '#pragme omp end declare target'.
8942  void ActOnFinishOpenMPDeclareTargetDirective();
8943  /// Called on correct id-expression from the '#pragma omp declare target'.
8944  void ActOnOpenMPDeclareTargetName(Scope *CurScopeCXXScopeSpec &ScopeSpec,
8945                                    const DeclarationNameInfo &Id,
8946                                    OMPDeclareTargetDeclAttr::MapTypeTy MT,
8947                                    NamedDeclSetType &SameDirectiveDecls);
8948  /// Check declaration inside target region.
8949  void
8950  checkDeclIsAllowedInOpenMPTarget(Expr *EDecl *D,
8951                                   SourceLocation IdLoc = SourceLocation());
8952  /// Return true inside OpenMP declare target region.
8953  bool isInOpenMPDeclareTargetContext() const {
8954    return DeclareTargetNestingLevel > 0;
8955  }
8956  /// Return true inside OpenMP target region.
8957  bool isInOpenMPTargetExecutionDirective() const;
8958  /// Return true if (un)supported features for the current target should be
8959  /// diagnosed if OpenMP (offloading) is enabled.
8960  bool shouldDiagnoseTargetSupportFromOpenMP() const {
8961    return !getLangOpts().OpenMPIsDevice || isInOpenMPDeclareTargetContext() ||
8962      isInOpenMPTargetExecutionDirective();
8963  }
8964
8965  /// Return the number of captured regions created for an OpenMP directive.
8966  static int getOpenMPCaptureLevels(OpenMPDirectiveKind Kind);
8967
8968  /// Initialization of captured region for OpenMP region.
8969  void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKindScope *CurScope);
8970  /// End of OpenMP region.
8971  ///
8972  /// \param S Statement associated with the current OpenMP region.
8973  /// \param Clauses List of clauses for the current OpenMP region.
8974  ///
8975  /// \returns Statement for finished OpenMP region.
8976  StmtResult ActOnOpenMPRegionEnd(StmtResult SArrayRef<OMPClause *> Clauses);
8977  StmtResult ActOnOpenMPExecutableDirective(
8978      OpenMPDirectiveKind Kindconst DeclarationNameInfo &DirName,
8979      OpenMPDirectiveKind CancelRegionArrayRef<OMPClause *> Clauses,
8980      Stmt *AStmtSourceLocation StartLocSourceLocation EndLoc);
8981  /// Called on well-formed '\#pragma omp parallel' after parsing
8982  /// of the  associated statement.
8983  StmtResult ActOnOpenMPParallelDirective(ArrayRef<OMPClause *> Clauses,
8984                                          Stmt *AStmt,
8985                                          SourceLocation StartLoc,
8986                                          SourceLocation EndLoc);
8987  using VarsWithInheritedDSAType =
8988      llvm::SmallDenseMap<const ValueDecl *, const Expr *, 4>;
8989  /// Called on well-formed '\#pragma omp simd' after parsing
8990  /// of the associated statement.
8991  StmtResult
8992  ActOnOpenMPSimdDirective(ArrayRef<OMPClause *> ClausesStmt *AStmt,
8993                           SourceLocation StartLocSourceLocation EndLoc,
8994                           VarsWithInheritedDSAType &VarsWithImplicitDSA);
8995  /// Called on well-formed '\#pragma omp for' after parsing
8996  /// of the associated statement.
8997  StmtResult
8998  ActOnOpenMPForDirective(ArrayRef<OMPClause *> ClausesStmt *AStmt,
8999                          SourceLocation StartLocSourceLocation EndLoc,
9000                          VarsWithInheritedDSAType &VarsWithImplicitDSA);
9001  /// Called on well-formed '\#pragma omp for simd' after parsing
9002  /// of the associated statement.
9003  StmtResult
9004  ActOnOpenMPForSimdDirective(ArrayRef<OMPClause *> ClausesStmt *AStmt,
9005                              SourceLocation StartLocSourceLocation EndLoc,
9006                              VarsWithInheritedDSAType &VarsWithImplicitDSA);
9007  /// Called on well-formed '\#pragma omp sections' after parsing
9008  /// of the associated statement.
9009  StmtResult ActOnOpenMPSectionsDirective(ArrayRef<OMPClause *> Clauses,
9010                                          Stmt *AStmtSourceLocation StartLoc,
9011                                          SourceLocation EndLoc);
9012  /// Called on well-formed '\#pragma omp section' after parsing of the
9013  /// associated statement.
9014  StmtResult ActOnOpenMPSectionDirective(Stmt *AStmtSourceLocation StartLoc,
9015                                         SourceLocation EndLoc);
9016  /// Called on well-formed '\#pragma omp single' after parsing of the
9017  /// associated statement.
9018  StmtResult ActOnOpenMPSingleDirective(ArrayRef<OMPClause *> Clauses,
9019                                        Stmt *AStmtSourceLocation StartLoc,
9020                                        SourceLocation EndLoc);
9021  /// Called on well-formed '\#pragma omp master' after parsing of the
9022  /// associated statement.
9023  StmtResult ActOnOpenMPMasterDirective(Stmt *AStmtSourceLocation StartLoc,
9024                                        SourceLocation EndLoc);
9025  /// Called on well-formed '\#pragma omp critical' after parsing of the
9026  /// associated statement.
9027  StmtResult ActOnOpenMPCriticalDirective(const DeclarationNameInfo &DirName,
9028                                          ArrayRef<OMPClause *> Clauses,
9029                                          Stmt *AStmtSourceLocation StartLoc,
9030                                          SourceLocation EndLoc);
9031  /// Called on well-formed '\#pragma omp parallel for' after parsing
9032  /// of the  associated statement.
9033  StmtResult ActOnOpenMPParallelForDirective(
9034      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9035      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9036  /// Called on well-formed '\#pragma omp parallel for simd' after
9037  /// parsing of the  associated statement.
9038  StmtResult ActOnOpenMPParallelForSimdDirective(
9039      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9040      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9041  /// Called on well-formed '\#pragma omp parallel sections' after
9042  /// parsing of the  associated statement.
9043  StmtResult ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *> Clauses,
9044                                                  Stmt *AStmt,
9045                                                  SourceLocation StartLoc,
9046                                                  SourceLocation EndLoc);
9047  /// Called on well-formed '\#pragma omp task' after parsing of the
9048  /// associated statement.
9049  StmtResult ActOnOpenMPTaskDirective(ArrayRef<OMPClause *> Clauses,
9050                                      Stmt *AStmtSourceLocation StartLoc,
9051                                      SourceLocation EndLoc);
9052  /// Called on well-formed '\#pragma omp taskyield'.
9053  StmtResult ActOnOpenMPTaskyieldDirective(SourceLocation StartLoc,
9054                                           SourceLocation EndLoc);
9055  /// Called on well-formed '\#pragma omp barrier'.
9056  StmtResult ActOnOpenMPBarrierDirective(SourceLocation StartLoc,
9057                                         SourceLocation EndLoc);
9058  /// Called on well-formed '\#pragma omp taskwait'.
9059  StmtResult ActOnOpenMPTaskwaitDirective(SourceLocation StartLoc,
9060                                          SourceLocation EndLoc);
9061  /// Called on well-formed '\#pragma omp taskgroup'.
9062  StmtResult ActOnOpenMPTaskgroupDirective(ArrayRef<OMPClause *> Clauses,
9063                                           Stmt *AStmtSourceLocation StartLoc,
9064                                           SourceLocation EndLoc);
9065  /// Called on well-formed '\#pragma omp flush'.
9066  StmtResult ActOnOpenMPFlushDirective(ArrayRef<OMPClause *> Clauses,
9067                                       SourceLocation StartLoc,
9068                                       SourceLocation EndLoc);
9069  /// Called on well-formed '\#pragma omp ordered' after parsing of the
9070  /// associated statement.
9071  StmtResult ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses,
9072                                         Stmt *AStmtSourceLocation StartLoc,
9073                                         SourceLocation EndLoc);
9074  /// Called on well-formed '\#pragma omp atomic' after parsing of the
9075  /// associated statement.
9076  StmtResult ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses,
9077                                        Stmt *AStmtSourceLocation StartLoc,
9078                                        SourceLocation EndLoc);
9079  /// Called on well-formed '\#pragma omp target' after parsing of the
9080  /// associated statement.
9081  StmtResult ActOnOpenMPTargetDirective(ArrayRef<OMPClause *> Clauses,
9082                                        Stmt *AStmtSourceLocation StartLoc,
9083                                        SourceLocation EndLoc);
9084  /// Called on well-formed '\#pragma omp target data' after parsing of
9085  /// the associated statement.
9086  StmtResult ActOnOpenMPTargetDataDirective(ArrayRef<OMPClause *> Clauses,
9087                                            Stmt *AStmtSourceLocation StartLoc,
9088                                            SourceLocation EndLoc);
9089  /// Called on well-formed '\#pragma omp target enter data' after
9090  /// parsing of the associated statement.
9091  StmtResult ActOnOpenMPTargetEnterDataDirective(ArrayRef<OMPClause *> Clauses,
9092                                                 SourceLocation StartLoc,
9093                                                 SourceLocation EndLoc,
9094                                                 Stmt *AStmt);
9095  /// Called on well-formed '\#pragma omp target exit data' after
9096  /// parsing of the associated statement.
9097  StmtResult ActOnOpenMPTargetExitDataDirective(ArrayRef<OMPClause *> Clauses,
9098                                                SourceLocation StartLoc,
9099                                                SourceLocation EndLoc,
9100                                                Stmt *AStmt);
9101  /// Called on well-formed '\#pragma omp target parallel' after
9102  /// parsing of the associated statement.
9103  StmtResult ActOnOpenMPTargetParallelDirective(ArrayRef<OMPClause *> Clauses,
9104                                                Stmt *AStmt,
9105                                                SourceLocation StartLoc,
9106                                                SourceLocation EndLoc);
9107  /// Called on well-formed '\#pragma omp target parallel for' after
9108  /// parsing of the  associated statement.
9109  StmtResult ActOnOpenMPTargetParallelForDirective(
9110      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9111      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9112  /// Called on well-formed '\#pragma omp teams' after parsing of the
9113  /// associated statement.
9114  StmtResult ActOnOpenMPTeamsDirective(ArrayRef<OMPClause *> Clauses,
9115                                       Stmt *AStmtSourceLocation StartLoc,
9116                                       SourceLocation EndLoc);
9117  /// Called on well-formed '\#pragma omp cancellation point'.
9118  StmtResult
9119  ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc,
9120                                        SourceLocation EndLoc,
9121                                        OpenMPDirectiveKind CancelRegion);
9122  /// Called on well-formed '\#pragma omp cancel'.
9123  StmtResult ActOnOpenMPCancelDirective(ArrayRef<OMPClause *> Clauses,
9124                                        SourceLocation StartLoc,
9125                                        SourceLocation EndLoc,
9126                                        OpenMPDirectiveKind CancelRegion);
9127  /// Called on well-formed '\#pragma omp taskloop' after parsing of the
9128  /// associated statement.
9129  StmtResult
9130  ActOnOpenMPTaskLoopDirective(ArrayRef<OMPClause *> ClausesStmt *AStmt,
9131                               SourceLocation StartLocSourceLocation EndLoc,
9132                               VarsWithInheritedDSAType &VarsWithImplicitDSA);
9133  /// Called on well-formed '\#pragma omp taskloop simd' after parsing of
9134  /// the associated statement.
9135  StmtResult ActOnOpenMPTaskLoopSimdDirective(
9136      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9137      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9138  /// Called on well-formed '\#pragma omp distribute' after parsing
9139  /// of the associated statement.
9140  StmtResult
9141  ActOnOpenMPDistributeDirective(ArrayRef<OMPClause *> ClausesStmt *AStmt,
9142                                 SourceLocation StartLocSourceLocation EndLoc,
9143                                 VarsWithInheritedDSAType &VarsWithImplicitDSA);
9144  /// Called on well-formed '\#pragma omp target update'.
9145  StmtResult ActOnOpenMPTargetUpdateDirective(ArrayRef<OMPClause *> Clauses,
9146                                              SourceLocation StartLoc,
9147                                              SourceLocation EndLoc,
9148                                              Stmt *AStmt);
9149  /// Called on well-formed '\#pragma omp distribute parallel for' after
9150  /// parsing of the associated statement.
9151  StmtResult ActOnOpenMPDistributeParallelForDirective(
9152      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9153      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9154  /// Called on well-formed '\#pragma omp distribute parallel for simd'
9155  /// after parsing of the associated statement.
9156  StmtResult ActOnOpenMPDistributeParallelForSimdDirective(
9157      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9158      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9159  /// Called on well-formed '\#pragma omp distribute simd' after
9160  /// parsing of the associated statement.
9161  StmtResult ActOnOpenMPDistributeSimdDirective(
9162      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9163      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9164  /// Called on well-formed '\#pragma omp target parallel for simd' after
9165  /// parsing of the associated statement.
9166  StmtResult ActOnOpenMPTargetParallelForSimdDirective(
9167      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9168      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9169  /// Called on well-formed '\#pragma omp target simd' after parsing of
9170  /// the associated statement.
9171  StmtResult
9172  ActOnOpenMPTargetSimdDirective(ArrayRef<OMPClause *> ClausesStmt *AStmt,
9173                                 SourceLocation StartLocSourceLocation EndLoc,
9174                                 VarsWithInheritedDSAType &VarsWithImplicitDSA);
9175  /// Called on well-formed '\#pragma omp teams distribute' after parsing of
9176  /// the associated statement.
9177  StmtResult ActOnOpenMPTeamsDistributeDirective(
9178      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9179      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9180  /// Called on well-formed '\#pragma omp teams distribute simd' after parsing
9181  /// of the associated statement.
9182  StmtResult ActOnOpenMPTeamsDistributeSimdDirective(
9183      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9184      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9185  /// Called on well-formed '\#pragma omp teams distribute parallel for simd'
9186  /// after parsing of the associated statement.
9187  StmtResult ActOnOpenMPTeamsDistributeParallelForSimdDirective(
9188      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9189      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9190  /// Called on well-formed '\#pragma omp teams distribute parallel for'
9191  /// after parsing of the associated statement.
9192  StmtResult ActOnOpenMPTeamsDistributeParallelForDirective(
9193      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9194      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9195  /// Called on well-formed '\#pragma omp target teams' after parsing of the
9196  /// associated statement.
9197  StmtResult ActOnOpenMPTargetTeamsDirective(ArrayRef<OMPClause *> Clauses,
9198                                             Stmt *AStmt,
9199                                             SourceLocation StartLoc,
9200                                             SourceLocation EndLoc);
9201  /// Called on well-formed '\#pragma omp target teams distribute' after parsing
9202  /// of the associated statement.
9203  StmtResult ActOnOpenMPTargetTeamsDistributeDirective(
9204      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9205      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9206  /// Called on well-formed '\#pragma omp target teams distribute parallel for'
9207  /// after parsing of the associated statement.
9208  StmtResult ActOnOpenMPTargetTeamsDistributeParallelForDirective(
9209      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9210      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9211  /// Called on well-formed '\#pragma omp target teams distribute parallel for
9212  /// simd' after parsing of the associated statement.
9213  StmtResult ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(
9214      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9215      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9216  /// Called on well-formed '\#pragma omp target teams distribute simd' after
9217  /// parsing of the associated statement.
9218  StmtResult ActOnOpenMPTargetTeamsDistributeSimdDirective(
9219      ArrayRef<OMPClause *> ClausesStmt *AStmtSourceLocation StartLoc,
9220      SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
9221
9222  /// Checks correctness of linear modifiers.
9223  bool CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind,
9224                                 SourceLocation LinLoc);
9225  /// Checks that the specified declaration matches requirements for the linear
9226  /// decls.
9227  bool CheckOpenMPLinearDecl(const ValueDecl *DSourceLocation ELoc,
9228                             OpenMPLinearClauseKind LinKindQualType Type);
9229
9230  /// Called on well-formed '\#pragma omp declare simd' after parsing of
9231  /// the associated method/function.
9232  DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(
9233      DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS,
9234      Expr *SimdlenArrayRef<Expr *> UniformsArrayRef<Expr *> Aligneds,
9235      ArrayRef<Expr *> AlignmentsArrayRef<Expr *> Linears,
9236      ArrayRef<unsignedLinModifiersArrayRef<Expr *> StepsSourceRange SR);
9237
9238  OMPClause *ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind,
9239                                         Expr *Expr,
9240                                         SourceLocation StartLoc,
9241                                         SourceLocation LParenLoc,
9242                                         SourceLocation EndLoc);
9243  /// Called on well-formed 'allocator' clause.
9244  OMPClause *ActOnOpenMPAllocatorClause(Expr *Allocator,
9245                                        SourceLocation StartLoc,
9246                                        SourceLocation LParenLoc,
9247                                        SourceLocation EndLoc);
9248  /// Called on well-formed 'if' clause.
9249  OMPClause *ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier,
9250                                 Expr *ConditionSourceLocation StartLoc,
9251                                 SourceLocation LParenLoc,
9252                                 SourceLocation NameModifierLoc,
9253                                 SourceLocation ColonLoc,
9254                                 SourceLocation EndLoc);
9255  /// Called on well-formed 'final' clause.
9256  OMPClause *ActOnOpenMPFinalClause(Expr *ConditionSourceLocation StartLoc,
9257                                    SourceLocation LParenLoc,
9258                                    SourceLocation EndLoc);
9259  /// Called on well-formed 'num_threads' clause.
9260  OMPClause *ActOnOpenMPNumThreadsClause(Expr *NumThreads,
9261                                         SourceLocation StartLoc,
9262                                         SourceLocation LParenLoc,
9263                                         SourceLocation EndLoc);
9264  /// Called on well-formed 'safelen' clause.
9265  OMPClause *ActOnOpenMPSafelenClause(Expr *Length,
9266                                      SourceLocation StartLoc,
9267                                      SourceLocation LParenLoc,
9268                                      SourceLocation EndLoc);
9269  /// Called on well-formed 'simdlen' clause.
9270  OMPClause *ActOnOpenMPSimdlenClause(Expr *LengthSourceLocation StartLoc,
9271                                      SourceLocation LParenLoc,
9272                                      SourceLocation EndLoc);
9273  /// Called on well-formed 'collapse' clause.
9274  OMPClause *ActOnOpenMPCollapseClause(Expr *NumForLoops,
9275                                       SourceLocation StartLoc,
9276                                       SourceLocation LParenLoc,
9277                                       SourceLocation EndLoc);
9278  /// Called on well-formed 'ordered' clause.
9279  OMPClause *
9280  ActOnOpenMPOrderedClause(SourceLocation StartLocSourceLocation EndLoc,
9281                           SourceLocation LParenLoc = SourceLocation(),
9282                           Expr *NumForLoops = nullptr);
9283  /// Called on well-formed 'grainsize' clause.
9284  OMPClause *ActOnOpenMPGrainsizeClause(Expr *SizeSourceLocation StartLoc,
9285                                        SourceLocation LParenLoc,
9286                                        SourceLocation EndLoc);
9287  /// Called on well-formed 'num_tasks' clause.
9288  OMPClause *ActOnOpenMPNumTasksClause(Expr *NumTasksSourceLocation StartLoc,
9289                                       SourceLocation LParenLoc,
9290                                       SourceLocation EndLoc);
9291  /// Called on well-formed 'hint' clause.
9292  OMPClause *ActOnOpenMPHintClause(Expr *HintSourceLocation StartLoc,
9293                                   SourceLocation LParenLoc,
9294                                   SourceLocation EndLoc);
9295
9296  OMPClause *ActOnOpenMPSimpleClause(OpenMPClauseKind Kind,
9297                                     unsigned Argument,
9298                                     SourceLocation ArgumentLoc,
9299                                     SourceLocation StartLoc,
9300                                     SourceLocation LParenLoc,
9301                                     SourceLocation EndLoc);
9302  /// Called on well-formed 'default' clause.
9303  OMPClause *ActOnOpenMPDefaultClause(OpenMPDefaultClauseKind Kind,
9304                                      SourceLocation KindLoc,
9305                                      SourceLocation StartLoc,
9306                                      SourceLocation LParenLoc,
9307                                      SourceLocation EndLoc);
9308  /// Called on well-formed 'proc_bind' clause.
9309  OMPClause *ActOnOpenMPProcBindClause(OpenMPProcBindClauseKind Kind,
9310                                       SourceLocation KindLoc,
9311                                       SourceLocation StartLoc,
9312                                       SourceLocation LParenLoc,
9313                                       SourceLocation EndLoc);
9314
9315  OMPClause *ActOnOpenMPSingleExprWithArgClause(
9316      OpenMPClauseKind KindArrayRef<unsignedArgumentsExpr *Expr,
9317      SourceLocation StartLocSourceLocation LParenLoc,
9318      ArrayRef<SourceLocationArgumentsLocSourceLocation DelimLoc,
9319      SourceLocation EndLoc);
9320  /// Called on well-formed 'schedule' clause.
9321  OMPClause *ActOnOpenMPScheduleClause(
9322      OpenMPScheduleClauseModifier M1OpenMPScheduleClauseModifier M2,
9323      OpenMPScheduleClauseKind KindExpr *ChunkSizeSourceLocation StartLoc,
9324      SourceLocation LParenLocSourceLocation M1LocSourceLocation M2Loc,
9325      SourceLocation KindLocSourceLocation CommaLocSourceLocation EndLoc);
9326
9327  OMPClause *ActOnOpenMPClause(OpenMPClauseKind KindSourceLocation StartLoc,
9328                               SourceLocation EndLoc);
9329  /// Called on well-formed 'nowait' clause.
9330  OMPClause *ActOnOpenMPNowaitClause(SourceLocation StartLoc,
9331                                     SourceLocation EndLoc);
9332  /// Called on well-formed 'untied' clause.
9333  OMPClause *ActOnOpenMPUntiedClause(SourceLocation StartLoc,
9334                                     SourceLocation EndLoc);
9335  /// Called on well-formed 'mergeable' clause.
9336  OMPClause *ActOnOpenMPMergeableClause(SourceLocation StartLoc,
9337                                        SourceLocation EndLoc);
9338  /// Called on well-formed 'read' clause.
9339  OMPClause *ActOnOpenMPReadClause(SourceLocation StartLoc,
9340                                   SourceLocation EndLoc);
9341  /// Called on well-formed 'write' clause.
9342  OMPClause *ActOnOpenMPWriteClause(SourceLocation StartLoc,
9343                                    SourceLocation EndLoc);
9344  /// Called on well-formed 'update' clause.
9345  OMPClause *ActOnOpenMPUpdateClause(SourceLocation StartLoc,
9346                                     SourceLocation EndLoc);
9347  /// Called on well-formed 'capture' clause.
9348  OMPClause *ActOnOpenMPCaptureClause(SourceLocation StartLoc,
9349                                      SourceLocation EndLoc);
9350  /// Called on well-formed 'seq_cst' clause.
9351  OMPClause *ActOnOpenMPSeqCstClause(SourceLocation StartLoc,
9352                                     SourceLocation EndLoc);
9353  /// Called on well-formed 'threads' clause.
9354  OMPClause *ActOnOpenMPThreadsClause(SourceLocation StartLoc,
9355                                      SourceLocation EndLoc);
9356  /// Called on well-formed 'simd' clause.
9357  OMPClause *ActOnOpenMPSIMDClause(SourceLocation StartLoc,
9358                                   SourceLocation EndLoc);
9359  /// Called on well-formed 'nogroup' clause.
9360  OMPClause *ActOnOpenMPNogroupClause(SourceLocation StartLoc,
9361                                      SourceLocation EndLoc);
9362  /// Called on well-formed 'unified_address' clause.
9363  OMPClause *ActOnOpenMPUnifiedAddressClause(SourceLocation StartLoc,
9364                                             SourceLocation EndLoc);
9365
9366  /// Called on well-formed 'unified_address' clause.
9367  OMPClause *ActOnOpenMPUnifiedSharedMemoryClause(SourceLocation StartLoc,
9368                                                  SourceLocation EndLoc);
9369
9370  /// Called on well-formed 'reverse_offload' clause.
9371  OMPClause *ActOnOpenMPReverseOffloadClause(SourceLocation StartLoc,
9372                                             SourceLocation EndLoc);
9373
9374  /// Called on well-formed 'dynamic_allocators' clause.
9375  OMPClause *ActOnOpenMPDynamicAllocatorsClause(SourceLocation StartLoc,
9376                                                SourceLocation EndLoc);
9377
9378  /// Called on well-formed 'atomic_default_mem_order' clause.
9379  OMPClause *ActOnOpenMPAtomicDefaultMemOrderClause(
9380      OpenMPAtomicDefaultMemOrderClauseKind KindSourceLocation KindLoc,
9381      SourceLocation StartLocSourceLocation LParenLocSourceLocation EndLoc);
9382
9383  OMPClause *ActOnOpenMPVarListClause(
9384      OpenMPClauseKind KindArrayRef<Expr *> VarsExpr *TailExpr,
9385      const OMPVarListLocTy &LocsSourceLocation ColonLoc,
9386      CXXScopeSpec &ReductionOrMapperIdScopeSpec,
9387      DeclarationNameInfo &ReductionOrMapperIdOpenMPDependClauseKind DepKind,
9388      OpenMPLinearClauseKind LinKind,
9389      ArrayRef<OpenMPMapModifierKindMapTypeModifiers,
9390      ArrayRef<SourceLocationMapTypeModifiersLocOpenMPMapClauseKind MapType,
9391      bool IsMapTypeImplicitSourceLocation DepLinMapLoc);
9392  /// Called on well-formed 'allocate' clause.
9393  OMPClause *
9394  ActOnOpenMPAllocateClause(Expr *AllocatorArrayRef<Expr *> VarList,
9395                            SourceLocation StartLocSourceLocation ColonLoc,
9396                            SourceLocation LParenLocSourceLocation EndLoc);
9397  /// Called on well-formed 'private' clause.
9398  OMPClause *ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
9399                                      SourceLocation StartLoc,
9400                                      SourceLocation LParenLoc,
9401                                      SourceLocation EndLoc);
9402  /// Called on well-formed 'firstprivate' clause.
9403  OMPClause *ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
9404                                           SourceLocation StartLoc,
9405                                           SourceLocation LParenLoc,
9406                                           SourceLocation EndLoc);
9407  /// Called on well-formed 'lastprivate' clause.
9408  OMPClause *ActOnOpenMPLastprivateClause(ArrayRef<Expr *> VarList,
9409                                          SourceLocation StartLoc,
9410                                          SourceLocation LParenLoc,
9411                                          SourceLocation EndLoc);
9412  /// Called on well-formed 'shared' clause.
9413  OMPClause *ActOnOpenMPSharedClause(ArrayRef<Expr *> VarList,
9414                                     SourceLocation StartLoc,
9415                                     SourceLocation LParenLoc,
9416                                     SourceLocation EndLoc);
9417  /// Called on well-formed 'reduction' clause.
9418  OMPClause *ActOnOpenMPReductionClause(
9419      ArrayRef<Expr *> VarListSourceLocation StartLoc,
9420      SourceLocation LParenLocSourceLocation ColonLocSourceLocation EndLoc,
9421      CXXScopeSpec &ReductionIdScopeSpec,
9422      const DeclarationNameInfo &ReductionId,
9423      ArrayRef<Expr *> UnresolvedReductions = llvm::None);
9424  /// Called on well-formed 'task_reduction' clause.
9425  OMPClause *ActOnOpenMPTaskReductionClause(
9426      ArrayRef<Expr *> VarListSourceLocation StartLoc,
9427      SourceLocation LParenLocSourceLocation ColonLocSourceLocation EndLoc,
9428      CXXScopeSpec &ReductionIdScopeSpec,
9429      const DeclarationNameInfo &ReductionId,
9430      ArrayRef<Expr *> UnresolvedReductions = llvm::None);
9431  /// Called on well-formed 'in_reduction' clause.
9432  OMPClause *ActOnOpenMPInReductionClause(
9433      ArrayRef<Expr *> VarListSourceLocation StartLoc,
9434      SourceLocation LParenLocSourceLocation ColonLocSourceLocation EndLoc,
9435      CXXScopeSpec &ReductionIdScopeSpec,
9436      const DeclarationNameInfo &ReductionId,
9437      ArrayRef<Expr *> UnresolvedReductions = llvm::None);
9438  /// Called on well-formed 'linear' clause.
9439  OMPClause *
9440  ActOnOpenMPLinearClause(ArrayRef<Expr *> VarListExpr *Step,
9441                          SourceLocation StartLocSourceLocation LParenLoc,
9442                          OpenMPLinearClauseKind LinKindSourceLocation LinLoc,
9443                          SourceLocation ColonLocSourceLocation EndLoc);
9444  /// Called on well-formed 'aligned' clause.
9445  OMPClause *ActOnOpenMPAlignedClause(ArrayRef<Expr *> VarList,
9446                                      Expr *Alignment,
9447                                      SourceLocation StartLoc,
9448                                      SourceLocation LParenLoc,
9449                                      SourceLocation ColonLoc,
9450                                      SourceLocation EndLoc);
9451  /// Called on well-formed 'copyin' clause.
9452  OMPClause *ActOnOpenMPCopyinClause(ArrayRef<Expr *> VarList,
9453                                     SourceLocation StartLoc,
9454                                     SourceLocation LParenLoc,
9455                                     SourceLocation EndLoc);
9456  /// Called on well-formed 'copyprivate' clause.
9457  OMPClause *ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList,
9458                                          SourceLocation StartLoc,
9459                                          SourceLocation LParenLoc,
9460                                          SourceLocation EndLoc);
9461  /// Called on well-formed 'flush' pseudo clause.
9462  OMPClause *ActOnOpenMPFlushClause(ArrayRef<Expr *> VarList,
9463                                    SourceLocation StartLoc,
9464                                    SourceLocation LParenLoc,
9465                                    SourceLocation EndLoc);
9466  /// Called on well-formed 'depend' clause.
9467  OMPClause *
9468  ActOnOpenMPDependClause(OpenMPDependClauseKind DepKindSourceLocation DepLoc,
9469                          SourceLocation ColonLocArrayRef<Expr *> VarList,
9470                          SourceLocation StartLocSourceLocation LParenLoc,
9471                          SourceLocation EndLoc);
9472  /// Called on well-formed 'device' clause.
9473  OMPClause *ActOnOpenMPDeviceClause(Expr *DeviceSourceLocation StartLoc,
9474                                     SourceLocation LParenLoc,
9475                                     SourceLocation EndLoc);
9476  /// Called on well-formed 'map' clause.
9477  OMPClause *
9478  ActOnOpenMPMapClause(ArrayRef<OpenMPMapModifierKindMapTypeModifiers,
9479                       ArrayRef<SourceLocationMapTypeModifiersLoc,
9480                       CXXScopeSpec &MapperIdScopeSpec,
9481                       DeclarationNameInfo &MapperId,
9482                       OpenMPMapClauseKind MapTypebool IsMapTypeImplicit,
9483                       SourceLocation MapLocSourceLocation ColonLoc,
9484                       ArrayRef<Expr *> VarListconst OMPVarListLocTy &Locs,
9485                       ArrayRef<Expr *> UnresolvedMappers = llvm::None);
9486  /// Called on well-formed 'num_teams' clause.
9487  OMPClause *ActOnOpenMPNumTeamsClause(Expr *NumTeamsSourceLocation StartLoc,
9488                                       SourceLocation LParenLoc,
9489                                       SourceLocation EndLoc);
9490  /// Called on well-formed 'thread_limit' clause.
9491  OMPClause *ActOnOpenMPThreadLimitClause(Expr *ThreadLimit,
9492                                          SourceLocation StartLoc,
9493                                          SourceLocation LParenLoc,
9494                                          SourceLocation EndLoc);
9495  /// Called on well-formed 'priority' clause.
9496  OMPClause *ActOnOpenMPPriorityClause(Expr *PrioritySourceLocation StartLoc,
9497                                       SourceLocation LParenLoc,
9498                                       SourceLocation EndLoc);
9499  /// Called on well-formed 'dist_schedule' clause.
9500  OMPClause *ActOnOpenMPDistScheduleClause(
9501      OpenMPDistScheduleClauseKind KindExpr *ChunkSize,
9502      SourceLocation StartLocSourceLocation LParenLocSourceLocation KindLoc,
9503      SourceLocation CommaLocSourceLocation EndLoc);
9504  /// Called on well-formed 'defaultmap' clause.
9505  OMPClause *ActOnOpenMPDefaultmapClause(
9506      OpenMPDefaultmapClauseModifier MOpenMPDefaultmapClauseKind Kind,
9507      SourceLocation StartLocSourceLocation LParenLocSourceLocation MLoc,
9508      SourceLocation KindLocSourceLocation EndLoc);
9509  /// Called on well-formed 'to' clause.
9510  OMPClause *
9511  ActOnOpenMPToClause(ArrayRef<Expr *> VarListCXXScopeSpec &MapperIdScopeSpec,
9512                      DeclarationNameInfo &MapperId,
9513                      const OMPVarListLocTy &Locs,
9514                      ArrayRef<Expr *> UnresolvedMappers = llvm::None);
9515  /// Called on well-formed 'from' clause.
9516  OMPClause *ActOnOpenMPFromClause(
9517      ArrayRef<Expr *> VarListCXXScopeSpec &MapperIdScopeSpec,
9518      DeclarationNameInfo &MapperIdconst OMPVarListLocTy &Locs,
9519      ArrayRef<Expr *> UnresolvedMappers = llvm::None);
9520  /// Called on well-formed 'use_device_ptr' clause.
9521  OMPClause *ActOnOpenMPUseDevicePtrClause(ArrayRef<Expr *> VarList,
9522                                           const OMPVarListLocTy &Locs);
9523  /// Called on well-formed 'is_device_ptr' clause.
9524  OMPClause *ActOnOpenMPIsDevicePtrClause(ArrayRef<Expr *> VarList,
9525                                          const OMPVarListLocTy &Locs);
9526
9527  /// The kind of conversion being performed.
9528  enum CheckedConversionKind {
9529    /// An implicit conversion.
9530    CCK_ImplicitConversion,
9531    /// A C-style cast.
9532    CCK_CStyleCast,
9533    /// A functional-style cast.
9534    CCK_FunctionalCast,
9535    /// A cast other than a C-style cast.
9536    CCK_OtherCast,
9537    /// A conversion for an operand of a builtin overloaded operator.
9538    CCK_ForBuiltinOverloadedOp
9539  };
9540
9541  static bool isCast(CheckedConversionKind CCK) {
9542    return CCK == CCK_CStyleCast || CCK == CCK_FunctionalCast ||
9543           CCK == CCK_OtherCast;
9544  }
9545
9546  /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
9547  /// cast.  If there is already an implicit cast, merge into the existing one.
9548  /// If isLvalue, the result of the cast is an lvalue.
9549  ExprResult ImpCastExprToType(Expr *EQualType TypeCastKind CK,
9550                               ExprValueKind VK = VK_RValue,
9551                               const CXXCastPath *BasePath = nullptr,
9552                               CheckedConversionKind CCK
9553                                  = CCK_ImplicitConversion);
9554
9555  /// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding
9556  /// to the conversion from scalar type ScalarTy to the Boolean type.
9557  static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy);
9558
9559  /// IgnoredValueConversions - Given that an expression's result is
9560  /// syntactically ignored, perform any conversions that are
9561  /// required.
9562  ExprResult IgnoredValueConversions(Expr *E);
9563
9564  // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
9565  // functions and arrays to their respective pointers (C99 6.3.2.1).
9566  ExprResult UsualUnaryConversions(Expr *E);
9567
9568  /// CallExprUnaryConversions - a special case of an unary conversion
9569  /// performed on a function designator of a call expression.
9570  ExprResult CallExprUnaryConversions(Expr *E);
9571
9572  // DefaultFunctionArrayConversion - converts functions and arrays
9573  // to their respective pointers (C99 6.3.2.1).
9574  ExprResult DefaultFunctionArrayConversion(Expr *Ebool Diagnose = true);
9575
9576  // DefaultFunctionArrayLvalueConversion - converts functions and
9577  // arrays to their respective pointers and performs the
9578  // lvalue-to-rvalue conversion.
9579  ExprResult DefaultFunctionArrayLvalueConversion(Expr *E,
9580                                                  bool Diagnose = true);
9581
9582  // DefaultLvalueConversion - performs lvalue-to-rvalue conversion on
9583  // the operand.  This is DefaultFunctionArrayLvalueConversion,
9584  // except that it assumes the operand isn't of function or array
9585  // type.
9586  ExprResult DefaultLvalueConversion(Expr *E);
9587
9588  // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
9589  // do not have a prototype. Integer promotions are performed on each
9590  // argument, and arguments that have type float are promoted to double.
9591  ExprResult DefaultArgumentPromotion(Expr *E);
9592
9593  /// If \p E is a prvalue denoting an unmaterialized temporary, materialize
9594  /// it as an xvalue. In C++98, the result will still be a prvalue, because
9595  /// we don't have xvalues there.
9596  ExprResult TemporaryMaterializationConversion(Expr *E);
9597
9598  // Used for emitting the right warning by DefaultVariadicArgumentPromotion
9599  enum VariadicCallType {
9600    VariadicFunction,
9601    VariadicBlock,
9602    VariadicMethod,
9603    VariadicConstructor,
9604    VariadicDoesNotApply
9605  };
9606
9607  VariadicCallType getVariadicCallType(FunctionDecl *FDecl,
9608                                       const FunctionProtoType *Proto,
9609                                       Expr *Fn);
9610
9611  // Used for determining in which context a type is allowed to be passed to a
9612  // vararg function.
9613  enum VarArgKind {
9614    VAK_Valid,
9615    VAK_ValidInCXX11,
9616    VAK_Undefined,
9617    VAK_MSVCUndefined,
9618    VAK_Invalid
9619  };
9620
9621  // Determines which VarArgKind fits an expression.
9622  VarArgKind isValidVarArgType(const QualType &Ty);
9623
9624  /// Check to see if the given expression is a valid argument to a variadic
9625  /// function, issuing a diagnostic if not.
9626  void checkVariadicArgument(const Expr *EVariadicCallType CT);
9627
9628  /// Check to see if a given expression could have '.c_str()' called on it.
9629  bool hasCStrMethod(const Expr *E);
9630
9631  /// GatherArgumentsForCall - Collector argument expressions for various
9632  /// form of call prototypes.
9633  bool GatherArgumentsForCall(SourceLocation CallLocFunctionDecl *FDecl,
9634                              const FunctionProtoType *Proto,
9635                              unsigned FirstParamArrayRef<Expr *> Args,
9636                              SmallVectorImpl<Expr *> &AllArgs,
9637                              VariadicCallType CallType = VariadicDoesNotApply,
9638                              bool AllowExplicit = false,
9639                              bool IsListInitialization = false);
9640
9641  // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but
9642  // will create a runtime trap if the resulting type is not a POD type.
9643  ExprResult DefaultVariadicArgumentPromotion(Expr *EVariadicCallType CT,
9644                                              FunctionDecl *FDecl);
9645
9646  // UsualArithmeticConversions - performs the UsualUnaryConversions on it's
9647  // operands and then handles various conversions that are common to binary
9648  // operators (C99 6.3.1.8). If both operands aren't arithmetic, this
9649  // routine returns the first non-arithmetic type found. The client is
9650  // responsible for emitting appropriate error diagnostics.
9651  QualType UsualArithmeticConversions(ExprResult &LHSExprResult &RHS,
9652                                      bool IsCompAssign = false);
9653
9654  /// AssignConvertType - All of the 'assignment' semantic checks return this
9655  /// enum to indicate whether the assignment was allowed.  These checks are
9656  /// done for simple assignments, as well as initialization, return from
9657  /// function, argument passing, etc.  The query is phrased in terms of a
9658  /// source and destination type.
9659  enum AssignConvertType {
9660    /// Compatible - the types are compatible according to the standard.
9661    Compatible,
9662
9663    /// PointerToInt - The assignment converts a pointer to an int, which we
9664    /// accept as an extension.
9665    PointerToInt,
9666
9667    /// IntToPointer - The assignment converts an int to a pointer, which we
9668    /// accept as an extension.
9669    IntToPointer,
9670
9671    /// FunctionVoidPointer - The assignment is between a function pointer and
9672    /// void*, which the standard doesn't allow, but we accept as an extension.
9673    FunctionVoidPointer,
9674
9675    /// IncompatiblePointer - The assignment is between two pointers types that
9676    /// are not compatible, but we accept them as an extension.
9677    IncompatiblePointer,
9678
9679    /// IncompatiblePointerSign - The assignment is between two pointers types
9680    /// which point to integers which have a different sign, but are otherwise
9681    /// identical. This is a subset of the above, but broken out because it's by
9682    /// far the most common case of incompatible pointers.
9683    IncompatiblePointerSign,
9684
9685    /// CompatiblePointerDiscardsQualifiers - The assignment discards
9686    /// c/v/r qualifiers, which we accept as an extension.
9687    CompatiblePointerDiscardsQualifiers,
9688
9689    /// IncompatiblePointerDiscardsQualifiers - The assignment
9690    /// discards qualifiers that we don't permit to be discarded,
9691    /// like address spaces.
9692    IncompatiblePointerDiscardsQualifiers,
9693
9694    /// IncompatibleNestedPointerQualifiers - The assignment is between two
9695    /// nested pointer types, and the qualifiers other than the first two
9696    /// levels differ e.g. char ** -> const char **, but we accept them as an
9697    /// extension.
9698    IncompatibleNestedPointerQualifiers,
9699
9700    /// IncompatibleVectors - The assignment is between two vector types that
9701    /// have the same size, which we accept as an extension.
9702    IncompatibleVectors,
9703
9704    /// IntToBlockPointer - The assignment converts an int to a block
9705    /// pointer. We disallow this.
9706    IntToBlockPointer,
9707
9708    /// IncompatibleBlockPointer - The assignment is between two block
9709    /// pointers types that are not compatible.
9710    IncompatibleBlockPointer,
9711
9712    /// IncompatibleObjCQualifiedId - The assignment is between a qualified
9713    /// id type and something else (that is incompatible with it). For example,
9714    /// "id <XXX>" = "Foo *", where "Foo *" doesn't implement the XXX protocol.
9715    IncompatibleObjCQualifiedId,
9716
9717    /// IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an
9718    /// object with __weak qualifier.
9719    IncompatibleObjCWeakRef,
9720
9721    /// Incompatible - We reject this conversion outright, it is invalid to
9722    /// represent it in the AST.
9723    Incompatible
9724  };
9725
9726  /// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the
9727  /// assignment conversion type specified by ConvTy.  This returns true if the
9728  /// conversion was invalid or false if the conversion was accepted.
9729  bool DiagnoseAssignmentResult(AssignConvertType ConvTy,
9730                                SourceLocation Loc,
9731                                QualType DstTypeQualType SrcType,
9732                                Expr *SrcExprAssignmentAction Action,
9733                                bool *Complained = nullptr);
9734
9735  /// IsValueInFlagEnum - Determine if a value is allowed as part of a flag
9736  /// enum. If AllowMask is true, then we also allow the complement of a valid
9737  /// value, to be used as a mask.
9738  bool IsValueInFlagEnum(const EnumDecl *EDconst llvm::APInt &Val,
9739                         bool AllowMaskconst;
9740
9741  /// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant
9742  /// integer not in the range of enum values.
9743  void DiagnoseAssignmentEnum(QualType DstTypeQualType SrcType,
9744                              Expr *SrcExpr);
9745
9746  /// CheckAssignmentConstraints - Perform type checking for assignment,
9747  /// argument passing, variable initialization, and function return values.
9748  /// C99 6.5.16.
9749  AssignConvertType CheckAssignmentConstraints(SourceLocation Loc,
9750                                               QualType LHSType,
9751                                               QualType RHSType);
9752
9753  /// Check assignment constraints and optionally prepare for a conversion of
9754  /// the RHS to the LHS type. The conversion is prepared for if ConvertRHS
9755  /// is true.
9756  AssignConvertType CheckAssignmentConstraints(QualType LHSType,
9757                                               ExprResult &RHS,
9758                                               CastKind &Kind,
9759                                               bool ConvertRHS = true);
9760
9761  /// Check assignment constraints for an assignment of RHS to LHSType.
9762  ///
9763  /// \param LHSType The destination type for the assignment.
9764  /// \param RHS The source expression for the assignment.
9765  /// \param Diagnose If \c true, diagnostics may be produced when checking
9766  ///        for assignability. If a diagnostic is produced, \p RHS will be
9767  ///        set to ExprError(). Note that this function may still return
9768  ///        without producing a diagnostic, even for an invalid assignment.
9769  /// \param DiagnoseCFAudited If \c true, the target is a function parameter
9770  ///        in an audited Core Foundation API and does not need to be checked
9771  ///        for ARC retain issues.
9772  /// \param ConvertRHS If \c true, \p RHS will be updated to model the
9773  ///        conversions necessary to perform the assignment. If \c false,
9774  ///        \p Diagnose must also be \c false.
9775  AssignConvertType CheckSingleAssignmentConstraints(
9776      QualType LHSTypeExprResult &RHSbool Diagnose = true,
9777      bool DiagnoseCFAudited = falsebool ConvertRHS = true);
9778
9779  // If the lhs type is a transparent union, check whether we
9780  // can initialize the transparent union with the given expression.
9781  AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType,
9782                                                             ExprResult &RHS);
9783
9784  bool IsStringLiteralToNonConstPointerConversion(Expr *FromQualType ToType);
9785
9786  bool CheckExceptionSpecCompatibility(Expr *FromQualType ToType);
9787
9788  ExprResult PerformImplicitConversion(Expr *FromQualType ToType,
9789                                       AssignmentAction Action,
9790                                       bool AllowExplicit = false);
9791  ExprResult PerformImplicitConversion(Expr *FromQualType ToType,
9792                                       AssignmentAction Action,
9793                                       bool AllowExplicit,
9794                                       ImplicitConversionSequenceICS);
9795  ExprResult PerformImplicitConversion(Expr *FromQualType ToType,
9796                                       const ImplicitConversionSequenceICS,
9797                                       AssignmentAction Action,
9798                                       CheckedConversionKind CCK
9799                                          = CCK_ImplicitConversion);
9800  ExprResult PerformImplicitConversion(Expr *FromQualType ToType,
9801                                       const StandardConversionSequenceSCS,
9802                                       AssignmentAction Action,
9803                                       CheckedConversionKind CCK);
9804
9805  ExprResult PerformQualificationConversion(
9806      Expr *EQualType TyExprValueKind VK = VK_RValue,
9807      CheckedConversionKind CCK = CCK_ImplicitConversion);
9808
9809  /// the following "Check" methods will return a valid/converted QualType
9810  /// or a null QualType (indicating an error diagnostic was issued).
9811
9812  /// type checking binary operators (subroutines of CreateBuiltinBinOp).
9813  QualType InvalidOperands(SourceLocation LocExprResult &LHS,
9814                           ExprResult &RHS);
9815  QualType InvalidLogicalVectorOperands(SourceLocation LocExprResult &LHS,
9816                                 ExprResult &RHS);
9817  QualType CheckPointerToMemberOperands// C++ 5.5
9818    ExprResult &LHSExprResult &RHSExprValueKind &VK,
9819    SourceLocation OpLocbool isIndirect);
9820  QualType CheckMultiplyDivideOperands// C99 6.5.5
9821    ExprResult &LHSExprResult &RHSSourceLocation Locbool IsCompAssign,
9822    bool IsDivide);
9823  QualType CheckRemainderOperands// C99 6.5.5
9824    ExprResult &LHSExprResult &RHSSourceLocation Loc,
9825    bool IsCompAssign = false);
9826  QualType CheckAdditionOperands// C99 6.5.6
9827    ExprResult &LHSExprResult &RHSSourceLocation Loc,
9828    BinaryOperatorKind OpcQualTypeCompLHSTy = nullptr);
9829  QualType CheckSubtractionOperands// C99 6.5.6
9830    ExprResult &LHSExprResult &RHSSourceLocation Loc,
9831    QualTypeCompLHSTy = nullptr);
9832  QualType CheckShiftOperands// C99 6.5.7
9833    ExprResult &LHSExprResult &RHSSourceLocation Loc,
9834    BinaryOperatorKind Opcbool IsCompAssign = false);
9835  QualType CheckCompareOperands// C99 6.5.8/9
9836      ExprResult &LHSExprResult &RHSSourceLocation Loc,
9837      BinaryOperatorKind Opc);
9838  QualType CheckBitwiseOperands// C99 6.5.[10...12]
9839      ExprResult &LHSExprResult &RHSSourceLocation Loc,
9840      BinaryOperatorKind Opc);
9841  QualType CheckLogicalOperands// C99 6.5.[13,14]
9842    ExprResult &LHSExprResult &RHSSourceLocation Loc,
9843    BinaryOperatorKind Opc);
9844  // CheckAssignmentOperands is used for both simple and compound assignment.
9845  // For simple assignment, pass both expressions and a null converted type.
9846  // For compound assignment, pass both expressions and the converted type.
9847  QualType CheckAssignmentOperands// C99 6.5.16.[1,2]
9848    Expr *LHSExprExprResult &RHSSourceLocation LocQualType CompoundType);
9849
9850  ExprResult checkPseudoObjectIncDec(Scope *SSourceLocation OpLoc,
9851                                     UnaryOperatorKind OpcodeExpr *Op);
9852  ExprResult checkPseudoObjectAssignment(Scope *SSourceLocation OpLoc,
9853                                         BinaryOperatorKind Opcode,
9854                                         Expr *LHSExpr *RHS);
9855  ExprResult checkPseudoObjectRValue(Expr *E);
9856  Expr *recreateSyntacticForm(PseudoObjectExpr *E);
9857
9858  QualType CheckConditionalOperands// C99 6.5.15
9859    ExprResult &CondExprResult &LHSExprResult &RHS,
9860    ExprValueKind &VKExprObjectKind &OKSourceLocation QuestionLoc);
9861  QualType CXXCheckConditionalOperands// C++ 5.16
9862    ExprResult &condExprResult &lhsExprResult &rhs,
9863    ExprValueKind &VKExprObjectKind &OKSourceLocation questionLoc);
9864  QualType FindCompositePointerType(SourceLocation LocExpr *&E1Expr *&E2,
9865                                    bool ConvertArgs = true);
9866  QualType FindCompositePointerType(SourceLocation Loc,
9867                                    ExprResult &E1ExprResult &E2,
9868                                    bool ConvertArgs = true) {
9869    Expr *E1Tmp = E1.get(), *E2Tmp = E2.get();
9870    QualType Composite =
9871        FindCompositePointerType(LocE1TmpE2TmpConvertArgs);
9872    E1 = E1Tmp;
9873    E2 = E2Tmp;
9874    return Composite;
9875  }
9876
9877  QualType FindCompositeObjCPointerType(ExprResult &LHSExprResult &RHS,
9878                                        SourceLocation QuestionLoc);
9879
9880  bool DiagnoseConditionalForNull(Expr *LHSExprExpr *RHSExpr,
9881                                  SourceLocation QuestionLoc);
9882
9883  void DiagnoseAlwaysNonNullPointer(Expr *E,
9884                                    Expr::NullPointerConstantKind NullType,
9885                                    bool IsEqualSourceRange Range);
9886
9887  /// type checking for vector binary operators.
9888  QualType CheckVectorOperands(ExprResult &LHSExprResult &RHS,
9889                               SourceLocation Locbool IsCompAssign,
9890                               bool AllowBothBoolbool AllowBoolConversion);
9891  QualType GetSignedVectorType(QualType V);
9892  QualType CheckVectorCompareOperands(ExprResult &LHSExprResult &RHS,
9893                                      SourceLocation Loc,
9894                                      BinaryOperatorKind Opc);
9895  QualType CheckVectorLogicalOperands(ExprResult &LHSExprResult &RHS,
9896                                      SourceLocation Loc);
9897
9898  bool areLaxCompatibleVectorTypes(QualType srcTypeQualType destType);
9899  bool isLaxVectorConversion(QualType srcTypeQualType destType);
9900
9901  /// type checking declaration initializers (C99 6.7.8)
9902  bool CheckForConstantInitializer(Expr *eQualType t);
9903
9904  // type checking C++ declaration initializers (C++ [dcl.init]).
9905
9906  /// ReferenceCompareResult - Expresses the result of comparing two
9907  /// types (cv1 T1 and cv2 T2) to determine their compatibility for the
9908  /// purposes of initialization by reference (C++ [dcl.init.ref]p4).
9909  enum ReferenceCompareResult {
9910    /// Ref_Incompatible - The two types are incompatible, so direct
9911    /// reference binding is not possible.
9912    Ref_Incompatible = 0,
9913    /// Ref_Related - The two types are reference-related, which means
9914    /// that their unqualified forms (T1 and T2) are either the same
9915    /// or T1 is a base class of T2.
9916    Ref_Related,
9917    /// Ref_Compatible - The two types are reference-compatible.
9918    Ref_Compatible
9919  };
9920
9921  ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc,
9922                                                      QualType T1QualType T2,
9923                                                      bool &DerivedToBase,
9924                                                      bool &ObjCConversion,
9925                                                bool &ObjCLifetimeConversion);
9926
9927  ExprResult checkUnknownAnyCast(SourceRange TypeRangeQualType CastType,
9928                                 Expr *CastExprCastKind &CastKind,
9929                                 ExprValueKind &VKCXXCastPath &Path);
9930
9931  /// Force an expression with unknown-type to an expression of the
9932  /// given type.
9933  ExprResult forceUnknownAnyToType(Expr *EQualType ToType);
9934
9935  /// Type-check an expression that's being passed to an
9936  /// __unknown_anytype parameter.
9937  ExprResult checkUnknownAnyArg(SourceLocation callLoc,
9938                                Expr *resultQualType &paramType);
9939
9940  // CheckVectorCast - check type constraints for vectors.
9941  // Since vectors are an extension, there are no C standard reference for this.
9942  // We allow casting between vectors and integer datatypes of the same size.
9943  // returns true if the cast is invalid
9944  bool CheckVectorCast(SourceRange RQualType VectorTyQualType Ty,
9945                       CastKind &Kind);
9946
9947  /// Prepare `SplattedExpr` for a vector splat operation, adding
9948  /// implicit casts if necessary.
9949  ExprResult prepareVectorSplat(QualType VectorTyExpr *SplattedExpr);
9950
9951  // CheckExtVectorCast - check type constraints for extended vectors.
9952  // Since vectors are an extension, there are no C standard reference for this.
9953  // We allow casting between vectors and integer datatypes of the same size,
9954  // or vectors and the element type of that vector.
9955  // returns the cast expr
9956  ExprResult CheckExtVectorCast(SourceRange RQualType DestTyExpr *CastExpr,
9957                                CastKind &Kind);
9958
9959  ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfoQualType Type,
9960                                        SourceLocation LParenLoc,
9961                                        Expr *CastExpr,
9962                                        SourceLocation RParenLoc);
9963
9964  enum ARCConversionResult { ACR_okayACR_unbridgedACR_error };
9965
9966  /// Checks for invalid conversions and casts between
9967  /// retainable pointers and other pointer kinds for ARC and Weak.
9968  ARCConversionResult CheckObjCConversion(SourceRange castRange,
9969                                          QualType castTypeExpr *&op,
9970                                          CheckedConversionKind CCK,
9971                                          bool Diagnose = true,
9972                                          bool DiagnoseCFAudited = false,
9973                                          BinaryOperatorKind Opc = BO_PtrMemD
9974                                          );
9975
9976  Expr *stripARCUnbridgedCast(Expr *e);
9977  void diagnoseARCUnbridgedCast(Expr *e);
9978
9979  bool CheckObjCARCUnavailableWeakConversion(QualType castType,
9980                                             QualType ExprType);
9981
9982  /// checkRetainCycles - Check whether an Objective-C message send
9983  /// might create an obvious retain cycle.
9984  void checkRetainCycles(ObjCMessageExpr *msg);
9985  void checkRetainCycles(Expr *receiverExpr *argument);
9986  void checkRetainCycles(VarDecl *VarExpr *Init);
9987
9988  /// checkUnsafeAssigns - Check whether +1 expr is being assigned
9989  /// to weak/__unsafe_unretained type.
9990  bool checkUnsafeAssigns(SourceLocation LocQualType LHSExpr *RHS);
9991
9992  /// checkUnsafeExprAssigns - Check whether +1 expr is being assigned
9993  /// to weak/__unsafe_unretained expression.
9994  void checkUnsafeExprAssigns(SourceLocation LocExpr *LHSExpr *RHS);
9995
9996  /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
9997  /// \param Method - May be null.
9998  /// \param [out] ReturnType - The return type of the send.
9999  /// \return true iff there were any incompatible types.
10000  bool CheckMessageArgumentTypes(const Expr *ReceiverQualType ReceiverType,
10001                                 MultiExprArg ArgsSelector Sel,
10002                                 ArrayRef<SourceLocationSelectorLocs,
10003                                 ObjCMethodDecl *Methodbool isClassMessage,
10004                                 bool isSuperMessageSourceLocation lbrac,
10005                                 SourceLocation rbracSourceRange RecRange,
10006                                 QualType &ReturnTypeExprValueKind &VK);
10007
10008  /// Determine the result of a message send expression based on
10009  /// the type of the receiver, the method expected to receive the message,
10010  /// and the form of the message send.
10011  QualType getMessageSendResultType(const Expr *ReceiverQualType ReceiverType,
10012                                    ObjCMethodDecl *Methodbool isClassMessage,
10013                                    bool isSuperMessage);
10014
10015  /// If the given expression involves a message send to a method
10016  /// with a related result type, emit a note describing what happened.
10017  void EmitRelatedResultTypeNote(const Expr *E);
10018
10019  /// Given that we had incompatible pointer types in a return
10020  /// statement, check whether we're in a method with a related result
10021  /// type, and if so, emit a note describing what happened.
10022  void EmitRelatedResultTypeNoteForReturn(QualType destType);
10023
10024  class ConditionResult {
10025    Decl *ConditionVar;
10026    FullExprArg Condition;
10027    bool Invalid;
10028    bool HasKnownValue;
10029    bool KnownValue;
10030
10031    friend class Sema;
10032    ConditionResult(Sema &SDecl *ConditionVarFullExprArg Condition,
10033                    bool IsConstexpr)
10034        : ConditionVar(ConditionVar), Condition(Condition), Invalid(false),
10035          HasKnownValue(IsConstexpr && Condition.get() &&
10036                        !Condition.get()->isValueDependent()),
10037          KnownValue(HasKnownValue &&
10038                     !!Condition.get()->EvaluateKnownConstInt(S.Context)) {}
10039    explicit ConditionResult(bool Invalid)
10040        : ConditionVar(nullptr), Condition(nullptr), Invalid(Invalid),
10041          HasKnownValue(false), KnownValue(false) {}
10042
10043  public:
10044    ConditionResult() : ConditionResult(false) {}
10045    bool isInvalid() const { return Invalid; }
10046    std::pair<VarDecl *, Expr *> get() const {
10047      return std::make_pair(cast_or_null<VarDecl>(ConditionVar),
10048                            Condition.get());
10049    }
10050    llvm::Optional<boolgetKnownValue() const {
10051      if (!HasKnownValue)
10052        return None;
10053      return KnownValue;
10054    }
10055  };
10056  static ConditionResult ConditionError() { return ConditionResult(true); }
10057
10058  enum class ConditionKind {
10059    Boolean,     ///< A boolean condition, from 'if', 'while', 'for', or 'do'.
10060    ConstexprIf///< A constant boolean condition from 'if constexpr'.
10061    Switch       ///< An integral condition for a 'switch' statement.
10062  };
10063
10064  ConditionResult ActOnCondition(Scope *SSourceLocation Loc,
10065                                 Expr *SubExprConditionKind CK);
10066
10067  ConditionResult ActOnConditionVariable(Decl *ConditionVar,
10068                                         SourceLocation StmtLoc,
10069                                         ConditionKind CK);
10070
10071  DeclResult ActOnCXXConditionDeclaration(Scope *SDeclarator &D);
10072
10073  ExprResult CheckConditionVariable(VarDecl *ConditionVar,
10074                                    SourceLocation StmtLoc,
10075                                    ConditionKind CK);
10076  ExprResult CheckSwitchCondition(SourceLocation SwitchLocExpr *Cond);
10077
10078  /// CheckBooleanCondition - Diagnose problems involving the use of
10079  /// the given expression as a boolean condition (e.g. in an if
10080  /// statement).  Also performs the standard function and array
10081  /// decays, possibly changing the input variable.
10082  ///
10083  /// \param Loc - A location associated with the condition, e.g. the
10084  /// 'if' keyword.
10085  /// \return true iff there were any errors
10086  ExprResult CheckBooleanCondition(SourceLocation LocExpr *E,
10087                                   bool IsConstexpr = false);
10088
10089  /// DiagnoseAssignmentAsCondition - Given that an expression is
10090  /// being used as a boolean condition, warn if it's an assignment.
10091  void DiagnoseAssignmentAsCondition(Expr *E);
10092
10093  /// Redundant parentheses over an equality comparison can indicate
10094  /// that the user intended an assignment used as condition.
10095  void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE);
10096
10097  /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
10098  ExprResult CheckCXXBooleanCondition(Expr *CondExprbool IsConstexpr = false);
10099
10100  /// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have
10101  /// the specified width and sign.  If an overflow occurs, detect it and emit
10102  /// the specified diagnostic.
10103  void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal,
10104                                          unsigned NewWidthbool NewSign,
10105                                          SourceLocation Locunsigned DiagID);
10106
10107  /// Checks that the Objective-C declaration is declared in the global scope.
10108  /// Emits an error and marks the declaration as invalid if it's not declared
10109  /// in the global scope.
10110  bool CheckObjCDeclScope(Decl *D);
10111
10112  /// Abstract base class used for diagnosing integer constant
10113  /// expression violations.
10114  class VerifyICEDiagnoser {
10115  public:
10116    bool Suppress;
10117
10118    VerifyICEDiagnoser(bool Suppress = false) : Suppress(Suppress) { }
10119
10120    virtual void diagnoseNotICE(Sema &SSourceLocation LocSourceRange SR) =0;
10121    virtual void diagnoseFold(Sema &SSourceLocation LocSourceRange SR);
10122    virtual ~VerifyICEDiagnoser() { }
10123  };
10124
10125  /// VerifyIntegerConstantExpression - Verifies that an expression is an ICE,
10126  /// and reports the appropriate diagnostics. Returns false on success.
10127  /// Can optionally return the value of the expression.
10128  ExprResult VerifyIntegerConstantExpression(Expr *Ellvm::APSInt *Result,
10129                                             VerifyICEDiagnoser &Diagnoser,
10130                                             bool AllowFold = true);
10131  ExprResult VerifyIntegerConstantExpression(Expr *Ellvm::APSInt *Result,
10132                                             unsigned DiagID,
10133                                             bool AllowFold = true);
10134  ExprResult VerifyIntegerConstantExpression(Expr *E,
10135                                             llvm::APSInt *Result = nullptr);
10136
10137  /// VerifyBitField - verifies that a bit field expression is an ICE and has
10138  /// the correct width, and that the field type is valid.
10139  /// Returns false on success.
10140  /// Can optionally return whether the bit-field is of width 0
10141  ExprResult VerifyBitField(SourceLocation FieldLocIdentifierInfo *FieldName,
10142                            QualType FieldTybool IsMsStruct,
10143                            Expr *BitWidthbool *ZeroWidth = nullptr);
10144
10145private:
10146  unsigned ForceCUDAHostDeviceDepth = 0;
10147
10148public:
10149  /// Increments our count of the number of times we've seen a pragma forcing
10150  /// functions to be __host__ __device__.  So long as this count is greater
10151  /// than zero, all functions encountered will be __host__ __device__.
10152  void PushForceCUDAHostDevice();
10153
10154  /// Decrements our count of the number of times we've seen a pragma forcing
10155  /// functions to be __host__ __device__.  Returns false if the count is 0
10156  /// before incrementing, so you can emit an error.
10157  bool PopForceCUDAHostDevice();
10158
10159  /// Diagnostics that are emitted only if we discover that the given function
10160  /// must be codegen'ed.  Because handling these correctly adds overhead to
10161  /// compilation, this is currently only enabled for CUDA compilations.
10162  llvm::DenseMap<CanonicalDeclPtr<FunctionDecl>,
10163                 std::vector<PartialDiagnosticAt>>
10164      DeviceDeferredDiags;
10165
10166  /// A pair of a canonical FunctionDecl and a SourceLocation.  When used as the
10167  /// key in a hashtable, both the FD and location are hashed.
10168  struct FunctionDeclAndLoc {
10169    CanonicalDeclPtr<FunctionDeclFD;
10170    SourceLocation Loc;
10171  };
10172
10173  /// FunctionDecls and SourceLocations for which CheckCUDACall has emitted a
10174  /// (maybe deferred) "bad call" diagnostic.  We use this to avoid emitting the
10175  /// same deferred diag twice.
10176  llvm::DenseSet<FunctionDeclAndLoc> LocsWithCUDACallDiags;
10177
10178  /// An inverse call graph, mapping known-emitted functions to one of their
10179  /// known-emitted callers (plus the location of the call).
10180  ///
10181  /// Functions that we can tell a priori must be emitted aren't added to this
10182  /// map.
10183  llvm::DenseMap</* Callee = */ CanonicalDeclPtr<FunctionDecl>,
10184                 /* Caller = */ FunctionDeclAndLoc>
10185      DeviceKnownEmittedFns;
10186
10187  /// A partial call graph maintained during CUDA/OpenMP device code compilation
10188  /// to support deferred diagnostics.
10189  ///
10190  /// Functions are only added here if, at the time they're considered, they are
10191  /// not known-emitted.  As soon as we discover that a function is
10192  /// known-emitted, we remove it and everything it transitively calls from this
10193  /// set and add those functions to DeviceKnownEmittedFns.
10194  llvm::DenseMap</* Caller = */ CanonicalDeclPtr<FunctionDecl>,
10195                 /* Callees = */ llvm::MapVector<CanonicalDeclPtr<FunctionDecl>,
10196                                                 SourceLocation>>
10197      DeviceCallGraph;
10198
10199  /// Diagnostic builder for CUDA/OpenMP devices errors which may or may not be
10200  /// deferred.
10201  ///
10202  /// In CUDA, there exist constructs (e.g. variable-length arrays, try/catch)
10203  /// which are not allowed to appear inside __device__ functions and are
10204  /// allowed to appear in __host__ __device__ functions only if the host+device
10205  /// function is never codegen'ed.
10206  ///
10207  /// To handle this, we use the notion of "deferred diagnostics", where we
10208  /// attach a diagnostic to a FunctionDecl that's emitted iff it's codegen'ed.
10209  ///
10210  /// This class lets you emit either a regular diagnostic, a deferred
10211  /// diagnostic, or no diagnostic at all, according to an argument you pass to
10212  /// its constructor, thus simplifying the process of creating these "maybe
10213  /// deferred" diagnostics.
10214  class DeviceDiagBuilder {
10215  public:
10216    enum Kind {
10217      /// Emit no diagnostics.
10218      K_Nop,
10219      /// Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
10220      K_Immediate,
10221      /// Emit the diagnostic immediately, and, if it's a warning or error, also
10222      /// emit a call stack showing how this function can be reached by an a
10223      /// priori known-emitted function.
10224      K_ImmediateWithCallStack,
10225      /// Create a deferred diagnostic, which is emitted only if the function
10226      /// it's attached to is codegen'ed.  Also emit a call stack as with
10227      /// K_ImmediateWithCallStack.
10228      K_Deferred
10229    };
10230
10231    DeviceDiagBuilder(Kind KSourceLocation Locunsigned DiagID,
10232                      FunctionDecl *FnSema &S);
10233    DeviceDiagBuilder(DeviceDiagBuilder &&D);
10234    DeviceDiagBuilder(const DeviceDiagBuilder &) = default;
10235    ~DeviceDiagBuilder();
10236
10237    /// Convertible to bool: True if we immediately emitted an error, false if
10238    /// we didn't emit an error or we created a deferred error.
10239    ///
10240    /// Example usage:
10241    ///
10242    ///   if (DeviceDiagBuilder(...) << foo << bar)
10243    ///     return ExprError();
10244    ///
10245    /// But see CUDADiagIfDeviceCode() and CUDADiagIfHostCode() -- you probably
10246    /// want to use these instead of creating a DeviceDiagBuilder yourself.
10247    operator bool() const { return ImmediateDiag.hasValue(); }
10248
10249    template <typename T>
10250    friend const DeviceDiagBuilder &operator<<(const DeviceDiagBuilder &Diag,
10251                                               const T &Value) {
10252      if (Diag.ImmediateDiag.hasValue())
10253        *Diag.ImmediateDiag << Value;
10254      else if (Diag.PartialDiagId.hasValue())
10255        Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second
10256            << Value;
10257      return Diag;
10258    }
10259
10260  private:
10261    Sema &S;
10262    SourceLocation Loc;
10263    unsigned DiagID;
10264    FunctionDecl *Fn;
10265    bool ShowCallStack;
10266
10267    // Invariant: At most one of these Optionals has a value.
10268    // FIXME: Switch these to a Variant once that exists.
10269    llvm::Optional<SemaDiagnosticBuilderImmediateDiag;
10270    llvm::Optional<unsignedPartialDiagId;
10271  };
10272
10273  /// Indicate that this function (and thus everything it transtively calls)
10274  /// will be codegen'ed, and emit any deferred diagnostics on this function and
10275  /// its (transitive) callees.
10276  void markKnownEmitted(
10277      Sema &SFunctionDecl *OrigCallerFunctionDecl *OrigCallee,
10278      SourceLocation OrigLoc,
10279      const llvm::function_ref<bool(Sema &, FunctionDecl *)> IsKnownEmitted);
10280
10281  /// Creates a DeviceDiagBuilder that emits the diagnostic if the current context
10282  /// is "used as device code".
10283  ///
10284  /// - If CurContext is a __host__ function, does not emit any diagnostics.
10285  /// - If CurContext is a __device__ or __global__ function, emits the
10286  ///   diagnostics immediately.
10287  /// - If CurContext is a __host__ __device__ function and we are compiling for
10288  ///   the device, creates a diagnostic which is emitted if and when we realize
10289  ///   that the function will be codegen'ed.
10290  ///
10291  /// Example usage:
10292  ///
10293  ///  // Variable-length arrays are not allowed in CUDA device code.
10294  ///  if (CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget())
10295  ///    return ExprError();
10296  ///  // Otherwise, continue parsing as normal.
10297  DeviceDiagBuilder CUDADiagIfDeviceCode(SourceLocation Locunsigned DiagID);
10298
10299  /// Creates a DeviceDiagBuilder that emits the diagnostic if the current context
10300  /// is "used as host code".
10301  ///
10302  /// Same as CUDADiagIfDeviceCode, with "host" and "device" switched.
10303  DeviceDiagBuilder CUDADiagIfHostCode(SourceLocation Locunsigned DiagID);
10304
10305  /// Creates a DeviceDiagBuilder that emits the diagnostic if the current
10306  /// context is "used as device code".
10307  ///
10308  /// - If CurContext is a `declare target` function or it is known that the
10309  /// function is emitted for the device, emits the diagnostics immediately.
10310  /// - If CurContext is a non-`declare target` function and we are compiling
10311  ///   for the device, creates a diagnostic which is emitted if and when we
10312  ///   realize that the function will be codegen'ed.
10313  ///
10314  /// Example usage:
10315  ///
10316  ///  // Variable-length arrays are not allowed in NVPTX device code.
10317  ///  if (diagIfOpenMPDeviceCode(Loc, diag::err_vla_unsupported))
10318  ///    return ExprError();
10319  ///  // Otherwise, continue parsing as normal.
10320  DeviceDiagBuilder diagIfOpenMPDeviceCode(SourceLocation Locunsigned DiagID);
10321
10322  DeviceDiagBuilder targetDiag(SourceLocation Locunsigned DiagID);
10323
10324  enum CUDAFunctionTarget {
10325    CFT_Device,
10326    CFT_Global,
10327    CFT_Host,
10328    CFT_HostDevice,
10329    CFT_InvalidTarget
10330  };
10331
10332  /// Determines whether the given function is a CUDA device/host/kernel/etc.
10333  /// function.
10334  ///
10335  /// Use this rather than examining the function's attributes yourself -- you
10336  /// will get it wrong.  Returns CFT_Host if D is null.
10337  CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D,
10338                                        bool IgnoreImplicitHDAttr = false);
10339  CUDAFunctionTarget IdentifyCUDATarget(const ParsedAttributesView &Attrs);
10340
10341  /// Gets the CUDA target for the current context.
10342  CUDAFunctionTarget CurrentCUDATarget() {
10343    return IdentifyCUDATarget(dyn_cast<FunctionDecl>(CurContext));
10344  }
10345
10346  // CUDA function call preference. Must be ordered numerically from
10347  // worst to best.
10348  enum CUDAFunctionPreference {
10349    CFP_Never,      // Invalid caller/callee combination.
10350    CFP_WrongSide,  // Calls from host-device to host or device
10351                    // function that do not match current compilation
10352                    // mode.
10353    CFP_HostDevice// Any calls to host/device functions.
10354    CFP_SameSide,   // Calls from host-device to host or device
10355                    // function matching current compilation mode.
10356    CFP_Native,     // host-to-host or device-to-device calls.
10357  };
10358
10359  /// Identifies relative preference of a given Caller/Callee
10360  /// combination, based on their host/device attributes.
10361  /// \param Caller function which needs address of \p Callee.
10362  ///               nullptr in case of global context.
10363  /// \param Callee target function
10364  ///
10365  /// \returns preference value for particular Caller/Callee combination.
10366  CUDAFunctionPreference IdentifyCUDAPreference(const FunctionDecl *Caller,
10367                                                const FunctionDecl *Callee);
10368
10369  /// Determines whether Caller may invoke Callee, based on their CUDA
10370  /// host/device attributes.  Returns false if the call is not allowed.
10371  ///
10372  /// Note: Will return true for CFP_WrongSide calls.  These may appear in
10373  /// semantically correct CUDA programs, but only if they're never codegen'ed.
10374  bool IsAllowedCUDACall(const FunctionDecl *Caller,
10375                         const FunctionDecl *Callee) {
10376    return IdentifyCUDAPreference(CallerCallee) != CFP_Never;
10377  }
10378
10379  /// May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD,
10380  /// depending on FD and the current compilation settings.
10381  void maybeAddCUDAHostDeviceAttrs(FunctionDecl *FD,
10382                                   const LookupResult &Previous);
10383
10384public:
10385  /// Check whether we're allowed to call Callee from the current context.
10386  ///
10387  /// - If the call is never allowed in a semantically-correct program
10388  ///   (CFP_Never), emits an error and returns false.
10389  ///
10390  /// - If the call is allowed in semantically-correct programs, but only if
10391  ///   it's never codegen'ed (CFP_WrongSide), creates a deferred diagnostic to
10392  ///   be emitted if and when the caller is codegen'ed, and returns true.
10393  ///
10394  ///   Will only create deferred diagnostics for a given SourceLocation once,
10395  ///   so you can safely call this multiple times without generating duplicate
10396  ///   deferred errors.
10397  ///
10398  /// - Otherwise, returns true without emitting any diagnostics.
10399  bool CheckCUDACall(SourceLocation LocFunctionDecl *Callee);
10400
10401  /// Set __device__ or __host__ __device__ attributes on the given lambda
10402  /// operator() method.
10403  ///
10404  /// CUDA lambdas declared inside __device__ or __global__ functions inherit
10405  /// the __device__ attribute.  Similarly, lambdas inside __host__ __device__
10406  /// functions become __host__ __device__ themselves.
10407  void CUDASetLambdaAttrs(CXXMethodDecl *Method);
10408
10409  /// Finds a function in \p Matches with highest calling priority
10410  /// from \p Caller context and erases all functions with lower
10411  /// calling priority.
10412  void EraseUnwantedCUDAMatches(
10413      const FunctionDecl *Caller,
10414      SmallVectorImpl<std::pair<DeclAccessPairFunctionDecl *>> &Matches);
10415
10416  /// Given a implicit special member, infer its CUDA target from the
10417  /// calls it needs to make to underlying base/field special members.
10418  /// \param ClassDecl the class for which the member is being created.
10419  /// \param CSM the kind of special member.
10420  /// \param MemberDecl the special member itself.
10421  /// \param ConstRHS true if this is a copy operation with a const object on
10422  ///        its RHS.
10423  /// \param Diagnose true if this call should emit diagnostics.
10424  /// \return true if there was an error inferring.
10425  /// The result of this call is implicit CUDA target attribute(s) attached to
10426  /// the member declaration.
10427  bool inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl,
10428                                               CXXSpecialMember CSM,
10429                                               CXXMethodDecl *MemberDecl,
10430                                               bool ConstRHS,
10431                                               bool Diagnose);
10432
10433  /// \return true if \p CD can be considered empty according to CUDA
10434  /// (E.2.3.1 in CUDA 7.5 Programming guide).
10435  bool isEmptyCudaConstructor(SourceLocation LocCXXConstructorDecl *CD);
10436  bool isEmptyCudaDestructor(SourceLocation LocCXXDestructorDecl *CD);
10437
10438  // \brief Checks that initializers of \p Var satisfy CUDA restrictions. In
10439  // case of error emits appropriate diagnostic and invalidates \p Var.
10440  //
10441  // \details CUDA allows only empty constructors as initializers for global
10442  // variables (see E.2.3.1, CUDA 7.5). The same restriction also applies to all
10443  // __shared__ variables whether they are local or not (they all are implicitly
10444  // static in CUDA). One exception is that CUDA allows constant initializers
10445  // for __constant__ and __device__ variables.
10446  void checkAllowedCUDAInitializer(VarDecl *VD);
10447
10448  /// Check whether NewFD is a valid overload for CUDA. Emits
10449  /// diagnostics and invalidates NewFD if not.
10450  void checkCUDATargetOverload(FunctionDecl *NewFD,
10451                               const LookupResult &Previous);
10452  /// Copies target attributes from the template TD to the function FD.
10453  void inheritCUDATargetAttrs(FunctionDecl *FDconst FunctionTemplateDecl &TD);
10454
10455  /// Returns the name of the launch configuration function.  This is the name
10456  /// of the function that will be called to configure kernel call, with the
10457  /// parameters specified via <<<>>>.
10458  std::string getCudaConfigureFuncName() const;
10459
10460  /// \name Code completion
10461  //@{
10462  /// Describes the context in which code completion occurs.
10463  enum ParserCompletionContext {
10464    /// Code completion occurs at top-level or namespace context.
10465    PCC_Namespace,
10466    /// Code completion occurs within a class, struct, or union.
10467    PCC_Class,
10468    /// Code completion occurs within an Objective-C interface, protocol,
10469    /// or category.
10470    PCC_ObjCInterface,
10471    /// Code completion occurs within an Objective-C implementation or
10472    /// category implementation
10473    PCC_ObjCImplementation,
10474    /// Code completion occurs within the list of instance variables
10475    /// in an Objective-C interface, protocol, category, or implementation.
10476    PCC_ObjCInstanceVariableList,
10477    /// Code completion occurs following one or more template
10478    /// headers.
10479    PCC_Template,
10480    /// Code completion occurs following one or more template
10481    /// headers within a class.
10482    PCC_MemberTemplate,
10483    /// Code completion occurs within an expression.
10484    PCC_Expression,
10485    /// Code completion occurs within a statement, which may
10486    /// also be an expression or a declaration.
10487    PCC_Statement,
10488    /// Code completion occurs at the beginning of the
10489    /// initialization statement (or expression) in a for loop.
10490    PCC_ForInit,
10491    /// Code completion occurs within the condition of an if,
10492    /// while, switch, or for statement.
10493    PCC_Condition,
10494    /// Code completion occurs within the body of a function on a
10495    /// recovery path, where we do not have a specific handle on our position
10496    /// in the grammar.
10497    PCC_RecoveryInFunction,
10498    /// Code completion occurs where only a type is permitted.
10499    PCC_Type,
10500    /// Code completion occurs in a parenthesized expression, which
10501    /// might also be a type cast.
10502    PCC_ParenthesizedExpression,
10503    /// Code completion occurs within a sequence of declaration
10504    /// specifiers within a function, method, or block.
10505    PCC_LocalDeclarationSpecifiers
10506  };
10507
10508  void CodeCompleteModuleImport(SourceLocation ImportLocModuleIdPath Path);
10509  void CodeCompleteOrdinaryName(Scope *S,
10510                                ParserCompletionContext CompletionContext);
10511  void CodeCompleteDeclSpec(Scope *SDeclSpec &DS,
10512                            bool AllowNonIdentifiers,
10513                            bool AllowNestedNameSpecifiers);
10514
10515  struct CodeCompleteExpressionData;
10516  void CodeCompleteExpression(Scope *S,
10517                              const CodeCompleteExpressionData &Data);
10518  void CodeCompleteExpression(Scope *SQualType PreferredType,
10519                              bool IsParenthesized = false);
10520  void CodeCompleteMemberReferenceExpr(Scope *SExpr *BaseExpr *OtherOpBase,
10521                                       SourceLocation OpLocbool IsArrow,
10522                                       bool IsBaseExprStatement,
10523                                       QualType PreferredType);
10524  void CodeCompletePostfixExpression(Scope *SExprResult LHS,
10525                                     QualType PreferredType);
10526  void CodeCompleteTag(Scope *Sunsigned TagSpec);
10527  void CodeCompleteTypeQualifiers(DeclSpec &DS);
10528  void CodeCompleteFunctionQualifiers(DeclSpec &DSDeclarator &D,
10529                                      const VirtSpecifiers *VS = nullptr);
10530  void CodeCompleteBracketDeclarator(Scope *S);
10531  void CodeCompleteCase(Scope *S);
10532  /// Reports signatures for a call to CodeCompleteConsumer and returns the
10533  /// preferred type for the current argument. Returned type can be null.
10534  QualType ProduceCallSignatureHelp(Scope *SExpr *FnArrayRef<Expr *> Args,
10535                                    SourceLocation OpenParLoc);
10536  QualType ProduceConstructorSignatureHelp(Scope *SQualType Type,
10537                                           SourceLocation Loc,
10538                                           ArrayRef<Expr *> Args,
10539                                           SourceLocation OpenParLoc);
10540  QualType ProduceCtorInitMemberSignatureHelp(Scope *SDecl *ConstructorDecl,
10541                                              CXXScopeSpec SS,
10542                                              ParsedType TemplateTypeTy,
10543                                              ArrayRef<Expr *> ArgExprs,
10544                                              IdentifierInfo *II,
10545                                              SourceLocation OpenParLoc);
10546  void CodeCompleteInitializer(Scope *SDecl *D);
10547  void CodeCompleteAfterIf(Scope *S);
10548
10549  void CodeCompleteQualifiedId(Scope *SCXXScopeSpec &SS,
10550                               bool EnteringContextQualType BaseType);
10551  void CodeCompleteUsing(Scope *S);
10552  void CodeCompleteUsingDirective(Scope *S);
10553  void CodeCompleteNamespaceDecl(Scope *S);
10554  void CodeCompleteNamespaceAliasDecl(Scope *S);
10555  void CodeCompleteOperatorName(Scope *S);
10556  void CodeCompleteConstructorInitializer(
10557                                Decl *Constructor,
10558                                ArrayRef<CXXCtorInitializer *> Initializers);
10559
10560  void CodeCompleteLambdaIntroducer(Scope *SLambdaIntroducer &Intro,
10561                                    bool AfterAmpersand);
10562
10563  void CodeCompleteObjCAtDirective(Scope *S);
10564  void CodeCompleteObjCAtVisibility(Scope *S);
10565  void CodeCompleteObjCAtStatement(Scope *S);
10566  void CodeCompleteObjCAtExpression(Scope *S);
10567  void CodeCompleteObjCPropertyFlags(Scope *SObjCDeclSpec &ODS);
10568  void CodeCompleteObjCPropertyGetter(Scope *S);
10569  void CodeCompleteObjCPropertySetter(Scope *S);
10570  void CodeCompleteObjCPassingType(Scope *SObjCDeclSpec &DS,
10571                                   bool IsParameter);
10572  void CodeCompleteObjCMessageReceiver(Scope *S);
10573  void CodeCompleteObjCSuperMessage(Scope *SSourceLocation SuperLoc,
10574                                    ArrayRef<IdentifierInfo *> SelIdents,
10575                                    bool AtArgumentExpression);
10576  void CodeCompleteObjCClassMessage(Scope *SParsedType Receiver,
10577                                    ArrayRef<IdentifierInfo *> SelIdents,
10578                                    bool AtArgumentExpression,
10579                                    bool IsSuper = false);
10580  void CodeCompleteObjCInstanceMessage(Scope *SExpr *Receiver,
10581                                       ArrayRef<IdentifierInfo *> SelIdents,
10582                                       bool AtArgumentExpression,
10583                                       ObjCInterfaceDecl *Super = nullptr);
10584  void CodeCompleteObjCForCollection(Scope *S,
10585                                     DeclGroupPtrTy IterationVar);
10586  void CodeCompleteObjCSelector(Scope *S,
10587                                ArrayRef<IdentifierInfo *> SelIdents);
10588  void CodeCompleteObjCProtocolReferences(
10589                                         ArrayRef<IdentifierLocPairProtocols);
10590  void CodeCompleteObjCProtocolDecl(Scope *S);
10591  void CodeCompleteObjCInterfaceDecl(Scope *S);
10592  void CodeCompleteObjCSuperclass(Scope *S,
10593                                  IdentifierInfo *ClassName,
10594                                  SourceLocation ClassNameLoc);
10595  void CodeCompleteObjCImplementationDecl(Scope *S);
10596  void CodeCompleteObjCInterfaceCategory(Scope *S,
10597                                         IdentifierInfo *ClassName,
10598                                         SourceLocation ClassNameLoc);
10599  void CodeCompleteObjCImplementationCategory(Scope *S,
10600                                              IdentifierInfo *ClassName,
10601                                              SourceLocation ClassNameLoc);
10602  void CodeCompleteObjCPropertyDefinition(Scope *S);
10603  void CodeCompleteObjCPropertySynthesizeIvar(Scope *S,
10604                                              IdentifierInfo *PropertyName);
10605  void CodeCompleteObjCMethodDecl(Scope *SOptional<boolIsInstanceMethod,
10606                                  ParsedType ReturnType);
10607  void CodeCompleteObjCMethodDeclSelector(Scope *S,
10608                                          bool IsInstanceMethod,
10609                                          bool AtParameterName,
10610                                          ParsedType ReturnType,
10611                                          ArrayRef<IdentifierInfo *> SelIdents);
10612  void CodeCompleteObjCClassPropertyRefExpr(Scope *SIdentifierInfo &ClassName,
10613                                            SourceLocation ClassNameLoc,
10614                                            bool IsBaseExprStatement);
10615  void CodeCompletePreprocessorDirective(bool InConditional);
10616  void CodeCompleteInPreprocessorConditionalExclusion(Scope *S);
10617  void CodeCompletePreprocessorMacroName(bool IsDefinition);
10618  void CodeCompletePreprocessorExpression();
10619  void CodeCompletePreprocessorMacroArgument(Scope *S,
10620                                             IdentifierInfo *Macro,
10621                                             MacroInfo *MacroInfo,
10622                                             unsigned Argument);
10623  void CodeCompleteIncludedFile(llvm::StringRef Dirbool IsAngled);
10624  void CodeCompleteNaturalLanguage();
10625  void CodeCompleteAvailabilityPlatformName();
10626  void GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator,
10627                                   CodeCompletionTUInfo &CCTUInfo,
10628                  SmallVectorImpl<CodeCompletionResult> &Results);
10629  //@}
10630
10631  //===--------------------------------------------------------------------===//
10632  // Extra semantic analysis beyond the C type system
10633
10634public:
10635  SourceLocation getLocationOfStringLiteralByte(const StringLiteral *SL,
10636                                                unsigned ByteNoconst;
10637
10638private:
10639  void CheckArrayAccess(const Expr *BaseExprconst Expr *IndexExpr,
10640                        const ArraySubscriptExpr *ASE=nullptr,
10641                        bool AllowOnePastEnd=truebool IndexNegated=false);
10642  void CheckArrayAccess(const Expr *E);
10643  // Used to grab the relevant information from a FormatAttr and a
10644  // FunctionDeclaration.
10645  struct FormatStringInfo {
10646    unsigned FormatIdx;
10647    unsigned FirstDataArg;
10648    bool HasVAListArg;
10649  };
10650
10651  static bool getFormatStringInfo(const FormatAttr *Formatbool IsCXXMember,
10652                                  FormatStringInfo *FSI);
10653  bool CheckFunctionCall(FunctionDecl *FDeclCallExpr *TheCall,
10654                         const FunctionProtoType *Proto);
10655  bool CheckObjCMethodCall(ObjCMethodDecl *MethodSourceLocation loc,
10656                           ArrayRef<const Expr *> Args);
10657  bool CheckPointerCall(NamedDecl *NDeclCallExpr *TheCall,
10658                        const FunctionProtoType *Proto);
10659  bool CheckOtherCall(CallExpr *TheCallconst FunctionProtoType *Proto);
10660  void CheckConstructorCall(FunctionDecl *FDecl,
10661                            ArrayRef<const Expr *> Args,
10662                            const FunctionProtoType *Proto,
10663                            SourceLocation Loc);
10664
10665  void checkCall(NamedDecl *FDeclconst FunctionProtoType *Proto,
10666                 const Expr *ThisArgArrayRef<const Expr *> Args,
10667                 bool IsMemberFunctionSourceLocation LocSourceRange Range,
10668                 VariadicCallType CallType);
10669
10670  bool CheckObjCString(Expr *Arg);
10671  ExprResult CheckOSLogFormatStringArg(Expr *Arg);
10672
10673  ExprResult CheckBuiltinFunctionCall(FunctionDecl *FDecl,
10674                                      unsigned BuiltinIDCallExpr *TheCall);
10675  void checkFortifiedBuiltinMemoryFunction(FunctionDecl *FDCallExpr *TheCall);
10676
10677  bool CheckARMBuiltinExclusiveCall(unsigned BuiltinIDCallExpr *TheCall,
10678                                    unsigned MaxWidth);
10679  bool CheckNeonBuiltinFunctionCall(unsigned BuiltinIDCallExpr *TheCall);
10680  bool CheckARMBuiltinFunctionCall(unsigned BuiltinIDCallExpr *TheCall);
10681
10682  bool CheckAArch64BuiltinFunctionCall(unsigned BuiltinIDCallExpr *TheCall);
10683  bool CheckHexagonBuiltinFunctionCall(unsigned BuiltinIDCallExpr *TheCall);
10684  bool CheckHexagonBuiltinCpu(unsigned BuiltinIDCallExpr *TheCall);
10685  bool CheckHexagonBuiltinArgument(unsigned BuiltinIDCallExpr *TheCall);
10686  bool CheckMipsBuiltinFunctionCall(unsigned BuiltinIDCallExpr *TheCall);
10687  bool CheckSystemZBuiltinFunctionCall(unsigned BuiltinIDCallExpr *TheCall);
10688  bool CheckX86BuiltinRoundingOrSAE(unsigned BuiltinIDCallExpr *TheCall);
10689  bool CheckX86BuiltinGatherScatterScale(unsigned BuiltinIDCallExpr *TheCall);
10690  bool CheckX86BuiltinFunctionCall(unsigned BuiltinIDCallExpr *TheCall);
10691  bool CheckPPCBuiltinFunctionCall(unsigned BuiltinIDCallExpr *TheCall);
10692
10693  bool SemaBuiltinVAStart(unsigned BuiltinIDCallExpr *TheCall);
10694  bool SemaBuiltinVAStartARMMicrosoft(CallExpr *Call);
10695  bool SemaBuiltinUnorderedCompare(CallExpr *TheCall);
10696  bool SemaBuiltinFPClassification(CallExpr *TheCallunsigned NumArgs);
10697  bool SemaBuiltinVSX(CallExpr *TheCall);
10698  bool SemaBuiltinOSLogFormat(CallExpr *TheCall);
10699
10700public:
10701  // Used by C++ template instantiation.
10702  ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall);
10703  ExprResult SemaConvertVectorExpr(Expr *ETypeSourceInfo *TInfo,
10704                                   SourceLocation BuiltinLoc,
10705                                   SourceLocation RParenLoc);
10706
10707private:
10708  bool SemaBuiltinPrefetch(CallExpr *TheCall);
10709  bool SemaBuiltinAllocaWithAlign(CallExpr *TheCall);
10710  bool SemaBuiltinAssume(CallExpr *TheCall);
10711  bool SemaBuiltinAssumeAligned(CallExpr *TheCall);
10712  bool SemaBuiltinLongjmp(CallExpr *TheCall);
10713  bool SemaBuiltinSetjmp(CallExpr *TheCall);
10714  ExprResult SemaBuiltinAtomicOverloaded(ExprResult TheCallResult);
10715  ExprResult SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult);
10716  ExprResult SemaAtomicOpsOverloaded(ExprResult TheCallResult,
10717                                     AtomicExpr::AtomicOp Op);
10718  ExprResult SemaBuiltinOperatorNewDeleteOverloaded(ExprResult TheCallResult,
10719                                                    bool IsDelete);
10720  bool SemaBuiltinConstantArg(CallExpr *TheCallint ArgNum,
10721                              llvm::APSInt &Result);
10722  bool SemaBuiltinConstantArgRange(CallExpr *TheCallint ArgNumint Low,
10723                                   int Highbool RangeIsError = true);
10724  bool SemaBuiltinConstantArgMultiple(CallExpr *TheCallint ArgNum,
10725                                      unsigned Multiple);
10726  bool SemaBuiltinARMSpecialReg(unsigned BuiltinIDCallExpr *TheCall,
10727                                int ArgNumunsigned ExpectedFieldNum,
10728                                bool AllowName);
10729public:
10730  enum FormatStringType {
10731    FST_Scanf,
10732    FST_Printf,
10733    FST_NSString,
10734    FST_Strftime,
10735    FST_Strfmon,
10736    FST_Kprintf,
10737    FST_FreeBSDKPrintf,
10738    FST_OSTrace,
10739    FST_OSLog,
10740    FST_Unknown
10741  };
10742  static FormatStringType GetFormatStringType(const FormatAttr *Format);
10743
10744  bool FormatStringHasSArg(const StringLiteral *FExpr);
10745
10746  static bool GetFormatNSStringIdx(const FormatAttr *Formatunsigned &Idx);
10747
10748private:
10749  bool CheckFormatArguments(const FormatAttr *Format,
10750                            ArrayRef<const Expr *> Args,
10751                            bool IsCXXMember,
10752                            VariadicCallType CallType,
10753                            SourceLocation LocSourceRange Range,
10754                            llvm::SmallBitVector &CheckedVarArgs);
10755  bool CheckFormatArguments(ArrayRef<const Expr *> Args,
10756                            bool HasVAListArgunsigned format_idx,
10757                            unsigned firstDataArgFormatStringType Type,
10758                            VariadicCallType CallType,
10759                            SourceLocation LocSourceRange range,
10760                            llvm::SmallBitVector &CheckedVarArgs);
10761
10762  void CheckAbsoluteValueFunction(const CallExpr *Call,
10763                                  const FunctionDecl *FDecl);
10764
10765  void CheckMaxUnsignedZero(const CallExpr *Callconst FunctionDecl *FDecl);
10766
10767  void CheckMemaccessArguments(const CallExpr *Call,
10768                               unsigned BId,
10769                               IdentifierInfo *FnName);
10770
10771  void CheckStrlcpycatArguments(const CallExpr *Call,
10772                                IdentifierInfo *FnName);
10773
10774  void CheckStrncatArguments(const CallExpr *Call,
10775                             IdentifierInfo *FnName);
10776
10777  void CheckReturnValExpr(Expr *RetValExpQualType lhsType,
10778                          SourceLocation ReturnLoc,
10779                          bool isObjCMethod = false,
10780                          const AttrVec *Attrs = nullptr,
10781                          const FunctionDecl *FD = nullptr);
10782
10783public:
10784  void CheckFloatComparison(SourceLocation LocExpr *LHSExpr *RHS);
10785
10786private:
10787  void CheckImplicitConversions(Expr *ESourceLocation CC = SourceLocation());
10788  void CheckBoolLikeConversion(Expr *ESourceLocation CC);
10789  void CheckForIntOverflow(Expr *E);
10790  void CheckUnsequencedOperations(Expr *E);
10791
10792  /// Perform semantic checks on a completed expression. This will either
10793  /// be a full-expression or a default argument expression.
10794  void CheckCompletedExpr(Expr *ESourceLocation CheckLoc = SourceLocation(),
10795                          bool IsConstexpr = false);
10796
10797  void CheckBitFieldInitialization(SourceLocation InitLocFieldDecl *Field,
10798                                   Expr *Init);
10799
10800  /// Check if there is a field shadowing.
10801  void CheckShadowInheritedFields(const SourceLocation &Loc,
10802                                  DeclarationName FieldName,
10803                                  const CXXRecordDecl *RD,
10804                                  bool DeclIsField = true);
10805
10806  /// Check if the given expression contains 'break' or 'continue'
10807  /// statement that produces control flow different from GCC.
10808  void CheckBreakContinueBinding(Expr *E);
10809
10810  /// Check whether receiver is mutable ObjC container which
10811  /// attempts to add itself into the container
10812  void CheckObjCCircularContainer(ObjCMessageExpr *Message);
10813
10814  void AnalyzeDeleteExprMismatch(const CXXDeleteExpr *DE);
10815  void AnalyzeDeleteExprMismatch(FieldDecl *FieldSourceLocation DeleteLoc,
10816                                 bool DeleteWasArrayForm);
10817public:
10818  /// Register a magic integral constant to be used as a type tag.
10819  void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind,
10820                                  uint64_t MagicValueQualType Type,
10821                                  bool LayoutCompatiblebool MustBeNull);
10822
10823  struct TypeTagData {
10824    TypeTagData() {}
10825
10826    TypeTagData(QualType Typebool LayoutCompatiblebool MustBeNull) :
10827        Type(Type), LayoutCompatible(LayoutCompatible),
10828        MustBeNull(MustBeNull)
10829    {}
10830
10831    QualType Type;
10832
10833    /// If true, \c Type should be compared with other expression's types for
10834    /// layout-compatibility.
10835    unsigned LayoutCompatible : 1;
10836    unsigned MustBeNull : 1;
10837  };
10838
10839  /// A pair of ArgumentKind identifier and magic value.  This uniquely
10840  /// identifies the magic value.
10841  typedef std::pair<const IdentifierInfo *, uint64_tTypeTagMagicValue;
10842
10843private:
10844  /// A map from magic value to type information.
10845  std::unique_ptr<llvm::DenseMap<TypeTagMagicValue, TypeTagData>>
10846      TypeTagForDatatypeMagicValues;
10847
10848  /// Peform checks on a call of a function with argument_with_type_tag
10849  /// or pointer_with_type_tag attributes.
10850  void CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
10851                                const ArrayRef<const Expr *> ExprArgs,
10852                                SourceLocation CallSiteLoc);
10853
10854  /// Check if we are taking the address of a packed field
10855  /// as this may be a problem if the pointer value is dereferenced.
10856  void CheckAddressOfPackedMember(Expr *rhs);
10857
10858  /// The parser's current scope.
10859  ///
10860  /// The parser maintains this state here.
10861  Scope *CurScope;
10862
10863  mutable IdentifierInfo *Ident_super;
10864  mutable IdentifierInfo *Ident___float128;
10865
10866  /// Nullability type specifiers.
10867  IdentifierInfo *Ident__Nonnull = nullptr;
10868  IdentifierInfo *Ident__Nullable = nullptr;
10869  IdentifierInfo *Ident__Null_unspecified = nullptr;
10870
10871  IdentifierInfo *Ident_NSError = nullptr;
10872
10873  /// The handler for the FileChanged preprocessor events.
10874  ///
10875  /// Used for diagnostics that implement custom semantic analysis for #include
10876  /// directives, like -Wpragma-pack.
10877  sema::SemaPPCallbacks *SemaPPCallbackHandler;
10878
10879protected:
10880  friend class Parser;
10881  friend class InitializationSequence;
10882  friend class ASTReader;
10883  friend class ASTDeclReader;
10884  friend class ASTWriter;
10885
10886public:
10887  /// Retrieve the keyword associated
10888  IdentifierInfo *getNullabilityKeyword(NullabilityKind nullability);
10889
10890  /// The struct behind the CFErrorRef pointer.
10891  RecordDecl *CFError = nullptr;
10892
10893  /// Retrieve the identifier "NSError".
10894  IdentifierInfo *getNSErrorIdent();
10895
10896  /// Retrieve the parser's current scope.
10897  ///
10898  /// This routine must only be used when it is certain that semantic analysis
10899  /// and the parser are in precisely the same context, which is not the case
10900  /// when, e.g., we are performing any kind of template instantiation.
10901  /// Therefore, the only safe places to use this scope are in the parser
10902  /// itself and in routines directly invoked from the parser and *never* from
10903  /// template substitution or instantiation.
10904  Scope *getCurScope() const { return CurScope; }
10905
10906  void incrementMSManglingNumber() const {
10907    return CurScope->incrementMSManglingNumber();
10908  }
10909
10910  IdentifierInfo *getSuperIdentifier() const;
10911  IdentifierInfo *getFloat128Identifier() const;
10912
10913  Decl *getObjCDeclContext() const;
10914
10915  DeclContext *getCurLexicalContext() const {
10916    return OriginalLexicalContext ? OriginalLexicalContext : CurContext;
10917  }
10918
10919  const DeclContext *getCurObjCLexicalContext() const {
10920    const DeclContext *DC = getCurLexicalContext();
10921    // A category implicitly has the attribute of the interface.
10922    if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(DC))
10923      DC = CatD->getClassInterface();
10924    return DC;
10925  }
10926
10927  /// To be used for checking whether the arguments being passed to
10928  /// function exceeds the number of parameters expected for it.
10929  static bool TooManyArguments(size_t NumParams, size_t NumArgs,
10930                               bool PartialOverloading = false) {
10931    // We check whether we're just after a comma in code-completion.
10932    if (NumArgs > 0 && PartialOverloading)
10933      return NumArgs + 1 > NumParams; // If so, we view as an extra argument.
10934    return NumArgs > NumParams;
10935  }
10936
10937  // Emitting members of dllexported classes is delayed until the class
10938  // (including field initializers) is fully parsed.
10939  SmallVector<CXXRecordDecl*, 4DelayedDllExportClasses;
10940
10941private:
10942  class SavePendingParsedClassStateRAII {
10943  public:
10944    SavePendingParsedClassStateRAII(Sema &S) : S(S) { swapSavedState(); }
10945
10946    ~SavePendingParsedClassStateRAII() {
10947       (0) . __assert_fail ("S.DelayedOverridingExceptionSpecChecks.empty() && \"there shouldn't be any pending delayed exception spec checks\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10948, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.DelayedOverridingExceptionSpecChecks.empty() &&
10948 (0) . __assert_fail ("S.DelayedOverridingExceptionSpecChecks.empty() && \"there shouldn't be any pending delayed exception spec checks\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10948, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">             "there shouldn't be any pending delayed exception spec checks");
10949       (0) . __assert_fail ("S.DelayedEquivalentExceptionSpecChecks.empty() && \"there shouldn't be any pending delayed exception spec checks\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10950, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.DelayedEquivalentExceptionSpecChecks.empty() &&
10950 (0) . __assert_fail ("S.DelayedEquivalentExceptionSpecChecks.empty() && \"there shouldn't be any pending delayed exception spec checks\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10950, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">             "there shouldn't be any pending delayed exception spec checks");
10951       (0) . __assert_fail ("S.DelayedDefaultedMemberExceptionSpecs.empty() && \"there shouldn't be any pending delayed defaulted member \" \"exception specs\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10953, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.DelayedDefaultedMemberExceptionSpecs.empty() &&
10952 (0) . __assert_fail ("S.DelayedDefaultedMemberExceptionSpecs.empty() && \"there shouldn't be any pending delayed defaulted member \" \"exception specs\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10953, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">             "there shouldn't be any pending delayed defaulted member "
10953 (0) . __assert_fail ("S.DelayedDefaultedMemberExceptionSpecs.empty() && \"there shouldn't be any pending delayed defaulted member \" \"exception specs\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10953, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">             "exception specs");
10954       (0) . __assert_fail ("S.DelayedDllExportClasses.empty() && \"there shouldn't be any pending delayed DLL export classes\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10955, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.DelayedDllExportClasses.empty() &&
10955 (0) . __assert_fail ("S.DelayedDllExportClasses.empty() && \"there shouldn't be any pending delayed DLL export classes\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10955, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">             "there shouldn't be any pending delayed DLL export classes");
10956      swapSavedState();
10957    }
10958
10959  private:
10960    Sema &S;
10961    decltype(DelayedOverridingExceptionSpecChecks)
10962        SavedOverridingExceptionSpecChecks;
10963    decltype(DelayedEquivalentExceptionSpecChecks)
10964        SavedEquivalentExceptionSpecChecks;
10965    decltype(DelayedDefaultedMemberExceptionSpecs)
10966        SavedDefaultedMemberExceptionSpecs;
10967    decltype(DelayedDllExportClasses) SavedDllExportClasses;
10968
10969    void swapSavedState() {
10970      SavedOverridingExceptionSpecChecks.swap(
10971          S.DelayedOverridingExceptionSpecChecks);
10972      SavedEquivalentExceptionSpecChecks.swap(
10973          S.DelayedEquivalentExceptionSpecChecks);
10974      SavedDefaultedMemberExceptionSpecs.swap(
10975          S.DelayedDefaultedMemberExceptionSpecs);
10976      SavedDllExportClasses.swap(S.DelayedDllExportClasses);
10977    }
10978  };
10979
10980  /// Helper class that collects misaligned member designations and
10981  /// their location info for delayed diagnostics.
10982  struct MisalignedMember {
10983    Expr *E;
10984    RecordDecl *RD;
10985    ValueDecl *MD;
10986    CharUnits Alignment;
10987
10988    MisalignedMember() : E(), RD(), MD(), Alignment() {}
10989    MisalignedMember(Expr *ERecordDecl *RDValueDecl *MD,
10990                     CharUnits Alignment)
10991        : E(E), RD(RD), MD(MD), Alignment(Alignment) {}
10992    explicit MisalignedMember(Expr *E)
10993        : MisalignedMember(EnullptrnullptrCharUnits()) {}
10994
10995    bool operator==(const MisalignedMember &m) { return this->E == m.E; }
10996  };
10997  /// Small set of gathered accesses to potentially misaligned members
10998  /// due to the packed attribute.
10999  SmallVector<MisalignedMember4MisalignedMembers;
11000
11001  /// Adds an expression to the set of gathered misaligned members.
11002  void AddPotentialMisalignedMembers(Expr *ERecordDecl *RDValueDecl *MD,
11003                                     CharUnits Alignment);
11004
11005public:
11006  /// Diagnoses the current set of gathered accesses. This typically
11007  /// happens at full expression level. The set is cleared after emitting the
11008  /// diagnostics.
11009  void DiagnoseMisalignedMembers();
11010
11011  /// This function checks if the expression is in the sef of potentially
11012  /// misaligned members and it is converted to some pointer type T with lower
11013  /// or equal alignment requirements. If so it removes it. This is used when
11014  /// we do not want to diagnose such misaligned access (e.g. in conversions to
11015  /// void*).
11016  void DiscardMisalignedMemberAddress(const Type *TExpr *E);
11017
11018  /// This function calls Action when it determines that E designates a
11019  /// misaligned member due to the packed attribute. This is used to emit
11020  /// local diagnostics like in reference binding.
11021  void RefersToMemberWithReducedAlignment(
11022      Expr *E,
11023      llvm::function_ref<void(Expr *, RecordDecl *, FieldDecl *, CharUnits)>
11024          Action);
11025
11026  /// Describes the reason a calling convention specification was ignored, used
11027  /// for diagnostics.
11028  enum class CallingConventionIgnoredReason {
11029    ForThisTarget = 0,
11030    VariadicFunction,
11031    ConstructorDestructor,
11032    BuiltinFunction
11033  };
11034};
11035
11036/// RAII object that enters a new expression evaluation context.
11037class EnterExpressionEvaluationContext {
11038  Sema &Actions;
11039  bool Entered = true;
11040
11041public:
11042  EnterExpressionEvaluationContext(
11043      Sema &ActionsSema::ExpressionEvaluationContext NewContext,
11044      Decl *LambdaContextDecl = nullptr,
11045      Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext =
11046          Sema::ExpressionEvaluationContextRecord::EK_Other,
11047      bool ShouldEnter = true)
11048      : Actions(Actions), Entered(ShouldEnter) {
11049    if (Entered)
11050      Actions.PushExpressionEvaluationContext(NewContextLambdaContextDecl,
11051                                              ExprContext);
11052  }
11053  EnterExpressionEvaluationContext(
11054      Sema &ActionsSema::ExpressionEvaluationContext NewContext,
11055      Sema::ReuseLambdaContextDecl_t,
11056      Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext =
11057          Sema::ExpressionEvaluationContextRecord::EK_Other)
11058      : Actions(Actions) {
11059    Actions.PushExpressionEvaluationContext(
11060        NewContextSema::ReuseLambdaContextDeclExprContext);
11061  }
11062
11063  enum InitListTag { InitList };
11064  EnterExpressionEvaluationContext(Sema &ActionsInitListTag,
11065                                   bool ShouldEnter = true)
11066      : Actions(Actions), Entered(false) {
11067    // In C++11 onwards, narrowing checks are performed on the contents of
11068    // braced-init-lists, even when they occur within unevaluated operands.
11069    // Therefore we still need to instantiate constexpr functions used in such
11070    // a context.
11071    if (ShouldEnter && Actions.isUnevaluatedContext() &&
11072        Actions.getLangOpts().CPlusPlus11) {
11073      Actions.PushExpressionEvaluationContext(
11074          Sema::ExpressionEvaluationContext::UnevaluatedList);
11075      Entered = true;
11076    }
11077  }
11078
11079  ~EnterExpressionEvaluationContext() {
11080    if (Entered)
11081      Actions.PopExpressionEvaluationContext();
11082  }
11083};
11084
11085DeductionFailureInfo
11086MakeDeductionFailureInfo(ASTContext &ContextSema::TemplateDeductionResult TDK,
11087                         sema::TemplateDeductionInfo &Info);
11088
11089/// Contains a late templated function.
11090/// Will be parsed at the end of the translation unit, used by Sema & Parser.
11091struct LateParsedTemplate {
11092  CachedTokens Toks;
11093  /// The template function declaration to be late parsed.
11094  Decl *D;
11095};
11096// end namespace clang
11097
11098namespace llvm {
11099// Hash a FunctionDeclAndLoc by looking at both its FunctionDecl and its
11100// SourceLocation.
11101template <> struct DenseMapInfo<clang::Sema::FunctionDeclAndLoc> {
11102  using FunctionDeclAndLoc = clang::Sema::FunctionDeclAndLoc;
11103  using FDBaseInfo = DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl>>;
11104
11105  static FunctionDeclAndLoc getEmptyKey() {
11106    return {FDBaseInfo::getEmptyKey(), clang::SourceLocation()};
11107  }
11108
11109  static FunctionDeclAndLoc getTombstoneKey() {
11110    return {FDBaseInfo::getTombstoneKey(), clang::SourceLocation()};
11111  }
11112
11113  static unsigned getHashValue(const FunctionDeclAndLoc &FDL) {
11114    return hash_combine(FDBaseInfo::getHashValue(FDL.FD),
11115                        FDL.Loc.getRawEncoding());
11116  }
11117
11118  static bool isEqual(const FunctionDeclAndLoc &LHS,
11119                      const FunctionDeclAndLoc &RHS) {
11120    return LHS.FD == RHS.FD && LHS.Loc == RHS.Loc;
11121  }
11122};
11123// namespace llvm
11124
11125#endif
11126
clang::FileNullability::PointerLoc
clang::FileNullability::PointerEndLoc
clang::FileNullability::PointerKind
clang::FileNullability::SawTypeNullability
clang::FileNullabilityMap::Map
clang::FileNullabilityMap::(anonymous struct)::File
clang::FileNullabilityMap::(anonymous struct)::Nullability
clang::FileNullabilityMap::Cache
clang::PreferredTypeBuilder::enterCondition
clang::PreferredTypeBuilder::enterReturn
clang::PreferredTypeBuilder::enterVariableInit
clang::PreferredTypeBuilder::enterFunctionArgument
clang::PreferredTypeBuilder::enterParenExpr
clang::PreferredTypeBuilder::enterUnary
clang::PreferredTypeBuilder::enterBinary
clang::PreferredTypeBuilder::enterMemAccess
clang::PreferredTypeBuilder::enterSubscript
clang::PreferredTypeBuilder::enterTypeCast
clang::PreferredTypeBuilder::get
clang::PreferredTypeBuilder::ExpectedLoc
clang::PreferredTypeBuilder::Type
clang::PreferredTypeBuilder::ComputeType
clang::Sema::ExternalSource
clang::Sema::isMultiplexExternalSource
clang::Sema::mightHaveNonExternalLinkage
clang::Sema::isVisibleSlow
clang::Sema::shouldLinkPossiblyHiddenDecl
clang::Sema::shouldLinkPossiblyHiddenDecl
clang::Sema::setupImplicitSpecialMemberType
clang::Sema::OpenCLFeatures
clang::Sema::FPFeatures
clang::Sema::LangOpts
clang::Sema::PP
clang::Sema::Context
clang::Sema::Consumer
clang::Sema::Diags
clang::Sema::SourceMgr
clang::Sema::CollectStats
clang::Sema::CodeCompleter
clang::Sema::CurContext
clang::Sema::OriginalLexicalContext
clang::Sema::VAListTagName
clang::Sema::MSStructPragmaOn
clang::Sema::MSPointerToMemberRepresentationMethod
clang::Sema::CurrentSEHFinally
clang::Sema::ImplicitMSInheritanceAttrLoc
clang::Sema::PragmaClangSectionKind
clang::Sema::PragmaClangSectionAction
clang::Sema::PragmaClangSection
clang::Sema::PragmaClangSection::SectionName
clang::Sema::PragmaClangSection::Valid
clang::Sema::PragmaClangSection::PragmaLocation
clang::Sema::PragmaClangSection::Act
clang::Sema::PragmaClangBSSSection
clang::Sema::PragmaClangDataSection
clang::Sema::PragmaClangRodataSection
clang::Sema::PragmaClangTextSection
clang::Sema::PragmaMsStackAction
clang::Sema::PragmaStack
clang::Sema::PragmaStack::Slot
clang::Sema::PragmaStack::Slot::StackSlotLabel
clang::Sema::PragmaStack::Slot::Value
clang::Sema::PragmaStack::Slot::PragmaLocation
clang::Sema::PragmaStack::Slot::PragmaPushLocation
clang::Sema::PragmaStack::Act
clang::Sema::PragmaStack::SentinelAction
clang::Sema::PragmaStack::hasValue
clang::Sema::PragmaStack::Stack
clang::Sema::PragmaStack::DefaultValue
clang::Sema::PragmaStack::CurrentValue
clang::Sema::PragmaStack::CurrentPragmaLocation
clang::Sema::VtorDispStack
clang::Sema::kMac68kAlignmentSentinel
clang::Sema::PackStack
clang::Sema::PackIncludeState
clang::Sema::PackIncludeState::CurrentValue
clang::Sema::PackIncludeState::CurrentPragmaLocation
clang::Sema::PackIncludeState::HasNonDefaultValue
clang::Sema::PackIncludeState::ShouldWarnOnInclude
clang::Sema::PackIncludeStack
clang::Sema::DataSegStack
clang::Sema::BSSSegStack
clang::Sema::ConstSegStack
clang::Sema::CodeSegStack
clang::Sema::PragmaStackSentinelRAII
clang::Sema::PragmaStackSentinelRAII::S
clang::Sema::PragmaStackSentinelRAII::SlotLabel
clang::Sema::PragmaStackSentinelRAII::ShouldAct
clang::Sema::NullabilityMap
clang::Sema::CurInitSeg
clang::Sema::CurInitSegLoc
clang::Sema::VisContext
clang::Sema::PragmaAttributeEntry
clang::Sema::PragmaAttributeEntry::Loc
clang::Sema::PragmaAttributeEntry::Attribute
clang::Sema::PragmaAttributeEntry::MatchRules
clang::Sema::PragmaAttributeEntry::IsUsed
clang::Sema::PragmaAttributeGroup
clang::Sema::PragmaAttributeGroup::Loc
clang::Sema::PragmaAttributeGroup::Namespace
clang::Sema::PragmaAttributeGroup::Entries
clang::Sema::PragmaAttributeStack
clang::Sema::PragmaAttributeCurrentTargetDecl
clang::Sema::OptimizeOffPragmaLocation
clang::Sema::IsBuildingRecoveryCallExpr
clang::Sema::Cleanup
clang::Sema::ExprCleanupObjects
clang::Sema::MaybeODRUseExprs
clang::Sema::PreallocatedFunctionScope
clang::Sema::FunctionScopes
clang::Sema::ExtVectorDecls
clang::Sema::FieldCollector
clang::Sema::UnusedPrivateFields
clang::Sema::UnusedLocalTypedefNameCandidates
clang::Sema::DeleteExprs
clang::Sema::PureVirtualClassDiagSet
clang::Sema::ParsingInitForAutoVars
clang::Sema::findLocallyScopedExternCDecl
clang::Sema::TentativeDefinitions
clang::Sema::UnusedFileScopedDecls
clang::Sema::DelegatingCtorDecls
clang::Sema::DelayedOverridingExceptionSpecChecks
clang::Sema::DelayedEquivalentExceptionSpecChecks
clang::Sema::DelayedDefaultedMemberExceptionSpecs
clang::Sema::LateParsedTemplateMap
clang::Sema::LateTemplateParser
clang::Sema::LateTemplateParserCleanup
clang::Sema::OpaqueParser
clang::Sema::SetLateTemplateParser
clang::Sema::DelayedDiagnosticsState
clang::Sema::DelayedDiagnosticsState::SavedPool
clang::Sema::DelayedDiagnostics
clang::Sema::DelayedDiagnostics::CurPool
clang::Sema::DelayedDiagnostics::add
clang::Sema::DelayedDiagnostics::shouldDelayDiagnostics
clang::Sema::DelayedDiagnostics::getCurrentPool
clang::Sema::DelayedDiagnostics::push
clang::Sema::DelayedDiagnostics::popWithoutEmitting
clang::Sema::DelayedDiagnostics::pushUndelayed
clang::Sema::DelayedDiagnostics::popUndelayed
clang::Sema::DelayedDiagnostics
clang::Sema::ContextRAII
clang::Sema::ContextRAII::S
clang::Sema::ContextRAII::SavedContext
clang::Sema::ContextRAII::SavedContextState
clang::Sema::ContextRAII::SavedCXXThisTypeOverride
clang::Sema::ContextRAII::pop
clang::Sema::SynthesizedFunctionScope
clang::Sema::SynthesizedFunctionScope::S
clang::Sema::SynthesizedFunctionScope::SavedContext
clang::Sema::SynthesizedFunctionScope::PushedCodeSynthesisContext
clang::Sema::SynthesizedFunctionScope::addContextNote
clang::Sema::WeakUndeclaredIdentifiers
clang::Sema::ExtnameUndeclaredIdentifiers
clang::Sema::LoadExternalWeakUndeclaredIdentifiers
clang::Sema::WeakTopLevelDecl
clang::Sema::IdResolver
clang::Sema::TUScope
clang::Sema::StdNamespace
clang::Sema::StdBadAlloc
clang::Sema::StdAlignValT
clang::Sema::StdExperimentalNamespaceCache
clang::Sema::StdInitializerList
clang::Sema::StdCoroutineTraitsCache
clang::Sema::CXXTypeInfoDecl
clang::Sema::MSVCGuidDecl
clang::Sema::NSAPIObj
clang::Sema::NSNumberDecl
clang::Sema::NSValueDecl
clang::Sema::NSNumberPointer
clang::Sema::NSValuePointer
clang::Sema::NSNumberLiteralMethods
clang::Sema::NSStringDecl
clang::Sema::NSStringPointer
clang::Sema::StringWithUTF8StringMethod
clang::Sema::ValueWithBytesObjCTypeMethod
clang::Sema::NSArrayDecl
clang::Sema::ArrayWithObjectsMethod
clang::Sema::NSDictionaryDecl
clang::Sema::DictionaryWithObjectsMethod
clang::Sema::QIDNSCopying
clang::Sema::RespondsToSelectorSel
clang::Sema::GlobalNewDeleteDeclared
clang::Sema::AllowAbstractFieldReference
clang::Sema::ExpressionEvaluationContext
clang::Sema::ExpressionEvaluationContextRecord
clang::Sema::ExpressionEvaluationContextRecord::Context
clang::Sema::ExpressionEvaluationContextRecord::ParentCleanup
clang::Sema::ExpressionEvaluationContextRecord::IsDecltype
clang::Sema::ExpressionEvaluationContextRecord::NumCleanupObjects
clang::Sema::ExpressionEvaluationContextRecord::NumTypos
clang::Sema::ExpressionEvaluationContextRecord::SavedMaybeODRUseExprs
clang::Sema::ExpressionEvaluationContextRecord::Lambdas
clang::Sema::ExpressionEvaluationContextRecord::ManglingContextDecl
clang::Sema::ExpressionEvaluationContextRecord::MangleNumbering
clang::Sema::ExpressionEvaluationContextRecord::DelayedDecltypeCalls
clang::Sema::ExpressionEvaluationContextRecord::DelayedDecltypeBinds
clang::Sema::ExpressionEvaluationContextRecord::PossibleDerefs
clang::Sema::ExpressionEvaluationContextRecord::ExpressionKind
clang::Sema::ExpressionEvaluationContextRecord::ExprContext
clang::Sema::ExpressionEvaluationContextRecord::getMangleNumberingContext
clang::Sema::ExpressionEvaluationContextRecord::isUnevaluated
clang::Sema::ExpressionEvaluationContextRecord::isConstantEvaluated
clang::Sema::ExprEvalContexts
clang::Sema::WarnOnPendingNoDerefs
clang::Sema::getCurrentMangleNumberContext
clang::Sema::SpecialMemberOverloadResult
clang::Sema::SpecialMemberOverloadResult::Kind
clang::Sema::SpecialMemberOverloadResult::Pair
clang::Sema::SpecialMemberOverloadResult::getMethod
clang::Sema::SpecialMemberOverloadResult::setMethod
clang::Sema::SpecialMemberOverloadResult::getKind
clang::Sema::SpecialMemberOverloadResult::setKind
clang::Sema::SpecialMemberOverloadResultEntry
clang::Sema::SpecialMemberCache
clang::Sema::FlagBitsCache
clang::Sema::TUKind
clang::Sema::BumpAlloc
clang::Sema::NumSFINAEErrors
clang::Sema::UnparsedDefaultArgInstantiations
clang::Sema::UnparsedDefaultArgLocs
clang::Sema::UndefinedButUsed
clang::Sema::isExternalWithNoLinkageType
clang::Sema::getUndefinedButUsed
clang::Sema::getMismatchingDeleteExpressions
clang::Sema::MethodPool
clang::Sema::ReferencedSelectors
clang::Sema::CXXSpecialMember
clang::Sema::SpecialMembersBeingDeclared
clang::Sema::TypoCorrectedFunctionDefinitions
clang::Sema::CurrentParameterCopyTypes
clang::Sema::ReadMethodPool
clang::Sema::updateOutOfDateSelector
clang::Sema::isSelfExpr
clang::Sema::isSelfExpr
clang::Sema::EmitCurrentDiagnostic
clang::Sema::FPContractStateRAII
clang::Sema::FPContractStateRAII::S
clang::Sema::FPContractStateRAII::OldFPFeaturesState
clang::Sema::addImplicitTypedef
clang::Sema::Initialize
clang::Sema::getLangOpts
clang::Sema::getOpenCLOptions
clang::Sema::getFPOptions
clang::Sema::getDiagnostics
clang::Sema::getSourceManager
clang::Sema::getPreprocessor
clang::Sema::getASTContext
clang::Sema::getASTConsumer
clang::Sema::getASTMutationListener
clang::Sema::getExternalSource
clang::Sema::addExternalSource
clang::Sema::PrintStats
clang::Sema::SemaDiagnosticBuilder
clang::Sema::SemaDiagnosticBuilder::SemaRef
clang::Sema::SemaDiagnosticBuilder::DiagID
clang::Sema::Diag
clang::Sema::Diag
clang::Sema::PDiag
clang::Sema::findMacroSpelling
clang::Sema::getFixItZeroInitializerForType
clang::Sema::getFixItZeroLiteralForType
clang::Sema::getLocForEndOfToken
clang::Sema::getModuleLoader
clang::Sema::emitAndClearUnusedLocalTypedefWarnings
clang::Sema::ActOnStartOfTranslationUnit
clang::Sema::ActOnEndOfTranslationUnit
clang::Sema::CheckDelegatingCtorCycles
clang::Sema::getScopeForContext
clang::Sema::PushFunctionScope
clang::Sema::PushBlockScope
clang::Sema::PushLambdaScope
clang::Sema::RecordParsingTemplateParameterDepth
clang::Sema::PushCapturedRegionScope
clang::Sema::PopFunctionScopeInfo
clang::Sema::getCurFunction
clang::Sema::getEnclosingFunction
clang::Sema::setFunctionHasBranchIntoScope
clang::Sema::setFunctionHasBranchProtectedScope
clang::Sema::setFunctionHasIndirectGoto
clang::Sema::PushCompoundScope
clang::Sema::PopCompoundScope
clang::Sema::getCurCompoundScope
clang::Sema::hasAnyUnrecoverableErrorsInThisFunction
clang::Sema::getCurBlock
clang::Sema::getCurLambda
clang::Sema::getCurGenericLambda
clang::Sema::getCurCapturedRegion
clang::Sema::WeakTopLevelDecls
clang::Sema::ActOnComment
clang::Sema::BuildQualifiedType
clang::Sema::BuildQualifiedType
clang::Sema::BuildPointerType
clang::Sema::BuildReferenceType
clang::Sema::BuildArrayType
clang::Sema::BuildVectorType
clang::Sema::BuildExtVectorType
clang::Sema::BuildAddressSpaceAttr
clang::Sema::BuildAddressSpaceAttr
clang::Sema::CheckFunctionReturnType
clang::Sema::BuildFunctionType
clang::Sema::BuildMemberPointerType
clang::Sema::BuildBlockPointerType
clang::Sema::BuildParenType
clang::Sema::BuildAtomicType
clang::Sema::BuildReadPipeType
clang::Sema::BuildWritePipeType
clang::Sema::GetTypeForDeclarator
clang::Sema::GetTypeForDeclaratorCast
clang::Sema::CreateParsedType
clang::Sema::GetNameForDeclarator
clang::Sema::GetNameFromUnqualifiedId
clang::Sema::GetTypeFromParser
clang::Sema::canThrow
clang::Sema::ResolveExceptionSpec
clang::Sema::UpdateExceptionSpec
clang::Sema::CheckSpecifiedExceptionType
clang::Sema::CheckDistantExceptionSpec
clang::Sema::CheckEquivalentExceptionSpec
clang::Sema::CheckEquivalentExceptionSpec
clang::Sema::CheckEquivalentExceptionSpec
clang::Sema::handlerCanCatch
clang::Sema::CheckExceptionSpecSubset
clang::Sema::CheckParamExceptionSpec
clang::Sema::ActOnTypeName
clang::Sema::ActOnObjCInstanceType
clang::Sema::TypeDiagnoser
clang::Sema::TypeDiagnoser::diagnose
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::getPrintable
clang::Sema::BoundTypeDiagnoser
clang::Sema::BoundTypeDiagnoser::DiagID
clang::Sema::BoundTypeDiagnoser::Args
clang::Sema::BoundTypeDiagnoser::emit
clang::Sema::BoundTypeDiagnoser::diagnose
clang::Sema::CheckSubscriptAccessOfNoDeref
clang::Sema::CheckAddressOfNoDeref
clang::Sema::CheckMemberAccessOfNoDeref
clang::Sema::RequireCompleteTypeImpl
clang::Sema::ModuleScope
clang::Sema::ModuleScope::Module
clang::Sema::ModuleScope::ModuleInterface
clang::Sema::ModuleScope::OuterVisibleModules
clang::Sema::ModuleScopes
clang::Sema::getCurrentModule
clang::Sema::VisibleModules
clang::Sema::getOwningModule
clang::Sema::makeMergedDefinitionVisible
clang::Sema::isModuleVisible
clang::Sema::isVisible
clang::Sema::hasVisibleDeclaration
clang::Sema::hasVisibleDeclarationSlow
clang::Sema::hasVisibleMergedDefinition
clang::Sema::hasMergedDefinitionInCurrentModule
clang::Sema::hasStructuralCompatLayout
clang::Sema::hasVisibleDefinition
clang::Sema::hasVisibleDefinition
clang::Sema::hasVisibleDefaultArgument
clang::Sema::hasVisibleExplicitSpecialization
clang::Sema::hasVisibleMemberSpecialization
clang::Sema::isEquivalentInternalLinkageDeclaration
clang::Sema::diagnoseEquivalentInternalLinkageDeclarations
clang::Sema::isUsualDeallocationFunction
clang::Sema::isCompleteType
clang::Sema::RequireCompleteType
clang::Sema::RequireCompleteType
clang::Sema::RequireCompleteType
clang::Sema::completeExprArrayBound
clang::Sema::RequireCompleteExprType
clang::Sema::RequireCompleteExprType
clang::Sema::RequireCompleteExprType
clang::Sema::RequireLiteralType
clang::Sema::RequireLiteralType
clang::Sema::RequireLiteralType
clang::Sema::getElaboratedType
clang::Sema::BuildTypeofExprType
clang::Sema::BuildDecltypeType
clang::Sema::BuildUnaryTransformType
clang::Sema::SkipBodyInfo
clang::Sema::SkipBodyInfo::ShouldSkip
clang::Sema::SkipBodyInfo::CheckSameAsPrevious
clang::Sema::SkipBodyInfo::Previous
clang::Sema::SkipBodyInfo::New
clang::Sema::ConvertDeclToDeclGroup
clang::Sema::DiagnoseUseOfUnimplementedSelectors
clang::Sema::isSimpleTypeSpecifier
clang::Sema::getTypeName
clang::Sema::isTagName
clang::Sema::isMicrosoftMissingTypename
clang::Sema::DiagnoseUnknownTypeName
clang::Sema::ActOnMSVCUnknownTypeName
clang::Sema::NameClassificationKind
clang::Sema::NameClassification
clang::Sema::NameClassification::Kind
clang::Sema::NameClassification::Expr
clang::Sema::NameClassification::Template
clang::Sema::NameClassification::Type
clang::Sema::NameClassification::Error
clang::Sema::NameClassification::Unknown
clang::Sema::NameClassification::NestedNameSpecifier
clang::Sema::NameClassification::TypeTemplate
clang::Sema::NameClassification::VarTemplate
clang::Sema::NameClassification::FunctionTemplate
clang::Sema::NameClassification::getKind
clang::Sema::NameClassification::getType
clang::Sema::NameClassification::getExpression
clang::Sema::NameClassification::getTemplateName
clang::Sema::NameClassification::getTemplateNameKind
clang::Sema::ClassifyName
clang::Sema::TemplateNameKindForDiagnostics
clang::Sema::getTemplateNameKindForDiagnostics
clang::Sema::mightBeIntendedToBeTemplateName
clang::Sema::diagnoseExprIntendedAsTemplateName
clang::Sema::ActOnDeclarator
clang::Sema::HandleDeclarator
clang::Sema::RegisterLocallyScopedExternCDecl
clang::Sema::DiagnoseClassNameShadow
clang::Sema::diagnoseQualifiedDeclaration
clang::Sema::diagnoseIgnoredQualifiers
clang::Sema::adjustContextForLocalExternDecl
clang::Sema::DiagnoseFunctionSpecifiers
clang::Sema::getShadowedDeclaration
clang::Sema::getShadowedDeclaration
clang::Sema::CheckShadow
clang::Sema::CheckShadow
clang::Sema::CheckShadowingDeclModification
clang::Sema::DiagnoseShadowingLambdaDecls
clang::Sema::ShadowingDecls
clang::Sema::CheckCastAlign
clang::Sema::handleTagNumbering
clang::Sema::setTagNameForLinkagePurposes
clang::Sema::CheckTypedefForVariablyModifiedType
clang::Sema::ActOnTypedefDeclarator
clang::Sema::ActOnTypedefNameDecl
clang::Sema::ActOnVariableDeclarator
clang::Sema::ActOnDecompositionDeclarator
clang::Sema::CheckVariableDeclaration
clang::Sema::CheckVariableDeclarationType
clang::Sema::DeduceVariableDeclarationType
clang::Sema::CheckCompleteVariableDeclaration
clang::Sema::CheckCompleteDecompositionDeclaration
clang::Sema::MaybeSuggestAddingStaticToDecl
clang::Sema::ActOnFunctionDeclarator
clang::Sema::AddOverriddenMethods
clang::Sema::CheckConstexprFunctionDecl
clang::Sema::CheckConstexprFunctionBody
clang::Sema::DiagnoseHiddenVirtualMethods
clang::Sema::FindHiddenVirtualMethods
clang::Sema::NoteHiddenVirtualMethods
clang::Sema::CheckFunctionDeclaration
clang::Sema::shouldLinkDependentDeclWithPrevious
clang::Sema::canFullyTypeCheckRedeclaration
clang::Sema::CheckMain
clang::Sema::CheckMSVCRTEntryPoint
clang::Sema::getImplicitCodeSegOrSectionAttrForFunction
clang::Sema::ActOnParamDeclarator
clang::Sema::BuildParmVarDeclForTypedef
clang::Sema::CheckParameter
clang::Sema::ActOnParamDefaultArgument
clang::Sema::ActOnParamUnparsedDefaultArgument
clang::Sema::ActOnParamDefaultArgumentError
clang::Sema::SetParamDefaultArgument
clang::Sema::AddInitializerToDecl
clang::Sema::ActOnUninitializedDecl
clang::Sema::ActOnInitializerError
clang::Sema::ActOnPureSpecifier
clang::Sema::ActOnCXXForRangeDecl
clang::Sema::ActOnCXXForRangeIdentifier
clang::Sema::SetDeclDeleted
clang::Sema::SetDeclDefaulted
clang::Sema::CheckStaticLocalForDllExport
clang::Sema::FinalizeDeclaration
clang::Sema::FinalizeDeclaratorGroup
clang::Sema::BuildDeclaratorGroup
clang::Sema::ActOnDocumentableDecl
clang::Sema::ActOnDocumentableDecls
clang::Sema::ActOnFinishKNRParamDeclarations
clang::Sema::CheckForFunctionRedefinition
clang::Sema::ActOnStartOfFunctionDef
clang::Sema::ActOnStartOfFunctionDef
clang::Sema::ActOnStartOfObjCMethodDef
clang::Sema::isObjCMethodDecl
clang::Sema::canDelayFunctionBody
clang::Sema::canSkipFunctionBody
clang::Sema::computeNRVO
clang::Sema::ActOnFinishFunctionBody
clang::Sema::ActOnFinishFunctionBody
clang::Sema::ActOnSkippedFunctionBody
clang::Sema::ActOnFinishInlineFunctionDef
clang::Sema::ActOnFinishDelayedAttribute
clang::Sema::DiagnoseUnusedParameters
clang::Sema::DiagnoseSizeOfParametersAndReturnValue
clang::Sema::DiagnoseInvalidJumps
clang::Sema::ActOnFileScopeAsmDecl
clang::Sema::ActOnEmptyDeclaration
clang::Sema::ModuleDeclKind
clang::Sema::ActOnModuleDecl
clang::Sema::ActOnModuleImport
clang::Sema::ActOnModuleInclude
clang::Sema::BuildModuleInclude
clang::Sema::ActOnModuleBegin
clang::Sema::ActOnModuleEnd
clang::Sema::createImplicitModuleImportForErrorRecovery
clang::Sema::MissingImportKind
clang::Sema::diagnoseMissingImport
clang::Sema::diagnoseMissingImport
clang::Sema::ActOnStartExportDecl
clang::Sema::ActOnFinishExportDecl
clang::Sema::checkSpecializationVisibility
clang::Sema::checkPartialSpecializationVisibility
clang::Sema::getPrintingPolicy
clang::Sema::getPrintingPolicy
clang::Sema::ActOnPopScope
clang::Sema::ActOnTranslationUnitScope
clang::Sema::ParsedFreeStandingDeclSpec
clang::Sema::ParsedFreeStandingDeclSpec
clang::Sema::BuildAnonymousStructOrUnion
clang::Sema::BuildMicrosoftCAnonymousStruct
clang::Sema::NonTagKind
clang::Sema::getNonTagTypeDeclKind
clang::Sema::isAcceptableTagRedeclaration
clang::Sema::TagUseKind
clang::Sema::ActOnTag
clang::Sema::ActOnTemplatedFriendTag
clang::Sema::ActOnDependentTag
clang::Sema::ActOnDefs
clang::Sema::ActOnField
clang::Sema::HandleField
clang::Sema::HandleMSProperty
clang::Sema::CheckFieldDecl
clang::Sema::CheckNontrivialField
clang::Sema::DiagnoseNontrivial
clang::Sema::TrivialABIHandling
clang::Sema::SpecialMemberIsTrivial
clang::Sema::getSpecialMember
clang::Sema::ActOnLastBitfield
clang::Sema::ActOnIvar
clang::Sema::ActOnFields
clang::Sema::ActOnTagStartDefinition
clang::Sema::ActOnDuplicateDefinition
clang::Sema::ActOnTagStartSkippedDefinition
clang::Sema::ActOnObjCContainerStartDefinition
clang::Sema::ActOnStartCXXMemberDeclarations
clang::Sema::ActOnTagFinishDefinition
clang::Sema::ActOnTagFinishSkippedDefinition
clang::Sema::ActOnObjCContainerFinishDefinition
clang::Sema::ActOnObjCTemporaryExitContainerContext
clang::Sema::ActOnObjCReenterContainerContext
clang::Sema::ActOnTagDefinitionError
clang::Sema::CheckEnumConstant
clang::Sema::CheckEnumUnderlyingType
clang::Sema::CheckEnumRedeclaration
clang::Sema::shouldSkipAnonEnumBody
clang::Sema::ActOnEnumConstant
clang::Sema::ActOnEnumBody
clang::Sema::getContainingDC
clang::Sema::PushDeclContext
clang::Sema::PopDeclContext
clang::Sema::EnterDeclaratorContext
clang::Sema::ExitDeclaratorContext
clang::Sema::ActOnReenterFunctionContext
clang::Sema::ActOnExitFunctionContext
clang::Sema::getFunctionLevelDeclContext
clang::Sema::getCurFunctionDecl
clang::Sema::getCurMethodDecl
clang::Sema::getCurFunctionOrMethodDecl
clang::Sema::PushOnScopeChains
clang::Sema::pushExternalDeclIntoScope
clang::Sema::isDeclInScope
clang::Sema::getScopeForDeclContext
clang::Sema::ParseTypedefDecl
clang::Sema::isIncompatibleTypedef
clang::Sema::AvailabilityMergeKind
clang::Sema::AvailabilityPriority
clang::Sema::mergeAvailabilityAttr
clang::Sema::mergeTypeVisibilityAttr
clang::Sema::mergeVisibilityAttr
clang::Sema::mergeUuidAttr
clang::Sema::mergeDLLImportAttr
clang::Sema::mergeDLLExportAttr
clang::Sema::mergeMSInheritanceAttr
clang::Sema::mergeFormatAttr
clang::Sema::mergeSectionAttr
clang::Sema::mergeCodeSegAttr
clang::Sema::mergeAlwaysInlineAttr
clang::Sema::mergeMinSizeAttr
clang::Sema::mergeNoSpeculativeLoadHardeningAttr
clang::Sema::mergeSpeculativeLoadHardeningAttr
clang::Sema::mergeOptimizeNoneAttr
clang::Sema::mergeInternalLinkageAttr
clang::Sema::mergeInternalLinkageAttr
clang::Sema::mergeCommonAttr
clang::Sema::mergeCommonAttr
clang::Sema::mergeDeclAttributes
clang::Sema::MergeTypedefNameDecl
clang::Sema::MergeFunctionDecl
clang::Sema::MergeCompatibleFunctionDecls
clang::Sema::mergeObjCMethodDecls
clang::Sema::MergeVarDecl
clang::Sema::MergeVarDeclTypes
clang::Sema::MergeVarDeclExceptionSpecs
clang::Sema::checkVarDeclRedefinition
clang::Sema::notePreviousDefinition
clang::Sema::MergeCXXFunctionDecl
clang::Sema::AssignmentAction
clang::Sema::OverloadKind
clang::Sema::CheckOverload
clang::Sema::IsOverload
clang::Sema::TryImplicitConversion
clang::Sema::IsIntegralPromotion
clang::Sema::IsFloatingPointPromotion
clang::Sema::IsComplexPromotion
clang::Sema::IsPointerConversion
clang::Sema::isObjCPointerConversion
clang::Sema::isObjCWritebackConversion
clang::Sema::IsBlockPointerConversion
clang::Sema::FunctionParamTypesAreEqual
clang::Sema::HandleFunctionTypeMismatch
clang::Sema::maybeExtendBlockObject
clang::Sema::PrepareCastToObjCObjectPointer
clang::Sema::CheckPointerConversion
clang::Sema::IsMemberPointerConversion
clang::Sema::CheckMemberPointerConversion
clang::Sema::IsQualificationConversion
clang::Sema::IsFunctionConversion
clang::Sema::DiagnoseMultipleUserDefinedConversion
clang::Sema::isSameOrCompatibleFunctionType
clang::Sema::PerformMoveOrCopyInitialization
clang::Sema::CanPerformCopyInitialization
clang::Sema::PerformCopyInitialization
clang::Sema::PerformObjectArgumentInitialization
clang::Sema::checkInitializerLifetime
clang::Sema::PerformContextuallyConvertToBool
clang::Sema::PerformContextuallyConvertToObjCPointer
clang::Sema::CCEKind
clang::Sema::CheckConvertedConstantExpression
clang::Sema::CheckConvertedConstantExpression
clang::Sema::ContextualImplicitConverter
clang::Sema::ContextualImplicitConverter::Suppress
clang::Sema::ContextualImplicitConverter::SuppressConversion
clang::Sema::ContextualImplicitConverter::match
clang::Sema::ContextualImplicitConverter::diagnoseNoMatch
clang::Sema::ContextualImplicitConverter::diagnoseIncomplete
clang::Sema::ContextualImplicitConverter::diagnoseExplicitConv
clang::Sema::ContextualImplicitConverter::noteExplicitConv
clang::Sema::ContextualImplicitConverter::diagnoseAmbiguous
clang::Sema::ContextualImplicitConverter::noteAmbiguous
clang::Sema::ContextualImplicitConverter::diagnoseConversion
clang::Sema::ICEConvertDiagnoser
clang::Sema::ICEConvertDiagnoser::AllowScopedEnumerations
clang::Sema::ICEConvertDiagnoser::match
clang::Sema::ICEConvertDiagnoser::diagnoseNoMatch
clang::Sema::ICEConvertDiagnoser::diagnoseNotInt
clang::Sema::PerformContextualImplicitConversion
clang::Sema::ObjCSubscriptKind
clang::Sema::CheckSubscriptingKind
clang::Sema::ObjCLiteralKind
clang::Sema::CheckLiteralKind
clang::Sema::PerformObjectMemberConversion
clang::Sema::AddOverloadCandidate
clang::Sema::AddFunctionCandidates
clang::Sema::AddMethodCandidate
clang::Sema::AddMethodCandidate
clang::Sema::AddMethodTemplateCandidate
clang::Sema::AddTemplateOverloadCandidate
clang::Sema::CheckNonDependentConversions
clang::Sema::AddConversionCandidate
clang::Sema::AddTemplateConversionCandidate
clang::Sema::AddSurrogateCandidate
clang::Sema::AddMemberOperatorCandidates
clang::Sema::AddBuiltinCandidate
clang::Sema::AddBuiltinOperatorCandidates
clang::Sema::AddArgumentDependentLookupCandidates
clang::Sema::NoteOverloadCandidate
clang::Sema::NoteAllOverloadCandidates
clang::Sema::CheckEnableIf
clang::Sema::findFailedBooleanCondition
clang::Sema::diagnoseArgDependentDiagnoseIfAttrs
clang::Sema::diagnoseArgIndependentDiagnoseIfAttrs
clang::Sema::checkAddressOfFunctionIsAvailable
clang::Sema::ExtractUnqualifiedFunctionType
clang::Sema::ResolveAddressOfOverloadedFunction
clang::Sema::resolveAddressOfOnlyViableOverloadCandidate
clang::Sema::resolveAndFixAddressOfOnlyViableOverloadCandidate
clang::Sema::ResolveSingleFunctionTemplateSpecialization
clang::Sema::ResolveAndFixSingleFunctionTemplateSpecialization
clang::Sema::FixOverloadedFunctionReference
clang::Sema::FixOverloadedFunctionReference
clang::Sema::AddOverloadedCallCandidates
clang::Sema::ForRangeStatus
clang::Sema::BuildForRangeBeginEndCall
clang::Sema::BuildOverloadedCallExpr
clang::Sema::buildOverloadedCallSet
clang::Sema::CreateOverloadedUnaryOp
clang::Sema::CreateOverloadedBinOp
clang::Sema::CreateOverloadedArraySubscriptExpr
clang::Sema::BuildCallToMemberFunction
clang::Sema::BuildCallToObjectOfClassType
clang::Sema::BuildOverloadedArrowExpr
clang::Sema::CheckCallReturnType
clang::Sema::CheckParmsForFunctionDef
clang::Sema::CheckCXXDefaultArguments
clang::Sema::CheckExtraCXXDefaultArguments
clang::Sema::getNonFieldDeclScope
clang::Sema::LookupNameKind
clang::Sema::RedeclarationKind
clang::Sema::forRedeclarationInCurContext
clang::Sema::LiteralOperatorLookupResult
clang::Sema::LookupSpecialMember
clang::Sema::CppLookupName
clang::Sema::TypoExprState
clang::Sema::TypoExprState::Consumer
clang::Sema::TypoExprState::DiagHandler
clang::Sema::TypoExprState::RecoveryHandler
clang::Sema::DelayedTypos
clang::Sema::createDelayedTypo
clang::Sema::KnownNamespaces
clang::Sema::LoadedExternalKnownNamespaces
clang::Sema::makeTypoCorrectionConsumer
clang::Sema::getTypoExprState
clang::Sema::clearDelayedTypo
clang::Sema::LookupSingleName
clang::Sema::LookupName
clang::Sema::LookupQualifiedName
clang::Sema::LookupQualifiedName
clang::Sema::LookupParsedName
clang::Sema::LookupProtocol
clang::Sema::LookupInSuper
clang::Sema::LookupOverloadedOperatorName
clang::Sema::LookupOrCreateLabel
clang::Sema::LookupConstructors
clang::Sema::LookupDefaultConstructor
clang::Sema::LookupCopyingConstructor
clang::Sema::LookupCopyingAssignment
clang::Sema::LookupMovingConstructor
clang::Sema::LookupMovingAssignment
clang::Sema::LookupDestructor
clang::Sema::checkLiteralOperatorId
clang::Sema::LookupLiteralOperator
clang::Sema::isKnownName
clang::Sema::ArgumentDependentLookup
clang::Sema::LookupVisibleDecls
clang::Sema::LookupVisibleDecls
clang::Sema::CorrectTypoKind
clang::Sema::CorrectTypo
clang::Sema::CorrectTypoDelayed
clang::Sema::CorrectDelayedTyposInExpr
clang::Sema::CorrectDelayedTyposInExpr
clang::Sema::CorrectDelayedTyposInExpr
clang::Sema::CorrectDelayedTyposInExpr
clang::Sema::diagnoseTypo
clang::Sema::diagnoseTypo
clang::Sema::MarkTypoCorrectedFunctionDefinition
clang::Sema::FindAssociatedClassesAndNamespaces
clang::Sema::FilterLookupForScope
clang::Sema::CheckRedeclarationModuleOwnership
clang::Sema::DiagnoseAmbiguousLookup
clang::Sema::getObjCInterfaceDecl
clang::Sema::LazilyCreateBuiltin
clang::Sema::ImplicitlyDefineFunction
clang::Sema::AddKnownFunctionAttributes
clang::Sema::ProcessPragmaWeak
clang::Sema::ProcessDeclAttributes
clang::Sema::ProcessDeclAttributeDelayed
clang::Sema::ProcessDeclAttributeList
clang::Sema::ProcessAccessDeclAttributeList
clang::Sema::checkUnusedDeclAttributes
clang::Sema::isValidPointerAttrType
clang::Sema::CheckRegparmAttr
clang::Sema::CheckCallingConvAttr
clang::Sema::CheckAttrTarget
clang::Sema::CheckAttrNoArgs
clang::Sema::checkStringLiteralArgumentAttr
clang::Sema::checkSectionName
clang::Sema::checkTargetAttr
clang::Sema::checkMSInheritanceAttrOnDefinition
clang::Sema::CheckAlignasUnderalignment
clang::Sema::adjustMemberFunctionCC
clang::Sema::hasExplicitCallingConv
clang::Sema::getCallingConvAttributedType
clang::Sema::ProcessStmtAttributes
clang::Sema::WarnConflictingTypedMethods
clang::Sema::CheckConflictingOverridingMethod
clang::Sema::WarnExactTypedMethods
clang::Sema::CheckImplementationIvars
clang::Sema::ImplMethodsVsClassMethods
clang::Sema::DiagnoseUnimplementedProperties
clang::Sema::diagnoseNullResettableSynthesizedSetters
clang::Sema::DefaultSynthesizeProperties
clang::Sema::DefaultSynthesizeProperties
clang::Sema::IvarBacksCurrentMethodAccessor
clang::Sema::DiagnoseUnusedBackingIvarInAccessor
clang::Sema::GetIvarBackingPropertyAccessor
clang::Sema::HandlePropertyInClassExtension
clang::Sema::CreatePropertyDecl
clang::Sema::AtomicPropertySetterGetterRules
clang::Sema::DiagnoseOwningPropertyGetterSynthesis
clang::Sema::DiagnoseMissingDesignatedInitOverrides
clang::Sema::DiagnoseDuplicateIvars
clang::Sema::MethodMatchStrategy
clang::Sema::MatchTwoMethodDeclarations
clang::Sema::MatchAllMethodDeclarations
clang::Sema::CheckCategoryVsClassMethodMatches
clang::Sema::addMethodToGlobalList
clang::Sema::AddMethodToGlobalPool
clang::Sema::LookupMethodInGlobalPool
clang::Sema::CollectMultipleMethodsInGlobalPool
clang::Sema::AreMultipleMethodsInGlobalPool
clang::Sema::DiagnoseMultipleMethodInGlobalPool
clang::Sema::SelectBestMethod
clang::Sema::FailedCorrection
clang::Sema::AddInstanceMethodToGlobalPool
clang::Sema::AddFactoryMethodToGlobalPool
clang::Sema::AddAnyMethodToGlobalPool
clang::Sema::LookupInstanceMethodInGlobalPool
clang::Sema::LookupFactoryMethodInGlobalPool
clang::Sema::SelectorsForTypoCorrection
clang::Sema::LookupImplementedMethodInGlobalPool
clang::Sema::CollectIvarsToConstructOrDestruct
clang::Sema::FullExprArg
clang::Sema::FullExprArg::release
clang::Sema::FullExprArg::get
clang::Sema::FullExprArg::E
clang::Sema::MakeFullExpr
clang::Sema::MakeFullExpr
clang::Sema::MakeFullDiscardedValueExpr
clang::Sema::ActOnExprStmt
clang::Sema::ActOnExprStmtError
clang::Sema::ActOnNullStmt
clang::Sema::ActOnStartOfCompoundStmt
clang::Sema::ActOnFinishOfCompoundStmt
clang::Sema::ActOnCompoundStmt
clang::Sema::CompoundScopeRAII
clang::Sema::CompoundScopeRAII::S
clang::Sema::FunctionScopeRAII
clang::Sema::FunctionScopeRAII::S
clang::Sema::FunctionScopeRAII::Active
clang::Sema::FunctionScopeRAII::disable
clang::Sema::ActOnDeclStmt
clang::Sema::ActOnForEachDeclStmt
clang::Sema::ActOnForEachLValueExpr
clang::Sema::ActOnCaseExpr
clang::Sema::ActOnCaseStmt
clang::Sema::ActOnCaseStmtBody
clang::Sema::ActOnDefaultStmt
clang::Sema::ActOnLabelStmt
clang::Sema::ActOnAttributedStmt
clang::Sema::ActOnIfStmt
clang::Sema::BuildIfStmt
clang::Sema::ActOnStartOfSwitchStmt
clang::Sema::ActOnFinishSwitchStmt
clang::Sema::ActOnWhileStmt
clang::Sema::ActOnDoStmt
clang::Sema::ActOnForStmt
clang::Sema::CheckObjCForCollectionOperand
clang::Sema::ActOnObjCForCollectionStmt
clang::Sema::FinishObjCForCollectionStmt
clang::Sema::BuildForRangeKind
clang::Sema::ActOnCXXForRangeStmt
clang::Sema::BuildCXXForRangeStmt
clang::Sema::FinishCXXForRangeStmt
clang::Sema::ActOnGotoStmt
clang::Sema::ActOnIndirectGotoStmt
clang::Sema::ActOnContinueStmt
clang::Sema::ActOnBreakStmt
clang::Sema::ActOnCapturedRegionStart
clang::Sema::ActOnCapturedRegionStart
clang::Sema::ActOnCapturedRegionEnd
clang::Sema::ActOnCapturedRegionError
clang::Sema::CreateCapturedStmtRecordDecl
clang::Sema::CopyElisionSemanticsKind
clang::Sema::getCopyElisionCandidate
clang::Sema::isCopyElisionCandidate
clang::Sema::ActOnReturnStmt
clang::Sema::BuildReturnStmt
clang::Sema::ActOnCapScopeReturnStmt
clang::Sema::ActOnGCCAsmStmt
clang::Sema::FillInlineAsmIdentifierInfo
clang::Sema::LookupInlineAsmIdentifier
clang::Sema::LookupInlineAsmField
clang::Sema::LookupInlineAsmVarDeclField
clang::Sema::ActOnMSAsmStmt
clang::Sema::GetOrCreateMSAsmLabel
clang::Sema::BuildObjCExceptionDecl
clang::Sema::ActOnObjCExceptionDecl
clang::Sema::ActOnObjCAtCatchStmt
clang::Sema::ActOnObjCAtFinallyStmt
clang::Sema::ActOnObjCAtTryStmt
clang::Sema::BuildObjCAtThrowStmt
clang::Sema::ActOnObjCAtThrowStmt
clang::Sema::ActOnObjCAtSynchronizedOperand
clang::Sema::ActOnObjCAtSynchronizedStmt
clang::Sema::ActOnObjCAutoreleasePoolStmt
clang::Sema::BuildExceptionDeclaration
clang::Sema::ActOnExceptionDeclarator
clang::Sema::ActOnCXXCatchBlock
clang::Sema::ActOnCXXTryBlock
clang::Sema::ActOnSEHTryBlock
clang::Sema::ActOnSEHExceptBlock
clang::Sema::ActOnStartSEHFinallyBlock
clang::Sema::ActOnAbortSEHFinallyBlock
clang::Sema::ActOnFinishSEHFinallyBlock
clang::Sema::ActOnSEHLeaveStmt
clang::Sema::DiagnoseReturnInConstructorExceptionHandler
clang::Sema::ShouldWarnIfUnusedFileScopedDecl
clang::Sema::MarkUnusedFileScopedDecl
clang::Sema::DiagnoseUnusedExprResult
clang::Sema::DiagnoseUnusedNestedTypedefs
clang::Sema::DiagnoseUnusedDecl
clang::Sema::DiagnoseEmptyStmtBody
clang::Sema::DiagnoseEmptyLoopBody
clang::Sema::DiagnoseSelfMove
clang::Sema::diagnoseNullableToNonnullConversion
clang::Sema::diagnoseZeroToNullptrConversion
clang::Sema::PushParsingDeclaration
clang::Sema::PopParsingDeclaration
clang::Sema::PushParsingClass
clang::Sema::PopParsingClass
clang::Sema::redelayDiagnostics
clang::Sema::DiagnoseAvailabilityOfDecl
clang::Sema::makeUnavailableInSystemHeader
clang::Sema::DiagnoseUnguardedAvailabilityViolations
clang::Sema::CanUseDecl
clang::Sema::DiagnoseUseOfDecl
clang::Sema::NoteDeletedFunction
clang::Sema::NoteDeletedInheritingConstructor
clang::Sema::DiagnosePropertyAccessorMismatch
clang::Sema::DiagnoseSentinelCalls
clang::Sema::PushExpressionEvaluationContext
clang::Sema::ReuseLambdaContextDecl_t
clang::Sema::PushExpressionEvaluationContext
clang::Sema::PopExpressionEvaluationContext
clang::Sema::DiscardCleanupsInEvaluationContext
clang::Sema::TransformToPotentiallyEvaluated
clang::Sema::HandleExprEvaluationContextForTypeof
clang::Sema::ActOnConstantExpression
clang::Sema::MarkAnyDeclReferenced
clang::Sema::MarkFunctionReferenced
clang::Sema::MarkVariableReferenced
clang::Sema::MarkDeclRefReferenced
clang::Sema::MarkMemberReferenced
clang::Sema::UpdateMarkingForLValueToRValue
clang::Sema::CleanupVarDeclMarking
clang::Sema::TryCaptureKind
clang::Sema::tryCaptureVariable
clang::Sema::tryCaptureVariable
clang::Sema::NeedToCaptureVariable
clang::Sema::getCapturedDeclRefType
clang::Sema::MarkDeclarationsReferencedInType
clang::Sema::MarkDeclarationsReferencedInExpr
clang::Sema::tryToRecoverWithCall
clang::Sema::tryExprAsCall
clang::Sema::DiagRuntimeBehavior
clang::Sema::getExprRange
clang::Sema::ActOnIdExpression
clang::Sema::DecomposeUnqualifiedId
clang::Sema::DiagnoseEmptyLookup
clang::Sema::LookupInObjCMethod
clang::Sema::ActOnDependentIdExpression
clang::Sema::BuildDeclRefExpr
clang::Sema::BuildDeclRefExpr
clang::Sema::BuildAnonymousStructUnionMemberReference
clang::Sema::BuildPossibleImplicitMemberExpr
clang::Sema::BuildImplicitMemberExpr
clang::Sema::UseArgumentDependentLookup
clang::Sema::BuildQualifiedDeclarationNameExpr
clang::Sema::BuildDependentDeclRefExpr
clang::Sema::BuildDeclarationNameExpr
clang::Sema::BuildDeclarationNameExpr
clang::Sema::BuildLiteralOperatorCall
clang::Sema::BuildPredefinedExpr
clang::Sema::ActOnPredefinedExpr
clang::Sema::ActOnIntegerConstant
clang::Sema::CheckLoopHintExpr
clang::Sema::ActOnNumericConstant
clang::Sema::ActOnCharacterConstant
clang::Sema::ActOnParenExpr
clang::Sema::ActOnParenListExpr
clang::Sema::ActOnStringLiteral
clang::Sema::ActOnGenericSelectionExpr
clang::Sema::CreateGenericSelectionExpr
clang::Sema::CreateBuiltinUnaryOp
clang::Sema::BuildUnaryOp
clang::Sema::ActOnUnaryOp
clang::Sema::isQualifiedMemberAccess
clang::Sema::CheckAddressOfOperand
clang::Sema::CreateUnaryExprOrTypeTraitExpr
clang::Sema::CreateUnaryExprOrTypeTraitExpr
clang::Sema::ActOnUnaryExprOrTypeTraitExpr
clang::Sema::CheckPlaceholderExpr
clang::Sema::CheckVecStepExpr
clang::Sema::CheckUnaryExprOrTypeTraitOperand
clang::Sema::CheckUnaryExprOrTypeTraitOperand
clang::Sema::ActOnSizeofParameterPackExpr
clang::Sema::ActOnPostfixUnaryOp
clang::Sema::ActOnArraySubscriptExpr
clang::Sema::CreateBuiltinArraySubscriptExpr
clang::Sema::ActOnOMPArraySectionExpr
clang::Sema::ActOnMemberAccessExtraArgs
clang::Sema::ActOnMemberAccessExtraArgs::S
clang::Sema::ActOnMemberAccessExtraArgs::Id
clang::Sema::ActOnMemberAccessExtraArgs::ObjCImpDecl
clang::Sema::BuildMemberReferenceExpr
clang::Sema::BuildMemberReferenceExpr
clang::Sema::BuildFieldReferenceExpr
clang::Sema::PerformMemberExprBaseConversion
clang::Sema::CheckQualifiedMemberReference
clang::Sema::ActOnDependentMemberExpr
clang::Sema::ActOnMemberAccessExpr
clang::Sema::ActOnDefaultCtorInitializers
clang::Sema::ConvertArgumentsForCall
clang::Sema::CheckStaticArrayArgument
clang::Sema::ActOnCallExpr
clang::Sema::BuildResolvedCallExpr
clang::Sema::ActOnCUDAExecConfigExpr
clang::Sema::ActOnCastExpr
clang::Sema::BuildCStyleCastExpr
clang::Sema::PrepareScalarCast
clang::Sema::BuildVectorLiteral
clang::Sema::MaybeConvertParenListExprToParenExpr
clang::Sema::ActOnCompoundLiteral
clang::Sema::BuildCompoundLiteralExpr
clang::Sema::ActOnInitList
clang::Sema::ActOnDesignatedInitializer
clang::Sema::ConvertTokenKindToBinaryOpcode
clang::Sema::ActOnBinOp
clang::Sema::BuildBinOp
clang::Sema::CreateBuiltinBinOp
clang::Sema::DiagnoseCommaOperator
clang::Sema::ActOnConditionalOp
clang::Sema::ActOnAddrLabel
clang::Sema::ActOnStartStmtExpr
clang::Sema::ActOnStmtExpr
clang::Sema::ActOnStmtExprResult
clang::Sema::ActOnStmtExprError
clang::Sema::OffsetOfComponent
clang::Sema::OffsetOfComponent::LocStart
clang::Sema::OffsetOfComponent::LocEnd
clang::Sema::OffsetOfComponent::isBrackets
clang::Sema::OffsetOfComponent::(anonymous union)::IdentInfo
clang::Sema::OffsetOfComponent::(anonymous union)::E
clang::Sema::OffsetOfComponent::U
clang::Sema::BuildBuiltinOffsetOf
clang::Sema::ActOnBuiltinOffsetOf
clang::Sema::ActOnChooseExpr
clang::Sema::ActOnVAArg
clang::Sema::BuildVAArgExpr
clang::Sema::ActOnGNUNullExpr
clang::Sema::CheckCaseExpression
clang::Sema::IfExistsResult
clang::Sema::CheckMicrosoftIfExistsSymbol
clang::Sema::CheckMicrosoftIfExistsSymbol
clang::Sema::BuildMSDependentExistsStmt
clang::Sema::ActOnMSDependentExistsStmt
clang::Sema::ActOnBlockStart
clang::Sema::ActOnBlockArguments
clang::Sema::ActOnBlockError
clang::Sema::ActOnBlockStmtExpr
clang::Sema::ActOnConvertVectorExpr
clang::Sema::ActOnAsTypeExpr
clang::Sema::ActOnStartNamespaceDef
clang::Sema::ActOnFinishNamespaceDef
clang::Sema::getStdNamespace
clang::Sema::getOrCreateStdNamespace
clang::Sema::lookupStdExperimentalNamespace
clang::Sema::getStdBadAlloc
clang::Sema::getStdAlignValT
clang::Sema::FullyCheckedComparisonCategories
clang::Sema::tryLookupCtorInitMemberDecl
clang::Sema::CheckComparisonCategoryType
clang::Sema::isStdInitializerList
clang::Sema::BuildStdInitializerList
clang::Sema::isInitListConstructor
clang::Sema::ActOnUsingDirective
clang::Sema::PushUsingDirective
clang::Sema::ActOnNamespaceAliasDef
clang::Sema::HideUsingShadowDecl
clang::Sema::CheckUsingShadowDecl
clang::Sema::BuildUsingShadowDecl
clang::Sema::CheckUsingDeclRedeclaration
clang::Sema::CheckUsingDeclQualifier
clang::Sema::BuildUsingDeclaration
clang::Sema::BuildUsingPackDecl
clang::Sema::CheckInheritingConstructorUsingDecl
clang::Sema::findInheritingConstructor
clang::Sema::ActOnUsingDeclaration
clang::Sema::ActOnAliasDeclaration
clang::Sema::BuildCXXConstructExpr
clang::Sema::BuildCXXConstructExpr
clang::Sema::BuildCXXConstructExpr
clang::Sema::BuildCXXDefaultInitExpr
clang::Sema::CheckCXXDefaultArgExpr
clang::Sema::BuildCXXDefaultArgExpr
clang::Sema::FinalizeVarWithDestructor
clang::Sema::ImplicitExceptionSpecification
clang::Sema::ImplicitExceptionSpecification::Self
clang::Sema::ImplicitExceptionSpecification::ComputedEST
clang::Sema::ImplicitExceptionSpecification::ExceptionsSeen
clang::Sema::ImplicitExceptionSpecification::Exceptions
clang::Sema::ImplicitExceptionSpecification::ClearExceptions
clang::Sema::ImplicitExceptionSpecification::getExceptionSpecType
clang::Sema::ImplicitExceptionSpecification::size
clang::Sema::ImplicitExceptionSpecification::data
clang::Sema::ImplicitExceptionSpecification::CalledDecl
clang::Sema::ImplicitExceptionSpecification::CalledExpr
clang::Sema::ImplicitExceptionSpecification::getExceptionSpec
clang::Sema::ComputeDefaultedDefaultCtorExceptionSpec
clang::Sema::ComputeDefaultedCopyCtorExceptionSpec
clang::Sema::ComputeDefaultedCopyAssignmentExceptionSpec
clang::Sema::ComputeDefaultedMoveCtorExceptionSpec
clang::Sema::ComputeDefaultedMoveAssignmentExceptionSpec
clang::Sema::ComputeDefaultedDtorExceptionSpec
clang::Sema::ComputeInheritingCtorExceptionSpec
clang::Sema::EvaluateImplicitExceptionSpec
clang::Sema::ActOnNoexceptSpec
clang::Sema::checkExceptionSpecification
clang::Sema::isLibstdcxxEagerExceptionSpecHack
clang::Sema::actOnDelayedExceptionSpecification
clang::Sema::ShouldDeleteSpecialMember
clang::Sema::DeclareImplicitDefaultConstructor
clang::Sema::DefineImplicitDefaultConstructor
clang::Sema::DeclareImplicitDestructor
clang::Sema::DefineImplicitDestructor
clang::Sema::AdjustDestructorExceptionSpec
clang::Sema::DefineInheritingConstructor
clang::Sema::DeclareImplicitCopyConstructor
clang::Sema::DefineImplicitCopyConstructor
clang::Sema::DeclareImplicitMoveConstructor
clang::Sema::DefineImplicitMoveConstructor
clang::Sema::DeclareImplicitCopyAssignment
clang::Sema::DefineImplicitCopyAssignment
clang::Sema::DeclareImplicitMoveAssignment
clang::Sema::DefineImplicitMoveAssignment
clang::Sema::ForceDeclarationOfImplicitMembers
clang::Sema::CheckImplicitSpecialMemberDeclaration
clang::Sema::isImplicitlyDeleted
clang::Sema::checkThisInStaticMemberFunctionType
clang::Sema::checkThisInStaticMemberFunctionExceptionSpec
clang::Sema::checkThisInStaticMemberFunctionAttributes
clang::Sema::MaybeBindToTemporary
clang::Sema::CompleteConstructorCall
clang::Sema::getInheritingConstructorName
clang::Sema::getConstructorName
clang::Sema::getDestructorName
clang::Sema::getDestructorTypeForDecltype
clang::Sema::CheckCompatibleReinterpretCast
clang::Sema::ActOnCXXNamedCast
clang::Sema::BuildCXXNamedCast
clang::Sema::BuildCXXTypeId
clang::Sema::BuildCXXTypeId
clang::Sema::ActOnCXXTypeid
clang::Sema::BuildCXXUuidof
clang::Sema::BuildCXXUuidof
clang::Sema::ActOnCXXUuidof
clang::Sema::ActOnCXXFoldExpr
clang::Sema::BuildCXXFoldExpr
clang::Sema::BuildEmptyCXXFoldExpr
clang::Sema::ActOnCXXThis
clang::Sema::getCurrentThisType
clang::Sema::CXXThisTypeOverride
clang::Sema::CXXThisScopeRAII
clang::Sema::CXXThisScopeRAII::S
clang::Sema::CXXThisScopeRAII::OldCXXThisTypeOverride
clang::Sema::CXXThisScopeRAII::Enabled
clang::Sema::CheckCXXThisCapture
clang::Sema::isThisOutsideMemberFunctionBody
clang::Sema::ActOnCXXBoolLiteral
clang::Sema::ActOnObjCBoolLiteral
clang::Sema::ActOnObjCAvailabilityCheckExpr
clang::Sema::ActOnCXXNullPtrLiteral
clang::Sema::ActOnCXXThrow
clang::Sema::BuildCXXThrow
clang::Sema::CheckCXXThrowOperand
clang::Sema::ActOnCXXTypeConstructExpr
clang::Sema::BuildCXXTypeConstructExpr
clang::Sema::ActOnCXXNew
clang::Sema::BuildCXXNew
clang::Sema::isUnavailableAlignedAllocationFunction
clang::Sema::diagnoseUnavailableAlignedAllocation
clang::Sema::CheckAllocatedType
clang::Sema::AllocationFunctionScope
clang::Sema::FindAllocationFunctions
clang::Sema::DeclareGlobalNewDelete
clang::Sema::DeclareGlobalAllocationFunction
clang::Sema::FindDeallocationFunction
clang::Sema::FindUsualDeallocationFunction
clang::Sema::FindDeallocationFunctionForDestructor
clang::Sema::ActOnCXXDelete
clang::Sema::CheckVirtualDtorCall
clang::Sema::ActOnNoexceptExpr
clang::Sema::BuildCXXNoexceptExpr
clang::Sema::ActOnTypeTrait
clang::Sema::BuildTypeTrait
clang::Sema::ActOnArrayTypeTrait
clang::Sema::BuildArrayTypeTrait
clang::Sema::ActOnExpressionTrait
clang::Sema::BuildExpressionTrait
clang::Sema::ActOnStartCXXMemberReference
clang::Sema::BuildPseudoDestructorExpr
clang::Sema::ActOnPseudoDestructorExpr
clang::Sema::ActOnPseudoDestructorExpr
clang::Sema::MaybeCreateExprWithCleanups
clang::Sema::MaybeCreateStmtWithCleanups
clang::Sema::MaybeCreateExprWithCleanups
clang::Sema::CreateMaterializeTemporaryExpr
clang::Sema::ActOnFinishFullExpr
clang::Sema::ActOnFinishFullExpr
clang::Sema::ActOnFinishFullStmt
clang::Sema::RequireCompleteDeclContext
clang::Sema::computeDeclContext
clang::Sema::computeDeclContext
clang::Sema::isDependentScopeSpecifier
clang::Sema::getCurrentInstantiationOf
clang::Sema::ActOnCXXGlobalScopeSpecifier
clang::Sema::ActOnSuperScopeSpecifier
clang::Sema::isAcceptableNestedNameSpecifier
clang::Sema::FindFirstQualifierInScope
clang::Sema::NestedNameSpecInfo
clang::Sema::NestedNameSpecInfo::ObjectType
clang::Sema::NestedNameSpecInfo::Identifier
clang::Sema::NestedNameSpecInfo::IdentifierLoc
clang::Sema::NestedNameSpecInfo::CCLoc
clang::Sema::isNonTypeNestedNameSpecifier
clang::Sema::BuildCXXNestedNameSpecifier
clang::Sema::ActOnCXXNestedNameSpecifier
clang::Sema::ActOnDecltypeExpression
clang::Sema::ActOnCXXNestedNameSpecifierDecltype
clang::Sema::IsInvalidUnlessNestedName
clang::Sema::ActOnCXXNestedNameSpecifier
clang::Sema::SaveNestedNameSpecifierAnnotation
clang::Sema::RestoreNestedNameSpecifierAnnotation
clang::Sema::ShouldEnterDeclaratorScope
clang::Sema::ActOnCXXEnterDeclaratorScope
clang::Sema::ActOnCXXExitDeclaratorScope
clang::Sema::ActOnCXXEnterDeclInitializer
clang::Sema::ActOnCXXExitDeclInitializer
clang::Sema::createLambdaClosureType
clang::Sema::startLambdaDefinition
clang::Sema::buildLambdaScope
clang::Sema::actOnLambdaInitCaptureInitialization
clang::Sema::buildLambdaInitCaptureInitialization
clang::Sema::createLambdaInitCaptureVarDecl
clang::Sema::buildInitCaptureField
clang::Sema::finishLambdaExplicitCaptures
clang::Sema::addLambdaParameters
clang::Sema::deduceClosureReturnType
clang::Sema::ActOnStartOfLambdaDefinition
clang::Sema::ActOnLambdaError
clang::Sema::ActOnLambdaExpr
clang::Sema::CaptureHasSideEffects
clang::Sema::DiagnoseUnusedLambdaCapture
clang::Sema::BuildLambdaExpr
clang::Sema::getLambdaConversionFunctionResultType
clang::Sema::DefineImplicitLambdaToFunctionPointerConversion
clang::Sema::DefineImplicitLambdaToBlockPointerConversion
clang::Sema::BuildBlockForLambdaConversion
clang::Sema::ParseObjCStringLiteral
clang::Sema::BuildObjCStringLiteral
clang::Sema::BuildObjCNumericLiteral
clang::Sema::ActOnObjCBoolLiteral
clang::Sema::BuildObjCArrayLiteral
clang::Sema::BuildObjCBoxedExpr
clang::Sema::BuildObjCSubscriptExpression
clang::Sema::BuildObjCDictionaryLiteral
clang::Sema::BuildObjCEncodeExpression
clang::Sema::BuildCXXMemberCallExpr
clang::Sema::ParseObjCEncodeExpression
clang::Sema::ParseObjCSelectorExpression
clang::Sema::ParseObjCProtocolExpression
clang::Sema::ActOnStartLinkageSpecification
clang::Sema::ActOnFinishLinkageSpecification
clang::Sema::getCurrentClass
clang::Sema::isCurrentClassName
clang::Sema::isCurrentClassNameTypo
clang::Sema::ActOnAccessSpecifier
clang::Sema::ActOnCXXMemberDeclarator
clang::Sema::ActOnStartCXXInClassMemberInitializer
clang::Sema::ActOnFinishCXXInClassMemberInitializer
clang::Sema::ActOnMemInitializer
clang::Sema::ActOnMemInitializer
clang::Sema::BuildMemInitializer
clang::Sema::BuildMemberInitializer
clang::Sema::BuildBaseInitializer
clang::Sema::BuildDelegatingInitializer
clang::Sema::SetDelegatingInitializer
clang::Sema::SetCtorInitializers
clang::Sema::SetIvarInitializers
clang::Sema::MarkBaseAndMemberDestructorsReferenced
clang::Sema::VTableUses
clang::Sema::VTablesUsed
clang::Sema::LoadExternalVTableUses
clang::Sema::MarkVTableUsed
clang::Sema::MarkVirtualMemberExceptionSpecsNeeded
clang::Sema::MarkVirtualMembersReferenced
clang::Sema::DefineUsedVTables
clang::Sema::AddImplicitlyDeclaredMembersToClass
clang::Sema::ActOnMemInitializers
clang::Sema::checkClassLevelDLLAttribute
clang::Sema::checkClassLevelCodeSegAttribute
clang::Sema::referenceDLLExportedClassMethods
clang::Sema::propagateDLLAttrToBaseClassTemplate
clang::Sema::CheckCompletedCXXClass
clang::Sema::checkIllFormedTrivialABIStruct
clang::Sema::ActOnFinishCXXMemberSpecification
clang::Sema::ActOnFinishCXXMemberDecls
clang::Sema::ActOnFinishCXXNonNestedClass
clang::Sema::ActOnReenterCXXMethodParameter
clang::Sema::ActOnReenterTemplateScope
clang::Sema::ActOnStartDelayedMemberDeclarations
clang::Sema::ActOnStartDelayedCXXMethodDeclaration
clang::Sema::ActOnDelayedCXXMethodParameter
clang::Sema::ActOnFinishDelayedMemberDeclarations
clang::Sema::ActOnFinishDelayedCXXMethodDeclaration
clang::Sema::ActOnFinishDelayedMemberInitializers
clang::Sema::MarkAsLateParsedTemplate
clang::Sema::UnmarkAsLateParsedTemplate
clang::Sema::IsInsideALocalClassWithinATemplateFunction
clang::Sema::ActOnStaticAssertDeclaration
clang::Sema::BuildStaticAssertDeclaration
clang::Sema::CheckFriendTypeDecl
clang::Sema::ActOnFriendTypeDecl
clang::Sema::ActOnFriendFunctionDecl
clang::Sema::CheckConstructorDeclarator
clang::Sema::CheckConstructor
clang::Sema::CheckDestructorDeclarator
clang::Sema::CheckDestructor
clang::Sema::CheckConversionDeclarator
clang::Sema::ActOnConversionDeclarator
clang::Sema::CheckDeductionGuideDeclarator
clang::Sema::CheckDeductionGuideTemplate
clang::Sema::CheckExplicitlyDefaultedSpecialMember
clang::Sema::CheckExplicitlyDefaultedMemberExceptionSpec
clang::Sema::CheckDelayedMemberExceptionSpecs
clang::Sema::CheckBaseSpecifier
clang::Sema::ActOnBaseSpecifier
clang::Sema::AttachBaseSpecifiers
clang::Sema::ActOnBaseSpecifiers
clang::Sema::IsDerivedFrom
clang::Sema::IsDerivedFrom
clang::Sema::BuildBasePathArray
clang::Sema::CheckDerivedToBaseConversion
clang::Sema::CheckDerivedToBaseConversion
clang::Sema::getAmbiguousPathsDisplayString
clang::Sema::CheckOverridingFunctionAttributes
clang::Sema::CheckOverridingFunctionReturnType
clang::Sema::CheckOverridingFunctionExceptionSpec
clang::Sema::CheckPureMethod
clang::Sema::CheckOverrideControl
clang::Sema::DiagnoseAbsenceOfOverrideControl
clang::Sema::CheckIfOverriddenFunctionIsMarkedFinal
clang::Sema::AccessResult
clang::Sema::SetMemberAccessSpecifier
clang::Sema::CheckUnresolvedMemberAccess
clang::Sema::CheckUnresolvedLookupAccess
clang::Sema::CheckAllocationAccess
clang::Sema::CheckConstructorAccess
clang::Sema::CheckConstructorAccess
clang::Sema::CheckDestructorAccess
clang::Sema::CheckFriendAccess
clang::Sema::CheckMemberAccess
clang::Sema::CheckStructuredBindingMemberAccess
clang::Sema::CheckMemberOperatorAccess
clang::Sema::CheckAddressOfMemberAccess
clang::Sema::CheckBaseClassAccess
clang::Sema::CheckLookupAccess
clang::Sema::IsSimplyAccessible
clang::Sema::isSpecialMemberAccessibleForDeletion
clang::Sema::HandleDependentAccessCheck
clang::Sema::PerformDependentDiagnostics
clang::Sema::HandleDelayedAccessCheck
clang::Sema::AccessCheckingSFINAE
clang::Sema::AbstractDiagSelID
clang::Sema::isAbstractType
clang::Sema::RequireNonAbstractType
clang::Sema::RequireNonAbstractType
clang::Sema::DiagnoseAbstractType
clang::Sema::CheckOverloadedOperatorDeclaration
clang::Sema::CheckLiteralOperatorDeclaration
clang::Sema::FilterAcceptableTemplateNames
clang::Sema::hasAnyAcceptableTemplateNames
clang::Sema::getAsTemplateNameDecl
clang::Sema::LookupTemplateName
clang::Sema::isTemplateName
clang::Sema::isDeductionGuideName
clang::Sema::DiagnoseUnknownTemplateName
clang::Sema::DiagnoseUninstantiableTemplate
clang::Sema::DiagnoseTemplateParameterShadow
clang::Sema::AdjustDeclIfTemplate
clang::Sema::ActOnTypeParameter
clang::Sema::CheckNonTypeTemplateParameterType
clang::Sema::CheckNonTypeTemplateParameterType
clang::Sema::ActOnNonTypeTemplateParameter
clang::Sema::ActOnTemplateTemplateParameter
clang::Sema::ActOnTemplateParameterList
clang::Sema::TemplateParamListContext
clang::Sema::CheckTemplateParameterList
clang::Sema::MatchTemplateParametersToScopeSpecifier
clang::Sema::CheckClassTemplate
clang::Sema::getTrivialTemplateArgumentLoc
clang::Sema::translateTemplateArguments
clang::Sema::ActOnTemplateTypeArgument
clang::Sema::NoteAllFoundTemplates
clang::Sema::CheckTemplateIdType
clang::Sema::ActOnTemplateIdType
clang::Sema::ActOnTagTemplateIdType
clang::Sema::ActOnVarTemplateSpecialization
clang::Sema::CheckVarTemplateId
clang::Sema::CheckVarTemplateId
clang::Sema::diagnoseMissingTemplateArguments
clang::Sema::BuildTemplateIdExpr
clang::Sema::BuildQualifiedTemplateIdExpr
clang::Sema::ActOnDependentTemplateName
clang::Sema::ActOnClassTemplateSpecialization
clang::Sema::CheckTemplatePartialSpecializationArgs
clang::Sema::CheckTemplatePartialSpecialization
clang::Sema::CheckTemplatePartialSpecialization
clang::Sema::ActOnTemplateDeclarator
clang::Sema::CheckSpecializationInstantiationRedecl
clang::Sema::CheckDependentFunctionTemplateSpecialization
clang::Sema::CheckFunctionTemplateSpecialization
clang::Sema::CheckMemberSpecialization
clang::Sema::CompleteMemberSpecialization
clang::Sema::ActOnExplicitInstantiation
clang::Sema::ActOnExplicitInstantiation
clang::Sema::ActOnExplicitInstantiation
clang::Sema::SubstDefaultTemplateArgumentIfAvailable
clang::Sema::CheckTemplateArgumentKind
clang::Sema::CheckTemplateArgument
clang::Sema::CheckTemplateArgumentList
clang::Sema::CheckTemplateTypeArgument
clang::Sema::CheckTemplateArgument
clang::Sema::CheckTemplateArgument
clang::Sema::CheckTemplateTemplateArgument
clang::Sema::BuildExpressionFromDeclTemplateArgument
clang::Sema::BuildExpressionFromIntegralTemplateArgument
clang::Sema::TemplateParameterListEqualKind
clang::Sema::TemplateParameterListsAreEqual
clang::Sema::CheckTemplateDeclScope
clang::Sema::ActOnTypenameType
clang::Sema::ActOnTypenameType
clang::Sema::CheckTypenameType
clang::Sema::RebuildTypeInCurrentInstantiation
clang::Sema::RebuildNestedNameSpecifierInCurrentInstantiation
clang::Sema::RebuildExprInCurrentInstantiation
clang::Sema::RebuildTemplateParamsInCurrentInstantiation
clang::Sema::getTemplateArgumentBindingsText
clang::Sema::getTemplateArgumentBindingsText
clang::Sema::isUnexpandedParameterPackPermitted
clang::Sema::UnexpandedParameterPackContext
clang::Sema::DiagnoseUnexpandedParameterPacks
clang::Sema::DiagnoseUnexpandedParameterPack
clang::Sema::DiagnoseUnexpandedParameterPack
clang::Sema::DiagnoseUnexpandedParameterPack
clang::Sema::DiagnoseUnexpandedParameterPack
clang::Sema::DiagnoseUnexpandedParameterPack
clang::Sema::DiagnoseUnexpandedParameterPack
clang::Sema::collectUnexpandedParameterPacks
clang::Sema::collectUnexpandedParameterPacks
clang::Sema::collectUnexpandedParameterPacks
clang::Sema::collectUnexpandedParameterPacks
clang::Sema::collectUnexpandedParameterPacks
clang::Sema::collectUnexpandedParameterPacks
clang::Sema::ActOnPackExpansion
clang::Sema::ActOnPackExpansion
clang::Sema::CheckPackExpansion
clang::Sema::CheckPackExpansion
clang::Sema::ActOnPackExpansion
clang::Sema::CheckPackExpansion
clang::Sema::CheckParameterPacksForExpansion
clang::Sema::getNumArgumentsInExpansion
clang::Sema::containsUnexpandedParameterPacks
clang::Sema::getTemplateArgumentPackExpansionPattern
clang::Sema::getFullyPackExpandedSize
clang::Sema::adjustCCAndNoReturn
clang::Sema::TemplateDeductionResult
clang::Sema::DeduceTemplateArguments
clang::Sema::DeduceTemplateArguments
clang::Sema::SubstituteExplicitTemplateArguments
clang::Sema::OriginalCallArg
clang::Sema::OriginalCallArg::OriginalParamType
clang::Sema::OriginalCallArg::DecomposedParam
clang::Sema::OriginalCallArg::ArgIdx
clang::Sema::OriginalCallArg::OriginalArgType
clang::Sema::FinishTemplateArgumentDeduction
clang::Sema::DeduceTemplateArguments
clang::Sema::DeduceTemplateArguments
clang::Sema::DeduceTemplateArguments
clang::Sema::DeduceTemplateArguments
clang::Sema::SubstAutoType
clang::Sema::SubstAutoTypeSourceInfo
clang::Sema::ReplaceAutoType
clang::Sema::DeduceAutoResult
clang::Sema::DeduceAutoType
clang::Sema::DeduceAutoType
clang::Sema::DiagnoseAutoDeductionFailure
clang::Sema::DeduceReturnType
clang::Sema::DeclareImplicitDeductionGuides
clang::Sema::DeduceTemplateSpecializationFromInitializer
clang::Sema::deduceVarTypeFromInitializer
clang::Sema::getReturnTypeLoc
clang::Sema::DeduceFunctionTypeFromReturnExpr
clang::Sema::getMoreSpecializedTemplate
clang::Sema::getMostSpecialized
clang::Sema::getMoreSpecializedPartialSpecialization
clang::Sema::isMoreSpecializedThanPrimary
clang::Sema::getMoreSpecializedPartialSpecialization
clang::Sema::isMoreSpecializedThanPrimary
clang::Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs
clang::Sema::MarkUsedTemplateParameters
clang::Sema::MarkDeducedTemplateParameters
clang::Sema::MarkDeducedTemplateParameters
clang::Sema::getTemplateInstantiationArgs
clang::Sema::CodeSynthesisContext
clang::Sema::CodeSynthesisContext::SynthesisKind
clang::Sema::CodeSynthesisContext::Kind
clang::Sema::CodeSynthesisContext::SavedInNonInstantiationSFINAEContext
clang::Sema::CodeSynthesisContext::PointOfInstantiation
clang::Sema::CodeSynthesisContext::Entity
clang::Sema::CodeSynthesisContext::Template
clang::Sema::CodeSynthesisContext::TemplateArgs
clang::Sema::CodeSynthesisContext::(anonymous union)::NumTemplateArgs
clang::Sema::CodeSynthesisContext::(anonymous union)::SpecialMember
clang::Sema::CodeSynthesisContext::template_arguments
clang::Sema::CodeSynthesisContext::DeductionInfo
clang::Sema::CodeSynthesisContext::InstantiationRange
clang::Sema::CodeSynthesisContext::isInstantiationRecord
clang::Sema::CodeSynthesisContexts
clang::Sema::InstantiatingSpecializations
clang::Sema::InstantiatedNonDependentTypes
clang::Sema::CodeSynthesisContextLookupModules
clang::Sema::LookupModulesCache
clang::Sema::getLookupModules
clang::Sema::VisibleNamespaceCache
clang::Sema::InNonInstantiationSFINAEContext
clang::Sema::NonInstantiationEntries
clang::Sema::LastEmittedCodeSynthesisContextDepth
clang::Sema::TemplateInstCallbacks
clang::Sema::ArgumentPackSubstitutionIndex
clang::Sema::ArgumentPackSubstitutionIndexRAII
clang::Sema::ArgumentPackSubstitutionIndexRAII::Self
clang::Sema::ArgumentPackSubstitutionIndexRAII::OldSubstitutionIndex
clang::Sema::SuppressedDiagnostics
clang::Sema::InstantiatingTemplate
clang::Sema::InstantiatingTemplate::ExceptionSpecification
clang::Sema::InstantiatingTemplate::Clear
clang::Sema::InstantiatingTemplate::isInvalid
clang::Sema::InstantiatingTemplate::isAlreadyInstantiating
clang::Sema::InstantiatingTemplate::SemaRef
clang::Sema::InstantiatingTemplate::Invalid
clang::Sema::InstantiatingTemplate::AlreadyInstantiating
clang::Sema::InstantiatingTemplate::CheckInstantiationDepth
clang::Sema::pushCodeSynthesisContext
clang::Sema::popCodeSynthesisContext
clang::Sema::inTemplateInstantiation
clang::Sema::PrintContextStack
clang::Sema::PrintInstantiationStack
clang::Sema::PrintPragmaAttributeInstantiationPoint
clang::Sema::isSFINAEContext
clang::Sema::isUnevaluatedContext
clang::Sema::SFINAETrap
clang::Sema::SFINAETrap::SemaRef
clang::Sema::SFINAETrap::PrevSFINAEErrors
clang::Sema::SFINAETrap::PrevInNonInstantiationSFINAEContext
clang::Sema::SFINAETrap::PrevAccessCheckingSFINAE
clang::Sema::SFINAETrap::PrevLastDiagnosticIgnored
clang::Sema::SFINAETrap::hasErrorOccurred
clang::Sema::TentativeAnalysisScope
clang::Sema::TentativeAnalysisScope::SemaRef
clang::Sema::TentativeAnalysisScope::Trap
clang::Sema::TentativeAnalysisScope::PrevDisableTypoCorrection
clang::Sema::CurrentInstantiationScope
clang::Sema::DisableTypoCorrection
clang::Sema::TyposCorrected
clang::Sema::TypoCorrectionFailures
clang::Sema::AnalysisWarnings
clang::Sema::ThreadSafetyDeclCache
clang::Sema::PendingInstantiations
clang::Sema::LateParsedInstantiations
clang::Sema::GlobalEagerInstantiationScope
clang::Sema::GlobalEagerInstantiationScope::perform
clang::Sema::GlobalEagerInstantiationScope::S
clang::Sema::GlobalEagerInstantiationScope::SavedVTableUses
clang::Sema::GlobalEagerInstantiationScope::SavedPendingInstantiations
clang::Sema::GlobalEagerInstantiationScope::Enabled
clang::Sema::PendingLocalImplicitInstantiations
clang::Sema::LocalEagerInstantiationScope
clang::Sema::LocalEagerInstantiationScope::perform
clang::Sema::LocalEagerInstantiationScope::S
clang::Sema::LocalEagerInstantiationScope::SavedPendingLocalImplicitInstantiations
clang::Sema::ExtParameterInfoBuilder
clang::Sema::ExtParameterInfoBuilder::Infos
clang::Sema::ExtParameterInfoBuilder::HasInteresting
clang::Sema::ExtParameterInfoBuilder::set
clang::Sema::ExtParameterInfoBuilder::getPointerOrNull
clang::Sema::PerformPendingInstantiations
clang::Sema::SubstType
clang::Sema::SubstType
clang::Sema::SubstType
clang::Sema::SubstFunctionDeclType
clang::Sema::SubstExceptionSpec
clang::Sema::SubstExceptionSpec
clang::Sema::SubstParmVarDecl
clang::Sema::SubstParmTypes
clang::Sema::SubstExpr
clang::Sema::SubstExprs
clang::Sema::SubstStmt
clang::Sema::SubstTemplateParams
clang::Sema::SubstDecl
clang::Sema::SubstInitializer
clang::Sema::SubstBaseSpecifiers
clang::Sema::InstantiateClass
clang::Sema::InstantiateEnum
clang::Sema::InstantiateInClassInitializer
clang::Sema::LateInstantiatedAttribute
clang::Sema::LateInstantiatedAttribute::TmplAttr
clang::Sema::LateInstantiatedAttribute::Scope
clang::Sema::LateInstantiatedAttribute::NewDecl
clang::Sema::InstantiateAttrs
clang::Sema::InstantiateAttrsForDecl
clang::Sema::usesPartialOrExplicitSpecialization
clang::Sema::InstantiateClassTemplateSpecialization
clang::Sema::InstantiateClassMembers
clang::Sema::InstantiateClassTemplateSpecializationMembers
clang::Sema::SubstNestedNameSpecifierLoc
clang::Sema::SubstDeclarationNameInfo
clang::Sema::SubstTemplateName
clang::Sema::Subst
clang::Sema::InstantiateExceptionSpec
clang::Sema::InstantiateFunctionDeclaration
clang::Sema::InstantiateFunctionDefinition
clang::Sema::BuildVarTemplateInstantiation
clang::Sema::CompleteVarTemplateSpecializationDecl
clang::Sema::BuildVariableInstantiation
clang::Sema::InstantiateVariableInitializer
clang::Sema::InstantiateVariableDefinition
clang::Sema::InstantiateMemInitializers
clang::Sema::FindInstantiatedDecl
clang::Sema::FindInstantiatedContext
clang::Sema::ObjCContainerKind
clang::Sema::getObjCContainerKind
clang::Sema::actOnObjCTypeParam
clang::Sema::actOnObjCTypeParamList
clang::Sema::popObjCTypeParamList
clang::Sema::ActOnStartClassInterface
clang::Sema::ActOnSuperClassOfClassInterface
clang::Sema::ActOnTypedefedProtocols
clang::Sema::ActOnCompatibilityAlias
clang::Sema::CheckForwardProtocolDeclarationForCircularDependency
clang::Sema::ActOnStartProtocolInterface
clang::Sema::ActOnStartCategoryInterface
clang::Sema::ActOnStartClassImplementation
clang::Sema::ActOnStartCategoryImplementation
clang::Sema::ActOnFinishObjCImplementation
clang::Sema::ActOnForwardClassDeclaration
clang::Sema::ActOnForwardProtocolDeclaration
clang::Sema::FindProtocolDeclaration
clang::Sema::DiagnoseTypeArgsAndProtocols
clang::Sema::actOnObjCTypeArgsOrProtocolQualifiers
clang::Sema::actOnObjCProtocolQualifierType
clang::Sema::actOnObjCTypeArgsAndProtocolQualifiers
clang::Sema::BuildObjCTypeParamType
clang::Sema::BuildObjCObjectType
clang::Sema::CheckObjCPropertyAttributes
clang::Sema::ProcessPropertyDecl
clang::Sema::DiagnosePropertyMismatch
clang::Sema::DiagnoseClassExtensionDupMethods
clang::Sema::ActOnAtEnd
clang::Sema::ActOnProperty
clang::Sema::ActOnPropertyImplDecl
clang::Sema::ObjCSpecialMethodKind
clang::Sema::ObjCArgInfo
clang::Sema::ObjCArgInfo::Name
clang::Sema::ObjCArgInfo::NameLoc
clang::Sema::ObjCArgInfo::Type
clang::Sema::ObjCArgInfo::DeclSpec
clang::Sema::ObjCArgInfo::ArgAttrs
clang::Sema::ActOnMethodDeclaration
clang::Sema::LookupMethodInQualifiedType
clang::Sema::LookupMethodInObjectType
clang::Sema::CheckARCMethodDecl
clang::Sema::inferObjCARCLifetime
clang::Sema::HandleExprPropertyRefExpr
clang::Sema::ActOnClassPropertyRefExpr
clang::Sema::tryCaptureObjCSelf
clang::Sema::ObjCMessageKind
clang::Sema::getObjCMessageKind
clang::Sema::ActOnSuperMessage
clang::Sema::BuildClassMessage
clang::Sema::BuildClassMessageImplicit
clang::Sema::ActOnClassMessage
clang::Sema::BuildInstanceMessage
clang::Sema::BuildInstanceMessageImplicit
clang::Sema::ActOnInstanceMessage
clang::Sema::BuildObjCBridgedCast
clang::Sema::ActOnObjCBridgedCast
clang::Sema::CheckTollFreeBridgeCast
clang::Sema::CheckObjCBridgeRelatedCast
clang::Sema::CheckTollFreeBridgeStaticCast
clang::Sema::checkObjCBridgeRelatedComponents
clang::Sema::CheckObjCBridgeRelatedConversions
clang::Sema::ConversionToObjCStringLiteralCheck
clang::Sema::checkInitMethod
clang::Sema::CheckObjCMethodOverride
clang::Sema::ResultTypeCompatibilityKind
clang::Sema::CheckObjCMethodOverrides
clang::Sema::PragmaOptionsAlignKind
clang::Sema::ActOnPragmaClangSection
clang::Sema::ActOnPragmaOptionsAlign
clang::Sema::ActOnPragmaPack
clang::Sema::PragmaPackDiagnoseKind
clang::Sema::DiagnoseNonDefaultPragmaPack
clang::Sema::DiagnoseUnterminatedPragmaPack
clang::Sema::ActOnPragmaMSStruct
clang::Sema::ActOnPragmaMSComment
clang::Sema::ActOnPragmaMSPointersToMembers
clang::Sema::ActOnPragmaMSVtorDisp
clang::Sema::PragmaSectionKind
clang::Sema::UnifySection
clang::Sema::UnifySection
clang::Sema::ActOnPragmaMSSeg
clang::Sema::ActOnPragmaMSSection
clang::Sema::ActOnPragmaMSInitSeg
clang::Sema::ActOnPragmaDump
clang::Sema::ActOnPragmaDetectMismatch
clang::Sema::ActOnPragmaUnused
clang::Sema::ActOnPragmaVisibility
clang::Sema::DeclClonePragmaWeak
clang::Sema::DeclApplyPragmaWeak
clang::Sema::ActOnPragmaWeakID
clang::Sema::ActOnPragmaRedefineExtname
clang::Sema::ActOnPragmaWeakAlias
clang::Sema::ActOnPragmaFPContract
clang::Sema::ActOnPragmaFEnvAccess
clang::Sema::AddAlignmentAttributesForRecord
clang::Sema::AddMsStructLayoutForRecord
clang::Sema::FreePackedContext
clang::Sema::PushNamespaceVisibilityAttr
clang::Sema::AddPushedVisibilityAttribute
clang::Sema::PopPragmaVisibility
clang::Sema::FreeVisContext
clang::Sema::AddCFAuditedAttribute
clang::Sema::ActOnPragmaAttributeAttribute
clang::Sema::ActOnPragmaAttributeEmptyPush
clang::Sema::ActOnPragmaAttributePop
clang::Sema::AddPragmaAttributes
clang::Sema::DiagnoseUnterminatedPragmaAttribute
clang::Sema::ActOnPragmaOptimize
clang::Sema::getOptimizeOffPragmaLocation
clang::Sema::AddRangeBasedOptnone
clang::Sema::AddOptnoneAttributeIfNoConflicts
clang::Sema::AddAlignedAttr
clang::Sema::AddAlignedAttr
clang::Sema::AddAssumeAlignedAttr
clang::Sema::AddAllocAlignAttr
clang::Sema::AddAlignValueAttr
clang::Sema::AddLaunchBoundsAttr
clang::Sema::AddModeAttr
clang::Sema::AddParameterABIAttr
clang::Sema::RetainOwnershipKind
clang::Sema::AddXConsumedAttr
clang::Sema::addAMDGPUFlatWorkGroupSizeAttr
clang::Sema::addAMDGPUWavesPerEUAttr
clang::Sema::checkNSReturnsRetainedReturnType
clang::Sema::ActOnCoroutineBodyStart
clang::Sema::ActOnCoawaitExpr
clang::Sema::ActOnCoyieldExpr
clang::Sema::ActOnCoreturnStmt
clang::Sema::BuildResolvedCoawaitExpr
clang::Sema::BuildUnresolvedCoawaitExpr
clang::Sema::BuildCoyieldExpr
clang::Sema::BuildCoreturnStmt
clang::Sema::BuildCoroutineBodyStmt
clang::Sema::buildCoroutineParameterMoves
clang::Sema::buildCoroutinePromise
clang::Sema::CheckCompletedCoroutineBody
clang::Sema::lookupCoroutineTraits
clang::Sema::CurrOpenCLExtension
clang::Sema::OpenCLTypeExtMap
clang::Sema::OpenCLDeclExtMap
clang::Sema::getCurrentOpenCLExtension
clang::Sema::getOpenCLExtensionsFromDeclExtMap
clang::Sema::getOpenCLExtensionsFromTypeExtMap
clang::Sema::getOpenCLExtensionsFromExtMap
clang::Sema::setCurrentOpenCLExtension
clang::Sema::setOpenCLExtensionForType
clang::Sema::setOpenCLExtensionForDecl
clang::Sema::setCurrentOpenCLExtensionForType
clang::Sema::setCurrentOpenCLExtensionForDecl
clang::Sema::isOpenCLDisabledDecl
clang::Sema::checkOpenCLDisabledTypeDeclSpec
clang::Sema::checkOpenCLDisabledDecl
clang::Sema::VarDataSharingAttributesStack
clang::Sema::DeclareTargetNestingLevel
clang::Sema::InitDataSharingAttributesStack
clang::Sema::DestroyDataSharingAttributesStack
clang::Sema::VerifyPositiveIntegerConstantInClause
clang::Sema::getOpenMPNestingLevel
clang::Sema::adjustOpenMPTargetScopeIndex
clang::Sema::pushOpenMPFunctionRegion
clang::Sema::popOpenMPFunctionRegion
clang::Sema::checkOpenMPDeviceFunction
clang::Sema::checkOpenMPDeviceExpr
clang::Sema::checkOpenCLDisabledTypeOrDecl
clang::Sema::isOpenMPCapturedByRef
clang::Sema::isOpenMPCapturedDecl
clang::Sema::getOpenMPCapturedExpr
clang::Sema::startOpenMPLoop
clang::Sema::isOpenMPPrivateDecl
clang::Sema::setOpenMPCaptureKind
clang::Sema::isOpenMPTargetCapturedDecl
clang::Sema::PerformOpenMPImplicitIntegerConversion
clang::Sema::StartOpenMPDSABlock
clang::Sema::StartOpenMPClause
clang::Sema::EndOpenMPClause
clang::Sema::EndOpenMPDSABlock
clang::Sema::ActOnOpenMPLoopInitialization
clang::Sema::ActOnOpenMPIdExpression
clang::Sema::ActOnOpenMPThreadprivateDirective
clang::Sema::CheckOMPThreadPrivateDecl
clang::Sema::ActOnOpenMPAllocateDirective
clang::Sema::ActOnOpenMPRequiresDirective
clang::Sema::CheckOMPRequiresDecl
clang::Sema::ActOnOpenMPDeclareReductionType
clang::Sema::ActOnOpenMPDeclareReductionDirectiveStart
clang::Sema::ActOnOpenMPDeclareReductionCombinerStart
clang::Sema::ActOnOpenMPDeclareReductionCombinerEnd
clang::Sema::ActOnOpenMPDeclareReductionInitializerStart
clang::Sema::ActOnOpenMPDeclareReductionInitializerEnd
clang::Sema::ActOnOpenMPDeclareReductionDirectiveEnd
clang::Sema::ActOnOpenMPDeclareMapperVarDecl
clang::Sema::ActOnOpenMPDeclareMapperType
clang::Sema::ActOnOpenMPDeclareMapperDirectiveStart
clang::Sema::ActOnOpenMPDeclareMapperDirectiveVarDecl
clang::Sema::ActOnOpenMPDeclareMapperDirectiveEnd
clang::Sema::ActOnStartOpenMPDeclareTargetDirective
clang::Sema::ActOnFinishOpenMPDeclareTargetDirective
clang::Sema::ActOnOpenMPDeclareTargetName
clang::Sema::checkDeclIsAllowedInOpenMPTarget
clang::Sema::isInOpenMPDeclareTargetContext
clang::Sema::isInOpenMPTargetExecutionDirective
clang::Sema::shouldDiagnoseTargetSupportFromOpenMP
clang::Sema::getOpenMPCaptureLevels
clang::Sema::ActOnOpenMPRegionStart
clang::Sema::ActOnOpenMPRegionEnd
clang::Sema::ActOnOpenMPExecutableDirective
clang::Sema::ActOnOpenMPParallelDirective
clang::Sema::ActOnOpenMPSimdDirective
clang::Sema::ActOnOpenMPForDirective
clang::Sema::ActOnOpenMPForSimdDirective
clang::Sema::ActOnOpenMPSectionsDirective
clang::Sema::ActOnOpenMPSectionDirective
clang::Sema::ActOnOpenMPSingleDirective
clang::Sema::ActOnOpenMPMasterDirective
clang::Sema::ActOnOpenMPCriticalDirective
clang::Sema::ActOnOpenMPParallelForDirective
clang::Sema::ActOnOpenMPParallelForSimdDirective
clang::Sema::ActOnOpenMPParallelSectionsDirective
clang::Sema::ActOnOpenMPTaskDirective
clang::Sema::ActOnOpenMPTaskyieldDirective
clang::Sema::ActOnOpenMPBarrierDirective
clang::Sema::ActOnOpenMPTaskwaitDirective
clang::Sema::ActOnOpenMPTaskgroupDirective
clang::Sema::ActOnOpenMPFlushDirective
clang::Sema::ActOnOpenMPOrderedDirective
clang::Sema::ActOnOpenMPAtomicDirective
clang::Sema::ActOnOpenMPTargetDirective
clang::Sema::ActOnOpenMPTargetDataDirective
clang::Sema::ActOnOpenMPTargetEnterDataDirective
clang::Sema::ActOnOpenMPTargetExitDataDirective
clang::Sema::ActOnOpenMPTargetParallelDirective
clang::Sema::ActOnOpenMPTargetParallelForDirective
clang::Sema::ActOnOpenMPTeamsDirective
clang::Sema::ActOnOpenMPCancellationPointDirective
clang::Sema::ActOnOpenMPCancelDirective
clang::Sema::ActOnOpenMPTaskLoopDirective
clang::Sema::ActOnOpenMPTaskLoopSimdDirective
clang::Sema::ActOnOpenMPDistributeDirective
clang::Sema::ActOnOpenMPTargetUpdateDirective
clang::Sema::ActOnOpenMPDistributeParallelForDirective
clang::Sema::ActOnOpenMPDistributeParallelForSimdDirective
clang::Sema::ActOnOpenMPDistributeSimdDirective
clang::Sema::ActOnOpenMPTargetParallelForSimdDirective
clang::Sema::ActOnOpenMPTargetSimdDirective
clang::Sema::ActOnOpenMPTeamsDistributeDirective
clang::Sema::ActOnOpenMPTeamsDistributeSimdDirective
clang::Sema::ActOnOpenMPTeamsDistributeParallelForSimdDirective
clang::Sema::ActOnOpenMPTeamsDistributeParallelForDirective
clang::Sema::ActOnOpenMPTargetTeamsDirective
clang::Sema::ActOnOpenMPTargetTeamsDistributeDirective
clang::Sema::ActOnOpenMPTargetTeamsDistributeParallelForDirective
clang::Sema::ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective
clang::Sema::ActOnOpenMPTargetTeamsDistributeSimdDirective
clang::Sema::CheckOpenMPLinearModifier
clang::Sema::CheckOpenMPLinearDecl
clang::Sema::ActOnOpenMPDeclareSimdDirective
clang::Sema::ActOnOpenMPSingleExprClause
clang::Sema::ActOnOpenMPAllocatorClause
clang::Sema::ActOnOpenMPIfClause
clang::Sema::ActOnOpenMPFinalClause
clang::Sema::ActOnOpenMPNumThreadsClause
clang::Sema::ActOnOpenMPSafelenClause
clang::Sema::ActOnOpenMPSimdlenClause
clang::Sema::ActOnOpenMPCollapseClause
clang::Sema::ActOnOpenMPOrderedClause
clang::Sema::ActOnOpenMPGrainsizeClause
clang::Sema::ActOnOpenMPNumTasksClause
clang::Sema::ActOnOpenMPHintClause
clang::Sema::ActOnOpenMPSimpleClause
clang::Sema::ActOnOpenMPDefaultClause
clang::Sema::ActOnOpenMPProcBindClause
clang::Sema::ActOnOpenMPSingleExprWithArgClause
clang::Sema::ActOnOpenMPScheduleClause
clang::Sema::ActOnOpenMPClause
clang::Sema::ActOnOpenMPNowaitClause
clang::Sema::ActOnOpenMPUntiedClause
clang::Sema::ActOnOpenMPMergeableClause
clang::Sema::ActOnOpenMPReadClause
clang::Sema::ActOnOpenMPWriteClause
clang::Sema::ActOnOpenMPUpdateClause
clang::Sema::ActOnOpenMPCaptureClause
clang::Sema::ActOnOpenMPSeqCstClause
clang::Sema::ActOnOpenMPThreadsClause
clang::Sema::ActOnOpenMPSIMDClause
clang::Sema::ActOnOpenMPNogroupClause
clang::Sema::ActOnOpenMPUnifiedAddressClause
clang::Sema::ActOnOpenMPUnifiedSharedMemoryClause
clang::Sema::ActOnOpenMPReverseOffloadClause
clang::Sema::ActOnOpenMPDynamicAllocatorsClause
clang::Sema::ActOnOpenMPAtomicDefaultMemOrderClause
clang::Sema::ActOnOpenMPVarListClause
clang::Sema::ActOnOpenMPAllocateClause
clang::Sema::ActOnOpenMPPrivateClause
clang::Sema::ActOnOpenMPFirstprivateClause
clang::Sema::ActOnOpenMPLastprivateClause
clang::Sema::ActOnOpenMPSharedClause
clang::Sema::ActOnOpenMPReductionClause
clang::Sema::ActOnOpenMPTaskReductionClause
clang::Sema::ActOnOpenMPInReductionClause
clang::Sema::ActOnOpenMPLinearClause
clang::Sema::ActOnOpenMPAlignedClause
clang::Sema::ActOnOpenMPCopyinClause
clang::Sema::ActOnOpenMPCopyprivateClause
clang::Sema::ActOnOpenMPFlushClause
clang::Sema::ActOnOpenMPDependClause
clang::Sema::ActOnOpenMPDeviceClause
clang::Sema::ActOnOpenMPMapClause
clang::Sema::ActOnOpenMPNumTeamsClause
clang::Sema::ActOnOpenMPThreadLimitClause
clang::Sema::ActOnOpenMPPriorityClause
clang::Sema::ActOnOpenMPDistScheduleClause
clang::Sema::ActOnOpenMPDefaultmapClause
clang::Sema::ActOnOpenMPToClause
clang::Sema::ActOnOpenMPFromClause
clang::Sema::ActOnOpenMPUseDevicePtrClause
clang::Sema::ActOnOpenMPIsDevicePtrClause
clang::Sema::CheckedConversionKind
clang::Sema::isCast
clang::Sema::ImpCastExprToType
clang::Sema::ScalarTypeToBooleanCastKind
clang::Sema::IgnoredValueConversions
clang::Sema::UsualUnaryConversions
clang::Sema::CallExprUnaryConversions
clang::Sema::DefaultFunctionArrayConversion
clang::Sema::DefaultFunctionArrayLvalueConversion
clang::Sema::DefaultLvalueConversion
clang::Sema::DefaultArgumentPromotion
clang::Sema::TemporaryMaterializationConversion
clang::Sema::VariadicCallType
clang::Sema::getVariadicCallType
clang::Sema::VarArgKind
clang::Sema::isValidVarArgType
clang::Sema::checkVariadicArgument
clang::Sema::hasCStrMethod
clang::Sema::GatherArgumentsForCall
clang::Sema::DefaultVariadicArgumentPromotion
clang::Sema::UsualArithmeticConversions
clang::Sema::AssignConvertType
clang::Sema::DiagnoseAssignmentResult
clang::Sema::IsValueInFlagEnum
clang::Sema::DiagnoseAssignmentEnum
clang::Sema::CheckAssignmentConstraints
clang::Sema::CheckAssignmentConstraints
clang::Sema::CheckSingleAssignmentConstraints
clang::Sema::CheckTransparentUnionArgumentConstraints
clang::Sema::IsStringLiteralToNonConstPointerConversion
clang::Sema::CheckExceptionSpecCompatibility
clang::Sema::PerformImplicitConversion
clang::Sema::PerformImplicitConversion
clang::Sema::PerformImplicitConversion
clang::Sema::PerformImplicitConversion
clang::Sema::PerformQualificationConversion
clang::Sema::InvalidOperands
clang::Sema::InvalidLogicalVectorOperands
clang::Sema::CheckPointerToMemberOperands
clang::Sema::CheckMultiplyDivideOperands
clang::Sema::CheckRemainderOperands
clang::Sema::CheckAdditionOperands
clang::Sema::CheckSubtractionOperands
clang::Sema::CheckShiftOperands
clang::Sema::CheckCompareOperands
clang::Sema::CheckBitwiseOperands
clang::Sema::CheckLogicalOperands
clang::Sema::CheckAssignmentOperands
clang::Sema::checkPseudoObjectIncDec
clang::Sema::checkPseudoObjectAssignment
clang::Sema::checkPseudoObjectRValue
clang::Sema::recreateSyntacticForm
clang::Sema::CheckConditionalOperands
clang::Sema::CXXCheckConditionalOperands
clang::Sema::FindCompositePointerType
clang::Sema::FindCompositePointerType
clang::Sema::FindCompositeObjCPointerType
clang::Sema::DiagnoseConditionalForNull
clang::Sema::DiagnoseAlwaysNonNullPointer
clang::Sema::CheckVectorOperands
clang::Sema::GetSignedVectorType
clang::Sema::CheckVectorCompareOperands
clang::Sema::CheckVectorLogicalOperands
clang::Sema::areLaxCompatibleVectorTypes
clang::Sema::isLaxVectorConversion
clang::Sema::CheckForConstantInitializer
clang::Sema::ReferenceCompareResult
clang::Sema::CompareReferenceRelationship
clang::Sema::checkUnknownAnyCast
clang::Sema::forceUnknownAnyToType
clang::Sema::checkUnknownAnyArg
clang::Sema::CheckVectorCast
clang::Sema::prepareVectorSplat
clang::Sema::CheckExtVectorCast
clang::Sema::BuildCXXFunctionalCastExpr
clang::Sema::ARCConversionResult
clang::Sema::CheckObjCConversion
clang::Sema::stripARCUnbridgedCast
clang::Sema::diagnoseARCUnbridgedCast
clang::Sema::CheckObjCARCUnavailableWeakConversion
clang::Sema::checkRetainCycles
clang::Sema::checkRetainCycles
clang::Sema::checkRetainCycles
clang::Sema::checkUnsafeAssigns
clang::Sema::checkUnsafeExprAssigns
clang::Sema::CheckMessageArgumentTypes
clang::Sema::getMessageSendResultType
clang::Sema::EmitRelatedResultTypeNote
clang::Sema::EmitRelatedResultTypeNoteForReturn
clang::Sema::ConditionResult
clang::Sema::ConditionResult::ConditionVar
clang::Sema::ConditionResult::Condition
clang::Sema::ConditionResult::Invalid
clang::Sema::ConditionResult::HasKnownValue
clang::Sema::ConditionResult::KnownValue
clang::Sema::ConditionResult::isInvalid
clang::Sema::ConditionResult::get
clang::Sema::ConditionResult::getKnownValue
clang::Sema::ConditionError
clang::Sema::ConditionKind
clang::Sema::ActOnCondition
clang::Sema::ActOnConditionVariable
clang::Sema::ActOnCXXConditionDeclaration
clang::Sema::CheckConditionVariable
clang::Sema::CheckSwitchCondition
clang::Sema::CheckBooleanCondition
clang::Sema::DiagnoseAssignmentAsCondition
clang::Sema::DiagnoseEqualityWithExtraParens
clang::Sema::CheckCXXBooleanCondition
clang::Sema::ConvertIntegerToTypeWarnOnOverflow
clang::Sema::CheckObjCDeclScope
clang::Sema::VerifyICEDiagnoser
clang::Sema::VerifyICEDiagnoser::Suppress
clang::Sema::VerifyICEDiagnoser::diagnoseNotICE
clang::Sema::VerifyICEDiagnoser::diagnoseFold
clang::Sema::VerifyIntegerConstantExpression
clang::Sema::VerifyIntegerConstantExpression
clang::Sema::VerifyIntegerConstantExpression
clang::Sema::VerifyBitField
clang::Sema::ForceCUDAHostDeviceDepth
clang::Sema::PushForceCUDAHostDevice
clang::Sema::PopForceCUDAHostDevice
clang::Sema::DeviceDeferredDiags
clang::Sema::FunctionDeclAndLoc
clang::Sema::FunctionDeclAndLoc::FD
clang::Sema::FunctionDeclAndLoc::Loc
clang::Sema::LocsWithCUDACallDiags
clang::Sema::DeviceKnownEmittedFns
clang::Sema::DeviceDiagBuilder
clang::Sema::DeviceDiagBuilder::Kind
clang::Sema::DeviceDiagBuilder::S
clang::Sema::DeviceDiagBuilder::Loc
clang::Sema::DeviceDiagBuilder::DiagID
clang::Sema::DeviceDiagBuilder::Fn
clang::Sema::DeviceDiagBuilder::ShowCallStack
clang::Sema::DeviceDiagBuilder::ImmediateDiag
clang::Sema::DeviceDiagBuilder::PartialDiagId
clang::Sema::markKnownEmitted
clang::Sema::CUDADiagIfDeviceCode
clang::Sema::CUDADiagIfHostCode
clang::Sema::diagIfOpenMPDeviceCode
clang::Sema::targetDiag
clang::Sema::CUDAFunctionTarget
clang::Sema::IdentifyCUDATarget
clang::Sema::IdentifyCUDATarget
clang::Sema::CurrentCUDATarget
clang::Sema::CUDAFunctionPreference
clang::Sema::IdentifyCUDAPreference
clang::Sema::IsAllowedCUDACall
clang::Sema::maybeAddCUDAHostDeviceAttrs
clang::Sema::CheckCUDACall
clang::Sema::CUDASetLambdaAttrs
clang::Sema::EraseUnwantedCUDAMatches
clang::Sema::inferCUDATargetForImplicitSpecialMember
clang::Sema::isEmptyCudaConstructor
clang::Sema::isEmptyCudaDestructor
clang::Sema::checkAllowedCUDAInitializer
clang::Sema::checkCUDATargetOverload
clang::Sema::inheritCUDATargetAttrs
clang::Sema::getCudaConfigureFuncName
clang::Sema::ParserCompletionContext
clang::Sema::CodeCompleteModuleImport
clang::Sema::CodeCompleteOrdinaryName
clang::Sema::CodeCompleteDeclSpec
clang::Sema::CodeCompleteExpression
clang::Sema::CodeCompleteExpression
clang::Sema::CodeCompleteMemberReferenceExpr
clang::Sema::CodeCompletePostfixExpression
clang::Sema::CodeCompleteTag
clang::Sema::CodeCompleteTypeQualifiers
clang::Sema::CodeCompleteFunctionQualifiers
clang::Sema::CodeCompleteBracketDeclarator
clang::Sema::CodeCompleteCase
clang::Sema::ProduceCallSignatureHelp
clang::Sema::ProduceConstructorSignatureHelp
clang::Sema::ProduceCtorInitMemberSignatureHelp
clang::Sema::CodeCompleteInitializer
clang::Sema::CodeCompleteAfterIf
clang::Sema::CodeCompleteQualifiedId
clang::Sema::CodeCompleteUsing
clang::Sema::CodeCompleteUsingDirective
clang::Sema::CodeCompleteNamespaceDecl
clang::Sema::CodeCompleteNamespaceAliasDecl
clang::Sema::CodeCompleteOperatorName
clang::Sema::CodeCompleteConstructorInitializer
clang::Sema::CodeCompleteLambdaIntroducer
clang::Sema::CodeCompleteObjCAtDirective
clang::Sema::CodeCompleteObjCAtVisibility
clang::Sema::CodeCompleteObjCAtStatement
clang::Sema::CodeCompleteObjCAtExpression
clang::Sema::CodeCompleteObjCPropertyFlags
clang::Sema::CodeCompleteObjCPropertyGetter
clang::Sema::CodeCompleteObjCPropertySetter
clang::Sema::CodeCompleteObjCPassingType
clang::Sema::CodeCompleteObjCMessageReceiver
clang::Sema::CodeCompleteObjCSuperMessage
clang::Sema::CodeCompleteObjCClassMessage
clang::Sema::CodeCompleteObjCInstanceMessage
clang::Sema::CodeCompleteObjCForCollection
clang::Sema::CodeCompleteObjCSelector
clang::Sema::CodeCompleteObjCProtocolReferences
clang::Sema::CodeCompleteObjCProtocolDecl
clang::Sema::CodeCompleteObjCInterfaceDecl
clang::Sema::CodeCompleteObjCSuperclass
clang::Sema::CodeCompleteObjCImplementationDecl
clang::Sema::CodeCompleteObjCInterfaceCategory
clang::Sema::CodeCompleteObjCImplementationCategory
clang::Sema::CodeCompleteObjCPropertyDefinition
clang::Sema::CodeCompleteObjCPropertySynthesizeIvar
clang::Sema::CodeCompleteObjCMethodDecl
clang::Sema::CodeCompleteObjCMethodDeclSelector
clang::Sema::CodeCompleteObjCClassPropertyRefExpr
clang::Sema::CodeCompletePreprocessorDirective
clang::Sema::CodeCompleteInPreprocessorConditionalExclusion
clang::Sema::CodeCompletePreprocessorMacroName
clang::Sema::CodeCompletePreprocessorExpression
clang::Sema::CodeCompletePreprocessorMacroArgument
clang::Sema::CodeCompleteIncludedFile
clang::Sema::CodeCompleteNaturalLanguage
clang::Sema::CodeCompleteAvailabilityPlatformName
clang::Sema::GatherGlobalCodeCompletions
clang::Sema::getLocationOfStringLiteralByte
clang::Sema::CheckArrayAccess
clang::Sema::CheckArrayAccess
clang::Sema::FormatStringInfo
clang::Sema::FormatStringInfo::FormatIdx
clang::Sema::FormatStringInfo::FirstDataArg
clang::Sema::FormatStringInfo::HasVAListArg
clang::Sema::getFormatStringInfo
clang::Sema::CheckFunctionCall
clang::Sema::CheckObjCMethodCall
clang::Sema::CheckPointerCall
clang::Sema::CheckOtherCall
clang::Sema::CheckConstructorCall
clang::Sema::checkCall
clang::Sema::CheckObjCString
clang::Sema::CheckOSLogFormatStringArg
clang::Sema::CheckBuiltinFunctionCall
clang::Sema::checkFortifiedBuiltinMemoryFunction
clang::Sema::CheckARMBuiltinExclusiveCall
clang::Sema::CheckNeonBuiltinFunctionCall
clang::Sema::CheckARMBuiltinFunctionCall
clang::Sema::CheckAArch64BuiltinFunctionCall
clang::Sema::CheckHexagonBuiltinFunctionCall
clang::Sema::CheckHexagonBuiltinCpu
clang::Sema::CheckHexagonBuiltinArgument
clang::Sema::CheckMipsBuiltinFunctionCall
clang::Sema::CheckSystemZBuiltinFunctionCall
clang::Sema::CheckX86BuiltinRoundingOrSAE
clang::Sema::CheckX86BuiltinGatherScatterScale
clang::Sema::CheckX86BuiltinFunctionCall
clang::Sema::CheckPPCBuiltinFunctionCall
clang::Sema::SemaBuiltinVAStart
clang::Sema::SemaBuiltinVAStartARMMicrosoft
clang::Sema::SemaBuiltinUnorderedCompare
clang::Sema::SemaBuiltinFPClassification
clang::Sema::SemaBuiltinVSX
clang::Sema::SemaBuiltinOSLogFormat
clang::Sema::SemaBuiltinShuffleVector
clang::Sema::SemaConvertVectorExpr
clang::Sema::SemaBuiltinPrefetch
clang::Sema::SemaBuiltinAllocaWithAlign
clang::Sema::SemaBuiltinAssume
clang::Sema::SemaBuiltinAssumeAligned
clang::Sema::SemaBuiltinLongjmp
clang::Sema::SemaBuiltinSetjmp
clang::Sema::SemaBuiltinAtomicOverloaded
clang::Sema::SemaBuiltinNontemporalOverloaded
clang::Sema::SemaAtomicOpsOverloaded
clang::Sema::SemaBuiltinOperatorNewDeleteOverloaded
clang::Sema::SemaBuiltinConstantArg
clang::Sema::SemaBuiltinConstantArgRange
clang::Sema::SemaBuiltinConstantArgMultiple
clang::Sema::SemaBuiltinARMSpecialReg
clang::Sema::FormatStringType
clang::Sema::GetFormatStringType
clang::Sema::FormatStringHasSArg
clang::Sema::GetFormatNSStringIdx
clang::Sema::CheckFormatArguments
clang::Sema::CheckFormatArguments
clang::Sema::CheckAbsoluteValueFunction
clang::Sema::CheckMaxUnsignedZero
clang::Sema::CheckMemaccessArguments
clang::Sema::CheckStrlcpycatArguments
clang::Sema::CheckStrncatArguments
clang::Sema::CheckReturnValExpr
clang::Sema::CheckFloatComparison
clang::Sema::CheckImplicitConversions
clang::Sema::CheckBoolLikeConversion
clang::Sema::CheckForIntOverflow
clang::Sema::CheckUnsequencedOperations
clang::Sema::CheckCompletedExpr
clang::Sema::CheckBitFieldInitialization
clang::Sema::CheckShadowInheritedFields
clang::Sema::CheckBreakContinueBinding
clang::Sema::CheckObjCCircularContainer
clang::Sema::AnalyzeDeleteExprMismatch
clang::Sema::AnalyzeDeleteExprMismatch
clang::Sema::RegisterTypeTagForDatatype
clang::Sema::TypeTagData
clang::Sema::TypeTagData::Type
clang::Sema::TypeTagData::LayoutCompatible
clang::Sema::TypeTagData::MustBeNull
clang::Sema::CheckArgumentWithTypeTag
clang::Sema::CheckAddressOfPackedMember
clang::Sema::CurScope
clang::Sema::Ident_super
clang::Sema::Ident___float128
clang::Sema::Ident__Nonnull
clang::Sema::Ident__Nullable
clang::Sema::Ident__Null_unspecified
clang::Sema::Ident_NSError
clang::Sema::SemaPPCallbackHandler
clang::Sema::getNullabilityKeyword
clang::Sema::CFError
clang::Sema::getNSErrorIdent
clang::Sema::getCurScope
clang::Sema::incrementMSManglingNumber
clang::Sema::getSuperIdentifier
clang::Sema::getFloat128Identifier
clang::Sema::getObjCDeclContext
clang::Sema::getCurLexicalContext
clang::Sema::getCurObjCLexicalContext
clang::Sema::TooManyArguments
clang::Sema::DelayedDllExportClasses
clang::Sema::SavePendingParsedClassStateRAII
clang::Sema::SavePendingParsedClassStateRAII::S
clang::Sema::SavePendingParsedClassStateRAII::SavedOverridingExceptionSpecChecks
clang::Sema::SavePendingParsedClassStateRAII::SavedEquivalentExceptionSpecChecks
clang::Sema::SavePendingParsedClassStateRAII::SavedDefaultedMemberExceptionSpecs
clang::Sema::SavePendingParsedClassStateRAII::SavedDllExportClasses
clang::Sema::SavePendingParsedClassStateRAII::swapSavedState
clang::Sema::MisalignedMember
clang::Sema::MisalignedMember::E
clang::Sema::MisalignedMember::RD
clang::Sema::MisalignedMember::MD
clang::Sema::MisalignedMember::Alignment
clang::Sema::MisalignedMembers
clang::Sema::AddPotentialMisalignedMembers
clang::Sema::DiagnoseMisalignedMembers
clang::Sema::DiscardMisalignedMemberAddress
clang::Sema::RefersToMemberWithReducedAlignment
clang::Sema::CallingConventionIgnoredReason
clang::EnterExpressionEvaluationContext::Actions
clang::EnterExpressionEvaluationContext::Entered
clang::EnterExpressionEvaluationContext::InitListTag
clang::LateParsedTemplate::Toks
clang::LateParsedTemplate::D
clang::Sema::IsValueInFlagEnum
llvm::DenseMapInfo::getEmptyKey
llvm::DenseMapInfo::getTombstoneKey
llvm::DenseMapInfo::getHashValue
llvm::DenseMapInfo::isEqual
clang::Sema::ActOnOpenMPDeclareMapperDirectiveVarDecl
clang::Sema::ActOnOpenMPDeclareMapperDirectiveEnd