Coverage Report

Created: 2018-07-22 10:17

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/Sema/Sema.h
Line
Count
Source (jump to first uncovered line)
1
//===--- Sema.h - Semantic Analysis & AST Building --------------*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
// This file defines the Sema class, which performs semantic analysis and
11
// builds ASTs.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_CLANG_SEMA_SEMA_H
16
#define LLVM_CLANG_SEMA_SEMA_H
17
18
#include "clang/AST/Attr.h"
19
#include "clang/AST/Availability.h"
20
#include "clang/AST/ComparisonCategories.h"
21
#include "clang/AST/DeclTemplate.h"
22
#include "clang/AST/DeclarationName.h"
23
#include "clang/AST/Expr.h"
24
#include "clang/AST/ExprCXX.h"
25
#include "clang/AST/ExprObjC.h"
26
#include "clang/AST/ExternalASTSource.h"
27
#include "clang/AST/LocInfoType.h"
28
#include "clang/AST/MangleNumberingContext.h"
29
#include "clang/AST/NSAPI.h"
30
#include "clang/AST/PrettyPrinter.h"
31
#include "clang/AST/StmtCXX.h"
32
#include "clang/AST/TypeLoc.h"
33
#include "clang/AST/TypeOrdering.h"
34
#include "clang/Basic/ExpressionTraits.h"
35
#include "clang/Basic/Module.h"
36
#include "clang/Basic/OpenMPKinds.h"
37
#include "clang/Basic/PragmaKinds.h"
38
#include "clang/Basic/Specifiers.h"
39
#include "clang/Basic/TemplateKinds.h"
40
#include "clang/Basic/TypeTraits.h"
41
#include "clang/Sema/AnalysisBasedWarnings.h"
42
#include "clang/Sema/CleanupInfo.h"
43
#include "clang/Sema/DeclSpec.h"
44
#include "clang/Sema/ExternalSemaSource.h"
45
#include "clang/Sema/IdentifierResolver.h"
46
#include "clang/Sema/ObjCMethodList.h"
47
#include "clang/Sema/Ownership.h"
48
#include "clang/Sema/Scope.h"
49
#include "clang/Sema/TypoCorrection.h"
50
#include "clang/Sema/Weak.h"
51
#include "llvm/ADT/ArrayRef.h"
52
#include "llvm/ADT/Optional.h"
53
#include "llvm/ADT/SetVector.h"
54
#include "llvm/ADT/SmallBitVector.h"
55
#include "llvm/ADT/SmallPtrSet.h"
56
#include "llvm/ADT/SmallVector.h"
57
#include "llvm/ADT/TinyPtrVector.h"
58
#include <deque>
59
#include <memory>
60
#include <string>
61
#include <vector>
62
63
namespace llvm {
64
  class APSInt;
65
  template <typename ValueT> struct DenseMapInfo;
66
  template <typename ValueT, typename ValueInfoT> class DenseSet;
67
  class SmallBitVector;
68
  struct InlineAsmIdentifierInfo;
69
}
70
71
namespace clang {
72
  class ADLResult;
73
  class ASTConsumer;
74
  class ASTContext;
75
  class ASTMutationListener;
76
  class ASTReader;
77
  class ASTWriter;
78
  class ArrayType;
79
  class ParsedAttr;
80
  class BindingDecl;
81
  class BlockDecl;
82
  class CapturedDecl;
83
  class CXXBasePath;
84
  class CXXBasePaths;
85
  class CXXBindTemporaryExpr;
86
  typedef SmallVector<CXXBaseSpecifier*, 4> CXXCastPath;
87
  class CXXConstructorDecl;
88
  class CXXConversionDecl;
89
  class CXXDeleteExpr;
90
  class CXXDestructorDecl;
91
  class CXXFieldCollector;
92
  class CXXMemberCallExpr;
93
  class CXXMethodDecl;
94
  class CXXScopeSpec;
95
  class CXXTemporary;
96
  class CXXTryStmt;
97
  class CallExpr;
98
  class ClassTemplateDecl;
99
  class ClassTemplatePartialSpecializationDecl;
100
  class ClassTemplateSpecializationDecl;
101
  class VarTemplatePartialSpecializationDecl;
102
  class CodeCompleteConsumer;
103
  class CodeCompletionAllocator;
104
  class CodeCompletionTUInfo;
105
  class CodeCompletionResult;
106
  class CoroutineBodyStmt;
107
  class Decl;
108
  class DeclAccessPair;
109
  class DeclContext;
110
  class DeclRefExpr;
111
  class DeclaratorDecl;
112
  class DeducedTemplateArgument;
113
  class DependentDiagnostic;
114
  class DesignatedInitExpr;
115
  class Designation;
116
  class EnableIfAttr;
117
  class EnumConstantDecl;
118
  class Expr;
119
  class ExtVectorType;
120
  class FormatAttr;
121
  class FriendDecl;
122
  class FunctionDecl;
123
  class FunctionProtoType;
124
  class FunctionTemplateDecl;
125
  class ImplicitConversionSequence;
126
  typedef MutableArrayRef<ImplicitConversionSequence> ConversionSequenceList;
127
  class InitListExpr;
128
  class InitializationKind;
129
  class InitializationSequence;
130
  class InitializedEntity;
131
  class IntegerLiteral;
132
  class LabelStmt;
133
  class LambdaExpr;
134
  class LangOptions;
135
  class LocalInstantiationScope;
136
  class LookupResult;
137
  class MacroInfo;
138
  typedef ArrayRef<std::pair<IdentifierInfo *, SourceLocation>> ModuleIdPath;
139
  class ModuleLoader;
140
  class MultiLevelTemplateArgumentList;
141
  class NamedDecl;
142
  class ObjCCategoryDecl;
143
  class ObjCCategoryImplDecl;
144
  class ObjCCompatibleAliasDecl;
145
  class ObjCContainerDecl;
146
  class ObjCImplDecl;
147
  class ObjCImplementationDecl;
148
  class ObjCInterfaceDecl;
149
  class ObjCIvarDecl;
150
  template <class T> class ObjCList;
151
  class ObjCMessageExpr;
152
  class ObjCMethodDecl;
153
  class ObjCPropertyDecl;
154
  class ObjCProtocolDecl;
155
  class OMPThreadPrivateDecl;
156
  class OMPDeclareReductionDecl;
157
  class OMPDeclareSimdDecl;
158
  class OMPClause;
159
  struct OverloadCandidate;
160
  class OverloadCandidateSet;
161
  class OverloadExpr;
162
  class ParenListExpr;
163
  class ParmVarDecl;
164
  class Preprocessor;
165
  class PseudoDestructorTypeStorage;
166
  class PseudoObjectExpr;
167
  class QualType;
168
  class StandardConversionSequence;
169
  class Stmt;
170
  class StringLiteral;
171
  class SwitchStmt;
172
  class TemplateArgument;
173
  class TemplateArgumentList;
174
  class TemplateArgumentLoc;
175
  class TemplateDecl;
176
  class TemplateInstantiationCallback;
177
  class TemplateParameterList;
178
  class TemplatePartialOrderingContext;
179
  class TemplateTemplateParmDecl;
180
  class Token;
181
  class TypeAliasDecl;
182
  class TypedefDecl;
183
  class TypedefNameDecl;
184
  class TypeLoc;
185
  class TypoCorrectionConsumer;
186
  class UnqualifiedId;
187
  class UnresolvedLookupExpr;
188
  class UnresolvedMemberExpr;
189
  class UnresolvedSetImpl;
190
  class UnresolvedSetIterator;
191
  class UsingDecl;
192
  class UsingShadowDecl;
193
  class ValueDecl;
194
  class VarDecl;
195
  class VarTemplateSpecializationDecl;
196
  class VisibilityAttr;
197
  class VisibleDeclConsumer;
198
  class IndirectFieldDecl;
199
  struct DeductionFailureInfo;
200
  class TemplateSpecCandidateSet;
201
202
namespace sema {
203
  class AccessedEntity;
204
  class BlockScopeInfo;
205
  class Capture;
206
  class CapturedRegionScopeInfo;
207
  class CapturingScopeInfo;
208
  class CompoundScopeInfo;
209
  class DelayedDiagnostic;
210
  class DelayedDiagnosticPool;
211
  class FunctionScopeInfo;
212
  class LambdaScopeInfo;
213
  class PossiblyUnreachableDiag;
214
  class SemaPPCallbacks;
215
  class TemplateDeductionInfo;
216
}
217
218
namespace threadSafety {
219
  class BeforeSet;
220
  void threadSafetyCleanup(BeforeSet* Cache);
221
}
222
223
// FIXME: No way to easily map from TemplateTypeParmTypes to
224
// TemplateTypeParmDecls, so we have this horrible PointerUnion.
225
typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType*, NamedDecl*>,
226
                  SourceLocation> UnexpandedParameterPack;
227
228
/// Describes whether we've seen any nullability information for the given
229
/// file.
230
0
struct FileNullability {
231
  /// The first pointer declarator (of any pointer kind) in the file that does
232
  /// not have a corresponding nullability annotation.
233
  SourceLocation PointerLoc;
234
235
  /// The end location for the first pointer declarator in the file. Used for
236
  /// placing fix-its.
237
  SourceLocation PointerEndLoc;
238
239
  /// Which kind of pointer declarator we saw.
240
  uint8_t PointerKind;
241
242
  /// Whether we saw any type nullability annotations in the given file.
243
  bool SawTypeNullability = false;
244
};
245
246
/// A mapping from file IDs to a record of whether we've seen nullability
247
/// information in that file.
248
class FileNullabilityMap {
249
  /// A mapping from file IDs to the nullability information for each file ID.
250
  llvm::DenseMap<FileID, FileNullability> Map;
251
252
  /// A single-element cache based on the file ID.
253
  struct {
254
    FileID File;
255
    FileNullability Nullability;
256
  } Cache;
257
258
public:
259
1.46M
  FileNullability &operator[](FileID file) {
260
1.46M
    // Check the single-element cache.
261
1.46M
    if (file == Cache.File)
262
1.40M
      return Cache.Nullability;
263
58.8k
264
58.8k
    // It's not in the single-element cache; flush the cache if we have one.
265
58.8k
    if (!Cache.File.isInvalid()) {
266
51.5k
      Map[Cache.File] = Cache.Nullability;
267
51.5k
    }
268
58.8k
269
58.8k
    // Pull this entry into the cache.
270
58.8k
    Cache.File = file;
271
58.8k
    Cache.Nullability = Map[file];
272
58.8k
    return Cache.Nullability;
273
58.8k
  }
274
};
275
276
/// Sema - This implements semantic analysis and AST building for C.
277
class Sema {
278
  Sema(const Sema &) = delete;
279
  void operator=(const Sema &) = delete;
280
281
  ///Source of additional semantic information.
282
  ExternalSemaSource *ExternalSource;
283
284
  ///Whether Sema has generated a multiplexer and has to delete it.
285
  bool isMultiplexExternalSource;
286
287
  static bool mightHaveNonExternalLinkage(const DeclaratorDecl *FD);
288
289
  bool isVisibleSlow(const NamedDecl *D);
290
291
  /// Determine whether two declarations should be linked together, given that
292
  /// the old declaration might not be visible and the new declaration might
293
  /// not have external linkage.
294
  bool shouldLinkPossiblyHiddenDecl(const NamedDecl *Old,
295
449k
                                    const NamedDecl *New) {
296
449k
    if (isVisible(Old))
297
449k
     return true;
298
106
    // See comment in below overload for why it's safe to compute the linkage
299
106
    // of the new declaration here.
300
106
    if (New->isExternallyDeclarable()) {
301
105
      assert(Old->isExternallyDeclarable() &&
302
105
             "should not have found a non-externally-declarable previous decl");
303
105
      return true;
304
105
    }
305
1
    return false;
306
1
  }
307
  bool shouldLinkPossiblyHiddenDecl(LookupResult &Old, const NamedDecl *New);
308
309
public:
310
  typedef OpaquePtr<DeclGroupRef> DeclGroupPtrTy;
311
  typedef OpaquePtr<TemplateName> TemplateTy;
312
  typedef OpaquePtr<QualType> TypeTy;
313
314
  OpenCLOptions OpenCLFeatures;
315
  FPOptions FPFeatures;
316
317
  const LangOptions &LangOpts;
318
  Preprocessor &PP;
319
  ASTContext &Context;
320
  ASTConsumer &Consumer;
321
  DiagnosticsEngine &Diags;
322
  SourceManager &SourceMgr;
323
324
  /// Flag indicating whether or not to collect detailed statistics.
325
  bool CollectStats;
326
327
  /// Code-completion consumer.
328
  CodeCompleteConsumer *CodeCompleter;
329
330
  /// CurContext - This is the current declaration context of parsing.
331
  DeclContext *CurContext;
332
333
  /// Generally null except when we temporarily switch decl contexts,
334
  /// like in \see ActOnObjCTemporaryExitContainerContext.
335
  DeclContext *OriginalLexicalContext;
336
337
  /// VAListTagName - The declaration name corresponding to __va_list_tag.
338
  /// This is used as part of a hack to omit that class from ADL results.
339
  DeclarationName VAListTagName;
340
341
  bool MSStructPragmaOn; // True when \#pragma ms_struct on
342
343
  /// Controls member pointer representation format under the MS ABI.
344
  LangOptions::PragmaMSPointersToMembersKind
345
      MSPointerToMemberRepresentationMethod;
346
347
  /// Stack of active SEH __finally scopes.  Can be empty.
348
  SmallVector<Scope*, 2> CurrentSEHFinally;
349
350
  /// Source location for newly created implicit MSInheritanceAttrs
351
  SourceLocation ImplicitMSInheritanceAttrLoc;
352
353
  /// pragma clang section kind
354
  enum PragmaClangSectionKind {
355
    PCSK_Invalid      = 0,
356
    PCSK_BSS          = 1,
357
    PCSK_Data         = 2,
358
    PCSK_Rodata       = 3,
359
    PCSK_Text         = 4
360
   };
361
362
  enum PragmaClangSectionAction {
363
    PCSA_Set     = 0,
364
    PCSA_Clear   = 1
365
  };
366
367
  struct PragmaClangSection {
368
    std::string SectionName;
369
    bool Valid = false;
370
    SourceLocation PragmaLocation;
371
372
    void Act(SourceLocation PragmaLocation,
373
             PragmaClangSectionAction Action,
374
             StringLiteral* Name);
375
   };
376
377
   PragmaClangSection PragmaClangBSSSection;
378
   PragmaClangSection PragmaClangDataSection;
379
   PragmaClangSection PragmaClangRodataSection;
380
   PragmaClangSection PragmaClangTextSection;
381
382
  enum PragmaMsStackAction {
383
    PSK_Reset     = 0x0,                // #pragma ()
384
    PSK_Set       = 0x1,                // #pragma (value)
385
    PSK_Push      = 0x2,                // #pragma (push[, id])
386
    PSK_Pop       = 0x4,                // #pragma (pop[, id])
387
    PSK_Show      = 0x8,                // #pragma (show) -- only for "pack"!
388
    PSK_Push_Set  = PSK_Push | PSK_Set, // #pragma (push[, id], value)
389
    PSK_Pop_Set   = PSK_Pop | PSK_Set,  // #pragma (pop[, id], value)
390
  };
391
392
  template<typename ValueType>
393
  struct PragmaStack {
394
    struct Slot {
395
      llvm::StringRef StackSlotLabel;
396
      ValueType Value;
397
      SourceLocation PragmaLocation;
398
      SourceLocation PragmaPushLocation;
399
      Slot(llvm::StringRef StackSlotLabel, ValueType Value,
400
           SourceLocation PragmaLocation, SourceLocation PragmaPushLocation)
401
          : StackSlotLabel(StackSlotLabel), Value(Value),
402
            PragmaLocation(PragmaLocation),
403
5.10M
            PragmaPushLocation(PragmaPushLocation) {}
clang::Sema::PragmaStack<unsigned int>::Slot::Slot(llvm::StringRef, unsigned int, clang::SourceLocation, clang::SourceLocation)
Line
Count
Source
403
233
            PragmaPushLocation(PragmaPushLocation) {}
clang::Sema::PragmaStack<clang::MSVtorDispAttr::Mode>::Slot::Slot(llvm::StringRef, clang::MSVtorDispAttr::Mode, clang::SourceLocation, clang::SourceLocation)
Line
Count
Source
403
1.02M
            PragmaPushLocation(PragmaPushLocation) {}
clang::Sema::PragmaStack<clang::StringLiteral*>::Slot::Slot(llvm::StringRef, clang::StringLiteral*, clang::SourceLocation, clang::SourceLocation)
Line
Count
Source
403
4.08M
            PragmaPushLocation(PragmaPushLocation) {}
404
    };
405
    void Act(SourceLocation PragmaLocation,
406
             PragmaMsStackAction Action,
407
             llvm::StringRef StackSlotLabel,
408
             ValueType Value);
409
410
    // MSVC seems to add artificial slots to #pragma stacks on entering a C++
411
    // method body to restore the stacks on exit, so it works like this:
412
    //
413
    //   struct S {
414
    //     #pragma <name>(push, InternalPragmaSlot, <current_pragma_value>)
415
    //     void Method {}
416
    //     #pragma <name>(pop, InternalPragmaSlot)
417
    //   };
418
    //
419
    // It works even with #pragma vtordisp, although MSVC doesn't support
420
    //   #pragma vtordisp(push [, id], n)
421
    // syntax.
422
    //
423
    // Push / pop a named sentinel slot.
424
10.2M
    void SentinelAction(PragmaMsStackAction Action, StringRef Label) {
425
10.2M
      assert((Action == PSK_Push || Action == PSK_Pop) &&
426
10.2M
             "Can only push / pop #pragma stack sentinels!");
427
10.2M
      Act(CurrentPragmaLocation, Action, Label, CurrentValue);
428
10.2M
    }
clang::Sema::PragmaStack<clang::MSVtorDispAttr::Mode>::SentinelAction(clang::Sema::PragmaMsStackAction, llvm::StringRef)
Line
Count
Source
424
2.04M
    void SentinelAction(PragmaMsStackAction Action, StringRef Label) {
425
2.04M
      assert((Action == PSK_Push || Action == PSK_Pop) &&
426
2.04M
             "Can only push / pop #pragma stack sentinels!");
427
2.04M
      Act(CurrentPragmaLocation, Action, Label, CurrentValue);
428
2.04M
    }
clang::Sema::PragmaStack<clang::StringLiteral*>::SentinelAction(clang::Sema::PragmaMsStackAction, llvm::StringRef)
Line
Count
Source
424
8.16M
    void SentinelAction(PragmaMsStackAction Action, StringRef Label) {
425
8.16M
      assert((Action == PSK_Push || Action == PSK_Pop) &&
426
8.16M
             "Can only push / pop #pragma stack sentinels!");
427
8.16M
      Act(CurrentPragmaLocation, Action, Label, CurrentValue);
428
8.16M
    }
429
430
    // Constructors.
431
    explicit PragmaStack(const ValueType &Default)
432
218k
        : DefaultValue(Default), CurrentValue(Default) {}
clang::Sema::PragmaStack<clang::MSVtorDispAttr::Mode>::PragmaStack(clang::MSVtorDispAttr::Mode const&)
Line
Count
Source
432
36.4k
        : DefaultValue(Default), CurrentValue(Default) {}
clang::Sema::PragmaStack<unsigned int>::PragmaStack(unsigned int const&)
Line
Count
Source
432
36.4k
        : DefaultValue(Default), CurrentValue(Default) {}
clang::Sema::PragmaStack<clang::StringLiteral*>::PragmaStack(clang::StringLiteral* const&)
Line
Count
Source
432
145k
        : DefaultValue(Default), CurrentValue(Default) {}
433
434
921k
    bool hasValue() const { return CurrentValue != DefaultValue; }
435
436
    SmallVector<Slot, 2> Stack;
437
    ValueType DefaultValue; // Value used for PSK_Reset action.
438
    ValueType CurrentValue;
439
    SourceLocation CurrentPragmaLocation;
440
  };
441
  // FIXME: We should serialize / deserialize these if they occur in a PCH (but
442
  // we shouldn't do so if they're in a module).
443
444
  /// Whether to insert vtordisps prior to virtual bases in the Microsoft
445
  /// C++ ABI.  Possible values are 0, 1, and 2, which mean:
446
  ///
447
  /// 0: Suppress all vtordisps
448
  /// 1: Insert vtordisps in the presence of vbase overrides and non-trivial
449
  ///    structors
450
  /// 2: Always insert vtordisps to support RTTI on partially constructed
451
  ///    objects
452
  PragmaStack<MSVtorDispAttr::Mode> VtorDispStack;
453
  // #pragma pack.
454
  // Sentinel to represent when the stack is set to mac68k alignment.
455
  static const unsigned kMac68kAlignmentSentinel = ~0U;
456
  PragmaStack<unsigned> PackStack;
457
  // The current #pragma pack values and locations at each #include.
458
  struct PackIncludeState {
459
    unsigned CurrentValue;
460
    SourceLocation CurrentPragmaLocation;
461
    bool HasNonDefaultValue, ShouldWarnOnInclude;
462
  };
463
  SmallVector<PackIncludeState, 8> PackIncludeStack;
464
  // Segment #pragmas.
465
  PragmaStack<StringLiteral *> DataSegStack;
466
  PragmaStack<StringLiteral *> BSSSegStack;
467
  PragmaStack<StringLiteral *> ConstSegStack;
468
  PragmaStack<StringLiteral *> CodeSegStack;
469
470
  // RAII object to push / pop sentinel slots for all MS #pragma stacks.
471
  // Actions should be performed only if we enter / exit a C++ method body.
472
  class PragmaStackSentinelRAII {
473
  public:
474
    PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct);
475
    ~PragmaStackSentinelRAII();
476
477
  private:
478
    Sema &S;
479
    StringRef SlotLabel;
480
    bool ShouldAct;
481
  };
482
483
  /// A mapping that describes the nullability we've seen in each header file.
484
  FileNullabilityMap NullabilityMap;
485
486
  /// Last section used with #pragma init_seg.
487
  StringLiteral *CurInitSeg;
488
  SourceLocation CurInitSegLoc;
489
490
  /// VisContext - Manages the stack for \#pragma GCC visibility.
491
  void *VisContext; // Really a "PragmaVisStack*"
492
493
  /// This represents the stack of attributes that were pushed by
494
  /// \#pragma clang attribute.
495
  struct PragmaAttributeEntry {
496
    SourceLocation Loc;
497
    ParsedAttr *Attribute;
498
    SmallVector<attr::SubjectMatchRule, 4> MatchRules;
499
    bool IsUsed;
500
  };
501
  SmallVector<PragmaAttributeEntry, 2> PragmaAttributeStack;
502
503
  /// The declaration that is currently receiving an attribute from the
504
  /// #pragma attribute stack.
505
  const Decl *PragmaAttributeCurrentTargetDecl;
506
507
  /// This represents the last location of a "#pragma clang optimize off"
508
  /// directive if such a directive has not been closed by an "on" yet. If
509
  /// optimizations are currently "on", this is set to an invalid location.
510
  SourceLocation OptimizeOffPragmaLocation;
511
512
  /// Flag indicating if Sema is building a recovery call expression.
513
  ///
514
  /// This flag is used to avoid building recovery call expressions
515
  /// if Sema is already doing so, which would cause infinite recursions.
516
  bool IsBuildingRecoveryCallExpr;
517
518
  /// Used to control the generation of ExprWithCleanups.
519
  CleanupInfo Cleanup;
520
521
  /// ExprCleanupObjects - This is the stack of objects requiring
522
  /// cleanup that are created by the current full expression.  The
523
  /// element type here is ExprWithCleanups::Object.
524
  SmallVector<BlockDecl*, 8> ExprCleanupObjects;
525
526
  /// Store a list of either DeclRefExprs or MemberExprs
527
  ///  that contain a reference to a variable (constant) that may or may not
528
  ///  be odr-used in this Expr, and we won't know until all lvalue-to-rvalue
529
  ///  and discarded value conversions have been applied to all subexpressions
530
  ///  of the enclosing full expression.  This is cleared at the end of each
531
  ///  full expression.
532
  llvm::SmallPtrSet<Expr*, 2> MaybeODRUseExprs;
533
534
  std::unique_ptr<sema::FunctionScopeInfo> PreallocatedFunctionScope;
535
536
  /// Stack containing information about each of the nested
537
  /// function, block, and method scopes that are currently active.
538
  SmallVector<sema::FunctionScopeInfo *, 4> FunctionScopes;
539
540
  typedef LazyVector<TypedefNameDecl *, ExternalSemaSource,
541
                     &ExternalSemaSource::ReadExtVectorDecls, 2, 2>
542
    ExtVectorDeclsType;
543
544
  /// ExtVectorDecls - This is a list all the extended vector types. This allows
545
  /// us to associate a raw vector type with one of the ext_vector type names.
546
  /// This is only necessary for issuing pretty diagnostics.
547
  ExtVectorDeclsType ExtVectorDecls;
548
549
  /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
550
  std::unique_ptr<CXXFieldCollector> FieldCollector;
551
552
  typedef llvm::SmallSetVector<NamedDecl *, 16> NamedDeclSetType;
553
554
  /// Set containing all declared private fields that are not used.
555
  NamedDeclSetType UnusedPrivateFields;
556
557
  /// Set containing all typedefs that are likely unused.
558
  llvm::SmallSetVector<const TypedefNameDecl *, 4>
559
      UnusedLocalTypedefNameCandidates;
560
561
  /// Delete-expressions to be analyzed at the end of translation unit
562
  ///
563
  /// This list contains class members, and locations of delete-expressions
564
  /// that could not be proven as to whether they mismatch with new-expression
565
  /// used in initializer of the field.
566
  typedef std::pair<SourceLocation, bool> DeleteExprLoc;
567
  typedef llvm::SmallVector<DeleteExprLoc, 4> DeleteLocs;
568
  llvm::MapVector<FieldDecl *, DeleteLocs> DeleteExprs;
569
570
  typedef llvm::SmallPtrSet<const CXXRecordDecl*, 8> RecordDeclSetTy;
571
572
  /// PureVirtualClassDiagSet - a set of class declarations which we have
573
  /// emitted a list of pure virtual functions. Used to prevent emitting the
574
  /// same list more than once.
575
  std::unique_ptr<RecordDeclSetTy> PureVirtualClassDiagSet;
576
577
  /// ParsingInitForAutoVars - a set of declarations with auto types for which
578
  /// we are currently parsing the initializer.
579
  llvm::SmallPtrSet<const Decl*, 4> ParsingInitForAutoVars;
580
581
  /// Look for a locally scoped extern "C" declaration by the given name.
582
  NamedDecl *findLocallyScopedExternCDecl(DeclarationName Name);
583
584
  typedef LazyVector<VarDecl *, ExternalSemaSource,
585
                     &ExternalSemaSource::ReadTentativeDefinitions, 2, 2>
586
    TentativeDefinitionsType;
587
588
  /// All the tentative definitions encountered in the TU.
589
  TentativeDefinitionsType TentativeDefinitions;
590
591
  typedef LazyVector<const DeclaratorDecl *, ExternalSemaSource,
592
                     &ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2>
593
    UnusedFileScopedDeclsType;
594
595
  /// The set of file scoped decls seen so far that have not been used
596
  /// and must warn if not used. Only contains the first declaration.
597
  UnusedFileScopedDeclsType UnusedFileScopedDecls;
598
599
  typedef LazyVector<CXXConstructorDecl *, ExternalSemaSource,
600
                     &ExternalSemaSource::ReadDelegatingConstructors, 2, 2>
601
    DelegatingCtorDeclsType;
602
603
  /// All the delegating constructors seen so far in the file, used for
604
  /// cycle detection at the end of the TU.
605
  DelegatingCtorDeclsType DelegatingCtorDecls;
606
607
  /// All the overriding functions seen during a class definition
608
  /// that had their exception spec checks delayed, plus the overridden
609
  /// function.
610
  SmallVector<std::pair<const CXXMethodDecl*, const CXXMethodDecl*>, 2>
611
    DelayedExceptionSpecChecks;
612
613
  /// All the members seen during a class definition which were both
614
  /// explicitly defaulted and had explicitly-specified exception
615
  /// specifications, along with the function type containing their
616
  /// user-specified exception specification. Those exception specifications
617
  /// were overridden with the default specifications, but we still need to
618
  /// check whether they are compatible with the default specification, and
619
  /// we can't do that until the nesting set of class definitions is complete.
620
  SmallVector<std::pair<CXXMethodDecl*, const FunctionProtoType*>, 2>
621
    DelayedDefaultedMemberExceptionSpecs;
622
623
  typedef llvm::MapVector<const FunctionDecl *,
624
                          std::unique_ptr<LateParsedTemplate>>
625
      LateParsedTemplateMapT;
626
  LateParsedTemplateMapT LateParsedTemplateMap;
627
628
  /// Callback to the parser to parse templated functions when needed.
629
  typedef void LateTemplateParserCB(void *P, LateParsedTemplate &LPT);
630
  typedef void LateTemplateParserCleanupCB(void *P);
631
  LateTemplateParserCB *LateTemplateParser;
632
  LateTemplateParserCleanupCB *LateTemplateParserCleanup;
633
  void *OpaqueParser;
634
635
  void SetLateTemplateParser(LateTemplateParserCB *LTP,
636
                             LateTemplateParserCleanupCB *LTPCleanup,
637
589
                             void *P) {
638
589
    LateTemplateParser = LTP;
639
589
    LateTemplateParserCleanup = LTPCleanup;
640
589
    OpaqueParser = P;
641
589
  }
642
643
  class DelayedDiagnostics;
644
645
0
  class DelayedDiagnosticsState {
646
    sema::DelayedDiagnosticPool *SavedPool;
647
    friend class Sema::DelayedDiagnostics;
648
  };
649
  typedef DelayedDiagnosticsState ParsingDeclState;
650
  typedef DelayedDiagnosticsState ProcessingContextState;
651
652
  /// A class which encapsulates the logic for delaying diagnostics
653
  /// during parsing and other processing.
654
  class DelayedDiagnostics {
655
    /// The current pool of diagnostics into which delayed
656
    /// diagnostics should go.
657
    sema::DelayedDiagnosticPool *CurPool;
658
659
  public:
660
36.4k
    DelayedDiagnostics() : CurPool(nullptr) {}
661
662
    /// Adds a delayed diagnostic.
663
    void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h
664
665
    /// Determines whether diagnostics should be delayed.
666
1.73M
    bool shouldDelayDiagnostics() { return CurPool != nullptr; }
667
668
    /// Returns the current delayed-diagnostics pool.
669
25.1M
    sema::DelayedDiagnosticPool *getCurrentPool() const {
670
25.1M
      return CurPool;
671
25.1M
    }
672
673
    /// Enter a new scope.  Access and deprecation diagnostics will be
674
    /// collected in this pool.
675
25.1M
    DelayedDiagnosticsState push(sema::DelayedDiagnosticPool &pool) {
676
25.1M
      DelayedDiagnosticsState state;
677
25.1M
      state.SavedPool = CurPool;
678
25.1M
      CurPool = &pool;
679
25.1M
      return state;
680
25.1M
    }
681
682
    /// Leave a delayed-diagnostic state that was previously pushed.
683
    /// Do not emit any of the diagnostics.  This is performed as part
684
    /// of the bookkeeping of popping a pool "properly".
685
25.1M
    void popWithoutEmitting(DelayedDiagnosticsState state) {
686
25.1M
      CurPool = state.SavedPool;
687
25.1M
    }
688
689
    /// Enter a new scope where access and deprecation diagnostics are
690
    /// not delayed.
691
5.92M
    DelayedDiagnosticsState pushUndelayed() {
692
5.92M
      DelayedDiagnosticsState state;
693
5.92M
      state.SavedPool = CurPool;
694
5.92M
      CurPool = nullptr;
695
5.92M
      return state;
696
5.92M
    }
697
698
    /// Undo a previous pushUndelayed().
699
5.92M
    void popUndelayed(DelayedDiagnosticsState state) {
700
5.92M
      assert(CurPool == nullptr);
701
5.92M
      CurPool = state.SavedPool;
702
5.92M
    }
703
  } DelayedDiagnostics;
704
705
  /// A RAII object to temporarily push a declaration context.
706
  class ContextRAII {
707
  private:
708
    Sema &S;
709
    DeclContext *SavedContext;
710
    ProcessingContextState SavedContextState;
711
    QualType SavedCXXThisTypeOverride;
712
713
  public:
714
    ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext = true)
715
      : S(S), SavedContext(S.CurContext),
716
        SavedContextState(S.DelayedDiagnostics.pushUndelayed()),
717
        SavedCXXThisTypeOverride(S.CXXThisTypeOverride)
718
5.15M
    {
719
5.15M
      assert(ContextToPush && "pushing null context");
720
5.15M
      S.CurContext = ContextToPush;
721
5.15M
      if (NewThisContext)
722
5.14M
        S.CXXThisTypeOverride = QualType();
723
5.15M
    }
724
725
6.24M
    void pop() {
726
6.24M
      if (!SavedContext) 
return1.08M
;
727
5.15M
      S.CurContext = SavedContext;
728
5.15M
      S.DelayedDiagnostics.popUndelayed(SavedContextState);
729
5.15M
      S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
730
5.15M
      SavedContext = nullptr;
731
5.15M
    }
732
733
5.15M
    ~ContextRAII() {
734
5.15M
      pop();
735
5.15M
    }
736
  };
737
738
  /// RAII object to handle the state changes required to synthesize
739
  /// a function body.
740
  class SynthesizedFunctionScope {
741
    Sema &S;
742
    Sema::ContextRAII SavedContext;
743
    bool PushedCodeSynthesisContext = false;
744
745
  public:
746
    SynthesizedFunctionScope(Sema &S, DeclContext *DC)
747
78.0k
        : S(S), SavedContext(S, DC) {
748
78.0k
      S.PushFunctionScope();
749
78.0k
      S.PushExpressionEvaluationContext(
750
78.0k
          Sema::ExpressionEvaluationContext::PotentiallyEvaluated);
751
78.0k
      if (auto *FD = dyn_cast<FunctionDecl>(DC))
752
78.0k
        FD->setWillHaveBody(true);
753
78.0k
      else
754
78.0k
        assert(isa<ObjCMethodDecl>(DC));
755
78.0k
    }
756
757
77.6k
    void addContextNote(SourceLocation UseLoc) {
758
77.6k
      assert(!PushedCodeSynthesisContext);
759
77.6k
760
77.6k
      Sema::CodeSynthesisContext Ctx;
761
77.6k
      Ctx.Kind = Sema::CodeSynthesisContext::DefiningSynthesizedFunction;
762
77.6k
      Ctx.PointOfInstantiation = UseLoc;
763
77.6k
      Ctx.Entity = cast<Decl>(S.CurContext);
764
77.6k
      S.pushCodeSynthesisContext(Ctx);
765
77.6k
766
77.6k
      PushedCodeSynthesisContext = true;
767
77.6k
    }
768
769
78.0k
    ~SynthesizedFunctionScope() {
770
78.0k
      if (PushedCodeSynthesisContext)
771
77.6k
        S.popCodeSynthesisContext();
772
78.0k
      if (auto *FD = dyn_cast<FunctionDecl>(S.CurContext))
773
78.0k
        FD->setWillHaveBody(false);
774
78.0k
      S.PopExpressionEvaluationContext();
775
78.0k
      S.PopFunctionScopeInfo();
776
78.0k
    }
777
  };
778
779
  /// WeakUndeclaredIdentifiers - Identifiers contained in
780
  /// \#pragma weak before declared. rare. may alias another
781
  /// identifier, declared or undeclared
782
  llvm::MapVector<IdentifierInfo *, WeakInfo> WeakUndeclaredIdentifiers;
783
784
  /// ExtnameUndeclaredIdentifiers - Identifiers contained in
785
  /// \#pragma redefine_extname before declared.  Used in Solaris system headers
786
  /// to define functions that occur in multiple standards to call the version
787
  /// in the currently selected standard.
788
  llvm::DenseMap<IdentifierInfo*,AsmLabelAttr*> ExtnameUndeclaredIdentifiers;
789
790
791
  /// Load weak undeclared identifiers from the external source.
792
  void LoadExternalWeakUndeclaredIdentifiers();
793
794
  /// WeakTopLevelDecl - Translation-unit scoped declarations generated by
795
  /// \#pragma weak during processing of other Decls.
796
  /// I couldn't figure out a clean way to generate these in-line, so
797
  /// we store them here and handle separately -- which is a hack.
798
  /// It would be best to refactor this.
799
  SmallVector<Decl*,2> WeakTopLevelDecl;
800
801
  IdentifierResolver IdResolver;
802
803
  /// Translation Unit Scope - useful to Objective-C actions that need
804
  /// to lookup file scope declarations in the "ordinary" C decl namespace.
805
  /// For example, user-defined classes, built-in "id" type, etc.
806
  Scope *TUScope;
807
808
  /// The C++ "std" namespace, where the standard library resides.
809
  LazyDeclPtr StdNamespace;
810
811
  /// The C++ "std::bad_alloc" class, which is defined by the C++
812
  /// standard library.
813
  LazyDeclPtr StdBadAlloc;
814
815
  /// The C++ "std::align_val_t" enum class, which is defined by the C++
816
  /// standard library.
817
  LazyDeclPtr StdAlignValT;
818
819
  /// The C++ "std::experimental" namespace, where the experimental parts
820
  /// of the standard library resides.
821
  NamespaceDecl *StdExperimentalNamespaceCache;
822
823
  /// The C++ "std::initializer_list" template, which is defined in
824
  /// \<initializer_list>.
825
  ClassTemplateDecl *StdInitializerList;
826
827
  /// The C++ "std::coroutine_traits" template, which is defined in
828
  /// \<coroutine_traits>
829
  ClassTemplateDecl *StdCoroutineTraitsCache;
830
831
  /// The C++ "type_info" declaration, which is defined in \<typeinfo>.
832
  RecordDecl *CXXTypeInfoDecl;
833
834
  /// The MSVC "_GUID" struct, which is defined in MSVC header files.
835
  RecordDecl *MSVCGuidDecl;
836
837
  /// Caches identifiers/selectors for NSFoundation APIs.
838
  std::unique_ptr<NSAPI> NSAPIObj;
839
840
  /// The declaration of the Objective-C NSNumber class.
841
  ObjCInterfaceDecl *NSNumberDecl;
842
843
  /// The declaration of the Objective-C NSValue class.
844
  ObjCInterfaceDecl *NSValueDecl;
845
846
  /// Pointer to NSNumber type (NSNumber *).
847
  QualType NSNumberPointer;
848
849
  /// Pointer to NSValue type (NSValue *).
850
  QualType NSValuePointer;
851
852
  /// The Objective-C NSNumber methods used to create NSNumber literals.
853
  ObjCMethodDecl *NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods];
854
855
  /// The declaration of the Objective-C NSString class.
856
  ObjCInterfaceDecl *NSStringDecl;
857
858
  /// Pointer to NSString type (NSString *).
859
  QualType NSStringPointer;
860
861
  /// The declaration of the stringWithUTF8String: method.
862
  ObjCMethodDecl *StringWithUTF8StringMethod;
863
864
  /// The declaration of the valueWithBytes:objCType: method.
865
  ObjCMethodDecl *ValueWithBytesObjCTypeMethod;
866
867
  /// The declaration of the Objective-C NSArray class.
868
  ObjCInterfaceDecl *NSArrayDecl;
869
870
  /// The declaration of the arrayWithObjects:count: method.
871
  ObjCMethodDecl *ArrayWithObjectsMethod;
872
873
  /// The declaration of the Objective-C NSDictionary class.
874
  ObjCInterfaceDecl *NSDictionaryDecl;
875
876
  /// The declaration of the dictionaryWithObjects:forKeys:count: method.
877
  ObjCMethodDecl *DictionaryWithObjectsMethod;
878
879
  /// id<NSCopying> type.
880
  QualType QIDNSCopying;
881
882
  /// will hold 'respondsToSelector:'
883
  Selector RespondsToSelectorSel;
884
885
  /// A flag to remember whether the implicit forms of operator new and delete
886
  /// have been declared.
887
  bool GlobalNewDeleteDeclared;
888
889
  /// A flag to indicate that we're in a context that permits abstract
890
  /// references to fields.  This is really a
891
  bool AllowAbstractFieldReference;
892
893
  /// Describes how the expressions currently being parsed are
894
  /// evaluated at run-time, if at all.
895
  enum class ExpressionEvaluationContext {
896
    /// The current expression and its subexpressions occur within an
897
    /// unevaluated operand (C++11 [expr]p7), such as the subexpression of
898
    /// \c sizeof, where the type of the expression may be significant but
899
    /// no code will be generated to evaluate the value of the expression at
900
    /// run time.
901
    Unevaluated,
902
903
    /// The current expression occurs within a braced-init-list within
904
    /// an unevaluated operand. This is mostly like a regular unevaluated
905
    /// context, except that we still instantiate constexpr functions that are
906
    /// referenced here so that we can perform narrowing checks correctly.
907
    UnevaluatedList,
908
909
    /// The current expression occurs within a discarded statement.
910
    /// This behaves largely similarly to an unevaluated operand in preventing
911
    /// definitions from being required, but not in other ways.
912
    DiscardedStatement,
913
914
    /// The current expression occurs within an unevaluated
915
    /// operand that unconditionally permits abstract references to
916
    /// fields, such as a SIZE operator in MS-style inline assembly.
917
    UnevaluatedAbstract,
918
919
    /// The current context is "potentially evaluated" in C++11 terms,
920
    /// but the expression is evaluated at compile-time (like the values of
921
    /// cases in a switch statement).
922
    ConstantEvaluated,
923
924
    /// The current expression is potentially evaluated at run time,
925
    /// which means that code may be generated to evaluate the value of the
926
    /// expression at run time.
927
    PotentiallyEvaluated,
928
929
    /// The current expression is potentially evaluated, but any
930
    /// declarations referenced inside that expression are only used if
931
    /// in fact the current expression is used.
932
    ///
933
    /// This value is used when parsing default function arguments, for which
934
    /// we would like to provide diagnostics (e.g., passing non-POD arguments
935
    /// through varargs) but do not want to mark declarations as "referenced"
936
    /// until the default argument is used.
937
    PotentiallyEvaluatedIfUsed
938
  };
939
940
  /// Data structure used to record current or nested
941
  /// expression evaluation contexts.
942
  struct ExpressionEvaluationContextRecord {
943
    /// The expression evaluation context.
944
    ExpressionEvaluationContext Context;
945
946
    /// Whether the enclosing context needed a cleanup.
947
    CleanupInfo ParentCleanup;
948
949
    /// Whether we are in a decltype expression.
950
    bool IsDecltype;
951
952
    /// The number of active cleanup objects when we entered
953
    /// this expression evaluation context.
954
    unsigned NumCleanupObjects;
955
956
    /// The number of typos encountered during this expression evaluation
957
    /// context (i.e. the number of TypoExprs created).
958
    unsigned NumTypos;
959
960
    llvm::SmallPtrSet<Expr*, 2> SavedMaybeODRUseExprs;
961
962
    /// The lambdas that are present within this context, if it
963
    /// is indeed an unevaluated context.
964
    SmallVector<LambdaExpr *, 2> Lambdas;
965
966
    /// The declaration that provides context for lambda expressions
967
    /// and block literals if the normal declaration context does not
968
    /// suffice, e.g., in a default function argument.
969
    Decl *ManglingContextDecl;
970
971
    /// The context information used to mangle lambda expressions
972
    /// and block literals within this context.
973
    ///
974
    /// This mangling information is allocated lazily, since most contexts
975
    /// do not have lambda expressions or block literals.
976
    std::unique_ptr<MangleNumberingContext> MangleNumbering;
977
978
    /// If we are processing a decltype type, a set of call expressions
979
    /// for which we have deferred checking the completeness of the return type.
980
    SmallVector<CallExpr *, 8> DelayedDecltypeCalls;
981
982
    /// If we are processing a decltype type, a set of temporary binding
983
    /// expressions for which we have deferred checking the destructor.
984
    SmallVector<CXXBindTemporaryExpr *, 8> DelayedDecltypeBinds;
985
986
    /// \brief Describes whether we are in an expression constext which we have
987
    /// to handle differently.
988
    enum ExpressionKind {
989
      EK_Decltype, EK_TemplateArgument, EK_Other
990
    } ExprContext;
991
992
    ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context,
993
                                      unsigned NumCleanupObjects,
994
                                      CleanupInfo ParentCleanup,
995
                                      Decl *ManglingContextDecl,
996
                                      ExpressionKind ExprContext)
997
        : Context(Context), ParentCleanup(ParentCleanup),
998
          NumCleanupObjects(NumCleanupObjects), NumTypos(0),
999
          ManglingContextDecl(ManglingContextDecl), MangleNumbering(),
1000
38.6M
          ExprContext(ExprContext) {}
1001
1002
    /// Retrieve the mangling numbering context, used to consistently
1003
    /// number constructs like lambdas for mangling.
1004
    MangleNumberingContext &getMangleNumberingContext(ASTContext &Ctx);
1005
1006
71.1M
    bool isUnevaluated() const {
1007
71.1M
      return Context == ExpressionEvaluationContext::Unevaluated ||
1008
71.1M
             
Context == ExpressionEvaluationContext::UnevaluatedAbstract49.4M
||
1009
71.1M
             
Context == ExpressionEvaluationContext::UnevaluatedList49.4M
;
1010
71.1M
    }
1011
17.1M
    bool isConstantEvaluated() const {
1012
17.1M
      return Context == ExpressionEvaluationContext::ConstantEvaluated;
1013
17.1M
    }
1014
  };
1015
1016
  /// A stack of expression evaluation contexts.
1017
  SmallVector<ExpressionEvaluationContextRecord, 8> ExprEvalContexts;
1018
1019
  /// Compute the mangling number context for a lambda expression or
1020
  /// block literal.
1021
  ///
1022
  /// \param DC - The DeclContext containing the lambda expression or
1023
  /// block literal.
1024
  /// \param[out] ManglingContextDecl - Returns the ManglingContextDecl
1025
  /// associated with the context, if relevant.
1026
  MangleNumberingContext *getCurrentMangleNumberContext(
1027
    const DeclContext *DC,
1028
    Decl *&ManglingContextDecl);
1029
1030
1031
  /// SpecialMemberOverloadResult - The overloading result for a special member
1032
  /// function.
1033
  ///
1034
  /// This is basically a wrapper around PointerIntPair. The lowest bits of the
1035
  /// integer are used to determine whether overload resolution succeeded.
1036
  class SpecialMemberOverloadResult {
1037
  public:
1038
    enum Kind {
1039
      NoMemberOrDeleted,
1040
      Ambiguous,
1041
      Success
1042
    };
1043
1044
  private:
1045
    llvm::PointerIntPair<CXXMethodDecl*, 2> Pair;
1046
1047
  public:
1048
571k
    SpecialMemberOverloadResult() : Pair() {}
1049
    SpecialMemberOverloadResult(CXXMethodDecl *MD)
1050
649
        : Pair(MD, MD->isDeleted() ? NoMemberOrDeleted : Success) {}
1051
1052
1.62M
    CXXMethodDecl *getMethod() const { return Pair.getPointer(); }
1053
306k
    void setMethod(CXXMethodDecl *MD) { Pair.setPointer(MD); }
1054
1055
986k
    Kind getKind() const { return static_cast<Kind>(Pair.getInt()); }
1056
306k
    void setKind(Kind K) { Pair.setInt(K); }
1057
  };
1058
1059
  class SpecialMemberOverloadResultEntry
1060
      : public llvm::FastFoldingSetNode,
1061
        public SpecialMemberOverloadResult {
1062
  public:
1063
    SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
1064
      : FastFoldingSetNode(ID)
1065
306k
    {}
1066
  };
1067
1068
  /// A cache of special member function overload resolution results
1069
  /// for C++ records.
1070
  llvm::FoldingSet<SpecialMemberOverloadResultEntry> SpecialMemberCache;
1071
1072
  /// A cache of the flags available in enumerations with the flag_bits
1073
  /// attribute.
1074
  mutable llvm::DenseMap<const EnumDecl*, llvm::APInt> FlagBitsCache;
1075
1076
  /// The kind of translation unit we are processing.
1077
  ///
1078
  /// When we're processing a complete translation unit, Sema will perform
1079
  /// end-of-translation-unit semantic tasks (such as creating
1080
  /// initializers for tentative definitions in C) once parsing has
1081
  /// completed. Modules and precompiled headers perform different kinds of
1082
  /// checks.
1083
  TranslationUnitKind TUKind;
1084
1085
  llvm::BumpPtrAllocator BumpAlloc;
1086
1087
  /// The number of SFINAE diagnostics that have been trapped.
1088
  unsigned NumSFINAEErrors;
1089
1090
  typedef llvm::DenseMap<ParmVarDecl *, llvm::TinyPtrVector<ParmVarDecl *>>
1091
    UnparsedDefaultArgInstantiationsMap;
1092
1093
  /// A mapping from parameters with unparsed default arguments to the
1094
  /// set of instantiations of each parameter.
1095
  ///
1096
  /// This mapping is a temporary data structure used when parsing
1097
  /// nested class templates or nested classes of class templates,
1098
  /// where we might end up instantiating an inner class before the
1099
  /// default arguments of its methods have been parsed.
1100
  UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations;
1101
1102
  // Contains the locations of the beginning of unparsed default
1103
  // argument locations.
1104
  llvm::DenseMap<ParmVarDecl *, SourceLocation> UnparsedDefaultArgLocs;
1105
1106
  /// UndefinedInternals - all the used, undefined objects which require a
1107
  /// definition in this translation unit.
1108
  llvm::MapVector<NamedDecl *, SourceLocation> UndefinedButUsed;
1109
1110
  /// Determine if VD, which must be a variable or function, is an external
1111
  /// symbol that nonetheless can't be referenced from outside this translation
1112
  /// unit because its type has no linkage and it's not extern "C".
1113
  bool isExternalWithNoLinkageType(ValueDecl *VD);
1114
1115
  /// Obtain a sorted list of functions that are undefined but ODR-used.
1116
  void getUndefinedButUsed(
1117
      SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> > &Undefined);
1118
1119
  /// Retrieves list of suspicious delete-expressions that will be checked at
1120
  /// the end of translation unit.
1121
  const llvm::MapVector<FieldDecl *, DeleteLocs> &
1122
  getMismatchingDeleteExpressions() const;
1123
1124
  typedef std::pair<ObjCMethodList, ObjCMethodList> GlobalMethods;
1125
  typedef llvm::DenseMap<Selector, GlobalMethods> GlobalMethodPool;
1126
1127
  /// Method Pool - allows efficient lookup when typechecking messages to "id".
1128
  /// We need to maintain a list, since selectors can have differing signatures
1129
  /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
1130
  /// of selectors are "overloaded").
1131
  /// At the head of the list it is recorded whether there were 0, 1, or >= 2
1132
  /// methods inside categories with a particular selector.
1133
  GlobalMethodPool MethodPool;
1134
1135
  /// Method selectors used in a \@selector expression. Used for implementation
1136
  /// of -Wselector.
1137
  llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
1138
1139
  /// Kinds of C++ special members.
1140
  enum CXXSpecialMember {
1141
    CXXDefaultConstructor,
1142
    CXXCopyConstructor,
1143
    CXXMoveConstructor,
1144
    CXXCopyAssignment,
1145
    CXXMoveAssignment,
1146
    CXXDestructor,
1147
    CXXInvalid
1148
  };
1149
1150
  typedef llvm::PointerIntPair<CXXRecordDecl *, 3, CXXSpecialMember>
1151
      SpecialMemberDecl;
1152
1153
  /// The C++ special members which we are currently in the process of
1154
  /// declaring. If this process recursively triggers the declaration of the
1155
  /// same special member, we should act as if it is not yet declared.
1156
  llvm::SmallPtrSet<SpecialMemberDecl, 4> SpecialMembersBeingDeclared;
1157
1158
  /// The function definitions which were renamed as part of typo-correction
1159
  /// to match their respective declarations. We want to keep track of them
1160
  /// to ensure that we don't emit a "redefinition" error if we encounter a
1161
  /// correctly named definition after the renamed definition.
1162
  llvm::SmallPtrSet<const NamedDecl *, 4> TypoCorrectedFunctionDefinitions;
1163
1164
  /// Stack of types that correspond to the parameter entities that are
1165
  /// currently being copy-initialized. Can be empty.
1166
  llvm::SmallVector<QualType, 4> CurrentParameterCopyTypes;
1167
1168
  void ReadMethodPool(Selector Sel);
1169
  void updateOutOfDateSelector(Selector Sel);
1170
1171
  /// Private Helper predicate to check for 'self'.
1172
  bool isSelfExpr(Expr *RExpr);
1173
  bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
1174
1175
  /// Cause the active diagnostic on the DiagosticsEngine to be
1176
  /// emitted. This is closely coupled to the SemaDiagnosticBuilder class and
1177
  /// should not be used elsewhere.
1178
  void EmitCurrentDiagnostic(unsigned DiagID);
1179
1180
  /// Records and restores the FP_CONTRACT state on entry/exit of compound
1181
  /// statements.
1182
  class FPContractStateRAII {
1183
  public:
1184
4.32M
    FPContractStateRAII(Sema &S) : S(S), OldFPFeaturesState(S.FPFeatures) {}
1185
4.32M
    ~FPContractStateRAII() { S.FPFeatures = OldFPFeaturesState; }
1186
1187
  private:
1188
    Sema& S;
1189
    FPOptions OldFPFeaturesState;
1190
  };
1191
1192
  void addImplicitTypedef(StringRef Name, QualType T);
1193
1194
public:
1195
  Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
1196
       TranslationUnitKind TUKind = TU_Complete,
1197
       CodeCompleteConsumer *CompletionConsumer = nullptr);
1198
  ~Sema();
1199
1200
  /// Perform initialization that occurs after the parser has been
1201
  /// initialized but before it parses anything.
1202
  void Initialize();
1203
1204
1.73G
  const LangOptions &getLangOpts() const { return LangOpts; }
1205
34.0k
  OpenCLOptions &getOpenCLOptions() { return OpenCLFeatures; }
1206
3.45k
  FPOptions     &getFPOptions() { return FPFeatures; }
1207
1208
21.1M
  DiagnosticsEngine &getDiagnostics() const { return Diags; }
1209
1.29M
  SourceManager &getSourceManager() const { return SourceMgr; }
1210
109k
  Preprocessor &getPreprocessor() const { return PP; }
1211
33.2M
  ASTContext &getASTContext() const { return Context; }
1212
888k
  ASTConsumer &getASTConsumer() const { return Consumer; }
1213
  ASTMutationListener *getASTMutationListener() const;
1214
44.2k
  ExternalSemaSource* getExternalSource() const { return ExternalSource; }
1215
1216
  ///Registers an external source. If an external source already exists,
1217
  /// creates a multiplex external source and appends to it.
1218
  ///
1219
  ///\param[in] E - A non-null external sema source.
1220
  ///
1221
  void addExternalSource(ExternalSemaSource *E);
1222
1223
  void PrintStats() const;
1224
1225
  /// Helper class that creates diagnostics with optional
1226
  /// template instantiation stacks.
1227
  ///
1228
  /// This class provides a wrapper around the basic DiagnosticBuilder
1229
  /// class that emits diagnostics. SemaDiagnosticBuilder is
1230
  /// responsible for emitting the diagnostic (as DiagnosticBuilder
1231
  /// does) and, if the diagnostic comes from inside a template
1232
  /// instantiation, printing the template instantiation stack as
1233
  /// well.
1234
  class SemaDiagnosticBuilder : public DiagnosticBuilder {
1235
    Sema &SemaRef;
1236
    unsigned DiagID;
1237
1238
  public:
1239
    SemaDiagnosticBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
1240
1.92M
      : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) { }
1241
1242
    // This is a cunning lie. DiagnosticBuilder actually performs move
1243
    // construction in its copy constructor (but due to varied uses, it's not
1244
    // possible to conveniently express this as actual move construction). So
1245
    // the default copy ctor here is fine, because the base class disables the
1246
    // source anyway, so the user-defined ~SemaDiagnosticBuilder is a safe no-op
1247
    // in that case anwyay.
1248
2.06k
    SemaDiagnosticBuilder(const SemaDiagnosticBuilder&) = default;
1249
1250
1.92M
    ~SemaDiagnosticBuilder() {
1251
1.92M
      // If we aren't active, there is nothing to do.
1252
1.92M
      if (!isActive()) 
return3.58k
;
1253
1.92M
1254
1.92M
      // Otherwise, we need to emit the diagnostic. First flush the underlying
1255
1.92M
      // DiagnosticBuilder data, and clear the diagnostic builder itself so it
1256
1.92M
      // won't emit the diagnostic in its own destructor.
1257
1.92M
      //
1258
1.92M
      // This seems wasteful, in that as written the DiagnosticBuilder dtor will
1259
1.92M
      // do its own needless checks to see if the diagnostic needs to be
1260
1.92M
      // emitted. However, because we take care to ensure that the builder
1261
1.92M
      // objects never escape, a sufficiently smart compiler will be able to
1262
1.92M
      // eliminate that code.
1263
1.92M
      FlushCounts();
1264
1.92M
      Clear();
1265
1.92M
1266
1.92M
      // Dispatch to Sema to emit the diagnostic.
1267
1.92M
      SemaRef.EmitCurrentDiagnostic(DiagID);
1268
1.92M
    }
1269
1270
    /// Teach operator<< to produce an object of the correct type.
1271
    template<typename T>
1272
    friend const SemaDiagnosticBuilder &operator<<(
1273
1.96M
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1.96M
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1.96M
      BaseDiag << Value;
1276
1.96M
      return Diag;
1277
1.96M
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<bool>(clang::Sema::SemaDiagnosticBuilder const&, bool const&)
Line
Count
Source
1273
65.6k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
65.6k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
65.6k
      BaseDiag << Value;
1276
65.6k
      return Diag;
1277
65.6k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::SourceRange>(clang::Sema::SemaDiagnosticBuilder const&, clang::SourceRange const&)
Line
Count
Source
1273
1.05M
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1.05M
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1.05M
      BaseDiag << Value;
1276
1.05M
      return Diag;
1277
1.05M
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::QualType>(clang::Sema::SemaDiagnosticBuilder const&, clang::QualType const&)
Line
Count
Source
1273
258k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
258k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
258k
      BaseDiag << Value;
1276
258k
      return Diag;
1277
258k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::FunctionDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::FunctionDecl const* const&)
Line
Count
Source
1273
1.20k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1.20k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1.20k
      BaseDiag << Value;
1276
1.20k
      return Diag;
1277
1.20k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<int>(clang::Sema::SemaDiagnosticBuilder const&, int const&)
Line
Count
Source
1273
39.0k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
39.0k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
39.0k
      BaseDiag << Value;
1276
39.0k
      return Diag;
1277
39.0k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ObjCMethodDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ObjCMethodDecl const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::FixItHint>(clang::Sema::SemaDiagnosticBuilder const&, clang::FixItHint const&)
Line
Count
Source
1273
57.3k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
57.3k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
57.3k
      BaseDiag << Value;
1276
57.3k
      return Diag;
1277
57.3k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::SourceLocation>(clang::Sema::SemaDiagnosticBuilder const&, clang::SourceLocation const&)
Line
Count
Source
1273
874
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
874
      const DiagnosticBuilder &BaseDiag = Diag;
1275
874
      BaseDiag << Value;
1276
874
      return Diag;
1277
874
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::DeclarationName>(clang::Sema::SemaDiagnosticBuilder const&, clang::DeclarationName const&)
Line
Count
Source
1273
120k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
120k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
120k
      BaseDiag << Value;
1276
120k
      return Diag;
1277
120k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::DeclContext*>(clang::Sema::SemaDiagnosticBuilder const&, clang::DeclContext* const&)
Line
Count
Source
1273
21.0k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
21.0k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
21.0k
      BaseDiag << Value;
1276
21.0k
      return Diag;
1277
21.0k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<unsigned int>(clang::Sema::SemaDiagnosticBuilder const&, unsigned int const&)
Line
Count
Source
1273
31.5k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
31.5k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
31.5k
      BaseDiag << Value;
1276
31.5k
      return Diag;
1277
31.5k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<llvm::StringRef>(clang::Sema::SemaDiagnosticBuilder const&, llvm::StringRef const&)
Line
Count
Source
1273
7.50k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
7.50k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
7.50k
      BaseDiag << Value;
1276
7.50k
      return Diag;
1277
7.50k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::NamedDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::NamedDecl const* const&)
Line
Count
Source
1273
24.6k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
24.6k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
24.6k
      BaseDiag << Value;
1276
24.6k
      return Diag;
1277
24.6k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char const*>(clang::Sema::SemaDiagnosticBuilder const&, char const* const&)
Line
Count
Source
1273
27.5k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
27.5k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
27.5k
      BaseDiag << Value;
1276
27.5k
      return Diag;
1277
27.5k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [9]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [9])
Line
Count
Source
1273
18.3k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
18.3k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
18.3k
      BaseDiag << Value;
1276
18.3k
      return Diag;
1277
18.3k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<llvm::SmallString<32u> >(clang::Sema::SemaDiagnosticBuilder const&, llvm::SmallString<32u> const&)
Line
Count
Source
1273
183
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
183
      const DiagnosticBuilder &BaseDiag = Diag;
1275
183
      BaseDiag << Value;
1276
183
      return Diag;
1277
183
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::IdentifierInfo*>(clang::Sema::SemaDiagnosticBuilder const&, clang::IdentifierInfo* const&)
Line
Count
Source
1273
7.57k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
7.57k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
7.57k
      BaseDiag << Value;
1276
7.57k
      return Diag;
1277
7.57k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [17]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [17])
Line
Count
Source
1273
26
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
26
      const DiagnosticBuilder &BaseDiag = Diag;
1275
26
      BaseDiag << Value;
1276
26
      return Diag;
1277
26
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [10]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [10])
Line
Count
Source
1273
270
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
270
      const DiagnosticBuilder &BaseDiag = Diag;
1275
270
      BaseDiag << Value;
1276
270
      return Diag;
1277
270
    }
Unexecuted instantiation: clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [46]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [46])
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [45]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [45])
Line
Count
Source
1273
90
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
90
      const DiagnosticBuilder &BaseDiag = Diag;
1275
90
      BaseDiag << Value;
1276
90
      return Diag;
1277
90
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [31]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [31])
Line
Count
Source
1273
12
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
12
      const DiagnosticBuilder &BaseDiag = Diag;
1275
12
      BaseDiag << Value;
1276
12
      return Diag;
1277
12
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [23]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [23])
Line
Count
Source
1273
14
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
14
      const DiagnosticBuilder &BaseDiag = Diag;
1275
14
      BaseDiag << Value;
1276
14
      return Diag;
1277
14
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [24]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [24])
Line
Count
Source
1273
9
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
9
      const DiagnosticBuilder &BaseDiag = Diag;
1275
9
      BaseDiag << Value;
1276
9
      return Diag;
1277
9
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [32]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [32])
Line
Count
Source
1273
3
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
3
      const DiagnosticBuilder &BaseDiag = Diag;
1275
3
      BaseDiag << Value;
1276
3
      return Diag;
1277
3
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [34]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [34])
Line
Count
Source
1273
23
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
23
      const DiagnosticBuilder &BaseDiag = Diag;
1275
23
      BaseDiag << Value;
1276
23
      return Diag;
1277
23
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [19]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [19])
Line
Count
Source
1273
42
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
42
      const DiagnosticBuilder &BaseDiag = Diag;
1275
42
      BaseDiag << Value;
1276
42
      return Diag;
1277
42
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [11]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [11])
Line
Count
Source
1273
20
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
20
      const DiagnosticBuilder &BaseDiag = Diag;
1275
20
      BaseDiag << Value;
1276
20
      return Diag;
1277
20
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [54]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [54])
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [39]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [39])
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [47]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [47])
Line
Count
Source
1273
5
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
5
      const DiagnosticBuilder &BaseDiag = Diag;
1275
5
      BaseDiag << Value;
1276
5
      return Diag;
1277
5
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [16]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [16])
Line
Count
Source
1273
10
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
10
      const DiagnosticBuilder &BaseDiag = Diag;
1275
10
      BaseDiag << Value;
1276
10
      return Diag;
1277
10
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [22]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [22])
Line
Count
Source
1273
7
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
7
      const DiagnosticBuilder &BaseDiag = Diag;
1275
7
      BaseDiag << Value;
1276
7
      return Diag;
1277
7
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [8]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [8])
Line
Count
Source
1273
40
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
40
      const DiagnosticBuilder &BaseDiag = Diag;
1275
40
      BaseDiag << Value;
1276
40
      return Diag;
1277
40
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [58]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [58])
Line
Count
Source
1273
150
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
150
      const DiagnosticBuilder &BaseDiag = Diag;
1275
150
      BaseDiag << Value;
1276
150
      return Diag;
1277
150
    }
Unexecuted instantiation: clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [59]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [59])
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [6]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [6])
Line
Count
Source
1273
2.56k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2.56k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2.56k
      BaseDiag << Value;
1276
2.56k
      return Diag;
1277
2.56k
    }
Unexecuted instantiation: clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [57]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [57])
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [48]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [48])
Line
Count
Source
1273
3
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
3
      const DiagnosticBuilder &BaseDiag = Diag;
1275
3
      BaseDiag << Value;
1276
3
      return Diag;
1277
3
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [29]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [29])
Line
Count
Source
1273
58
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
58
      const DiagnosticBuilder &BaseDiag = Diag;
1275
58
      BaseDiag << Value;
1276
58
      return Diag;
1277
58
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [56]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [56])
Line
Count
Source
1273
9
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
9
      const DiagnosticBuilder &BaseDiag = Diag;
1275
9
      BaseDiag << Value;
1276
9
      return Diag;
1277
9
    }
Unexecuted instantiation: clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [20]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [20])
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [65]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [65])
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
Unexecuted instantiation: clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [53]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [53])
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [35]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [35])
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [49]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [49])
Line
Count
Source
1273
6
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
6
      const DiagnosticBuilder &BaseDiag = Diag;
1275
6
      BaseDiag << Value;
1276
6
      return Diag;
1277
6
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [25]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [25])
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [77]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [77])
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [150]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [150])
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [69]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [69])
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [36]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [36])
Line
Count
Source
1273
8
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
8
      const DiagnosticBuilder &BaseDiag = Diag;
1275
8
      BaseDiag << Value;
1276
8
      return Diag;
1277
8
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [87]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [87])
Line
Count
Source
1273
3
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
3
      const DiagnosticBuilder &BaseDiag = Diag;
1275
3
      BaseDiag << Value;
1276
3
      return Diag;
1277
3
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ValueDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ValueDecl* const&)
Line
Count
Source
1273
7.97k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
7.97k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
7.97k
      BaseDiag << Value;
1276
7.97k
      return Diag;
1277
7.97k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [7]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [7])
Line
Count
Source
1273
144
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
144
      const DiagnosticBuilder &BaseDiag = Diag;
1275
144
      BaseDiag << Value;
1276
144
      return Diag;
1277
144
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AttributeDeclKind>(clang::Sema::SemaDiagnosticBuilder const&, clang::AttributeDeclKind const&)
Line
Count
Source
1273
65
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
65
      const DiagnosticBuilder &BaseDiag = Diag;
1275
65
      BaseDiag << Value;
1276
65
      return Diag;
1277
65
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(clang::Sema::SemaDiagnosticBuilder const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
1273
81.9k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
81.9k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
81.9k
      BaseDiag << Value;
1276
81.9k
      return Diag;
1277
81.9k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::NamedDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::NamedDecl* const&)
Line
Count
Source
1273
5.89k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
5.89k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
5.89k
      BaseDiag << Value;
1276
5.89k
      return Diag;
1277
5.89k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AccessSpecifier>(clang::Sema::SemaDiagnosticBuilder const&, clang::AccessSpecifier const&)
Line
Count
Source
1273
16
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
16
      const DiagnosticBuilder &BaseDiag = Diag;
1275
16
      BaseDiag << Value;
1276
16
      return Diag;
1277
16
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [12]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [12])
Line
Count
Source
1273
190
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
190
      const DiagnosticBuilder &BaseDiag = Diag;
1275
190
      BaseDiag << Value;
1276
190
      return Diag;
1277
190
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [5]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [5])
Line
Count
Source
1273
100
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
100
      const DiagnosticBuilder &BaseDiag = Diag;
1275
100
      BaseDiag << Value;
1276
100
      return Diag;
1277
100
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::DeclaratorDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::DeclaratorDecl* const&)
Line
Count
Source
1273
6
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
6
      const DiagnosticBuilder &BaseDiag = Diag;
1275
6
      BaseDiag << Value;
1276
6
      return Diag;
1277
6
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::IdentifierInfo const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::IdentifierInfo const* const&)
Line
Count
Source
1273
722
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
722
      const DiagnosticBuilder &BaseDiag = Diag;
1275
722
      BaseDiag << Value;
1276
722
      return Diag;
1277
722
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CXXRecordDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CXXRecordDecl* const&)
Line
Count
Source
1273
9.10k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
9.10k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
9.10k
      BaseDiag << Value;
1276
9.10k
      return Diag;
1277
9.10k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::TemplateName>(clang::Sema::SemaDiagnosticBuilder const&, clang::TemplateName const&)
Line
Count
Source
1273
139
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
139
      const DiagnosticBuilder &BaseDiag = Diag;
1275
139
      BaseDiag << Value;
1276
139
      return Diag;
1277
139
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<CastType>(clang::Sema::SemaDiagnosticBuilder const&, CastType const&)
Line
Count
Source
1273
378
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
378
      const DiagnosticBuilder &BaseDiag = Diag;
1275
378
      BaseDiag << Value;
1276
378
      return Diag;
1277
378
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::FunctionDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::FunctionDecl* const&)
Line
Count
Source
1273
92.3k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
92.3k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
92.3k
      BaseDiag << Value;
1276
92.3k
      return Diag;
1277
92.3k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::AssignmentAction>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::AssignmentAction const&)
Line
Count
Source
1273
78
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
78
      const DiagnosticBuilder &BaseDiag = Diag;
1275
78
      BaseDiag << Value;
1276
78
      return Diag;
1277
78
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [13]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [13])
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CanQual<clang::Type> >(clang::Sema::SemaDiagnosticBuilder const&, clang::CanQual<clang::Type> const&)
Line
Count
Source
1273
57
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
57
      const DiagnosticBuilder &BaseDiag = Diag;
1275
57
      BaseDiag << Value;
1276
57
      return Diag;
1277
57
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Expr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::Expr* const&)
Line
Count
Source
1273
39
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
39
      const DiagnosticBuilder &BaseDiag = Diag;
1275
39
      BaseDiag << Value;
1276
39
      return Diag;
1277
39
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [37]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [37])
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<llvm::SmallString<16u> >(clang::Sema::SemaDiagnosticBuilder const&, llvm::SmallString<16u> const&)
Line
Count
Source
1273
173
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
173
      const DiagnosticBuilder &BaseDiag = Diag;
1275
173
      BaseDiag << Value;
1276
173
      return Diag;
1277
173
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [3]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [3])
Line
Count
Source
1273
148
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
148
      const DiagnosticBuilder &BaseDiag = Diag;
1275
148
      BaseDiag << Value;
1276
148
      return Diag;
1277
148
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<llvm::ArrayRef<clang::FixItHint> >(clang::Sema::SemaDiagnosticBuilder const&, llvm::ArrayRef<clang::FixItHint> const&)
Line
Count
Source
1273
2.03k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2.03k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2.03k
      BaseDiag << Value;
1276
2.03k
      return Diag;
1277
2.03k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CharSourceRange>(clang::Sema::SemaDiagnosticBuilder const&, clang::CharSourceRange const&)
Line
Count
Source
1273
1.93k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1.93k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1.93k
      BaseDiag << Value;
1276
1.93k
      return Diag;
1277
1.93k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::VariadicCallType>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::VariadicCallType const&)
Line
Count
Source
1273
6
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
6
      const DiagnosticBuilder &BaseDiag = Diag;
1275
6
      BaseDiag << Value;
1276
6
      return Diag;
1277
6
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::EnumDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::EnumDecl* const&)
Line
Count
Source
1273
33
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
33
      const DiagnosticBuilder &BaseDiag = Diag;
1275
33
      BaseDiag << Value;
1276
33
      return Diag;
1277
33
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::FieldDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::FieldDecl* const&)
Line
Count
Source
1273
642
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
642
      const DiagnosticBuilder &BaseDiag = Diag;
1275
642
      BaseDiag << Value;
1276
642
      return Diag;
1277
642
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::VarDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::VarDecl* const&)
Line
Count
Source
1273
3.37k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
3.37k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
3.37k
      BaseDiag << Value;
1276
3.37k
      return Diag;
1277
3.37k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [18]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [18])
Line
Count
Source
1273
13
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
13
      const DiagnosticBuilder &BaseDiag = Diag;
1275
13
      BaseDiag << Value;
1276
13
      return Diag;
1277
13
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<AbsoluteValueKind>(clang::Sema::SemaDiagnosticBuilder const&, AbsoluteValueKind const&)
Line
Count
Source
1273
792
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
792
      const DiagnosticBuilder &BaseDiag = Diag;
1275
792
      BaseDiag << Value;
1276
792
      return Diag;
1277
792
    }
SemaChecking.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::DiagnoseAlwaysNonNullPointer(clang::Expr*, clang::Expr::NullPointerConstantKind, bool, clang::SourceRange)::$_4>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::DiagnoseAlwaysNonNullPointer(clang::Expr*, clang::Expr::NullPointerConstantKind, bool, clang::SourceRange)::$_4 const&)
Line
Count
Source
1273
210
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
210
      const DiagnosticBuilder &BaseDiag = Diag;
1275
210
      BaseDiag << Value;
1276
210
      return Diag;
1277
210
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ObjCIvarDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ObjCIvarDecl* const&)
Line
Count
Source
1273
46
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
46
      const DiagnosticBuilder &BaseDiag = Diag;
1275
46
      BaseDiag << Value;
1276
46
      return Diag;
1277
46
    }
SemaCoroutine.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<isValidCoroutineContext(clang::Sema&, clang::SourceLocation, llvm::StringRef)::InvalidFuncDiag>(clang::Sema::SemaDiagnosticBuilder const&, isValidCoroutineContext(clang::Sema&, clang::SourceLocation, llvm::StringRef)::InvalidFuncDiag const&)
Line
Count
Source
1273
13
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
13
      const DiagnosticBuilder &BaseDiag = Diag;
1275
13
      BaseDiag << Value;
1276
13
      return Diag;
1277
13
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CXXMethodDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CXXMethodDecl* const&)
Line
Count
Source
1273
10
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
10
      const DiagnosticBuilder &BaseDiag = Diag;
1275
10
      BaseDiag << Value;
1276
10
      return Diag;
1277
10
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::CUDAFunctionTarget>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::CUDAFunctionTarget const&)
Line
Count
Source
1273
408
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
408
      const DiagnosticBuilder &BaseDiag = Diag;
1275
408
      BaseDiag << Value;
1276
408
      return Diag;
1277
408
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AlignedAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AlignedAttr const* const&)
Line
Count
Source
1273
8
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
8
      const DiagnosticBuilder &BaseDiag = Diag;
1275
8
      BaseDiag << Value;
1276
8
      return Diag;
1277
8
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AlignedAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AlignedAttr* const&)
Line
Count
Source
1273
23
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
23
      const DiagnosticBuilder &BaseDiag = Diag;
1275
23
      BaseDiag << Value;
1276
23
      return Diag;
1277
23
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<std::__1::pair<clang::NullabilityKind, bool> >(clang::Sema::SemaDiagnosticBuilder const&, std::__1::pair<clang::NullabilityKind, bool> const&)
Line
Count
Source
1273
117
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
117
      const DiagnosticBuilder &BaseDiag = Diag;
1275
117
      BaseDiag << Value;
1276
117
      return Diag;
1277
117
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Attr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::Attr const* const&)
Line
Count
Source
1273
469
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
469
      const DiagnosticBuilder &BaseDiag = Diag;
1275
469
      BaseDiag << Value;
1276
469
      return Diag;
1277
469
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::DLLImportAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::DLLImportAttr const* const&)
Line
Count
Source
1273
366
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
366
      const DiagnosticBuilder &BaseDiag = Diag;
1275
366
      BaseDiag << Value;
1276
366
      return Diag;
1277
366
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::NotTailCalledAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::NotTailCalledAttr* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
SemaDecl.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<CheckMultiVersionValue(clang::Sema&, clang::FunctionDecl const*)::ErrType>(clang::Sema::SemaDiagnosticBuilder const&, CheckMultiVersionValue(clang::Sema&, clang::FunctionDecl const*)::ErrType const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
SemaDecl.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<CheckMultiVersionAdditionalRules(clang::Sema&, clang::FunctionDecl const*, clang::FunctionDecl const*, bool, MultiVersioning::Type)::DoesntSupport>(clang::Sema::SemaDiagnosticBuilder const&, CheckMultiVersionAdditionalRules(clang::Sema&, clang::FunctionDecl const*, clang::FunctionDecl const*, bool, MultiVersioning::Type)::DoesntSupport const&)
Line
Count
Source
1273
21
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
21
      const DiagnosticBuilder &BaseDiag = Diag;
1275
21
      BaseDiag << Value;
1276
21
      return Diag;
1277
21
    }
SemaDecl.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<CheckMultiVersionAdditionalRules(clang::Sema&, clang::FunctionDecl const*, clang::FunctionDecl const*, bool, MultiVersioning::Type)::Different>(clang::Sema::SemaDiagnosticBuilder const&, CheckMultiVersionAdditionalRules(clang::Sema&, clang::FunctionDecl const*, clang::FunctionDecl const*, bool, MultiVersioning::Type)::Different const&)
Line
Count
Source
1273
19
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
19
      const DiagnosticBuilder &BaseDiag = Diag;
1275
19
      BaseDiag << Value;
1276
19
      return Diag;
1277
19
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CXXRecordDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CXXRecordDecl const* const&)
Line
Count
Source
1273
144
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
144
      const DiagnosticBuilder &BaseDiag = Diag;
1275
144
      BaseDiag << Value;
1276
144
      return Diag;
1277
144
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::NestedNameSpecifier*>(clang::Sema::SemaDiagnosticBuilder const&, clang::NestedNameSpecifier* const&)
Line
Count
Source
1273
339
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
339
      const DiagnosticBuilder &BaseDiag = Diag;
1275
339
      BaseDiag << Value;
1276
339
      return Diag;
1277
339
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::FieldDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::FieldDecl const* const&)
Line
Count
Source
1273
88
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
88
      const DiagnosticBuilder &BaseDiag = Diag;
1275
88
      BaseDiag << Value;
1276
88
      return Diag;
1277
88
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::RecordDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::RecordDecl const* const&)
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AnyX86NoCallerSavedRegistersAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AnyX86NoCallerSavedRegistersAttr* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::CXXSpecialMember>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::CXXSpecialMember const&)
Line
Count
Source
1273
906
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
906
      const DiagnosticBuilder &BaseDiag = Diag;
1275
906
      BaseDiag << Value;
1276
906
      return Diag;
1277
906
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::TagTypeKind>(clang::Sema::SemaDiagnosticBuilder const&, clang::TagTypeKind const&)
Line
Count
Source
1273
314
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
314
      const DiagnosticBuilder &BaseDiag = Diag;
1275
314
      BaseDiag << Value;
1276
314
      return Diag;
1277
314
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::InheritableAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::InheritableAttr const* const&)
Line
Count
Source
1273
229
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
229
      const DiagnosticBuilder &BaseDiag = Diag;
1275
229
      BaseDiag << Value;
1276
229
      return Diag;
1277
229
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<ShadowedDeclKind>(clang::Sema::SemaDiagnosticBuilder const&, ShadowedDeclKind const&)
Line
Count
Source
1273
116
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
116
      const DiagnosticBuilder &BaseDiag = Diag;
1275
116
      BaseDiag << Value;
1276
116
      return Diag;
1277
116
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::DeclContext const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::DeclContext const* const&)
Line
Count
Source
1273
40
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
40
      const DiagnosticBuilder &BaseDiag = Diag;
1275
40
      BaseDiag << Value;
1276
40
      return Diag;
1277
40
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::VarDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::VarDecl const* const&)
Line
Count
Source
1273
87
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
87
      const DiagnosticBuilder &BaseDiag = Diag;
1275
87
      BaseDiag << Value;
1276
87
      return Diag;
1277
87
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::StorageClass>(clang::Sema::SemaDiagnosticBuilder const&, clang::StorageClass const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::UsedAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::UsedAttr* const&)
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::NonTagKind>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::NonTagKind const&)
Line
Count
Source
1273
32
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
32
      const DiagnosticBuilder &BaseDiag = Diag;
1275
32
      BaseDiag << Value;
1276
32
      return Diag;
1277
32
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::TagDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::TagDecl* const&)
Line
Count
Source
1273
9
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
9
      const DiagnosticBuilder &BaseDiag = Diag;
1275
9
      BaseDiag << Value;
1276
9
      return Diag;
1277
9
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::RecordDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::RecordDecl* const&)
Line
Count
Source
1273
21
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
21
      const DiagnosticBuilder &BaseDiag = Diag;
1275
21
      BaseDiag << Value;
1276
21
      return Diag;
1277
21
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::EnumConstantDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::EnumConstantDecl* const&)
Line
Count
Source
1273
24
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
24
      const DiagnosticBuilder &BaseDiag = Diag;
1275
24
      BaseDiag << Value;
1276
24
      return Diag;
1277
24
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CUDALaunchBoundsAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CUDALaunchBoundsAttr const* const&)
Line
Count
Source
1273
7
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
7
      const DiagnosticBuilder &BaseDiag = Diag;
1275
7
      BaseDiag << Value;
1276
7
      return Diag;
1277
7
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Mips16Attr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::Mips16Attr const* const&)
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::MicroMipsAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::MicroMipsAttr const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::MipsInterruptAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::MipsInterruptAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::MipsShortCallAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::MipsShortCallAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::MipsLongCallAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::MipsLongCallAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::NotTailCalledAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::NotTailCalledAttr const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<AttributeLangSupport::LANG>(clang::Sema::SemaDiagnosticBuilder const&, AttributeLangSupport::LANG const&)
Line
Count
Source
1273
3
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
3
      const DiagnosticBuilder &BaseDiag = Diag;
1275
3
      BaseDiag << Value;
1276
3
      return Diag;
1277
3
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CUDASharedAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CUDASharedAttr const* const&)
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [14]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [14])
Line
Count
Source
1273
10
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
10
      const DiagnosticBuilder &BaseDiag = Diag;
1275
10
      BaseDiag << Value;
1276
10
      return Diag;
1277
10
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CUDADeviceAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CUDADeviceAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CUDAHostAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CUDAHostAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CXXMethodDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CXXMethodDecl const* const&)
Line
Count
Source
1273
34
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
34
      const DiagnosticBuilder &BaseDiag = Diag;
1275
34
      BaseDiag << Value;
1276
34
      return Diag;
1277
34
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CUDAGlobalAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CUDAGlobalAttr const* const&)
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::OwnershipAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::OwnershipAttr const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::HotAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::HotAttr const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ColdAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ColdAttr const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::DisableTailCallsAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::DisableTailCallsAttr const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CUDAConstantAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CUDAConstantAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::VecReturnAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::VecReturnAttr* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
Unexecuted instantiation: clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CFUnknownTransferAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CFUnknownTransferAttr const* const&)
Unexecuted instantiation: clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CFAuditedTransferAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CFAuditedTransferAttr const* const&)
SemaDeclAttr.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<handleNSReturnsRetainedAttr(clang::Sema&, clang::Decl*, clang::ParsedAttr const&)::$_0>(clang::Sema::SemaDiagnosticBuilder const&, handleNSReturnsRetainedAttr(clang::Sema&, clang::Decl*, clang::ParsedAttr const&)::$_0 const&)
Line
Count
Source
1273
10
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
10
      const DiagnosticBuilder &BaseDiag = Diag;
1275
10
      BaseDiag << Value;
1276
10
      return Diag;
1277
10
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AlwaysInlineAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AlwaysInlineAttr const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::NakedAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::NakedAttr const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [4]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [4])
Line
Count
Source
1273
37
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
37
      const DiagnosticBuilder &BaseDiag = Diag;
1275
37
      BaseDiag << Value;
1276
37
      return Diag;
1277
37
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<llvm::SmallVector<clang::FixItHint, 12u> >(clang::Sema::SemaDiagnosticBuilder const&, llvm::SmallVector<clang::FixItHint, 12u> const&)
Line
Count
Source
1273
2.61k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2.61k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2.61k
      BaseDiag << Value;
1276
2.61k
      return Diag;
1277
2.61k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AttributeArgumentNType>(clang::Sema::SemaDiagnosticBuilder const&, clang::AttributeArgumentNType const&)
Line
Count
Source
1273
116
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
116
      const DiagnosticBuilder &BaseDiag = Diag;
1275
116
      BaseDiag << Value;
1276
116
      return Diag;
1277
116
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AssumeAlignedAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AssumeAlignedAttr* const&)
Line
Count
Source
1273
3
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
3
      const DiagnosticBuilder &BaseDiag = Diag;
1275
3
      BaseDiag << Value;
1276
3
      return Diag;
1277
3
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AllocAlignAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AllocAlignAttr* const&)
Line
Count
Source
1273
5
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
5
      const DiagnosticBuilder &BaseDiag = Diag;
1275
5
      BaseDiag << Value;
1276
5
      return Diag;
1277
5
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AllocAlignAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AllocAlignAttr const* const&)
Line
Count
Source
1273
5
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
5
      const DiagnosticBuilder &BaseDiag = Diag;
1275
5
      BaseDiag << Value;
1276
5
      return Diag;
1277
5
    }
SemaDeclAttr.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::checkTargetAttr(clang::SourceLocation, llvm::StringRef)::FirstParam>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::checkTargetAttr(clang::SourceLocation, llvm::StringRef)::FirstParam const&)
Line
Count
Source
1273
10
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
10
      const DiagnosticBuilder &BaseDiag = Diag;
1275
10
      BaseDiag << Value;
1276
10
      return Diag;
1277
10
    }
SemaDeclAttr.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::checkTargetAttr(clang::SourceLocation, llvm::StringRef)::SecondParam>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::checkTargetAttr(clang::SourceLocation, llvm::StringRef)::SecondParam const&)
Line
Count
Source
1273
10
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
10
      const DiagnosticBuilder &BaseDiag = Diag;
1275
10
      BaseDiag << Value;
1276
10
      return Diag;
1277
10
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AlignValueAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AlignValueAttr* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::InternalLinkageAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::InternalLinkageAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CommonAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CommonAttr const* const&)
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AlwaysInlineAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AlwaysInlineAttr* const&)
Line
Count
Source
1273
7
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
7
      const DiagnosticBuilder &BaseDiag = Diag;
1275
7
      BaseDiag << Value;
1276
7
      return Diag;
1277
7
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::MinSizeAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::MinSizeAttr* const&)
Line
Count
Source
1273
3
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
3
      const DiagnosticBuilder &BaseDiag = Diag;
1275
3
      BaseDiag << Value;
1276
3
      return Diag;
1277
3
    }
Unexecuted instantiation: clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ParameterABIAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ParameterABIAttr* const&)
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::DLLImportAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::DLLImportAttr* const&)
Line
Count
Source
1273
148
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
148
      const DiagnosticBuilder &BaseDiag = Diag;
1275
148
      BaseDiag << Value;
1276
148
      return Diag;
1277
148
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ReqdWorkGroupSizeAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ReqdWorkGroupSizeAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::WorkGroupSizeHintAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::WorkGroupSizeHintAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::VecTypeHintAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::VecTypeHintAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::OpenCLIntelReqdSubGroupSizeAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::OpenCLIntelReqdSubGroupSizeAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AMDGPUFlatWorkGroupSizeAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AMDGPUFlatWorkGroupSizeAttr const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AMDGPUWavesPerEUAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AMDGPUWavesPerEUAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AMDGPUNumSGPRAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AMDGPUNumSGPRAttr const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::AMDGPUNumVGPRAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::AMDGPUNumVGPRAttr const* const&)
Line
Count
Source
1273
1
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1
      BaseDiag << Value;
1276
1
      return Diag;
1277
1
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::BindingDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::BindingDecl* const&)
Line
Count
Source
1273
10
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
10
      const DiagnosticBuilder &BaseDiag = Diag;
1275
10
      BaseDiag << Value;
1276
10
      return Diag;
1277
10
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::AbstractDiagSelID>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::AbstractDiagSelID const&)
Line
Count
Source
1273
11
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
11
      const DiagnosticBuilder &BaseDiag = Diag;
1275
11
      BaseDiag << Value;
1276
11
      return Diag;
1277
11
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<TrivialSubobjectKind>(clang::Sema::SemaDiagnosticBuilder const&, TrivialSubobjectKind const&)
Line
Count
Source
1273
150
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
150
      const DiagnosticBuilder &BaseDiag = Diag;
1275
150
      BaseDiag << Value;
1276
150
      return Diag;
1277
150
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Qualifiers::ObjCLifetime>(clang::Sema::SemaDiagnosticBuilder const&, clang::Qualifiers::ObjCLifetime const&)
Line
Count
Source
1273
277
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
277
      const DiagnosticBuilder &BaseDiag = Diag;
1275
277
      BaseDiag << Value;
1276
277
      return Diag;
1277
277
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::CXXConstructorDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::CXXConstructorDecl* const&)
Line
Count
Source
1273
7
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
7
      const DiagnosticBuilder &BaseDiag = Diag;
1275
7
      BaseDiag << Value;
1276
7
      return Diag;
1277
7
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::DecompositionDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::DecompositionDecl* const&)
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [1]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [1])
Line
Count
Source
1273
23
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
23
      const DiagnosticBuilder &BaseDiag = Diag;
1275
23
      BaseDiag << Value;
1276
23
      return Diag;
1277
23
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Attr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::Attr* const&)
Line
Count
Source
1273
16
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
16
      const DiagnosticBuilder &BaseDiag = Diag;
1275
16
      BaseDiag << Value;
1276
16
      return Diag;
1277
16
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::InheritableAttr*>(clang::Sema::SemaDiagnosticBuilder const&, clang::InheritableAttr* const&)
Line
Count
Source
1273
8
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
8
      const DiagnosticBuilder &BaseDiag = Diag;
1275
8
      BaseDiag << Value;
1276
8
      return Diag;
1277
8
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ClassTemplateSpecializationDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ClassTemplateSpecializationDecl* const&)
Line
Count
Source
1273
65
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
65
      const DiagnosticBuilder &BaseDiag = Diag;
1275
65
      BaseDiag << Value;
1276
65
      return Diag;
1277
65
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::TemplateDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::TemplateDecl* const&)
Line
Count
Source
1273
923
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
923
      const DiagnosticBuilder &BaseDiag = Diag;
1275
923
      BaseDiag << Value;
1276
923
      return Diag;
1277
923
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::NamespaceDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::NamespaceDecl* const&)
Line
Count
Source
1273
37
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
37
      const DiagnosticBuilder &BaseDiag = Diag;
1275
37
      BaseDiag << Value;
1276
37
      return Diag;
1277
37
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [15]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [15])
Line
Count
Source
1273
14
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
14
      const DiagnosticBuilder &BaseDiag = Diag;
1275
14
      BaseDiag << Value;
1276
14
      return Diag;
1277
14
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ObjCMethodDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ObjCMethodDecl* const&)
Line
Count
Source
1273
2.33k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2.33k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2.33k
      BaseDiag << Value;
1276
2.33k
      return Diag;
1277
2.33k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ObjCMethodFamily>(clang::Sema::SemaDiagnosticBuilder const&, clang::ObjCMethodFamily const&)
Line
Count
Source
1273
48
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
48
      const DiagnosticBuilder &BaseDiag = Diag;
1275
48
      BaseDiag << Value;
1276
48
      return Diag;
1277
48
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Selector>(clang::Sema::SemaDiagnosticBuilder const&, clang::Selector const&)
Line
Count
Source
1273
1.41k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1.41k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1.41k
      BaseDiag << Value;
1276
1.41k
      return Diag;
1277
1.41k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ObjCProtocolDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ObjCProtocolDecl* const&)
Line
Count
Source
1273
52
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
52
      const DiagnosticBuilder &BaseDiag = Diag;
1275
52
      BaseDiag << Value;
1276
52
      return Diag;
1277
52
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ObjCIvarDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ObjCIvarDecl const* const&)
Line
Count
Source
1273
10
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
10
      const DiagnosticBuilder &BaseDiag = Diag;
1275
10
      BaseDiag << Value;
1276
10
      return Diag;
1277
10
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<llvm::SmallString<40u> >(clang::Sema::SemaDiagnosticBuilder const&, llvm::SmallString<40u> const&)
Line
Count
Source
1273
4.53k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4.53k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4.53k
      BaseDiag << Value;
1276
4.53k
      return Diag;
1277
4.53k
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::ObjCLiteralKind>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::ObjCLiteralKind const&)
Line
Count
Source
1273
79
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
79
      const DiagnosticBuilder &BaseDiag = Diag;
1275
79
      BaseDiag << Value;
1276
79
      return Diag;
1277
79
    }
SemaExpr.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<$_4>(clang::Sema::SemaDiagnosticBuilder const&, $_4 const&)
Line
Count
Source
1273
298
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
298
      const DiagnosticBuilder &BaseDiag = Diag;
1275
298
      BaseDiag << Value;
1276
298
      return Diag;
1277
298
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ValueDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ValueDecl const* const&)
Line
Count
Source
1273
431
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
431
      const DiagnosticBuilder &BaseDiag = Diag;
1275
431
      BaseDiag << Value;
1276
431
      return Diag;
1277
431
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<OriginalExprKind>(clang::Sema::SemaDiagnosticBuilder const&, OriginalExprKind const&)
Line
Count
Source
1273
10
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
10
      const DiagnosticBuilder &BaseDiag = Diag;
1275
10
      BaseDiag << Value;
1276
10
      return Diag;
1277
10
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::UnaryExprOrTypeTrait>(clang::Sema::SemaDiagnosticBuilder const&, clang::UnaryExprOrTypeTrait const&)
Line
Count
Source
1273
34
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
34
      const DiagnosticBuilder &BaseDiag = Diag;
1275
34
      BaseDiag << Value;
1276
34
      return Diag;
1277
34
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ParmVarDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ParmVarDecl* const&)
Line
Count
Source
1273
190
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
190
      const DiagnosticBuilder &BaseDiag = Diag;
1275
190
      BaseDiag << Value;
1276
190
      return Diag;
1277
190
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [2]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [2])
Line
Count
Source
1273
91
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
91
      const DiagnosticBuilder &BaseDiag = Diag;
1275
91
      BaseDiag << Value;
1276
91
      return Diag;
1277
91
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ObjCInterfaceDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ObjCInterfaceDecl const* const&)
Line
Count
Source
1273
3
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
3
      const DiagnosticBuilder &BaseDiag = Diag;
1275
3
      BaseDiag << Value;
1276
3
      return Diag;
1277
3
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ObjCProtocolDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ObjCProtocolDecl const* const&)
Line
Count
Source
1273
3
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
3
      const DiagnosticBuilder &BaseDiag = Diag;
1275
3
      BaseDiag << Value;
1276
3
      return Diag;
1277
3
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::UsingPackDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::UsingPackDecl* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::TypeAliasTemplateDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::TypeAliasTemplateDecl* const&)
Line
Count
Source
1273
7
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
7
      const DiagnosticBuilder &BaseDiag = Diag;
1275
7
      BaseDiag << Value;
1276
7
      return Diag;
1277
7
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::tok::TokenKind>(clang::Sema::SemaDiagnosticBuilder const&, clang::tok::TokenKind const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ObjCBridgeCastKind>(clang::Sema::SemaDiagnosticBuilder const&, clang::ObjCBridgeCastKind const&)
Line
Count
Source
1273
3
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
3
      const DiagnosticBuilder &BaseDiag = Diag;
1275
3
      BaseDiag << Value;
1276
3
      return Diag;
1277
3
    }
SemaInit.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<(anonymous namespace)::ReferenceKind>(clang::Sema::SemaDiagnosticBuilder const&, (anonymous namespace)::ReferenceKind const&)
Line
Count
Source
1273
68
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
68
      const DiagnosticBuilder &BaseDiag = Diag;
1275
68
      BaseDiag << Value;
1276
68
      return Diag;
1277
68
    }
SemaObjCProperty.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<SelectPropertyForSynthesisFromProtocols(clang::Sema&, clang::SourceLocation, clang::ObjCInterfaceDecl*, clang::ObjCPropertyDecl*)::MismatchKind>(clang::Sema::SemaDiagnosticBuilder const&, SelectPropertyForSynthesisFromProtocols(clang::Sema&, clang::SourceLocation, clang::ObjCInterfaceDecl*, clang::ObjCPropertyDecl*)::MismatchKind const&)
Line
Count
Source
1273
24
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
24
      const DiagnosticBuilder &BaseDiag = Diag;
1275
24
      BaseDiag << Value;
1276
24
      return Diag;
1277
24
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ObjCPropertyDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ObjCPropertyDecl* const&)
Line
Count
Source
1273
31
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
31
      const DiagnosticBuilder &BaseDiag = Diag;
1275
31
      BaseDiag << Value;
1276
31
      return Diag;
1277
31
    }
SemaOpenMP.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<checkNestingOfRegions(clang::Sema&, (anonymous namespace)::DSAStackTy const*, clang::OpenMPDirectiveKind, clang::DeclarationNameInfo const&, clang::OpenMPDirectiveKind, clang::SourceLocation)::$_10>(clang::Sema::SemaDiagnosticBuilder const&, checkNestingOfRegions(clang::Sema&, (anonymous namespace)::DSAStackTy const*, clang::OpenMPDirectiveKind, clang::DeclarationNameInfo const&, clang::OpenMPDirectiveKind, clang::SourceLocation)::$_10 const&)
Line
Count
Source
1273
1.88k
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
1.88k
      const DiagnosticBuilder &BaseDiag = Diag;
1275
1.88k
      BaseDiag << Value;
1276
1.88k
      return Diag;
1277
1.88k
    }
SemaOpenMP.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<(anonymous namespace)::OpenMPAtomicUpdateChecker::ExprAnalysisErrorCode>(clang::Sema::SemaDiagnosticBuilder const&, (anonymous namespace)::OpenMPAtomicUpdateChecker::ExprAnalysisErrorCode const&)
Line
Count
Source
1273
284
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
284
      const DiagnosticBuilder &BaseDiag = Diag;
1275
284
      BaseDiag << Value;
1276
284
      return Diag;
1277
284
    }
SemaOpenMP.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<getPrivateItem(clang::Sema&, clang::Expr*&, clang::SourceLocation&, clang::SourceRange&, bool)::$_14>(clang::Sema::SemaDiagnosticBuilder const&, getPrivateItem(clang::Sema&, clang::Expr*&, clang::SourceLocation&, clang::SourceRange&, bool)::$_14 const&)
Line
Count
Source
1273
12
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
12
      const DiagnosticBuilder &BaseDiag = Diag;
1275
12
      BaseDiag << Value;
1276
12
      return Diag;
1277
12
    }
SemaOpenMP.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<reportOriginalDsa(clang::Sema&, (anonymous namespace)::DSAStackTy const*, clang::ValueDecl const*, (anonymous namespace)::DSAStackTy::DSAVarData const&, bool)::$_9>(clang::Sema::SemaDiagnosticBuilder const&, reportOriginalDsa(clang::Sema&, (anonymous namespace)::DSAStackTy const*, clang::ValueDecl const*, (anonymous namespace)::DSAStackTy::DSAVarData const&, bool)::$_9 const&)
Line
Count
Source
1273
928
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
928
      const DiagnosticBuilder &BaseDiag = Diag;
1275
928
      BaseDiag << Value;
1276
928
      return Diag;
1277
928
    }
Unexecuted instantiation: clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ParmVarDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ParmVarDecl const* const&)
SemaOpenMP.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::ActOnOpenMPAtomicDirective(llvm::ArrayRef<clang::OMPClause*>, clang::Stmt*, clang::SourceLocation, clang::SourceLocation)::$_11>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::ActOnOpenMPAtomicDirective(llvm::ArrayRef<clang::OMPClause*>, clang::Stmt*, clang::SourceLocation, clang::SourceLocation)::$_11 const&)
Line
Count
Source
1273
32
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
32
      const DiagnosticBuilder &BaseDiag = Diag;
1275
32
      BaseDiag << Value;
1276
32
      return Diag;
1277
32
    }
SemaOpenMP.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::ActOnOpenMPAtomicDirective(llvm::ArrayRef<clang::OMPClause*>, clang::Stmt*, clang::SourceLocation, clang::SourceLocation)::$_12>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::ActOnOpenMPAtomicDirective(llvm::ArrayRef<clang::OMPClause*>, clang::Stmt*, clang::SourceLocation, clang::SourceLocation)::$_12 const&)
Line
Count
Source
1273
20
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
20
      const DiagnosticBuilder &BaseDiag = Diag;
1275
20
      BaseDiag << Value;
1276
20
      return Diag;
1277
20
    }
SemaOpenMP.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::ActOnOpenMPAtomicDirective(llvm::ArrayRef<clang::OMPClause*>, clang::Stmt*, clang::SourceLocation, clang::SourceLocation)::$_13>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::ActOnOpenMPAtomicDirective(llvm::ArrayRef<clang::OMPClause*>, clang::Stmt*, clang::SourceLocation, clang::SourceLocation)::$_13 const&)
Line
Count
Source
1273
36
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
36
      const DiagnosticBuilder &BaseDiag = Diag;
1275
36
      BaseDiag << Value;
1276
36
      return Diag;
1277
36
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [26]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [26])
Line
Count
Source
1273
6
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
6
      const DiagnosticBuilder &BaseDiag = Diag;
1275
6
      BaseDiag << Value;
1276
6
      return Diag;
1277
6
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<char [50]>(clang::Sema::SemaDiagnosticBuilder const&, char const (&) [50])
Line
Count
Source
1273
16
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
16
      const DiagnosticBuilder &BaseDiag = Diag;
1275
16
      BaseDiag << Value;
1276
16
      return Diag;
1277
16
    }
Unexecuted instantiation: clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::FunctionTemplateDecl const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::FunctionTemplateDecl const* const&)
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::CCEKind>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::CCEKind const&)
Line
Count
Source
1273
78
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
78
      const DiagnosticBuilder &BaseDiag = Diag;
1275
78
      BaseDiag << Value;
1276
78
      return Diag;
1277
78
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Qualifiers::GC>(clang::Sema::SemaDiagnosticBuilder const&, clang::Qualifiers::GC const&)
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::TemplateArgument>(clang::Sema::SemaDiagnosticBuilder const&, clang::TemplateArgument const&)
Line
Count
Source
1273
430
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
430
      const DiagnosticBuilder &BaseDiag = Diag;
1275
430
      BaseDiag << Value;
1276
430
      return Diag;
1277
430
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<llvm::SmallString<128u> >(clang::Sema::SemaDiagnosticBuilder const&, llvm::SmallString<128u> const&)
Line
Count
Source
1273
392
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
392
      const DiagnosticBuilder &BaseDiag = Diag;
1275
392
      BaseDiag << Value;
1276
392
      return Diag;
1277
392
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::RefQualifierKind>(clang::Sema::SemaDiagnosticBuilder const&, clang::RefQualifierKind const&)
Line
Count
Source
1273
22
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
22
      const DiagnosticBuilder &BaseDiag = Diag;
1275
22
      BaseDiag << Value;
1276
22
      return Diag;
1277
22
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::MSPropertyDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::MSPropertyDecl* const&)
Line
Count
Source
1273
25
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
25
      const DiagnosticBuilder &BaseDiag = Diag;
1275
25
      BaseDiag << Value;
1276
25
      return Diag;
1277
25
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::WarnUnusedResultAttr const*>(clang::Sema::SemaDiagnosticBuilder const&, clang::WarnUnusedResultAttr const* const&)
Line
Count
Source
1273
2
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
2
      const DiagnosticBuilder &BaseDiag = Diag;
1275
2
      BaseDiag << Value;
1276
2
      return Diag;
1277
2
    }
SemaStmt.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<(anonymous namespace)::BeginEndFunction>(clang::Sema::SemaDiagnosticBuilder const&, (anonymous namespace)::BeginEndFunction const&)
Line
Count
Source
1273
85
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
85
      const DiagnosticBuilder &BaseDiag = Diag;
1275
85
      BaseDiag << Value;
1276
85
      return Diag;
1277
85
    }
SemaStmtAsm.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<checkExprMemoryConstraintCompat(clang::Sema&, clang::Expr*, clang::TargetInfo::ConstraintInfo&, bool)::$_0>(clang::Sema::SemaDiagnosticBuilder const&, checkExprMemoryConstraintCompat(clang::Sema&, clang::Expr*, clang::TargetInfo::ConstraintInfo&, bool)::$_0 const&)
Line
Count
Source
1273
6
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
6
      const DiagnosticBuilder &BaseDiag = Diag;
1275
6
      BaseDiag << Value;
1276
6
      return Diag;
1277
6
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::VarTemplateSpecializationDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::VarTemplateSpecializationDecl* const&)
Line
Count
Source
1273
3
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
3
      const DiagnosticBuilder &BaseDiag = Diag;
1275
3
      BaseDiag << Value;
1276
3
      return Diag;
1277
3
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ClassTemplateDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ClassTemplateDecl* const&)
Line
Count
Source
1273
5
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
5
      const DiagnosticBuilder &BaseDiag = Diag;
1275
5
      BaseDiag << Value;
1276
5
      return Diag;
1277
5
    }
SemaTemplate.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::Sema::CheckDependentFunctionTemplateSpecialization(clang::FunctionDecl*, clang::TemplateArgumentListInfo const&, clang::LookupResult&)::DiscardReason>(clang::Sema::SemaDiagnosticBuilder const&, clang::Sema::CheckDependentFunctionTemplateSpecialization(clang::FunctionDecl*, clang::TemplateArgumentListInfo const&, clang::LookupResult&)::DiscardReason const&)
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::VarTemplateDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::VarTemplateDecl* const&)
Line
Count
Source
1273
21
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
21
      const DiagnosticBuilder &BaseDiag = Diag;
1275
21
      BaseDiag << Value;
1276
21
      return Diag;
1277
21
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::DeducedTemplateArgument>(clang::Sema::SemaDiagnosticBuilder const&, clang::DeducedTemplateArgument const&)
Line
Count
Source
1273
8
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
8
      const DiagnosticBuilder &BaseDiag = Diag;
1275
8
      BaseDiag << Value;
1276
8
      return Diag;
1277
8
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ObjCInterfaceDecl*>(clang::Sema::SemaDiagnosticBuilder const&, clang::ObjCInterfaceDecl* const&)
Line
Count
Source
1273
5
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
5
      const DiagnosticBuilder &BaseDiag = Diag;
1275
5
      BaseDiag << Value;
1276
5
      return Diag;
1277
5
    }
SemaType.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<(anonymous namespace)::QualifiedFunctionKind>(clang::Sema::SemaDiagnosticBuilder const&, (anonymous namespace)::QualifiedFunctionKind const&)
Line
Count
Source
1273
22
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
22
      const DiagnosticBuilder &BaseDiag = Diag;
1275
22
      BaseDiag << Value;
1276
22
      return Diag;
1277
22
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<TypeDiagSelector>(clang::Sema::SemaDiagnosticBuilder const&, TypeDiagSelector const&)
Line
Count
Source
1273
51
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
51
      const DiagnosticBuilder &BaseDiag = Diag;
1275
51
      BaseDiag << Value;
1276
51
      return Diag;
1277
51
    }
SemaType.cpp:clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<GetFullTypeForDeclarator((anonymous namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*)::$_1>(clang::Sema::SemaDiagnosticBuilder const&, GetFullTypeForDeclarator((anonymous namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*)::$_1 const&)
Line
Count
Source
1273
50
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
50
      const DiagnosticBuilder &BaseDiag = Diag;
1275
50
      BaseDiag << Value;
1276
50
      return Diag;
1277
50
    }
clang::Sema::SemaDiagnosticBuilder const& clang::operator<<<clang::ArrayType::ArraySizeModifier>(clang::Sema::SemaDiagnosticBuilder const&, clang::ArrayType::ArraySizeModifier const&)
Line
Count
Source
1273
4
        const SemaDiagnosticBuilder &Diag, const T &Value) {
1274
4
      const DiagnosticBuilder &BaseDiag = Diag;
1275
4
      BaseDiag << Value;
1276
4
      return Diag;
1277
4
    }
1278
  };
1279
1280
  /// Emit a diagnostic.
1281
1.92M
  SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) {
1282
1.92M
    DiagnosticBuilder DB = Diags.Report(Loc, DiagID);
1283
1.92M
    return SemaDiagnosticBuilder(DB, *this, DiagID);
1284
1.92M
  }
1285
1286
  /// Emit a partial diagnostic.
1287
  SemaDiagnosticBuilder Diag(SourceLocation Loc, const PartialDiagnostic& PD);
1288
1289
  /// Build a partial diagnostic.
1290
  PartialDiagnostic PDiag(unsigned DiagID = 0); // in SemaInternal.h
1291
1292
  bool findMacroSpelling(SourceLocation &loc, StringRef name);
1293
1294
  /// Get a string to suggest for zero-initialization of a type.
1295
  std::string
1296
  getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const;
1297
  std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const;
1298
1299
  /// Calls \c Lexer::getLocForEndOfToken()
1300
  SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset = 0);
1301
1302
  /// Retrieve the module loader associated with the preprocessor.
1303
  ModuleLoader &getModuleLoader() const;
1304
1305
  void emitAndClearUnusedLocalTypedefWarnings();
1306
1307
  void ActOnStartOfTranslationUnit();
1308
  void ActOnEndOfTranslationUnit();
1309
1310
  void CheckDelegatingCtorCycles();
1311
1312
  Scope *getScopeForContext(DeclContext *Ctx);
1313
1314
  void PushFunctionScope();
1315
  void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
1316
  sema::LambdaScopeInfo *PushLambdaScope();
1317
1318
  /// This is used to inform Sema what the current TemplateParameterDepth
1319
  /// is during Parsing.  Currently it is used to pass on the depth
1320
  /// when parsing generic lambda 'auto' parameters.
1321
  void RecordParsingTemplateParameterDepth(unsigned Depth);
1322
1323
  void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD,
1324
                               RecordDecl *RD,
1325
                               CapturedRegionKind K);
1326
  void
1327
  PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP = nullptr,
1328
                       const Decl *D = nullptr,
1329
                       const BlockExpr *blkExpr = nullptr);
1330
1331
22.0M
  sema::FunctionScopeInfo *getCurFunction() const {
1332
22.0M
    return FunctionScopes.empty() ? 
nullptr377k
:
FunctionScopes.back()21.6M
;
1333
22.0M
  }
1334
1335
  sema::FunctionScopeInfo *getEnclosingFunction() const;
1336
1337
  void setFunctionHasBranchIntoScope();
1338
  void setFunctionHasBranchProtectedScope();
1339
  void setFunctionHasIndirectGoto();
1340
1341
  void PushCompoundScope(bool IsStmtExpr);
1342
  void PopCompoundScope();
1343
1344
  sema::CompoundScopeInfo &getCurCompoundScope() const;
1345
1346
  bool hasAnyUnrecoverableErrorsInThisFunction() const;
1347
1348
  /// Retrieve the current block, if any.
1349
  sema::BlockScopeInfo *getCurBlock();
1350
1351
  /// Retrieve the current lambda scope info, if any.
1352
  /// \param IgnoreNonLambdaCapturingScope true if should find the top-most
1353
  /// lambda scope info ignoring all inner capturing scopes that are not
1354
  /// lambda scopes.
1355
  sema::LambdaScopeInfo *
1356
  getCurLambda(bool IgnoreNonLambdaCapturingScope = false);
1357
1358
  /// Retrieve the current generic lambda info, if any.
1359
  sema::LambdaScopeInfo *getCurGenericLambda();
1360
1361
  /// Retrieve the current captured region, if any.
1362
  sema::CapturedRegionScopeInfo *getCurCapturedRegion();
1363
1364
  /// WeakTopLevelDeclDecls - access to \#pragma weak-generated Decls
1365
36.3k
  SmallVectorImpl<Decl *> &WeakTopLevelDecls() { return WeakTopLevelDecl; }
1366
1367
  void ActOnComment(SourceRange Comment);
1368
1369
  //===--------------------------------------------------------------------===//
1370
  // Type Analysis / Processing: SemaType.cpp.
1371
  //
1372
1373
  QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs,
1374
                              const DeclSpec *DS = nullptr);
1375
  QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA,
1376
                              const DeclSpec *DS = nullptr);
1377
  QualType BuildPointerType(QualType T,
1378
                            SourceLocation Loc, DeclarationName Entity);
1379
  QualType BuildReferenceType(QualType T, bool LValueRef,
1380
                              SourceLocation Loc, DeclarationName Entity);
1381
  QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
1382
                          Expr *ArraySize, unsigned Quals,
1383
                          SourceRange Brackets, DeclarationName Entity);
1384
  QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc);
1385
  QualType BuildExtVectorType(QualType T, Expr *ArraySize,
1386
                              SourceLocation AttrLoc);
1387
  QualType BuildAddressSpaceAttr(QualType &T, Expr *AddrSpace,
1388
                                 SourceLocation AttrLoc);
1389
1390
  bool CheckFunctionReturnType(QualType T, SourceLocation Loc);
1391
1392
  /// Build a function type.
1393
  ///
1394
  /// This routine checks the function type according to C++ rules and
1395
  /// under the assumption that the result type and parameter types have
1396
  /// just been instantiated from a template. It therefore duplicates
1397
  /// some of the behavior of GetTypeForDeclarator, but in a much
1398
  /// simpler form that is only suitable for this narrow use case.
1399
  ///
1400
  /// \param T The return type of the function.
1401
  ///
1402
  /// \param ParamTypes The parameter types of the function. This array
1403
  /// will be modified to account for adjustments to the types of the
1404
  /// function parameters.
1405
  ///
1406
  /// \param Loc The location of the entity whose type involves this
1407
  /// function type or, if there is no such entity, the location of the
1408
  /// type that will have function type.
1409
  ///
1410
  /// \param Entity The name of the entity that involves the function
1411
  /// type, if known.
1412
  ///
1413
  /// \param EPI Extra information about the function type. Usually this will
1414
  /// be taken from an existing function with the same prototype.
1415
  ///
1416
  /// \returns A suitable function type, if there are no errors. The
1417
  /// unqualified type will always be a FunctionProtoType.
1418
  /// Otherwise, returns a NULL type.
1419
  QualType BuildFunctionType(QualType T,
1420
                             MutableArrayRef<QualType> ParamTypes,
1421
                             SourceLocation Loc, DeclarationName Entity,
1422
                             const FunctionProtoType::ExtProtoInfo &EPI);
1423
1424
  QualType BuildMemberPointerType(QualType T, QualType Class,
1425
                                  SourceLocation Loc,
1426
                                  DeclarationName Entity);
1427
  QualType BuildBlockPointerType(QualType T,
1428
                                 SourceLocation Loc, DeclarationName Entity);
1429
  QualType BuildParenType(QualType T);
1430
  QualType BuildAtomicType(QualType T, SourceLocation Loc);
1431
  QualType BuildReadPipeType(QualType T,
1432
                         SourceLocation Loc);
1433
  QualType BuildWritePipeType(QualType T,
1434
                         SourceLocation Loc);
1435
1436
  TypeSourceInfo *GetTypeForDeclarator(Declarator &D, Scope *S);
1437
  TypeSourceInfo *GetTypeForDeclaratorCast(Declarator &D, QualType FromTy);
1438
  TypeSourceInfo *GetTypeSourceInfoForDeclarator(Declarator &D, QualType T,
1439
                                               TypeSourceInfo *ReturnTypeInfo);
1440
1441
  /// Package the given type and TSI into a ParsedType.
1442
  ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo);
1443
  DeclarationNameInfo GetNameForDeclarator(Declarator &D);
1444
  DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name);
1445
  static QualType GetTypeFromParser(ParsedType Ty,
1446
                                    TypeSourceInfo **TInfo = nullptr);
1447
  CanThrowResult canThrow(const Expr *E);
1448
  const FunctionProtoType *ResolveExceptionSpec(SourceLocation Loc,
1449
                                                const FunctionProtoType *FPT);
1450
  void UpdateExceptionSpec(FunctionDecl *FD,
1451
                           const FunctionProtoType::ExceptionSpecInfo &ESI);
1452
  bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range);
1453
  bool CheckDistantExceptionSpec(QualType T);
1454
  bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New);
1455
  bool CheckEquivalentExceptionSpec(
1456
      const FunctionProtoType *Old, SourceLocation OldLoc,
1457
      const FunctionProtoType *New, SourceLocation NewLoc);
1458
  bool CheckEquivalentExceptionSpec(
1459
      const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
1460
      const FunctionProtoType *Old, SourceLocation OldLoc,
1461
      const FunctionProtoType *New, SourceLocation NewLoc);
1462
  bool handlerCanCatch(QualType HandlerType, QualType ExceptionType);
1463
  bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID,
1464
                                const PartialDiagnostic &NestedDiagID,
1465
                                const PartialDiagnostic &NoteID,
1466
                                const FunctionProtoType *Superset,
1467
                                SourceLocation SuperLoc,
1468
                                const FunctionProtoType *Subset,
1469
                                SourceLocation SubLoc);
1470
  bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID,
1471
                               const PartialDiagnostic &NoteID,
1472
                               const FunctionProtoType *Target,
1473
                               SourceLocation TargetLoc,
1474
                               const FunctionProtoType *Source,
1475
                               SourceLocation SourceLoc);
1476
1477
  TypeResult ActOnTypeName(Scope *S, Declarator &D);
1478
1479
  /// The parser has parsed the context-sensitive type 'instancetype'
1480
  /// in an Objective-C message declaration. Return the appropriate type.
1481
  ParsedType ActOnObjCInstanceType(SourceLocation Loc);
1482
1483
  /// Abstract class used to diagnose incomplete types.
1484
  struct TypeDiagnoser {
1485
42.0M
    TypeDiagnoser() {}
1486
1487
    virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0;
1488
42.0M
    virtual ~TypeDiagnoser() {}
1489
  };
1490
1491
1.66k
  static int getPrintable(int I) { return I; }
1492
42
  static unsigned getPrintable(unsigned I) { return I; }
1493
59
  static bool getPrintable(bool B) { return B; }
1494
3
  static const char * getPrintable(const char *S) { return S; }
1495
0
  static StringRef getPrintable(StringRef S) { return S; }
1496
0
  static const std::string &getPrintable(const std::string &S) { return S; }
1497
5
  static const IdentifierInfo *getPrintable(const IdentifierInfo *II) {
1498
5
    return II;
1499
5
  }
1500
16
  static DeclarationName getPrintable(DeclarationName N) { return N; }
1501
23
  static QualType getPrintable(QualType T) { return T; }
1502
314
  static SourceRange getPrintable(SourceRange R) { return R; }
1503
0
  static SourceRange getPrintable(SourceLocation L) { return L; }
1504
39
  static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); }
1505
12
  static SourceRange getPrintable(TypeLoc TL) { return TL.getSourceRange();}
1506
1507
  template <typename... Ts> class BoundTypeDiagnoser : public TypeDiagnoser {
1508
    unsigned DiagID;
1509
    std::tuple<const Ts &...> Args;
1510
1511
    template <std::size_t... Is>
1512
    void emit(const SemaDiagnosticBuilder &DB,
1513
3.62k
              llvm::index_sequence<Is...>) const {
1514
3.62k
      // Apply all tuple elements to the builder in order.
1515
3.62k
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
3.62k
      (void)Dummy;
1517
3.62k
    }
void clang::Sema::BoundTypeDiagnoser<clang::SourceRange>::emit<0ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul>) const
Line
Count
Source
1513
164
              llvm::index_sequence<Is...>) const {
1514
164
      // Apply all tuple elements to the builder in order.
1515
164
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
164
      (void)Dummy;
1517
164
    }
void clang::Sema::BoundTypeDiagnoser<clang::Expr*>::emit<0ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul>) const
Line
Count
Source
1513
38
              llvm::index_sequence<Is...>) const {
1514
38
      // Apply all tuple elements to the builder in order.
1515
38
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
38
      (void)Dummy;
1517
38
    }
void clang::Sema::BoundTypeDiagnoser<>::emit<>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<>) const
Line
Count
Source
1513
1.65k
              llvm::index_sequence<Is...>) const {
1514
1.65k
      // Apply all tuple elements to the builder in order.
1515
1.65k
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
1.65k
      (void)Dummy;
1517
1.65k
    }
void clang::Sema::BoundTypeDiagnoser<clang::Sema::AbstractDiagSelID>::emit<0ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul>) const
Line
Count
Source
1513
1.57k
              llvm::index_sequence<Is...>) const {
1514
1.57k
      // Apply all tuple elements to the builder in order.
1515
1.57k
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
1.57k
      (void)Dummy;
1517
1.57k
    }
Unexecuted instantiation: void clang::Sema::BoundTypeDiagnoser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::emit<0ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul>) const
void clang::Sema::BoundTypeDiagnoser<unsigned int, clang::SourceRange, bool>::emit<0ul, 1ul, 2ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul, 1ul, 2ul>) const
Line
Count
Source
1513
42
              llvm::index_sequence<Is...>) const {
1514
42
      // Apply all tuple elements to the builder in order.
1515
42
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
42
      (void)Dummy;
1517
42
    }
void clang::Sema::BoundTypeDiagnoser<bool>::emit<0ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul>) const
Line
Count
Source
1513
17
              llvm::index_sequence<Is...>) const {
1514
17
      // Apply all tuple elements to the builder in order.
1515
17
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
17
      (void)Dummy;
1517
17
    }
void clang::Sema::BoundTypeDiagnoser<clang::DeclarationName>::emit<0ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul>) const
Line
Count
Source
1513
9
              llvm::index_sequence<Is...>) const {
1514
9
      // Apply all tuple elements to the builder in order.
1515
9
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
9
      (void)Dummy;
1517
9
    }
void clang::Sema::BoundTypeDiagnoser<clang::DeclarationName, clang::IdentifierInfo*, clang::SourceRange>::emit<0ul, 1ul, 2ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul, 1ul, 2ul>) const
Line
Count
Source
1513
5
              llvm::index_sequence<Is...>) const {
1514
5
      // Apply all tuple elements to the builder in order.
1515
5
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
5
      (void)Dummy;
1517
5
    }
void clang::Sema::BoundTypeDiagnoser<int, clang::SourceRange>::emit<0ul, 1ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul, 1ul>) const
Line
Count
Source
1513
15
              llvm::index_sequence<Is...>) const {
1514
15
      // Apply all tuple elements to the builder in order.
1515
15
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
15
      (void)Dummy;
1517
15
    }
void clang::Sema::BoundTypeDiagnoser<clang::QualType, clang::SourceRange>::emit<0ul, 1ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul, 1ul>) const
Line
Count
Source
1513
19
              llvm::index_sequence<Is...>) const {
1514
19
      // Apply all tuple elements to the builder in order.
1515
19
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
19
      (void)Dummy;
1517
19
    }
void clang::Sema::BoundTypeDiagnoser<clang::UnaryExprOrTypeTrait, clang::SourceRange>::emit<0ul, 1ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul, 1ul>) const
Line
Count
Source
1513
68
              llvm::index_sequence<Is...>) const {
1514
68
      // Apply all tuple elements to the builder in order.
1515
68
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
68
      (void)Dummy;
1517
68
    }
void clang::Sema::BoundTypeDiagnoser<clang::TypeLoc>::emit<0ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul>) const
Line
Count
Source
1513
12
              llvm::index_sequence<Is...>) const {
1514
12
      // Apply all tuple elements to the builder in order.
1515
12
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
12
      (void)Dummy;
1517
12
    }
void clang::Sema::BoundTypeDiagnoser<char const*, int>::emit<0ul, 1ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul, 1ul>) const
Line
Count
Source
1513
3
              llvm::index_sequence<Is...>) const {
1514
3
      // Apply all tuple elements to the builder in order.
1515
3
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
3
      (void)Dummy;
1517
3
    }
void clang::Sema::BoundTypeDiagnoser<clang::DeclarationName, clang::SourceRange>::emit<0ul, 1ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul, 1ul>) const
Line
Count
Source
1513
1
              llvm::index_sequence<Is...>) const {
1514
1
      // Apply all tuple elements to the builder in order.
1515
1
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
1
      (void)Dummy;
1517
1
    }
void clang::Sema::BoundTypeDiagnoser<clang::DeclarationName, clang::Expr*>::emit<0ul, 1ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul, 1ul>) const
Line
Count
Source
1513
1
              llvm::index_sequence<Is...>) const {
1514
1
      // Apply all tuple elements to the builder in order.
1515
1
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
1
      (void)Dummy;
1517
1
    }
void clang::Sema::BoundTypeDiagnoser<clang::QualType>::emit<0ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul>) const
Line
Count
Source
1513
4
              llvm::index_sequence<Is...>) const {
1514
4
      // Apply all tuple elements to the builder in order.
1515
4
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
4
      (void)Dummy;
1517
4
    }
void clang::Sema::BoundTypeDiagnoser<int>::emit<0ul>(clang::Sema::SemaDiagnosticBuilder const&, llvm::index_sequence<0ul>) const
Line
Count
Source
1513
1
              llvm::index_sequence<Is...>) const {
1514
1
      // Apply all tuple elements to the builder in order.
1515
1
      bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1516
1
      (void)Dummy;
1517
1
    }
1518
1519
  public:
1520
    BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
1521
42.0M
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
42.0M
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
42.0M
    }
clang::Sema::BoundTypeDiagnoser<clang::SourceRange>::BoundTypeDiagnoser(unsigned int, clang::SourceRange const&)
Line
Count
Source
1521
3.64M
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
3.64M
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
3.64M
    }
clang::Sema::BoundTypeDiagnoser<clang::Expr*>::BoundTypeDiagnoser(unsigned int, clang::Expr* const&)
Line
Count
Source
1521
6.46M
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
6.46M
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
6.46M
    }
clang::Sema::BoundTypeDiagnoser<>::BoundTypeDiagnoser(unsigned int)
Line
Count
Source
1521
17.2M
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
17.2M
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
17.2M
    }
clang::Sema::BoundTypeDiagnoser<clang::Sema::AbstractDiagSelID>::BoundTypeDiagnoser(unsigned int, clang::Sema::AbstractDiagSelID const&)
Line
Count
Source
1521
14.3M
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
14.3M
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
14.3M
    }
clang::Sema::BoundTypeDiagnoser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::BoundTypeDiagnoser(unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
1521
2
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
2
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
2
    }
clang::Sema::BoundTypeDiagnoser<unsigned int, clang::SourceRange, bool>::BoundTypeDiagnoser(unsigned int, unsigned int const&, clang::SourceRange const&, bool const&)
Line
Count
Source
1521
30.8k
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
30.8k
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
30.8k
    }
clang::Sema::BoundTypeDiagnoser<bool>::BoundTypeDiagnoser(unsigned int, bool const&)
Line
Count
Source
1521
4.58k
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
4.58k
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
4.58k
    }
clang::Sema::BoundTypeDiagnoser<clang::DeclarationName>::BoundTypeDiagnoser(unsigned int, clang::DeclarationName const&)
Line
Count
Source
1521
3.17k
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
3.17k
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
3.17k
    }
clang::Sema::BoundTypeDiagnoser<clang::DeclarationName, clang::IdentifierInfo*, clang::SourceRange>::BoundTypeDiagnoser(unsigned int, clang::DeclarationName const&, clang::IdentifierInfo* const&, clang::SourceRange const&)
Line
Count
Source
1521
6.18k
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
6.18k
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
6.18k
    }
clang::Sema::BoundTypeDiagnoser<int, clang::SourceRange>::BoundTypeDiagnoser(unsigned int, int const&, clang::SourceRange const&)
Line
Count
Source
1521
869
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
869
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
869
    }
clang::Sema::BoundTypeDiagnoser<clang::QualType, clang::SourceRange>::BoundTypeDiagnoser(unsigned int, clang::QualType const&, clang::SourceRange const&)
Line
Count
Source
1521
126k
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
126k
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
126k
    }
clang::Sema::BoundTypeDiagnoser<clang::UnaryExprOrTypeTrait, clang::SourceRange>::BoundTypeDiagnoser(unsigned int, clang::UnaryExprOrTypeTrait const&, clang::SourceRange const&)
Line
Count
Source
1521
146k
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
146k
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
146k
    }
clang::Sema::BoundTypeDiagnoser<clang::TypeLoc>::BoundTypeDiagnoser(unsigned int, clang::TypeLoc const&)
Line
Count
Source
1521
2.82k
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
2.82k
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
2.82k
    }
clang::Sema::BoundTypeDiagnoser<char const*, int>::BoundTypeDiagnoser(unsigned int, char const* const&, int const&)
Line
Count
Source
1521
65
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
65
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
65
    }
clang::Sema::BoundTypeDiagnoser<clang::DeclarationName, clang::SourceRange>::BoundTypeDiagnoser(unsigned int, clang::DeclarationName const&, clang::SourceRange const&)
Line
Count
Source
1521
1.93k
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
1.93k
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
1.93k
    }
clang::Sema::BoundTypeDiagnoser<clang::DeclarationName, clang::Expr*>::BoundTypeDiagnoser(unsigned int, clang::DeclarationName const&, clang::Expr* const&)
Line
Count
Source
1521
1
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
1
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
1
    }
clang::Sema::BoundTypeDiagnoser<clang::QualType>::BoundTypeDiagnoser(unsigned int, clang::QualType const&)
Line
Count
Source
1521
97
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
97
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
97
    }
clang::Sema::BoundTypeDiagnoser<int>::BoundTypeDiagnoser(unsigned int, int const&)
Line
Count
Source
1521
7.90k
        : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1522
7.90k
      assert(DiagID != 0 && "no diagnostic for type diagnoser");
1523
7.90k
    }
1524
1525
3.62k
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
3.62k
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
3.62k
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
3.62k
      DB << T;
1529
3.62k
    }
clang::Sema::BoundTypeDiagnoser<clang::SourceRange>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
164
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
164
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
164
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
164
      DB << T;
1529
164
    }
clang::Sema::BoundTypeDiagnoser<clang::Expr*>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
38
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
38
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
38
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
38
      DB << T;
1529
38
    }
clang::Sema::BoundTypeDiagnoser<>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
1.65k
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
1.65k
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
1.65k
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
1.65k
      DB << T;
1529
1.65k
    }
clang::Sema::BoundTypeDiagnoser<clang::Sema::AbstractDiagSelID>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
1.57k
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
1.57k
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
1.57k
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
1.57k
      DB << T;
1529
1.57k
    }
Unexecuted instantiation: clang::Sema::BoundTypeDiagnoser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
clang::Sema::BoundTypeDiagnoser<unsigned int, clang::SourceRange, bool>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
42
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
42
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
42
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
42
      DB << T;
1529
42
    }
clang::Sema::BoundTypeDiagnoser<bool>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
17
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
17
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
17
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
17
      DB << T;
1529
17
    }
clang::Sema::BoundTypeDiagnoser<clang::DeclarationName>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
9
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
9
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
9
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
9
      DB << T;
1529
9
    }
clang::Sema::BoundTypeDiagnoser<clang::DeclarationName, clang::IdentifierInfo*, clang::SourceRange>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
5
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
5
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
5
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
5
      DB << T;
1529
5
    }
clang::Sema::BoundTypeDiagnoser<int, clang::SourceRange>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
15
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
15
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
15
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
15
      DB << T;
1529
15
    }
clang::Sema::BoundTypeDiagnoser<clang::QualType, clang::SourceRange>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
19
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
19
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
19
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
19
      DB << T;
1529
19
    }
clang::Sema::BoundTypeDiagnoser<clang::UnaryExprOrTypeTrait, clang::SourceRange>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
68
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
68
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
68
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
68
      DB << T;
1529
68
    }
clang::Sema::BoundTypeDiagnoser<clang::TypeLoc>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
12
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
12
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
12
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
12
      DB << T;
1529
12
    }
clang::Sema::BoundTypeDiagnoser<char const*, int>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
3
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
3
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
3
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
3
      DB << T;
1529
3
    }
clang::Sema::BoundTypeDiagnoser<clang::DeclarationName, clang::SourceRange>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
1
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
1
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
1
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
1
      DB << T;
1529
1
    }
clang::Sema::BoundTypeDiagnoser<clang::DeclarationName, clang::Expr*>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
1
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
1
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
1
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
1
      DB << T;
1529
1
    }
clang::Sema::BoundTypeDiagnoser<clang::QualType>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
4
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
4
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
4
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
4
      DB << T;
1529
4
    }
clang::Sema::BoundTypeDiagnoser<int>::diagnose(clang::Sema&, clang::SourceLocation, clang::QualType)
Line
Count
Source
1525
1
    void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1526
1
      const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1527
1
      emit(DB, llvm::index_sequence_for<Ts...>());
1528
1
      DB << T;
1529
1
    }
1530
  };
1531
1532
private:
1533
  bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
1534
                               TypeDiagnoser *Diagnoser);
1535
1536
  struct ModuleScope {
1537
    clang::Module *Module = nullptr;
1538
    bool ModuleInterface = false;
1539
    VisibleModuleSet OuterVisibleModules;
1540
  };
1541
  /// The modules we're currently parsing.
1542
  llvm::SmallVector<ModuleScope, 16> ModuleScopes;
1543
1544
  /// Get the module whose scope we are currently within.
1545
322k
  Module *getCurrentModule() const {
1546
322k
    return ModuleScopes.empty() ? 
nullptr320k
:
ModuleScopes.back().Module1.76k
;
1547
322k
  }
1548
1549
  VisibleModuleSet VisibleModules;
1550
1551
public:
1552
  /// Get the module owning an entity.
1553
23.6k
  Module *getOwningModule(Decl *Entity) { return Entity->getOwningModule(); }
1554
1555
  /// Make a merged definition of an existing hidden definition \p ND
1556
  /// visible at the specified location.
1557
  void makeMergedDefinitionVisible(NamedDecl *ND);
1558
1559
18.9k
  bool isModuleVisible(const Module *M) { return VisibleModules.isVisible(M); }
1560
1561
  /// Determine whether a declaration is visible to name lookup.
1562
29.3M
  bool isVisible(const NamedDecl *D) {
1563
29.3M
    return !D->isHidden() || 
isVisibleSlow(D)7.88k
;
1564
29.3M
  }
1565
1566
  /// Determine whether any declaration of an entity is visible.
1567
  bool
1568
  hasVisibleDeclaration(const NamedDecl *D,
1569
70.9k
                        llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
1570
70.9k
    return isVisible(D) || 
hasVisibleDeclarationSlow(D, Modules)71
;
1571
70.9k
  }
1572
  bool hasVisibleDeclarationSlow(const NamedDecl *D,
1573
                                 llvm::SmallVectorImpl<Module *> *Modules);
1574
1575
  bool hasVisibleMergedDefinition(NamedDecl *Def);
1576
  bool hasMergedDefinitionInCurrentModule(NamedDecl *Def);
1577
1578
  /// Determine if \p D and \p Suggested have a structurally compatible
1579
  /// layout as described in C11 6.2.7/1.
1580
  bool hasStructuralCompatLayout(Decl *D, Decl *Suggested);
1581
1582
  /// Determine if \p D has a visible definition. If not, suggest a declaration
1583
  /// that should be made visible to expose the definition.
1584
  bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested,
1585
                            bool OnlyNeedComplete = false);
1586
1.69k
  bool hasVisibleDefinition(const NamedDecl *D) {
1587
1.69k
    NamedDecl *Hidden;
1588
1.69k
    return hasVisibleDefinition(const_cast<NamedDecl*>(D), &Hidden);
1589
1.69k
  }
1590
1591
  /// Determine if the template parameter \p D has a visible default argument.
1592
  bool
1593
  hasVisibleDefaultArgument(const NamedDecl *D,
1594
                            llvm::SmallVectorImpl<Module *> *Modules = nullptr);
1595
1596
  /// Determine if there is a visible declaration of \p D that is an explicit
1597
  /// specialization declaration for a specialization of a template. (For a
1598
  /// member specialization, use hasVisibleMemberSpecialization.)
1599
  bool hasVisibleExplicitSpecialization(
1600
      const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
1601
1602
  /// Determine if there is a visible declaration of \p D that is a member
1603
  /// specialization declaration (as opposed to an instantiated declaration).
1604
  bool hasVisibleMemberSpecialization(
1605
      const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
1606
1607
  /// Determine if \p A and \p B are equivalent internal linkage declarations
1608
  /// from different modules, and thus an ambiguity error can be downgraded to
1609
  /// an extension warning.
1610
  bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A,
1611
                                              const NamedDecl *B);
1612
  void diagnoseEquivalentInternalLinkageDeclarations(
1613
      SourceLocation Loc, const NamedDecl *D,
1614
      ArrayRef<const NamedDecl *> Equiv);
1615
1616
22.4M
  bool isCompleteType(SourceLocation Loc, QualType T) {
1617
22.4M
    return !RequireCompleteTypeImpl(Loc, T, nullptr);
1618
22.4M
  }
1619
  bool RequireCompleteType(SourceLocation Loc, QualType T,
1620
                           TypeDiagnoser &Diagnoser);
1621
  bool RequireCompleteType(SourceLocation Loc, QualType T,
1622
                           unsigned DiagID);
1623
1624
  template <typename... Ts>
1625
  bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID,
1626
10.3M
                           const Ts &...Args) {
1627
10.3M
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
10.3M
    return RequireCompleteType(Loc, T, Diagnoser);
1629
10.3M
  }
bool clang::Sema::RequireCompleteType<clang::SourceRange>(clang::SourceLocation, clang::QualType, unsigned int, clang::SourceRange const&)
Line
Count
Source
1626
3.64M
                           const Ts &...Args) {
1627
3.64M
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
3.64M
    return RequireCompleteType(Loc, T, Diagnoser);
1629
3.64M
  }
bool clang::Sema::RequireCompleteType<clang::Expr*>(clang::SourceLocation, clang::QualType, unsigned int, clang::Expr* const&)
Line
Count
Source
1626
6.46M
                           const Ts &...Args) {
1627
6.46M
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
6.46M
    return RequireCompleteType(Loc, T, Diagnoser);
1629
6.46M
  }
bool clang::Sema::RequireCompleteType<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(clang::SourceLocation, clang::QualType, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
1626
2
                           const Ts &...Args) {
1627
2
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
2
    return RequireCompleteType(Loc, T, Diagnoser);
1629
2
  }
bool clang::Sema::RequireCompleteType<clang::DeclarationName>(clang::SourceLocation, clang::QualType, unsigned int, clang::DeclarationName const&)
Line
Count
Source
1626
3.17k
                           const Ts &...Args) {
1627
3.17k
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
3.17k
    return RequireCompleteType(Loc, T, Diagnoser);
1629
3.17k
  }
bool clang::Sema::RequireCompleteType<clang::DeclarationName, clang::IdentifierInfo*, clang::SourceRange>(clang::SourceLocation, clang::QualType, unsigned int, clang::DeclarationName const&, clang::IdentifierInfo* const&, clang::SourceRange const&)
Line
Count
Source
1626
6.18k
                           const Ts &...Args) {
1627
6.18k
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
6.18k
    return RequireCompleteType(Loc, T, Diagnoser);
1629
6.18k
  }
bool clang::Sema::RequireCompleteType<bool>(clang::SourceLocation, clang::QualType, unsigned int, bool const&)
Line
Count
Source
1626
3.71k
                           const Ts &...Args) {
1627
3.71k
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
3.71k
    return RequireCompleteType(Loc, T, Diagnoser);
1629
3.71k
  }
bool clang::Sema::RequireCompleteType<int, clang::SourceRange>(clang::SourceLocation, clang::QualType, unsigned int, int const&, clang::SourceRange const&)
Line
Count
Source
1626
869
                           const Ts &...Args) {
1627
869
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
869
    return RequireCompleteType(Loc, T, Diagnoser);
1629
869
  }
bool clang::Sema::RequireCompleteType<clang::QualType, clang::SourceRange>(clang::SourceLocation, clang::QualType, unsigned int, clang::QualType const&, clang::SourceRange const&)
Line
Count
Source
1626
126k
                           const Ts &...Args) {
1627
126k
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
126k
    return RequireCompleteType(Loc, T, Diagnoser);
1629
126k
  }
bool clang::Sema::RequireCompleteType<clang::UnaryExprOrTypeTrait, clang::SourceRange>(clang::SourceLocation, clang::QualType, unsigned int, clang::UnaryExprOrTypeTrait const&, clang::SourceRange const&)
Line
Count
Source
1626
104k
                           const Ts &...Args) {
1627
104k
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
104k
    return RequireCompleteType(Loc, T, Diagnoser);
1629
104k
  }
bool clang::Sema::RequireCompleteType<clang::TypeLoc>(clang::SourceLocation, clang::QualType, unsigned int, clang::TypeLoc const&)
Line
Count
Source
1626
1.46k
                           const Ts &...Args) {
1627
1.46k
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
1.46k
    return RequireCompleteType(Loc, T, Diagnoser);
1629
1.46k
  }
bool clang::Sema::RequireCompleteType<char const*, int>(clang::SourceLocation, clang::QualType, unsigned int, char const* const&, int const&)
Line
Count
Source
1626
65
                           const Ts &...Args) {
1627
65
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
65
    return RequireCompleteType(Loc, T, Diagnoser);
1629
65
  }
bool clang::Sema::RequireCompleteType<clang::DeclarationName, clang::SourceRange>(clang::SourceLocation, clang::QualType, unsigned int, clang::DeclarationName const&, clang::SourceRange const&)
Line
Count
Source
1626
1.93k
                           const Ts &...Args) {
1627
1.93k
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
1.93k
    return RequireCompleteType(Loc, T, Diagnoser);
1629
1.93k
  }
bool clang::Sema::RequireCompleteType<clang::DeclarationName, clang::Expr*>(clang::SourceLocation, clang::QualType, unsigned int, clang::DeclarationName const&, clang::Expr* const&)
Line
Count
Source
1626
1
                           const Ts &...Args) {
1627
1
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
1
    return RequireCompleteType(Loc, T, Diagnoser);
1629
1
  }
bool clang::Sema::RequireCompleteType<clang::QualType>(clang::SourceLocation, clang::QualType, unsigned int, clang::QualType const&)
Line
Count
Source
1626
97
                           const Ts &...Args) {
1627
97
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
97
    return RequireCompleteType(Loc, T, Diagnoser);
1629
97
  }
bool clang::Sema::RequireCompleteType<int>(clang::SourceLocation, clang::QualType, unsigned int, int const&)
Line
Count
Source
1626
7.90k
                           const Ts &...Args) {
1627
7.90k
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1628
7.90k
    return RequireCompleteType(Loc, T, Diagnoser);
1629
7.90k
  }
1630
1631
  void completeExprArrayBound(Expr *E);
1632
  bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser);
1633
  bool RequireCompleteExprType(Expr *E, unsigned DiagID);
1634
1635
  template <typename... Ts>
1636
41.4k
  bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args) {
1637
41.4k
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1638
41.4k
    return RequireCompleteExprType(E, Diagnoser);
1639
41.4k
  }
1640
1641
  bool RequireLiteralType(SourceLocation Loc, QualType T,
1642
                          TypeDiagnoser &Diagnoser);
1643
  bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID);
1644
1645
  template <typename... Ts>
1646
  bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID,
1647
31.7k
                          const Ts &...Args) {
1648
31.7k
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1649
31.7k
    return RequireLiteralType(Loc, T, Diagnoser);
1650
31.7k
  }
bool clang::Sema::RequireLiteralType<unsigned int, clang::SourceRange, bool>(clang::SourceLocation, clang::QualType, unsigned int, unsigned int const&, clang::SourceRange const&, bool const&)
Line
Count
Source
1647
30.8k
                          const Ts &...Args) {
1648
30.8k
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1649
30.8k
    return RequireLiteralType(Loc, T, Diagnoser);
1650
30.8k
  }
bool clang::Sema::RequireLiteralType<bool>(clang::SourceLocation, clang::QualType, unsigned int, bool const&)
Line
Count
Source
1647
871
                          const Ts &...Args) {
1648
871
    BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1649
871
    return RequireLiteralType(Loc, T, Diagnoser);
1650
871
  }
1651
1652
  QualType getElaboratedType(ElaboratedTypeKeyword Keyword,
1653
                             const CXXScopeSpec &SS, QualType T,
1654
                             TagDecl *OwnedTagDecl = nullptr);
1655
1656
  QualType BuildTypeofExprType(Expr *E, SourceLocation Loc);
1657
  /// If AsUnevaluated is false, E is treated as though it were an evaluated
1658
  /// context, such as when building a type for decltype(auto).
1659
  QualType BuildDecltypeType(Expr *E, SourceLocation Loc,
1660
                             bool AsUnevaluated = true);
1661
  QualType BuildUnaryTransformType(QualType BaseType,
1662
                                   UnaryTransformType::UTTKind UKind,
1663
                                   SourceLocation Loc);
1664
1665
  //===--------------------------------------------------------------------===//
1666
  // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
1667
  //
1668
1669
  struct SkipBodyInfo {
1670
    SkipBodyInfo()
1671
        : ShouldSkip(false), CheckSameAsPrevious(false), Previous(nullptr),
1672
3.11M
          New(nullptr) {}
1673
    bool ShouldSkip;
1674
    bool CheckSameAsPrevious;
1675
    NamedDecl *Previous;
1676
    NamedDecl *New;
1677
  };
1678
1679
  DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
1680
1681
  void DiagnoseUseOfUnimplementedSelectors();
1682
1683
  bool isSimpleTypeSpecifier(tok::TokenKind Kind) const;
1684
1685
  ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc,
1686
                         Scope *S, CXXScopeSpec *SS = nullptr,
1687
                         bool isClassName = false, bool HasTrailingDot = false,
1688
                         ParsedType ObjectType = nullptr,
1689
                         bool IsCtorOrDtorName = false,
1690
                         bool WantNontrivialTypeSourceInfo = false,
1691
                         bool IsClassTemplateDeductionContext = true,
1692
                         IdentifierInfo **CorrectedII = nullptr);
1693
  TypeSpecifierType isTagName(IdentifierInfo &II, Scope *S);
1694
  bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S);
1695
  void DiagnoseUnknownTypeName(IdentifierInfo *&II,
1696
                               SourceLocation IILoc,
1697
                               Scope *S,
1698
                               CXXScopeSpec *SS,
1699
                               ParsedType &SuggestedType,
1700
                               bool IsTemplateName = false);
1701
1702
  /// Attempt to behave like MSVC in situations where lookup of an unqualified
1703
  /// type name has failed in a dependent context. In these situations, we
1704
  /// automatically form a DependentTypeName that will retry lookup in a related
1705
  /// scope during instantiation.
1706
  ParsedType ActOnMSVCUnknownTypeName(const IdentifierInfo &II,
1707
                                      SourceLocation NameLoc,
1708
                                      bool IsTemplateTypeArg);
1709
1710
  /// Describes the result of the name lookup and resolution performed
1711
  /// by \c ClassifyName().
1712
  enum NameClassificationKind {
1713
    NC_Unknown,
1714
    NC_Error,
1715
    NC_Keyword,
1716
    NC_Type,
1717
    NC_Expression,
1718
    NC_NestedNameSpecifier,
1719
    NC_TypeTemplate,
1720
    NC_VarTemplate,
1721
    NC_FunctionTemplate
1722
  };
1723
1724
  class NameClassification {
1725
    NameClassificationKind Kind;
1726
    ExprResult Expr;
1727
    TemplateName Template;
1728
    ParsedType Type;
1729
1730
7.31k
    explicit NameClassification(NameClassificationKind Kind) : Kind(Kind) {}
1731
1732
  public:
1733
3.84M
    NameClassification(ExprResult Expr) : Kind(NC_Expression), Expr(Expr) {}
1734
1735
4.16M
    NameClassification(ParsedType Type) : Kind(NC_Type), Type(Type) {}
1736
1737
16
    NameClassification(const IdentifierInfo *Keyword) : Kind(NC_Keyword) {}
1738
1739
29
    static NameClassification Error() {
1740
29
      return NameClassification(NC_Error);
1741
29
    }
1742
1743
5.39k
    static NameClassification Unknown() {
1744
5.39k
      return NameClassification(NC_Unknown);
1745
5.39k
    }
1746
1747
    static NameClassification NestedNameSpecifier() {
1748
      return NameClassification(NC_NestedNameSpecifier);
1749
    }
1750
1751
1.88k
    static NameClassification TypeTemplate(TemplateName Name) {
1752
1.88k
      NameClassification Result(NC_TypeTemplate);
1753
1.88k
      Result.Template = Name;
1754
1.88k
      return Result;
1755
1.88k
    }
1756
1757
0
    static NameClassification VarTemplate(TemplateName Name) {
1758
0
      NameClassification Result(NC_VarTemplate);
1759
0
      Result.Template = Name;
1760
0
      return Result;
1761
0
    }
1762
1763
0
    static NameClassification FunctionTemplate(TemplateName Name) {
1764
0
      NameClassification Result(NC_FunctionTemplate);
1765
0
      Result.Template = Name;
1766
0
      return Result;
1767
0
    }
1768
1769
8.01M
    NameClassificationKind getKind() const { return Kind; }
1770
1771
4.16M
    ParsedType getType() const {
1772
4.16M
      assert(Kind == NC_Type);
1773
4.16M
      return Type;
1774
4.16M
    }
1775
1776
3.84M
    ExprResult getExpression() const {
1777
3.84M
      assert(Kind == NC_Expression);
1778
3.84M
      return Expr;
1779
3.84M
    }
1780
1781
0
    TemplateName getTemplateName() const {
1782
0
      assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate ||
1783
0
             Kind == NC_VarTemplate);
1784
0
      return Template;
1785
0
    }
1786
1787
0
    TemplateNameKind getTemplateNameKind() const {
1788
0
      switch (Kind) {
1789
0
      case NC_TypeTemplate:
1790
0
        return TNK_Type_template;
1791
0
      case NC_FunctionTemplate:
1792
0
        return TNK_Function_template;
1793
0
      case NC_VarTemplate:
1794
0
        return TNK_Var_template;
1795
0
      default:
1796
0
        llvm_unreachable("unsupported name classification.");
1797
0
      }
1798
0
    }
1799
  };
1800
1801
  /// Perform name lookup on the given name, classifying it based on
1802
  /// the results of name lookup and the following token.
1803
  ///
1804
  /// This routine is used by the parser to resolve identifiers and help direct
1805
  /// parsing. When the identifier cannot be found, this routine will attempt
1806
  /// to correct the typo and classify based on the resulting name.
1807
  ///
1808
  /// \param S The scope in which we're performing name lookup.
1809
  ///
1810
  /// \param SS The nested-name-specifier that precedes the name.
1811
  ///
1812
  /// \param Name The identifier. If typo correction finds an alternative name,
1813
  /// this pointer parameter will be updated accordingly.
1814
  ///
1815
  /// \param NameLoc The location of the identifier.
1816
  ///
1817
  /// \param NextToken The token following the identifier. Used to help
1818
  /// disambiguate the name.
1819
  ///
1820
  /// \param IsAddressOfOperand True if this name is the operand of a unary
1821
  ///        address of ('&') expression, assuming it is classified as an
1822
  ///        expression.
1823
  ///
1824
  /// \param CCC The correction callback, if typo correction is desired.
1825
  NameClassification
1826
  ClassifyName(Scope *S, CXXScopeSpec &SS, IdentifierInfo *&Name,
1827
               SourceLocation NameLoc, const Token &NextToken,
1828
               bool IsAddressOfOperand,
1829
               std::unique_ptr<CorrectionCandidateCallback> CCC = nullptr);
1830
1831
  /// Describes the detailed kind of a template name. Used in diagnostics.
1832
  enum class TemplateNameKindForDiagnostics {
1833
    ClassTemplate,
1834
    FunctionTemplate,
1835
    VarTemplate,
1836
    AliasTemplate,
1837
    TemplateTemplateParam,
1838
    DependentTemplate
1839
  };
1840
  TemplateNameKindForDiagnostics
1841
  getTemplateNameKindForDiagnostics(TemplateName Name);
1842
1843
  /// Determine whether it's plausible that E was intended to be a
1844
  /// template-name.
1845
252k
  bool mightBeIntendedToBeTemplateName(ExprResult E, bool &Dependent) {
1846
252k
    if (!getLangOpts().CPlusPlus || 
E.isInvalid()222k
)
1847
29.2k
      return false;
1848
222k
    Dependent = false;
1849
222k
    if (auto *DRE = dyn_cast<DeclRefExpr>(E.get()))
1850
212k
      return !DRE->hasExplicitTemplateArgs();
1851
10.8k
    if (auto *ME = dyn_cast<MemberExpr>(E.get()))
1852
6.41k
      return !ME->hasExplicitTemplateArgs();
1853
4.44k
    Dependent = true;
1854
4.44k
    if (auto *DSDRE = dyn_cast<DependentScopeDeclRefExpr>(E.get()))
1855
8
      return !DSDRE->hasExplicitTemplateArgs();
1856
4.43k
    if (auto *DSME = dyn_cast<CXXDependentScopeMemberExpr>(E.get()))
1857
4.41k
      return !DSME->hasExplicitTemplateArgs();
1858
20
    // Any additional cases recognized here should also be handled by
1859
20
    // diagnoseExprIntendedAsTemplateName.
1860
20
    return false;
1861
20
  }
1862
  void diagnoseExprIntendedAsTemplateName(Scope *S, ExprResult TemplateName,
1863
                                          SourceLocation Less,
1864
                                          SourceLocation Greater);
1865
1866
  Decl *ActOnDeclarator(Scope *S, Declarator &D);
1867
1868
  NamedDecl *HandleDeclarator(Scope *S, Declarator &D,
1869
                              MultiTemplateParamsArg TemplateParameterLists);
1870
  void RegisterLocallyScopedExternCDecl(NamedDecl *ND, Scope *S);
1871
  bool DiagnoseClassNameShadow(DeclContext *DC, DeclarationNameInfo Info);
1872
  bool diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC,
1873
                                    DeclarationName Name, SourceLocation Loc,
1874
                                    bool IsTemplateId);
1875
  void
1876
  diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals,
1877
                            SourceLocation FallbackLoc,
1878
                            SourceLocation ConstQualLoc = SourceLocation(),
1879
                            SourceLocation VolatileQualLoc = SourceLocation(),
1880
                            SourceLocation RestrictQualLoc = SourceLocation(),
1881
                            SourceLocation AtomicQualLoc = SourceLocation(),
1882
                            SourceLocation UnalignedQualLoc = SourceLocation());
1883
1884
  static bool adjustContextForLocalExternDecl(DeclContext *&DC);
1885
  void DiagnoseFunctionSpecifiers(const DeclSpec &DS);
1886
  NamedDecl *getShadowedDeclaration(const TypedefNameDecl *D,
1887
                                    const LookupResult &R);
1888
  NamedDecl *getShadowedDeclaration(const VarDecl *D, const LookupResult &R);
1889
  void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl,
1890
                   const LookupResult &R);
1891
  void CheckShadow(Scope *S, VarDecl *D);
1892
1893
  /// Warn if 'E', which is an expression that is about to be modified, refers
1894
  /// to a shadowing declaration.
1895
  void CheckShadowingDeclModification(Expr *E, SourceLocation Loc);
1896
1897
  void DiagnoseShadowingLambdaDecls(const sema::LambdaScopeInfo *LSI);
1898
1899
private:
1900
  /// Map of current shadowing declarations to shadowed declarations. Warn if
1901
  /// it looks like the user is trying to modify the shadowing declaration.
1902
  llvm::DenseMap<const NamedDecl *, const NamedDecl *> ShadowingDecls;
1903
1904
public:
1905
  void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange);
1906
  void handleTagNumbering(const TagDecl *Tag, Scope *TagScope);
1907
  void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
1908
                                    TypedefNameDecl *NewTD);
1909
  void CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *D);
1910
  NamedDecl* ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC,
1911
                                    TypeSourceInfo *TInfo,
1912
                                    LookupResult &Previous);
1913
  NamedDecl* ActOnTypedefNameDecl(Scope* S, DeclContext* DC, TypedefNameDecl *D,
1914
                                  LookupResult &Previous, bool &Redeclaration);
1915
  NamedDecl *ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC,
1916
                                     TypeSourceInfo *TInfo,
1917
                                     LookupResult &Previous,
1918
                                     MultiTemplateParamsArg TemplateParamLists,
1919
                                     bool &AddToScope,
1920
                                     ArrayRef<BindingDecl *> Bindings = None);
1921
  NamedDecl *
1922
  ActOnDecompositionDeclarator(Scope *S, Declarator &D,
1923
                               MultiTemplateParamsArg TemplateParamLists);
1924
  // Returns true if the variable declaration is a redeclaration
1925
  bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous);
1926
  void CheckVariableDeclarationType(VarDecl *NewVD);
1927
  bool DeduceVariableDeclarationType(VarDecl *VDecl, bool DirectInit,
1928
                                     Expr *Init);
1929
  void CheckCompleteVariableDeclaration(VarDecl *VD);
1930
  void CheckCompleteDecompositionDeclaration(DecompositionDecl *DD);
1931
  void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D);
1932
1933
  NamedDecl* ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
1934
                                     TypeSourceInfo *TInfo,
1935
                                     LookupResult &Previous,
1936
                                     MultiTemplateParamsArg TemplateParamLists,
1937
                                     bool &AddToScope);
1938
  bool AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD);
1939
1940
  bool CheckConstexprFunctionDecl(const FunctionDecl *FD);
1941
  bool CheckConstexprFunctionBody(const FunctionDecl *FD, Stmt *Body);
1942
1943
  void DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD);
1944
  void FindHiddenVirtualMethods(CXXMethodDecl *MD,
1945
                          SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
1946
  void NoteHiddenVirtualMethods(CXXMethodDecl *MD,
1947
                          SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
1948
  // Returns true if the function declaration is a redeclaration
1949
  bool CheckFunctionDeclaration(Scope *S,
1950
                                FunctionDecl *NewFD, LookupResult &Previous,
1951
                                bool IsMemberSpecialization);
1952
  bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl);
1953
  void CheckMain(FunctionDecl *FD, const DeclSpec &D);
1954
  void CheckMSVCRTEntryPoint(FunctionDecl *FD);
1955
  Attr *getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD, bool IsDefinition);
1956
  Decl *ActOnParamDeclarator(Scope *S, Declarator &D);
1957
  ParmVarDecl *BuildParmVarDeclForTypedef(DeclContext *DC,
1958
                                          SourceLocation Loc,
1959
                                          QualType T);
1960
  ParmVarDecl *CheckParameter(DeclContext *DC, SourceLocation StartLoc,
1961
                              SourceLocation NameLoc, IdentifierInfo *Name,
1962
                              QualType T, TypeSourceInfo *TSInfo,
1963
                              StorageClass SC);
1964
  void ActOnParamDefaultArgument(Decl *param,
1965
                                 SourceLocation EqualLoc,
1966
                                 Expr *defarg);
1967
  void ActOnParamUnparsedDefaultArgument(Decl *param,
1968
                                         SourceLocation EqualLoc,
1969
                                         SourceLocation ArgLoc);
1970
  void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc);
1971
  bool SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg,
1972
                               SourceLocation EqualLoc);
1973
1974
  void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit);
1975
  void ActOnUninitializedDecl(Decl *dcl);
1976
  void ActOnInitializerError(Decl *Dcl);
1977
1978
  void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc);
1979
  void ActOnCXXForRangeDecl(Decl *D);
1980
  StmtResult ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc,
1981
                                        IdentifierInfo *Ident,
1982
                                        ParsedAttributes &Attrs,
1983
                                        SourceLocation AttrEnd);
1984
  void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc);
1985
  void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc);
1986
  void FinalizeDeclaration(Decl *D);
1987
  DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS,
1988
                                         ArrayRef<Decl *> Group);
1989
  DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef<Decl *> Group);
1990
1991
  /// Should be called on all declarations that might have attached
1992
  /// documentation comments.
1993
  void ActOnDocumentableDecl(Decl *D);
1994
  void ActOnDocumentableDecls(ArrayRef<Decl *> Group);
1995
1996
  void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,
1997
                                       SourceLocation LocAfterDecls);
1998
  void CheckForFunctionRedefinition(
1999
      FunctionDecl *FD, const FunctionDecl *EffectiveDefinition = nullptr,
2000
      SkipBodyInfo *SkipBody = nullptr);
2001
  Decl *ActOnStartOfFunctionDef(Scope *S, Declarator &D,
2002
                                MultiTemplateParamsArg TemplateParamLists,
2003
                                SkipBodyInfo *SkipBody = nullptr);
2004
  Decl *ActOnStartOfFunctionDef(Scope *S, Decl *D,
2005
                                SkipBodyInfo *SkipBody = nullptr);
2006
  void ActOnStartOfObjCMethodDef(Scope *S, Decl *D);
2007
6.14k
  bool isObjCMethodDecl(Decl *D) {
2008
6.14k
    return D && isa<ObjCMethodDecl>(D);
2009
6.14k
  }
2010
2011
  /// Determine whether we can delay parsing the body of a function or
2012
  /// function template until it is used, assuming we don't care about emitting
2013
  /// code for that function.
2014
  ///
2015
  /// This will be \c false if we may need the body of the function in the
2016
  /// middle of parsing an expression (where it's impractical to switch to
2017
  /// parsing a different function), for instance, if it's constexpr in C++11
2018
  /// or has an 'auto' return type in C++14. These cases are essentially bugs.
2019
  bool canDelayFunctionBody(const Declarator &D);
2020
2021
  /// Determine whether we can skip parsing the body of a function
2022
  /// definition, assuming we don't care about analyzing its body or emitting
2023
  /// code for that function.
2024
  ///
2025
  /// This will be \c false only if we may need the body of the function in
2026
  /// order to parse the rest of the program (for instance, if it is
2027
  /// \c constexpr in C++11 or has an 'auto' return type in C++14).
2028
  bool canSkipFunctionBody(Decl *D);
2029
2030
  void computeNRVO(Stmt *Body, sema::FunctionScopeInfo *Scope);
2031
  Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body);
2032
  Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation);
2033
  Decl *ActOnSkippedFunctionBody(Decl *Decl);
2034
  void ActOnFinishInlineFunctionDef(FunctionDecl *D);
2035
2036
  /// ActOnFinishDelayedAttribute - Invoked when we have finished parsing an
2037
  /// attribute for which parsing is delayed.
2038
  void ActOnFinishDelayedAttribute(Scope *S, Decl *D, ParsedAttributes &Attrs);
2039
2040
  /// Diagnose any unused parameters in the given sequence of
2041
  /// ParmVarDecl pointers.
2042
  void DiagnoseUnusedParameters(ArrayRef<ParmVarDecl *> Parameters);
2043
2044
  /// Diagnose whether the size of parameters or return value of a
2045
  /// function or obj-c method definition is pass-by-value and larger than a
2046
  /// specified threshold.
2047
  void
2048
  DiagnoseSizeOfParametersAndReturnValue(ArrayRef<ParmVarDecl *> Parameters,
2049
                                         QualType ReturnTy, NamedDecl *D);
2050
2051
  void DiagnoseInvalidJumps(Stmt *Body);
2052
  Decl *ActOnFileScopeAsmDecl(Expr *expr,
2053
                              SourceLocation AsmLoc,
2054
                              SourceLocation RParenLoc);
2055
2056
  /// Handle a C++11 empty-declaration and attribute-declaration.
2057
  Decl *ActOnEmptyDeclaration(Scope *S, const ParsedAttributesView &AttrList,
2058
                              SourceLocation SemiLoc);
2059
2060
  enum class ModuleDeclKind {
2061
    Interface,      ///< 'export module X;'
2062
    Implementation, ///< 'module X;'
2063
    Partition,      ///< 'module partition X;'
2064
  };
2065
2066
  /// The parser has processed a module-declaration that begins the definition
2067
  /// of a module interface or implementation.
2068
  DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc,
2069
                                 SourceLocation ModuleLoc, ModuleDeclKind MDK,
2070
                                 ModuleIdPath Path);
2071
2072
  /// The parser has processed a module import declaration.
2073
  ///
2074
  /// \param AtLoc The location of the '@' symbol, if any.
2075
  ///
2076
  /// \param ImportLoc The location of the 'import' keyword.
2077
  ///
2078
  /// \param Path The module access path.
2079
  DeclResult ActOnModuleImport(SourceLocation AtLoc, SourceLocation ImportLoc,
2080
                               ModuleIdPath Path);
2081
2082
  /// The parser has processed a module import translated from a
2083
  /// #include or similar preprocessing directive.
2084
  void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
2085
  void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
2086
2087
  /// The parsed has entered a submodule.
2088
  void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod);
2089
  /// The parser has left a submodule.
2090
  void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod);
2091
2092
  /// Create an implicit import of the given module at the given
2093
  /// source location, for error recovery, if possible.
2094
  ///
2095
  /// This routine is typically used when an entity found by name lookup
2096
  /// is actually hidden within a module that we know about but the user
2097
  /// has forgotten to import.
2098
  void createImplicitModuleImportForErrorRecovery(SourceLocation Loc,
2099
                                                  Module *Mod);
2100
2101
  /// Kinds of missing import. Note, the values of these enumerators correspond
2102
  /// to %select values in diagnostics.
2103
  enum class MissingImportKind {
2104
    Declaration,
2105
    Definition,
2106
    DefaultArgument,
2107
    ExplicitSpecialization,
2108
    PartialSpecialization
2109
  };
2110
2111
  /// Diagnose that the specified declaration needs to be visible but
2112
  /// isn't, and suggest a module import that would resolve the problem.
2113
  void diagnoseMissingImport(SourceLocation Loc, NamedDecl *Decl,
2114
                             MissingImportKind MIK, bool Recover = true);
2115
  void diagnoseMissingImport(SourceLocation Loc, NamedDecl *Decl,
2116
                             SourceLocation DeclLoc, ArrayRef<Module *> Modules,
2117
                             MissingImportKind MIK, bool Recover);
2118
2119
  Decl *ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc,
2120
                             SourceLocation LBraceLoc);
2121
  Decl *ActOnFinishExportDecl(Scope *S, Decl *ExportDecl,
2122
                              SourceLocation RBraceLoc);
2123
2124
  /// We've found a use of a templated declaration that would trigger an
2125
  /// implicit instantiation. Check that any relevant explicit specializations
2126
  /// and partial specializations are visible, and diagnose if not.
2127
  void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec);
2128
2129
  /// We've found a use of a template specialization that would select a
2130
  /// partial specialization. Check that the partial specialization is visible,
2131
  /// and diagnose if not.
2132
  void checkPartialSpecializationVisibility(SourceLocation Loc,
2133
                                            NamedDecl *Spec);
2134
2135
  /// Retrieve a suitable printing policy for diagnostics.
2136
30.0M
  PrintingPolicy getPrintingPolicy() const {
2137
30.0M
    return getPrintingPolicy(Context, PP);
2138
30.0M
  }
2139
2140
  /// Retrieve a suitable printing policy for diagnostics.
2141
  static PrintingPolicy getPrintingPolicy(const ASTContext &Ctx,
2142
                                          const Preprocessor &PP);
2143
2144
  /// Scope actions.
2145
  void ActOnPopScope(SourceLocation Loc, Scope *S);
2146
  void ActOnTranslationUnitScope(Scope *S);
2147
2148
  Decl *ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS,
2149
                                   RecordDecl *&AnonRecord);
2150
  Decl *ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS,
2151
                                   MultiTemplateParamsArg TemplateParams,
2152
                                   bool IsExplicitInstantiation,
2153
                                   RecordDecl *&AnonRecord);
2154
2155
  Decl *BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
2156
                                    AccessSpecifier AS,
2157
                                    RecordDecl *Record,
2158
                                    const PrintingPolicy &Policy);
2159
2160
  Decl *BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS,
2161
                                       RecordDecl *Record);
2162
2163
  /// Common ways to introduce type names without a tag for use in diagnostics.
2164
  /// Keep in sync with err_tag_reference_non_tag.
2165
  enum NonTagKind {
2166
    NTK_NonStruct,
2167
    NTK_NonClass,
2168
    NTK_NonUnion,
2169
    NTK_NonEnum,
2170
    NTK_Typedef,
2171
    NTK_TypeAlias,
2172
    NTK_Template,
2173
    NTK_TypeAliasTemplate,
2174
    NTK_TemplateTemplateArgument,
2175
  };
2176
2177
  /// Given a non-tag type declaration, returns an enum useful for indicating
2178
  /// what kind of non-tag type this is.
2179
  NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK);
2180
2181
  bool isAcceptableTagRedeclaration(const TagDecl *Previous,
2182
                                    TagTypeKind NewTag, bool isDefinition,
2183
                                    SourceLocation NewTagLoc,
2184
                                    const IdentifierInfo *Name);
2185
2186
  enum TagUseKind {
2187
    TUK_Reference,   // Reference to a tag:  'struct foo *X;'
2188
    TUK_Declaration, // Fwd decl of a tag:   'struct foo;'
2189
    TUK_Definition,  // Definition of a tag: 'struct foo { int X; } Y;'
2190
    TUK_Friend       // Friend declaration:  'friend struct foo;'
2191
  };
2192
2193
  Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
2194
                 SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name,
2195
                 SourceLocation NameLoc, const ParsedAttributesView &Attr,
2196
                 AccessSpecifier AS, SourceLocation ModulePrivateLoc,
2197
                 MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl,
2198
                 bool &IsDependent, SourceLocation ScopedEnumKWLoc,
2199
                 bool ScopedEnumUsesClassTag, TypeResult UnderlyingType,
2200
                 bool IsTypeSpecifier, bool IsTemplateParamOrArg,
2201
                 SkipBodyInfo *SkipBody = nullptr);
2202
2203
  Decl *ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc,
2204
                                unsigned TagSpec, SourceLocation TagLoc,
2205
                                CXXScopeSpec &SS, IdentifierInfo *Name,
2206
                                SourceLocation NameLoc,
2207
                                const ParsedAttributesView &Attr,
2208
                                MultiTemplateParamsArg TempParamLists);
2209
2210
  TypeResult ActOnDependentTag(Scope *S,
2211
                               unsigned TagSpec,
2212
                               TagUseKind TUK,
2213
                               const CXXScopeSpec &SS,
2214
                               IdentifierInfo *Name,
2215
                               SourceLocation TagLoc,
2216
                               SourceLocation NameLoc);
2217
2218
  void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
2219
                 IdentifierInfo *ClassName,
2220
                 SmallVectorImpl<Decl *> &Decls);
2221
  Decl *ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart,
2222
                   Declarator &D, Expr *BitfieldWidth);
2223
2224
  FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart,
2225
                         Declarator &D, Expr *BitfieldWidth,
2226
                         InClassInitStyle InitStyle,
2227
                         AccessSpecifier AS);
2228
  MSPropertyDecl *HandleMSProperty(Scope *S, RecordDecl *TagD,
2229
                                   SourceLocation DeclStart, Declarator &D,
2230
                                   Expr *BitfieldWidth,
2231
                                   InClassInitStyle InitStyle,
2232
                                   AccessSpecifier AS,
2233
                                   const ParsedAttr &MSPropertyAttr);
2234
2235
  FieldDecl *CheckFieldDecl(DeclarationName Name, QualType T,
2236
                            TypeSourceInfo *TInfo,
2237
                            RecordDecl *Record, SourceLocation Loc,
2238
                            bool Mutable, Expr *BitfieldWidth,
2239
                            InClassInitStyle InitStyle,
2240
                            SourceLocation TSSL,
2241
                            AccessSpecifier AS, NamedDecl *PrevDecl,
2242
                            Declarator *D = nullptr);
2243
2244
  bool CheckNontrivialField(FieldDecl *FD);
2245
  void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM);
2246
2247
  enum TrivialABIHandling {
2248
    /// The triviality of a method unaffected by "trivial_abi".
2249
    TAH_IgnoreTrivialABI,
2250
2251
    /// The triviality of a method affected by "trivial_abi".
2252
    TAH_ConsiderTrivialABI
2253
  };
2254
2255
  bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM,
2256
                              TrivialABIHandling TAH = TAH_IgnoreTrivialABI,
2257
                              bool Diagnose = false);
2258
  CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD);
2259
  void ActOnLastBitfield(SourceLocation DeclStart,
2260
                         SmallVectorImpl<Decl *> &AllIvarDecls);
2261
  Decl *ActOnIvar(Scope *S, SourceLocation DeclStart,
2262
                  Declarator &D, Expr *BitfieldWidth,
2263
                  tok::ObjCKeywordKind visibility);
2264
2265
  // This is used for both record definitions and ObjC interface declarations.
2266
  void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl,
2267
                   ArrayRef<Decl *> Fields, SourceLocation LBrac,
2268
                   SourceLocation RBrac, const ParsedAttributesView &AttrList);
2269
2270
  /// ActOnTagStartDefinition - Invoked when we have entered the
2271
  /// scope of a tag's definition (e.g., for an enumeration, class,
2272
  /// struct, or union).
2273
  void ActOnTagStartDefinition(Scope *S, Decl *TagDecl);
2274
2275
  /// Perform ODR-like check for C/ObjC when merging tag types from modules.
2276
  /// Differently from C++, actually parse the body and reject / error out
2277
  /// in case of a structural mismatch.
2278
  bool ActOnDuplicateDefinition(DeclSpec &DS, Decl *Prev,
2279
                                SkipBodyInfo &SkipBody);
2280
2281
  typedef void *SkippedDefinitionContext;
2282
2283
  /// Invoked when we enter a tag definition that we're skipping.
2284
  SkippedDefinitionContext ActOnTagStartSkippedDefinition(Scope *S, Decl *TD);
2285
2286
  Decl *ActOnObjCContainerStartDefinition(Decl *IDecl);
2287
2288
  /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
2289
  /// C++ record definition's base-specifiers clause and are starting its
2290
  /// member declarations.
2291
  void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl,
2292
                                       SourceLocation FinalLoc,
2293
                                       bool IsFinalSpelledSealed,
2294
                                       SourceLocation LBraceLoc);
2295
2296
  /// ActOnTagFinishDefinition - Invoked once we have finished parsing
2297
  /// the definition of a tag (enumeration, class, struct, or union).
2298
  void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl,
2299
                                SourceRange BraceRange);
2300
2301
  void ActOnTagFinishSkippedDefinition(SkippedDefinitionContext Context);
2302
2303
  void ActOnObjCContainerFinishDefinition();
2304
2305
  /// Invoked when we must temporarily exit the objective-c container
2306
  /// scope for parsing/looking-up C constructs.
2307
  ///
2308
  /// Must be followed by a call to \see ActOnObjCReenterContainerContext
2309
  void ActOnObjCTemporaryExitContainerContext(DeclContext *DC);
2310
  void ActOnObjCReenterContainerContext(DeclContext *DC);
2311
2312
  /// ActOnTagDefinitionError - Invoked when there was an unrecoverable
2313
  /// error parsing the definition of a tag.
2314
  void ActOnTagDefinitionError(Scope *S, Decl *TagDecl);
2315
2316
  EnumConstantDecl *CheckEnumConstant(EnumDecl *Enum,
2317
                                      EnumConstantDecl *LastEnumConst,
2318
                                      SourceLocation IdLoc,
2319
                                      IdentifierInfo *Id,
2320
                                      Expr *val);
2321
  bool CheckEnumUnderlyingType(TypeSourceInfo *TI);
2322
  bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped,
2323
                              QualType EnumUnderlyingTy, bool IsFixed,
2324
                              const EnumDecl *Prev);
2325
2326
  /// Determine whether the body of an anonymous enumeration should be skipped.
2327
  /// \param II The name of the first enumerator.
2328
  SkipBodyInfo shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II,
2329
                                      SourceLocation IILoc);
2330
2331
  Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant,
2332
                          SourceLocation IdLoc, IdentifierInfo *Id,
2333
                          const ParsedAttributesView &Attrs,
2334
                          SourceLocation EqualLoc, Expr *Val);
2335
  void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange,
2336
                     Decl *EnumDecl, ArrayRef<Decl *> Elements, Scope *S,
2337
                     const ParsedAttributesView &Attr);
2338
2339
  DeclContext *getContainingDC(DeclContext *DC);
2340
2341
  /// Set the current declaration context until it gets popped.
2342
  void PushDeclContext(Scope *S, DeclContext *DC);
2343
  void PopDeclContext();
2344
2345
  /// EnterDeclaratorContext - Used when we must lookup names in the context
2346
  /// of a declarator's nested name specifier.
2347
  void EnterDeclaratorContext(Scope *S, DeclContext *DC);
2348
  void ExitDeclaratorContext(Scope *S);
2349
2350
  /// Push the parameters of D, which must be a function, into scope.
2351
  void ActOnReenterFunctionContext(Scope* S, Decl* D);
2352
  void ActOnExitFunctionContext();
2353
2354
  DeclContext *getFunctionLevelDeclContext();
2355
2356
  /// getCurFunctionDecl - If inside of a function body, this returns a pointer
2357
  /// to the function decl for the function being parsed.  If we're currently
2358
  /// in a 'block', this returns the containing context.
2359
  FunctionDecl *getCurFunctionDecl();
2360
2361
  /// getCurMethodDecl - If inside of a method body, this returns a pointer to
2362
  /// the method decl for the method being parsed.  If we're currently
2363
  /// in a 'block', this returns the containing context.
2364
  ObjCMethodDecl *getCurMethodDecl();
2365
2366
  /// getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method
2367
  /// or C function we're in, otherwise return null.  If we're currently
2368
  /// in a 'block', this returns the containing context.
2369
  NamedDecl *getCurFunctionOrMethodDecl();
2370
2371
  /// Add this decl to the scope shadowed decl chains.
2372
  void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext = true);
2373
2374
  /// Make the given externally-produced declaration visible at the
2375
  /// top level scope.
2376
  ///
2377
  /// \param D The externally-produced declaration to push.
2378
  ///
2379
  /// \param Name The name of the externally-produced declaration.
2380
  void pushExternalDeclIntoScope(NamedDecl *D, DeclarationName Name);
2381
2382
  /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true
2383
  /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns
2384
  /// true if 'D' belongs to the given declaration context.
2385
  ///
2386
  /// \param AllowInlineNamespace If \c true, allow the declaration to be in the
2387
  ///        enclosing namespace set of the context, rather than contained
2388
  ///        directly within it.
2389
  bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = nullptr,
2390
                     bool AllowInlineNamespace = false);
2391
2392
  /// Finds the scope corresponding to the given decl context, if it
2393
  /// happens to be an enclosing scope.  Otherwise return NULL.
2394
  static Scope *getScopeForDeclContext(Scope *S, DeclContext *DC);
2395
2396
  /// Subroutines of ActOnDeclarator().
2397
  TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, QualType T,
2398
                                TypeSourceInfo *TInfo);
2399
  bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New);
2400
2401
  /// Describes the kind of merge to perform for availability
2402
  /// attributes (including "deprecated", "unavailable", and "availability").
2403
  enum AvailabilityMergeKind {
2404
    /// Don't merge availability attributes at all.
2405
    AMK_None,
2406
    /// Merge availability attributes for a redeclaration, which requires
2407
    /// an exact match.
2408
    AMK_Redeclaration,
2409
    /// Merge availability attributes for an override, which requires
2410
    /// an exact match or a weakening of constraints.
2411
    AMK_Override,
2412
    /// Merge availability attributes for an implementation of
2413
    /// a protocol requirement.
2414
    AMK_ProtocolImplementation,
2415
  };
2416
2417
  /// Attribute merging methods. Return true if a new attribute was added.
2418
  AvailabilityAttr *mergeAvailabilityAttr(NamedDecl *D, SourceRange Range,
2419
                                          IdentifierInfo *Platform,
2420
                                          bool Implicit,
2421
                                          VersionTuple Introduced,
2422
                                          VersionTuple Deprecated,
2423
                                          VersionTuple Obsoleted,
2424
                                          bool IsUnavailable,
2425
                                          StringRef Message,
2426
                                          bool IsStrict, StringRef Replacement,
2427
                                          AvailabilityMergeKind AMK,
2428
                                          unsigned AttrSpellingListIndex);
2429
  TypeVisibilityAttr *mergeTypeVisibilityAttr(Decl *D, SourceRange Range,
2430
                                       TypeVisibilityAttr::VisibilityType Vis,
2431
                                              unsigned AttrSpellingListIndex);
2432
  VisibilityAttr *mergeVisibilityAttr(Decl *D, SourceRange Range,
2433
                                      VisibilityAttr::VisibilityType Vis,
2434
                                      unsigned AttrSpellingListIndex);
2435
  UuidAttr *mergeUuidAttr(Decl *D, SourceRange Range,
2436
                          unsigned AttrSpellingListIndex, StringRef Uuid);
2437
  DLLImportAttr *mergeDLLImportAttr(Decl *D, SourceRange Range,
2438
                                    unsigned AttrSpellingListIndex);
2439
  DLLExportAttr *mergeDLLExportAttr(Decl *D, SourceRange Range,
2440
                                    unsigned AttrSpellingListIndex);
2441
  MSInheritanceAttr *
2442
  mergeMSInheritanceAttr(Decl *D, SourceRange Range, bool BestCase,
2443
                         unsigned AttrSpellingListIndex,
2444
                         MSInheritanceAttr::Spelling SemanticSpelling);
2445
  FormatAttr *mergeFormatAttr(Decl *D, SourceRange Range,
2446
                              IdentifierInfo *Format, int FormatIdx,
2447
                              int FirstArg, unsigned AttrSpellingListIndex);
2448
  SectionAttr *mergeSectionAttr(Decl *D, SourceRange Range, StringRef Name,
2449
                                unsigned AttrSpellingListIndex);
2450
  CodeSegAttr *mergeCodeSegAttr(Decl *D, SourceRange Range, StringRef Name,
2451
                                unsigned AttrSpellingListIndex);
2452
  AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D, SourceRange Range,
2453
                                          IdentifierInfo *Ident,
2454
                                          unsigned AttrSpellingListIndex);
2455
  MinSizeAttr *mergeMinSizeAttr(Decl *D, SourceRange Range,
2456
                                unsigned AttrSpellingListIndex);
2457
  OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D, SourceRange Range,
2458
                                          unsigned AttrSpellingListIndex);
2459
  InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, SourceRange Range,
2460
                                                IdentifierInfo *Ident,
2461
                                                unsigned AttrSpellingListIndex);
2462
  CommonAttr *mergeCommonAttr(Decl *D, SourceRange Range, IdentifierInfo *Ident,
2463
                              unsigned AttrSpellingListIndex);
2464
2465
  void mergeDeclAttributes(NamedDecl *New, Decl *Old,
2466
                           AvailabilityMergeKind AMK = AMK_Redeclaration);
2467
  void MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New,
2468
                            LookupResult &OldDecls);
2469
  bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S,
2470
                         bool MergeTypeWithOld);
2471
  bool MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old,
2472
                                    Scope *S, bool MergeTypeWithOld);
2473
  void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old);
2474
  void MergeVarDecl(VarDecl *New, LookupResult &Previous);
2475
  void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
2476
  void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old);
2477
  bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn);
2478
  void notePreviousDefinition(const NamedDecl *Old, SourceLocation New);
2479
  bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S);
2480
2481
  // AssignmentAction - This is used by all the assignment diagnostic functions
2482
  // to represent what is actually causing the operation
2483
  enum AssignmentAction {
2484
    AA_Assigning,
2485
    AA_Passing,
2486
    AA_Returning,
2487
    AA_Converting,
2488
    AA_Initializing,
2489
    AA_Sending,
2490
    AA_Casting,
2491
    AA_Passing_CFAudited
2492
  };
2493
2494
  /// C++ Overloading.
2495
  enum OverloadKind {
2496
    /// This is a legitimate overload: the existing declarations are
2497
    /// functions or function templates with different signatures.
2498
    Ovl_Overload,
2499
2500
    /// This is not an overload because the signature exactly matches
2501
    /// an existing declaration.
2502
    Ovl_Match,
2503
2504
    /// This is not an overload because the lookup results contain a
2505
    /// non-function.
2506
    Ovl_NonFunction
2507
  };
2508
  OverloadKind CheckOverload(Scope *S,
2509
                             FunctionDecl *New,
2510
                             const LookupResult &OldDecls,
2511
                             NamedDecl *&OldDecl,
2512
                             bool IsForUsingDecl);
2513
  bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl,
2514
                  bool ConsiderCudaAttrs = true);
2515
2516
  /// Checks availability of the function depending on the current
2517
  /// function context.Inside an unavailable function,unavailability is ignored.
2518
  ///
2519
  /// \returns true if \p FD is unavailable and current context is inside
2520
  /// an available function, false otherwise.
2521
  bool isFunctionConsideredUnavailable(FunctionDecl *FD);
2522
2523
  ImplicitConversionSequence
2524
  TryImplicitConversion(Expr *From, QualType ToType,
2525
                        bool SuppressUserConversions,
2526
                        bool AllowExplicit,
2527
                        bool InOverloadResolution,
2528
                        bool CStyle,
2529
                        bool AllowObjCWritebackConversion);
2530
2531
  bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
2532
  bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
2533
  bool IsComplexPromotion(QualType FromType, QualType ToType);
2534
  bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
2535
                           bool InOverloadResolution,
2536
                           QualType& ConvertedType, bool &IncompatibleObjC);
2537
  bool isObjCPointerConversion(QualType FromType, QualType ToType,
2538
                               QualType& ConvertedType, bool &IncompatibleObjC);
2539
  bool isObjCWritebackConversion(QualType FromType, QualType ToType,
2540
                                 QualType &ConvertedType);
2541
  bool IsBlockPointerConversion(QualType FromType, QualType ToType,
2542
                                QualType& ConvertedType);
2543
  bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType,
2544
                                  const FunctionProtoType *NewType,
2545
                                  unsigned *ArgPos = nullptr);
2546
  void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag,
2547
                                  QualType FromType, QualType ToType);
2548
2549
  void maybeExtendBlockObject(ExprResult &E);
2550
  CastKind PrepareCastToObjCObjectPointer(ExprResult &E);
2551
  bool CheckPointerConversion(Expr *From, QualType ToType,
2552
                              CastKind &Kind,
2553
                              CXXCastPath& BasePath,
2554
                              bool IgnoreBaseAccess,
2555
                              bool Diagnose = true);
2556
  bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType,
2557
                                 bool InOverloadResolution,
2558
                                 QualType &ConvertedType);
2559
  bool CheckMemberPointerConversion(Expr *From, QualType ToType,
2560
                                    CastKind &Kind,
2561
                                    CXXCastPath &BasePath,
2562
                                    bool IgnoreBaseAccess);
2563
  bool IsQualificationConversion(QualType FromType, QualType ToType,
2564
                                 bool CStyle, bool &ObjCLifetimeConversion);
2565
  bool IsFunctionConversion(QualType FromType, QualType ToType,
2566
                            QualType &ResultTy);
2567
  bool DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType);
2568
  bool isSameOrCompatibleFunctionType(CanQualType Param, CanQualType Arg);
2569
2570
  ExprResult PerformMoveOrCopyInitialization(const InitializedEntity &Entity,
2571
                                             const VarDecl *NRVOCandidate,
2572
                                             QualType ResultType,
2573
                                             Expr *Value,
2574
                                             bool AllowNRVO = true);
2575
2576
  bool CanPerformCopyInitialization(const InitializedEntity &Entity,
2577
                                    ExprResult Init);
2578
  ExprResult PerformCopyInitialization(const InitializedEntity &Entity,
2579
                                       SourceLocation EqualLoc,
2580
                                       ExprResult Init,
2581
                                       bool TopLevelOfInitList = false,
2582
                                       bool AllowExplicit = false);
2583
  ExprResult PerformObjectArgumentInitialization(Expr *From,
2584
                                                 NestedNameSpecifier *Qualifier,
2585
                                                 NamedDecl *FoundDecl,
2586
                                                 CXXMethodDecl *Method);
2587
2588
  /// Check that the lifetime of the initializer (and its subobjects) is
2589
  /// sufficient for initializing the entity, and perform lifetime extension
2590
  /// (when permitted) if not.
2591
  void checkInitializerLifetime(const InitializedEntity &Entity, Expr *Init);
2592
2593
  ExprResult PerformContextuallyConvertToBool(Expr *From);
2594
  ExprResult PerformContextuallyConvertToObjCPointer(Expr *From);
2595
2596
  /// Contexts in which a converted constant expression is required.
2597
  enum CCEKind {
2598
    CCEK_CaseValue,   ///< Expression in a case label.
2599
    CCEK_Enumerator,  ///< Enumerator value with fixed underlying type.
2600
    CCEK_TemplateArg, ///< Value of a non-type template parameter.
2601
    CCEK_NewExpr,     ///< Constant expression in a noptr-new-declarator.
2602
    CCEK_ConstexprIf  ///< Condition in a constexpr if statement.
2603
  };
2604
  ExprResult CheckConvertedConstantExpression(Expr *From, QualType T,
2605
                                              llvm::APSInt &Value, CCEKind CCE);
2606
  ExprResult CheckConvertedConstantExpression(Expr *From, QualType T,
2607
                                              APValue &Value, CCEKind CCE);
2608
2609
  /// Abstract base class used to perform a contextual implicit
2610
  /// conversion from an expression to any type passing a filter.
2611
  class ContextualImplicitConverter {
2612
  public:
2613
    bool Suppress;
2614
    bool SuppressConversion;
2615
2616
    ContextualImplicitConverter(bool Suppress = false,
2617
                                bool SuppressConversion = false)
2618
388k
        : Suppress(Suppress), SuppressConversion(SuppressConversion) {}
2619
2620
    /// Determine whether the specified type is a valid destination type
2621
    /// for this conversion.
2622
    virtual bool match(QualType T) = 0;
2623
2624
    /// Emits a diagnostic complaining that the expression does not have
2625
    /// integral or enumeration type.
2626
    virtual SemaDiagnosticBuilder
2627
    diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) = 0;
2628
2629
    /// Emits a diagnostic when the expression has incomplete class type.
2630
    virtual SemaDiagnosticBuilder
2631
    diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T) = 0;
2632
2633
    /// Emits a diagnostic when the only matching conversion function
2634
    /// is explicit.
2635
    virtual SemaDiagnosticBuilder diagnoseExplicitConv(
2636
        Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
2637
2638
    /// Emits a note for the explicit conversion function.
2639
    virtual SemaDiagnosticBuilder
2640
    noteExplicitConv(Sema &S, CXXConversionDecl *Conv, QualType ConvTy) = 0;
2641
2642
    /// Emits a diagnostic when there are multiple possible conversion
2643
    /// functions.
2644
    virtual SemaDiagnosticBuilder
2645
    diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T) = 0;
2646
2647
    /// Emits a note for one of the candidate conversions.
2648
    virtual SemaDiagnosticBuilder
2649
    noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy) = 0;
2650
2651
    /// Emits a diagnostic when we picked a conversion function
2652
    /// (for cases when we are not allowed to pick a conversion function).
2653
    virtual SemaDiagnosticBuilder diagnoseConversion(
2654
        Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
2655
2656
388k
    virtual ~ContextualImplicitConverter() {}
2657
  };
2658
2659
  class ICEConvertDiagnoser : public ContextualImplicitConverter {
2660
    bool AllowScopedEnumerations;
2661
2662
  public:
2663
    ICEConvertDiagnoser(bool AllowScopedEnumerations,
2664
                        bool Suppress, bool SuppressConversion)
2665
        : ContextualImplicitConverter(Suppress, SuppressConversion),
2666
385k
          AllowScopedEnumerations(AllowScopedEnumerations) {}
2667
2668
    /// Match an integral or (possibly scoped) enumeration type.
2669
    bool match(QualType T) override;
2670
2671
    SemaDiagnosticBuilder
2672
1.34k
    diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) override {
2673
1.34k
      return diagnoseNotInt(S, Loc, T);
2674
1.34k
    }
2675
2676
    /// Emits a diagnostic complaining that the expression does not have
2677
    /// integral or enumeration type.
2678
    virtual SemaDiagnosticBuilder
2679
    diagnoseNotInt(Sema &S, SourceLocation Loc, QualType T) = 0;
2680
  };
2681
2682
  /// Perform a contextual implicit conversion.
2683
  ExprResult PerformContextualImplicitConversion(
2684
      SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter);
2685
2686
2687
  enum ObjCSubscriptKind {
2688
    OS_Array,
2689
    OS_Dictionary,
2690
    OS_Error
2691
  };
2692
  ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE);
2693
2694
  // Note that LK_String is intentionally after the other literals, as
2695
  // this is used for diagnostics logic.
2696
  enum ObjCLiteralKind {
2697
    LK_Array,
2698
    LK_Dictionary,
2699
    LK_Numeric,
2700
    LK_Boxed,
2701
    LK_String,
2702
    LK_Block,
2703
    LK_None
2704
  };
2705
  ObjCLiteralKind CheckLiteralKind(Expr *FromE);
2706
2707
  ExprResult PerformObjectMemberConversion(Expr *From,
2708
                                           NestedNameSpecifier *Qualifier,
2709
                                           NamedDecl *FoundDecl,
2710
                                           NamedDecl *Member);
2711
2712
  // Members have to be NamespaceDecl* or TranslationUnitDecl*.
2713
  // TODO: make this is a typesafe union.
2714
  typedef llvm::SmallSetVector<DeclContext   *, 16> AssociatedNamespaceSet;
2715
  typedef llvm::SmallSetVector<CXXRecordDecl *, 16> AssociatedClassSet;
2716
2717
  void AddOverloadCandidate(FunctionDecl *Function,
2718
                            DeclAccessPair FoundDecl,
2719
                            ArrayRef<Expr *> Args,
2720
                            OverloadCandidateSet &CandidateSet,
2721
                            bool SuppressUserConversions = false,
2722
                            bool PartialOverloading = false,
2723
                            bool AllowExplicit = false,
2724
                            ConversionSequenceList EarlyConversions = None);
2725
  void AddFunctionCandidates(const UnresolvedSetImpl &Functions,
2726
                      ArrayRef<Expr *> Args,
2727
                      OverloadCandidateSet &CandidateSet,
2728
                      TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
2729
                      bool SuppressUserConversions = false,
2730
                      bool PartialOverloading = false,
2731
                      bool FirstArgumentIsBase = false);
2732
  void AddMethodCandidate(DeclAccessPair FoundDecl,
2733
                          QualType ObjectType,
2734
                          Expr::Classification ObjectClassification,
2735
                          ArrayRef<Expr *> Args,
2736
                          OverloadCandidateSet& CandidateSet,
2737
                          bool SuppressUserConversion = false);
2738
  void AddMethodCandidate(CXXMethodDecl *Method,
2739
                          DeclAccessPair FoundDecl,
2740
                          CXXRecordDecl *ActingContext, QualType ObjectType,
2741
                          Expr::Classification ObjectClassification,
2742
                          ArrayRef<Expr *> Args,
2743
                          OverloadCandidateSet& CandidateSet,
2744
                          bool SuppressUserConversions = false,
2745
                          bool PartialOverloading = false,
2746
                          ConversionSequenceList EarlyConversions = None);
2747
  void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl,
2748
                                  DeclAccessPair FoundDecl,
2749
                                  CXXRecordDecl *ActingContext,
2750
                                 TemplateArgumentListInfo *ExplicitTemplateArgs,
2751
                                  QualType ObjectType,
2752
                                  Expr::Classification ObjectClassification,
2753
                                  ArrayRef<Expr *> Args,
2754
                                  OverloadCandidateSet& CandidateSet,
2755
                                  bool SuppressUserConversions = false,
2756
                                  bool PartialOverloading = false);
2757
  void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate,
2758
                                    DeclAccessPair FoundDecl,
2759
                                 TemplateArgumentListInfo *ExplicitTemplateArgs,
2760
                                    ArrayRef<Expr *> Args,
2761
                                    OverloadCandidateSet& CandidateSet,
2762
                                    bool SuppressUserConversions = false,
2763
                                    bool PartialOverloading = false);
2764
  bool CheckNonDependentConversions(FunctionTemplateDecl *FunctionTemplate,
2765
                                    ArrayRef<QualType> ParamTypes,
2766
                                    ArrayRef<Expr *> Args,
2767
                                    OverloadCandidateSet &CandidateSet,
2768
                                    ConversionSequenceList &Conversions,
2769
                                    bool SuppressUserConversions,
2770
                                    CXXRecordDecl *ActingContext = nullptr,
2771
                                    QualType ObjectType = QualType(),
2772
                                    Expr::Classification
2773
                                        ObjectClassification = {});
2774
  void AddConversionCandidate(CXXConversionDecl *Conversion,
2775
                              DeclAccessPair FoundDecl,
2776
                              CXXRecordDecl *ActingContext,
2777
                              Expr *From, QualType ToType,
2778
                              OverloadCandidateSet& CandidateSet,
2779
                              bool AllowObjCConversionOnExplicit,
2780
                              bool AllowResultConversion = true);
2781
  void AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate,
2782
                                      DeclAccessPair FoundDecl,
2783
                                      CXXRecordDecl *ActingContext,
2784
                                      Expr *From, QualType ToType,
2785
                                      OverloadCandidateSet &CandidateSet,
2786
                                      bool AllowObjCConversionOnExplicit,
2787
                                      bool AllowResultConversion = true);
2788
  void AddSurrogateCandidate(CXXConversionDecl *Conversion,
2789
                             DeclAccessPair FoundDecl,
2790
                             CXXRecordDecl *ActingContext,
2791
                             const FunctionProtoType *Proto,
2792
                             Expr *Object, ArrayRef<Expr *> Args,
2793
                             OverloadCandidateSet& CandidateSet);
2794
  void AddMemberOperatorCandidates(OverloadedOperatorKind Op,
2795
                                   SourceLocation OpLoc, ArrayRef<Expr *> Args,
2796
                                   OverloadCandidateSet& CandidateSet,
2797
                                   SourceRange OpRange = SourceRange());
2798
  void AddBuiltinCandidate(QualType *ParamTys, ArrayRef<Expr *> Args,
2799
                           OverloadCandidateSet& CandidateSet,
2800
                           bool IsAssignmentOperator = false,
2801
                           unsigned NumContextualBoolArguments = 0);
2802
  void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
2803
                                    SourceLocation OpLoc, ArrayRef<Expr *> Args,
2804
                                    OverloadCandidateSet& CandidateSet);
2805
  void AddArgumentDependentLookupCandidates(DeclarationName Name,
2806
                                            SourceLocation Loc,
2807
                                            ArrayRef<Expr *> Args,
2808
                                TemplateArgumentListInfo *ExplicitTemplateArgs,
2809
                                            OverloadCandidateSet& CandidateSet,
2810
                                            bool PartialOverloading = false);
2811
2812
  // Emit as a 'note' the specific overload candidate
2813
  void NoteOverloadCandidate(NamedDecl *Found, FunctionDecl *Fn,
2814
                             QualType DestType = QualType(),
2815
                             bool TakingAddress = false);
2816
2817
  // Emit as a series of 'note's all template and non-templates identified by
2818
  // the expression Expr
2819
  void NoteAllOverloadCandidates(Expr *E, QualType DestType = QualType(),
2820
                                 bool TakingAddress = false);
2821
2822
  /// Check the enable_if expressions on the given function. Returns the first
2823
  /// failing attribute, or NULL if they were all successful.
2824
  EnableIfAttr *CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> Args,
2825
                              bool MissingImplicitThis = false);
2826
2827
  /// Find the failed Boolean condition within a given Boolean
2828
  /// constant expression, and describe it with a string.
2829
  ///
2830
  /// \param AllowTopLevelCond Whether to allow the result to be the
2831
  /// complete top-level condition.
2832
  std::pair<Expr *, std::string>
2833
  findFailedBooleanCondition(Expr *Cond, bool AllowTopLevelCond);
2834
2835
  /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
2836
  /// non-ArgDependent DiagnoseIfAttrs.
2837
  ///
2838
  /// Argument-dependent diagnose_if attributes should be checked each time a
2839
  /// function is used as a direct callee of a function call.
2840
  ///
2841
  /// Returns true if any errors were emitted.
2842
  bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function,
2843
                                           const Expr *ThisArg,
2844
                                           ArrayRef<const Expr *> Args,
2845
                                           SourceLocation Loc);
2846
2847
  /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
2848
  /// ArgDependent DiagnoseIfAttrs.
2849
  ///
2850
  /// Argument-independent diagnose_if attributes should be checked on every use
2851
  /// of a function.
2852
  ///
2853
  /// Returns true if any errors were emitted.
2854
  bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND,
2855
                                             SourceLocation Loc);
2856
2857
  /// Returns whether the given function's address can be taken or not,
2858
  /// optionally emitting a diagnostic if the address can't be taken.
2859
  ///
2860
  /// Returns false if taking the address of the function is illegal.
2861
  bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function,
2862
                                         bool Complain = false,
2863
                                         SourceLocation Loc = SourceLocation());
2864
2865
  // [PossiblyAFunctionType]  -->   [Return]
2866
  // NonFunctionType --> NonFunctionType
2867
  // R (A) --> R(A)
2868
  // R (*)(A) --> R (A)
2869
  // R (&)(A) --> R (A)
2870
  // R (S::*)(A) --> R (A)
2871
  QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType);
2872
2873
  FunctionDecl *
2874
  ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr,
2875
                                     QualType TargetType,
2876
                                     bool Complain,
2877
                                     DeclAccessPair &Found,
2878
                                     bool *pHadMultipleCandidates = nullptr);
2879
2880
  FunctionDecl *
2881
  resolveAddressOfOnlyViableOverloadCandidate(Expr *E,
2882
                                              DeclAccessPair &FoundResult);
2883
2884
  bool resolveAndFixAddressOfOnlyViableOverloadCandidate(
2885
      ExprResult &SrcExpr, bool DoFunctionPointerConversion = false);
2886
2887
  FunctionDecl *
2888
  ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl,
2889
                                              bool Complain = false,
2890
                                              DeclAccessPair *Found = nullptr);
2891
2892
  bool ResolveAndFixSingleFunctionTemplateSpecialization(
2893
                      ExprResult &SrcExpr,
2894
                      bool DoFunctionPointerConverion = false,
2895
                      bool Complain = false,
2896
                      SourceRange OpRangeForComplaining = SourceRange(),
2897
                      QualType DestTypeForComplaining = QualType(),
2898
                      unsigned DiagIDForComplaining = 0);
2899
2900
2901
  Expr *FixOverloadedFunctionReference(Expr *E,
2902
                                       DeclAccessPair FoundDecl,
2903
                                       FunctionDecl *Fn);
2904
  ExprResult FixOverloadedFunctionReference(ExprResult,
2905
                                            DeclAccessPair FoundDecl,
2906
                                            FunctionDecl *Fn);
2907
2908
  void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
2909
                                   ArrayRef<Expr *> Args,
2910
                                   OverloadCandidateSet &CandidateSet,
2911
                                   bool PartialOverloading = false);
2912
2913
  // An enum used to represent the different possible results of building a
2914
  // range-based for loop.
2915
  enum ForRangeStatus {
2916
    FRS_Success,
2917
    FRS_NoViableFunction,
2918
    FRS_DiagnosticIssued
2919
  };
2920
2921
  ForRangeStatus BuildForRangeBeginEndCall(SourceLocation Loc,
2922
                                           SourceLocation RangeLoc,
2923
                                           const DeclarationNameInfo &NameInfo,
2924
                                           LookupResult &MemberLookup,
2925
                                           OverloadCandidateSet *CandidateSet,
2926
                                           Expr *Range, ExprResult *CallExpr);
2927
2928
  ExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn,
2929
                                     UnresolvedLookupExpr *ULE,
2930
                                     SourceLocation LParenLoc,
2931
                                     MultiExprArg Args,
2932
                                     SourceLocation RParenLoc,
2933
                                     Expr *ExecConfig,
2934
                                     bool AllowTypoCorrection=true,
2935
                                     bool CalleesAddressIsTaken=false);
2936
2937
  bool buildOverloadedCallSet(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE,
2938
                              MultiExprArg Args, SourceLocation RParenLoc,
2939
                              OverloadCandidateSet *CandidateSet,
2940
                              ExprResult *Result);
2941
2942
  ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc,
2943
                                     UnaryOperatorKind Opc,
2944
                                     const UnresolvedSetImpl &Fns,
2945
                                     Expr *input, bool RequiresADL = true);
2946
2947
  ExprResult CreateOverloadedBinOp(SourceLocation OpLoc,
2948
                                   BinaryOperatorKind Opc,
2949
                                   const UnresolvedSetImpl &Fns,
2950
                                   Expr *LHS, Expr *RHS,
2951
                                   bool RequiresADL = true);
2952
2953
  ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
2954
                                                SourceLocation RLoc,
2955
                                                Expr *Base,Expr *Idx);
2956
2957
  ExprResult
2958
  BuildCallToMemberFunction(Scope *S, Expr *MemExpr,
2959
                            SourceLocation LParenLoc,
2960
                            MultiExprArg Args,
2961
                            SourceLocation RParenLoc);
2962
  ExprResult
2963
  BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc,
2964
                               MultiExprArg Args,
2965
                               SourceLocation RParenLoc);
2966
2967
  ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base,
2968
                                      SourceLocation OpLoc,
2969
                                      bool *NoArrowOperatorFound = nullptr);
2970
2971
  /// CheckCallReturnType - Checks that a call expression's return type is
2972
  /// complete. Returns true on failure. The location passed in is the location
2973
  /// that best represents the call.
2974
  bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc,
2975
                           CallExpr *CE, FunctionDecl *FD);
2976
2977
  /// Helpers for dealing with blocks and functions.
2978
  bool CheckParmsForFunctionDef(ArrayRef<ParmVarDecl *> Parameters,
2979
                                bool CheckParameterNames);
2980
  void CheckCXXDefaultArguments(FunctionDecl *FD);
2981
  void CheckExtraCXXDefaultArguments(Declarator &D);
2982
  Scope *getNonFieldDeclScope(Scope *S);
2983
2984
  /// \name Name lookup
2985
  ///
2986
  /// These routines provide name lookup that is used during semantic
2987
  /// analysis to resolve the various kinds of names (identifiers,
2988
  /// overloaded operator names, constructor names, etc.) into zero or
2989
  /// more declarations within a particular scope. The major entry
2990
  /// points are LookupName, which performs unqualified name lookup,
2991
  /// and LookupQualifiedName, which performs qualified name lookup.
2992
  ///
2993
  /// All name lookup is performed based on some specific criteria,
2994
  /// which specify what names will be visible to name lookup and how
2995
  /// far name lookup should work. These criteria are important both
2996
  /// for capturing language semantics (certain lookups will ignore
2997
  /// certain names, for example) and for performance, since name
2998
  /// lookup is often a bottleneck in the compilation of C++. Name
2999
  /// lookup criteria is specified via the LookupCriteria enumeration.
3000
  ///
3001
  /// The results of name lookup can vary based on the kind of name
3002
  /// lookup performed, the current language, and the translation
3003
  /// unit. In C, for example, name lookup will either return nothing
3004
  /// (no entity found) or a single declaration. In C++, name lookup
3005
  /// can additionally refer to a set of overloaded functions or
3006
  /// result in an ambiguity. All of the possible results of name
3007
  /// lookup are captured by the LookupResult class, which provides
3008
  /// the ability to distinguish among them.
3009
  //@{
3010
3011
  /// Describes the kind of name lookup to perform.
3012
  enum LookupNameKind {
3013
    /// Ordinary name lookup, which finds ordinary names (functions,
3014
    /// variables, typedefs, etc.) in C and most kinds of names
3015
    /// (functions, variables, members, types, etc.) in C++.
3016
    LookupOrdinaryName = 0,
3017
    /// Tag name lookup, which finds the names of enums, classes,
3018
    /// structs, and unions.
3019
    LookupTagName,
3020
    /// Label name lookup.
3021
    LookupLabel,
3022
    /// Member name lookup, which finds the names of
3023
    /// class/struct/union members.
3024
    LookupMemberName,
3025
    /// Look up of an operator name (e.g., operator+) for use with
3026
    /// operator overloading. This lookup is similar to ordinary name
3027
    /// lookup, but will ignore any declarations that are class members.
3028
    LookupOperatorName,
3029
    /// Look up of a name that precedes the '::' scope resolution
3030
    /// operator in C++. This lookup completely ignores operator, object,
3031
    /// function, and enumerator names (C++ [basic.lookup.qual]p1).
3032
    LookupNestedNameSpecifierName,
3033
    /// Look up a namespace name within a C++ using directive or
3034
    /// namespace alias definition, ignoring non-namespace names (C++
3035
    /// [basic.lookup.udir]p1).
3036
    LookupNamespaceName,
3037
    /// Look up all declarations in a scope with the given name,
3038
    /// including resolved using declarations.  This is appropriate
3039
    /// for checking redeclarations for a using declaration.
3040
    LookupUsingDeclName,
3041
    /// Look up an ordinary name that is going to be redeclared as a
3042
    /// name with linkage. This lookup ignores any declarations that
3043
    /// are outside of the current scope unless they have linkage. See
3044
    /// C99 6.2.2p4-5 and C++ [basic.link]p6.
3045
    LookupRedeclarationWithLinkage,
3046
    /// Look up a friend of a local class. This lookup does not look
3047
    /// outside the innermost non-class scope. See C++11 [class.friend]p11.
3048
    LookupLocalFriendName,
3049
    /// Look up the name of an Objective-C protocol.
3050
    LookupObjCProtocolName,
3051
    /// Look up implicit 'self' parameter of an objective-c method.
3052
    LookupObjCImplicitSelfParam,
3053
    /// Look up the name of an OpenMP user-defined reduction operation.
3054
    LookupOMPReductionName,
3055
    /// Look up any declaration with any name.
3056
    LookupAnyName
3057
  };
3058
3059
  /// Specifies whether (or how) name lookup is being performed for a
3060
  /// redeclaration (vs. a reference).
3061
  enum RedeclarationKind {
3062
    /// The lookup is a reference to this name that is not for the
3063
    /// purpose of redeclaring the name.
3064
    NotForRedeclaration = 0,
3065
    /// The lookup results will be used for redeclaration of a name,
3066
    /// if an entity by that name already exists and is visible.
3067
    ForVisibleRedeclaration,
3068
    /// The lookup results will be used for redeclaration of a name
3069
    /// with external linkage; non-visible lookup results with external linkage
3070
    /// may also be found.
3071
    ForExternalRedeclaration
3072
  };
3073
3074
10.7M
  RedeclarationKind forRedeclarationInCurContext() {
3075
10.7M
    // A declaration with an owning module for linkage can never link against
3076
10.7M
    // anything that is not visible. We don't need to check linkage here; if
3077
10.7M
    // the context has internal linkage, redeclaration lookup won't find things
3078
10.7M
    // from other TUs, and we can't safely compute linkage yet in general.
3079
10.7M
    if (cast<Decl>(CurContext)
3080
10.7M
            ->getOwningModuleForLinkage(/*IgnoreLinkage*/true))
3081
271
      return ForVisibleRedeclaration;
3082
10.7M
    return ForExternalRedeclaration;
3083
10.7M
  }
3084
3085
  /// The possible outcomes of name lookup for a literal operator.
3086
  enum LiteralOperatorLookupResult {
3087
    /// The lookup resulted in an error.
3088
    LOLR_Error,
3089
    /// The lookup found no match but no diagnostic was issued.
3090
    LOLR_ErrorNoDiagnostic,
3091
    /// The lookup found a single 'cooked' literal operator, which
3092
    /// expects a normal literal to be built and passed to it.
3093
    LOLR_Cooked,
3094
    /// The lookup found a single 'raw' literal operator, which expects
3095
    /// a string literal containing the spelling of the literal token.
3096
    LOLR_Raw,
3097
    /// The lookup found an overload set of literal operator templates,
3098
    /// which expect the characters of the spelling of the literal token to be
3099
    /// passed as a non-type template argument pack.
3100
    LOLR_Template,
3101
    /// The lookup found an overload set of literal operator templates,
3102
    /// which expect the character type and characters of the spelling of the
3103
    /// string literal token to be passed as template arguments.
3104
    LOLR_StringTemplate
3105
  };
3106
3107
  SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D,
3108
                                                  CXXSpecialMember SM,
3109
                                                  bool ConstArg,
3110
                                                  bool VolatileArg,
3111
                                                  bool RValueThis,
3112
                                                  bool ConstThis,
3113
                                                  bool VolatileThis);
3114
3115
  typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
3116
  typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
3117
      TypoRecoveryCallback;
3118
3119
private:
3120
  bool CppLookupName(LookupResult &R, Scope *S);
3121
3122
  struct TypoExprState {
3123
    std::unique_ptr<TypoCorrectionConsumer> Consumer;
3124
    TypoDiagnosticGenerator DiagHandler;
3125
    TypoRecoveryCallback RecoveryHandler;
3126
    TypoExprState();
3127
    TypoExprState(TypoExprState &&other) noexcept;
3128
    TypoExprState &operator=(TypoExprState &&other) noexcept;
3129
  };
3130
3131
  /// The set of unhandled TypoExprs and their associated state.
3132
  llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos;
3133
3134
  /// Creates a new TypoExpr AST node.
3135
  TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC,
3136
                              TypoDiagnosticGenerator TDG,
3137
                              TypoRecoveryCallback TRC);
3138
3139
  // The set of known/encountered (unique, canonicalized) NamespaceDecls.
3140
  //
3141
  // The boolean value will be true to indicate that the namespace was loaded
3142
  // from an AST/PCH file, or false otherwise.
3143
  llvm::MapVector<NamespaceDecl*, bool> KnownNamespaces;
3144
3145
  /// Whether we have already loaded known namespaces from an extenal
3146
  /// source.
3147
  bool LoadedExternalKnownNamespaces;
3148
3149
  /// Helper for CorrectTypo and CorrectTypoDelayed used to create and
3150
  /// populate a new TypoCorrectionConsumer. Returns nullptr if typo correction
3151
  /// should be skipped entirely.
3152
  std::unique_ptr<TypoCorrectionConsumer>
3153
  makeTypoCorrectionConsumer(const DeclarationNameInfo &Typo,
3154
                             Sema::LookupNameKind LookupKind, Scope *S,
3155
                             CXXScopeSpec *SS,
3156
                             std::unique_ptr<CorrectionCandidateCallback> CCC,
3157
                             DeclContext *MemberContext, bool EnteringContext,
3158
                             const ObjCObjectPointerType *OPT,
3159
                             bool ErrorRecovery);
3160
3161
public:
3162
  const TypoExprState &getTypoExprState(TypoExpr *TE) const;
3163
3164
  /// Clears the state of the given TypoExpr.
3165
  void clearDelayedTypo(TypoExpr *TE);
3166
3167
  /// Look up a name, looking for a single declaration.  Return
3168
  /// null if the results were absent, ambiguous, or overloaded.
3169
  ///
3170
  /// It is preferable to use the elaborated form and explicitly handle
3171
  /// ambiguity and overloaded.
3172
  NamedDecl *LookupSingleName(Scope *S, DeclarationName Name,
3173
                              SourceLocation Loc,
3174
                              LookupNameKind NameKind,
3175
                              RedeclarationKind Redecl
3176
                                = NotForRedeclaration);
3177
  bool LookupName(LookupResult &R, Scope *S,
3178
                  bool AllowBuiltinCreation = false);
3179
  bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
3180
                           bool InUnqualifiedLookup = false);
3181
  bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
3182
                           CXXScopeSpec &SS);
3183
  bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS,
3184
                        bool AllowBuiltinCreation = false,
3185
                        bool EnteringContext = false);
3186
  ObjCProtocolDecl *LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc,
3187
                                   RedeclarationKind Redecl
3188
                                     = NotForRedeclaration);
3189
  bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class);
3190
3191
  void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S,
3192
                                    QualType T1, QualType T2,
3193
                                    UnresolvedSetImpl &Functions);
3194
3195
  LabelDecl *LookupOrCreateLabel(IdentifierInfo *II, SourceLocation IdentLoc,
3196
                                 SourceLocation GnuLabelLoc = SourceLocation());
3197
3198
  DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class);
3199
  CXXConstructorDecl *LookupDefaultConstructor(CXXRecordDecl *Class);
3200
  CXXConstructorDecl *LookupCopyingConstructor(CXXRecordDecl *Class,
3201
                                               unsigned Quals);
3202
  CXXMethodDecl *LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals,
3203
                                         bool RValueThis, unsigned ThisQuals);
3204
  CXXConstructorDecl *LookupMovingConstructor(CXXRecordDecl *Class,
3205
                                              unsigned Quals);
3206
  CXXMethodDecl *LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals,
3207
                                        bool RValueThis, unsigned ThisQuals);
3208
  CXXDestructorDecl *LookupDestructor(CXXRecordDecl *Class);
3209
3210
  bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id);
3211
  LiteralOperatorLookupResult LookupLiteralOperator(Scope *S, LookupResult &R,
3212
                                                    ArrayRef<QualType> ArgTys,
3213
                                                    bool AllowRaw,
3214
                                                    bool AllowTemplate,
3215
                                                    bool AllowStringTemplate,
3216
                                                    bool DiagnoseMissing);
3217
  bool isKnownName(StringRef name);
3218
3219
  void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc,
3220
                               ArrayRef<Expr *> Args, ADLResult &Functions);
3221
3222
  void LookupVisibleDecls(Scope *S, LookupNameKind Kind,
3223
                          VisibleDeclConsumer &Consumer,
3224
                          bool IncludeGlobalScope = true,
3225
                          bool LoadExternal = true);
3226
  void LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind,
3227
                          VisibleDeclConsumer &Consumer,
3228
                          bool IncludeGlobalScope = true,
3229
                          bool IncludeDependentBases = false,
3230
                          bool LoadExternal = true);
3231
3232
  enum CorrectTypoKind {
3233
    CTK_NonError,     // CorrectTypo used in a non error recovery situation.
3234
    CTK_ErrorRecovery // CorrectTypo used in normal error recovery.
3235
  };
3236
3237
  TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo,
3238
                             Sema::LookupNameKind LookupKind,
3239
                             Scope *S, CXXScopeSpec *SS,
3240
                             std::unique_ptr<CorrectionCandidateCallback> CCC,
3241
                             CorrectTypoKind Mode,
3242
                             DeclContext *MemberContext = nullptr,
3243
                             bool EnteringContext = false,
3244
                             const ObjCObjectPointerType *OPT = nullptr,
3245
                             bool RecordFailure = true);
3246
3247
  TypoExpr *CorrectTypoDelayed(const DeclarationNameInfo &Typo,
3248
                               Sema::LookupNameKind LookupKind, Scope *S,
3249
                               CXXScopeSpec *SS,
3250
                               std::unique_ptr<CorrectionCandidateCallback> CCC,
3251
                               TypoDiagnosticGenerator TDG,
3252
                               TypoRecoveryCallback TRC, CorrectTypoKind Mode,
3253
                               DeclContext *MemberContext = nullptr,
3254
                               bool EnteringContext = false,
3255
                               const ObjCObjectPointerType *OPT = nullptr);
3256
3257
  /// Process any TypoExprs in the given Expr and its children,
3258
  /// generating diagnostics as appropriate and returning a new Expr if there
3259
  /// were typos that were all successfully corrected and ExprError if one or
3260
  /// more typos could not be corrected.
3261
  ///
3262
  /// \param E The Expr to check for TypoExprs.
3263
  ///
3264
  /// \param InitDecl A VarDecl to avoid because the Expr being corrected is its
3265
  /// initializer.
3266
  ///
3267
  /// \param Filter A function applied to a newly rebuilt Expr to determine if
3268
  /// it is an acceptable/usable result from a single combination of typo
3269
  /// corrections. As long as the filter returns ExprError, different
3270
  /// combinations of corrections will be tried until all are exhausted.
3271
  ExprResult
3272
  CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl = nullptr,
3273
                            llvm::function_ref<ExprResult(Expr *)> Filter =
3274
319
                                [](Expr *E) -> ExprResult { return E; });
3275
3276
  ExprResult
3277
  CorrectDelayedTyposInExpr(Expr *E,
3278
10.6M
                            llvm::function_ref<ExprResult(Expr *)> Filter) {
3279
10.6M
    return CorrectDelayedTyposInExpr(E, nullptr, Filter);
3280
10.6M
  }
3281
3282
  ExprResult
3283
  CorrectDelayedTyposInExpr(ExprResult ER, VarDecl *InitDecl = nullptr,
3284
                            llvm::function_ref<ExprResult(Expr *)> Filter =
3285
10.5M
                                [](Expr *E) -> ExprResult 
{ return E; }37
) {
3286
10.5M
    return ER.isInvalid() ? 
ER19.3k
:
CorrectDelayedTyposInExpr(ER.get(), Filter)10.5M
;
3287
10.5M
  }
3288
3289
  ExprResult
3290
  CorrectDelayedTyposInExpr(ExprResult ER,
3291
2.57M
                            llvm::function_ref<ExprResult(Expr *)> Filter) {
3292
2.57M
    return CorrectDelayedTyposInExpr(ER, nullptr, Filter);
3293
2.57M
  }
3294
3295
  void diagnoseTypo(const TypoCorrection &Correction,
3296
                    const PartialDiagnostic &TypoDiag,
3297
                    bool ErrorRecovery = true);
3298
3299
  void diagnoseTypo(const TypoCorrection &Correction,
3300
                    const PartialDiagnostic &TypoDiag,
3301
                    const PartialDiagnostic &PrevNote,
3302
                    bool ErrorRecovery = true);
3303
3304
  void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F);
3305
3306
  void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc,
3307
                                          ArrayRef<Expr *> Args,
3308
                                   AssociatedNamespaceSet &AssociatedNamespaces,
3309
                                   AssociatedClassSet &AssociatedClasses);
3310
3311
  void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S,
3312
                            bool ConsiderLinkage, bool AllowInlineNamespace);
3313
3314
  bool CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old);
3315
3316
  void DiagnoseAmbiguousLookup(LookupResult &Result);
3317
  //@}
3318
3319
  ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *&Id,
3320
                                          SourceLocation IdLoc,
3321
                                          bool TypoCorrection = false);
3322
  NamedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID,
3323
                                 Scope *S, bool ForRedeclaration,
3324
                                 SourceLocation Loc);
3325
  NamedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
3326
                                      Scope *S);
3327
  void AddKnownFunctionAttributes(FunctionDecl *FD);
3328
3329
  // More parsing and symbol