Coverage Report

Created: 2018-09-23 22:08

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