Coverage Report

Created: 2020-09-22 08:39

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/AST/Decl.h
Line
Count
Source (jump to first uncovered line)
1
//===- Decl.h - Classes for representing declarations -----------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
//  This file defines the Decl subclasses.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_AST_DECL_H
14
#define LLVM_CLANG_AST_DECL_H
15
16
#include "clang/AST/APValue.h"
17
#include "clang/AST/ASTContextAllocate.h"
18
#include "clang/AST/DeclAccessPair.h"
19
#include "clang/AST/DeclBase.h"
20
#include "clang/AST/DeclarationName.h"
21
#include "clang/AST/ExternalASTSource.h"
22
#include "clang/AST/NestedNameSpecifier.h"
23
#include "clang/AST/Redeclarable.h"
24
#include "clang/AST/Type.h"
25
#include "clang/Basic/AddressSpaces.h"
26
#include "clang/Basic/Diagnostic.h"
27
#include "clang/Basic/IdentifierTable.h"
28
#include "clang/Basic/LLVM.h"
29
#include "clang/Basic/Linkage.h"
30
#include "clang/Basic/OperatorKinds.h"
31
#include "clang/Basic/PartialDiagnostic.h"
32
#include "clang/Basic/PragmaKinds.h"
33
#include "clang/Basic/SourceLocation.h"
34
#include "clang/Basic/Specifiers.h"
35
#include "clang/Basic/Visibility.h"
36
#include "llvm/ADT/APSInt.h"
37
#include "llvm/ADT/ArrayRef.h"
38
#include "llvm/ADT/Optional.h"
39
#include "llvm/ADT/PointerIntPair.h"
40
#include "llvm/ADT/PointerUnion.h"
41
#include "llvm/ADT/StringRef.h"
42
#include "llvm/ADT/iterator_range.h"
43
#include "llvm/Support/Casting.h"
44
#include "llvm/Support/Compiler.h"
45
#include "llvm/Support/TrailingObjects.h"
46
#include <cassert>
47
#include <cstddef>
48
#include <cstdint>
49
#include <string>
50
#include <utility>
51
52
namespace clang {
53
54
class ASTContext;
55
struct ASTTemplateArgumentListInfo;
56
class Attr;
57
class CompoundStmt;
58
class DependentFunctionTemplateSpecializationInfo;
59
class EnumDecl;
60
class Expr;
61
class FunctionTemplateDecl;
62
class FunctionTemplateSpecializationInfo;
63
class FunctionTypeLoc;
64
class LabelStmt;
65
class MemberSpecializationInfo;
66
class Module;
67
class NamespaceDecl;
68
class ParmVarDecl;
69
class RecordDecl;
70
class Stmt;
71
class StringLiteral;
72
class TagDecl;
73
class TemplateArgumentList;
74
class TemplateArgumentListInfo;
75
class TemplateParameterList;
76
class TypeAliasTemplateDecl;
77
class TypeLoc;
78
class UnresolvedSetImpl;
79
class VarTemplateDecl;
80
81
/// The top declaration context.
82
class TranslationUnitDecl : public Decl, public DeclContext {
83
  ASTContext &Ctx;
84
85
  /// The (most recently entered) anonymous namespace for this
86
  /// translation unit, if one has been created.
87
  NamespaceDecl *AnonymousNamespace = nullptr;
88
89
  explicit TranslationUnitDecl(ASTContext &ctx);
90
91
  virtual void anchor();
92
93
public:
94
1.91G
  ASTContext &getASTContext() const { return Ctx; }
95
96
6.52k
  NamespaceDecl *getAnonymousNamespace() const { return AnonymousNamespace; }
97
1.34k
  void setAnonymousNamespace(NamespaceDecl *D) { AnonymousNamespace = D; }
98
99
  static TranslationUnitDecl *Create(ASTContext &C);
100
101
  // Implement isa/cast/dyncast/etc.
102
2.11G
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
103
4.06G
  static bool classofKind(Kind K) { return K == TranslationUnit; }
104
35.3k
  static DeclContext *castToDeclContext(const TranslationUnitDecl *D) {
105
35.3k
    return static_cast<DeclContext *>(const_cast<TranslationUnitDecl*>(D));
106
35.3k
  }
107
0
  static TranslationUnitDecl *castFromDeclContext(const DeclContext *DC) {
108
0
    return static_cast<TranslationUnitDecl *>(const_cast<DeclContext*>(DC));
109
0
  }
110
};
111
112
/// Represents a `#pragma comment` line. Always a child of
113
/// TranslationUnitDecl.
114
class PragmaCommentDecl final
115
    : public Decl,
116
      private llvm::TrailingObjects<PragmaCommentDecl, char> {
117
  friend class ASTDeclReader;
118
  friend class ASTDeclWriter;
119
  friend TrailingObjects;
120
121
  PragmaMSCommentKind CommentKind;
122
123
  PragmaCommentDecl(TranslationUnitDecl *TU, SourceLocation CommentLoc,
124
                    PragmaMSCommentKind CommentKind)
125
58
      : Decl(PragmaComment, TU, CommentLoc), CommentKind(CommentKind) {}
126
127
  virtual void anchor();
128
129
public:
130
  static PragmaCommentDecl *Create(const ASTContext &C, TranslationUnitDecl *DC,
131
                                   SourceLocation CommentLoc,
132
                                   PragmaMSCommentKind CommentKind,
133
                                   StringRef Arg);
134
  static PragmaCommentDecl *CreateDeserialized(ASTContext &C, unsigned ID,
135
                                               unsigned ArgSize);
136
137
48
  PragmaMSCommentKind getCommentKind() const { return CommentKind; }
138
139
48
  StringRef getArg() const { return getTrailingObjects<char>(); }
140
141
  // Implement isa/cast/dyncast/etc.
142
5.77M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
143
5.77M
  static bool classofKind(Kind K) { return K == PragmaComment; }
144
};
145
146
/// Represents a `#pragma detect_mismatch` line. Always a child of
147
/// TranslationUnitDecl.
148
class PragmaDetectMismatchDecl final
149
    : public Decl,
150
      private llvm::TrailingObjects<PragmaDetectMismatchDecl, char> {
151
  friend class ASTDeclReader;
152
  friend class ASTDeclWriter;
153
  friend TrailingObjects;
154
155
  size_t ValueStart;
156
157
  PragmaDetectMismatchDecl(TranslationUnitDecl *TU, SourceLocation Loc,
158
                           size_t ValueStart)
159
18
      : Decl(PragmaDetectMismatch, TU, Loc), ValueStart(ValueStart) {}
160
161
  virtual void anchor();
162
163
public:
164
  static PragmaDetectMismatchDecl *Create(const ASTContext &C,
165
                                          TranslationUnitDecl *DC,
166
                                          SourceLocation Loc, StringRef Name,
167
                                          StringRef Value);
168
  static PragmaDetectMismatchDecl *
169
  CreateDeserialized(ASTContext &C, unsigned ID, unsigned NameValueSize);
170
171
16
  StringRef getName() const { return getTrailingObjects<char>(); }
172
16
  StringRef getValue() const { return getTrailingObjects<char>() + ValueStart; }
173
174
  // Implement isa/cast/dyncast/etc.
175
5.77M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
176
5.77M
  static bool classofKind(Kind K) { return K == PragmaDetectMismatch; }
177
};
178
179
/// Declaration context for names declared as extern "C" in C++. This
180
/// is neither the semantic nor lexical context for such declarations, but is
181
/// used to check for conflicts with other extern "C" declarations. Example:
182
///
183
/// \code
184
///   namespace N { extern "C" void f(); } // #1
185
///   void N::f() {}                       // #2
186
///   namespace M { extern "C" void f(); } // #3
187
/// \endcode
188
///
189
/// The semantic context of #1 is namespace N and its lexical context is the
190
/// LinkageSpecDecl; the semantic context of #2 is namespace N and its lexical
191
/// context is the TU. However, both declarations are also visible in the
192
/// extern "C" context.
193
///
194
/// The declaration at #3 finds it is a redeclaration of \c N::f through
195
/// lookup in the extern "C" context.
196
class ExternCContextDecl : public Decl, public DeclContext {
197
  explicit ExternCContextDecl(TranslationUnitDecl *TU)
198
    : Decl(ExternCContext, TU, SourceLocation()),
199
58.2k
      DeclContext(ExternCContext) {}
200
201
  virtual void anchor();
202
203
public:
204
  static ExternCContextDecl *Create(const ASTContext &C,
205
                                    TranslationUnitDecl *TU);
206
207
  // Implement isa/cast/dyncast/etc.
208
0
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
209
0
  static bool classofKind(Kind K) { return K == ExternCContext; }
210
0
  static DeclContext *castToDeclContext(const ExternCContextDecl *D) {
211
0
    return static_cast<DeclContext *>(const_cast<ExternCContextDecl*>(D));
212
0
  }
213
0
  static ExternCContextDecl *castFromDeclContext(const DeclContext *DC) {
214
0
    return static_cast<ExternCContextDecl *>(const_cast<DeclContext*>(DC));
215
0
  }
216
};
217
218
/// This represents a decl that may have a name.  Many decls have names such
219
/// as ObjCMethodDecl, but not \@class, etc.
220
///
221
/// Note that not every NamedDecl is actually named (e.g., a struct might
222
/// be anonymous), and not every name is an identifier.
223
class NamedDecl : public Decl {
224
  /// The name of this declaration, which is typically a normal
225
  /// identifier but may also be a special kind of name (C++
226
  /// constructor, Objective-C selector, etc.)
227
  DeclarationName Name;
228
229
  virtual void anchor();
230
231
private:
232
  NamedDecl *getUnderlyingDeclImpl() LLVM_READONLY;
233
234
protected:
235
  NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)
236
93.7M
      : Decl(DK, DC, L), Name(N) {}
237
238
public:
239
  /// Get the identifier that names this declaration, if there is one.
240
  ///
241
  /// This will return NULL if this declaration has no name (e.g., for
242
  /// an unnamed class) or if the name is a special name (C++ constructor,
243
  /// Objective-C selector, etc.).
244
173M
  IdentifierInfo *getIdentifier() const { return Name.getAsIdentifierInfo(); }
245
246
  /// Get the name of identifier for this declaration as a StringRef.
247
  ///
248
  /// This requires that the declaration have a name and that it be a simple
249
  /// identifier.
250
6.12M
  StringRef getName() const {
251
6.12M
    assert(Name.isIdentifier() && "Name is not a simple identifier");
252
5.94M
    return getIdentifier() ? getIdentifier()->getName() : 
""176k
;
253
6.12M
  }
254
255
  /// Get a human-readable name for the declaration, even if it is one of the
256
  /// special kinds of names (C++ constructor, Objective-C selector, etc).
257
  ///
258
  /// Creating this name requires expensive string manipulation, so it should
259
  /// be called only when performance doesn't matter. For simple declarations,
260
  /// getNameAsCString() should suffice.
261
  //
262
  // FIXME: This function should be renamed to indicate that it is not just an
263
  // alternate form of getName(), and clients should move as appropriate.
264
  //
265
  // FIXME: Deprecated, move clients to getName().
266
90.8k
  std::string getNameAsString() const { return Name.getAsString(); }
267
268
  /// Pretty-print the unqualified name of this declaration. Can be overloaded
269
  /// by derived classes to provide a more user-friendly name when appropriate.
270
  virtual void printName(raw_ostream &os) const;
271
272
  /// Get the actual, stored name of the declaration, which may be a special
273
  /// name.
274
  ///
275
  /// Note that generally in diagnostics, the non-null \p NamedDecl* itself
276
  /// should be sent into the diagnostic instead of using the result of
277
  /// \p getDeclName().
278
  ///
279
  /// A \p DeclarationName in a diagnostic will just be streamed to the output,
280
  /// which will directly result in a call to \p DeclarationName::print.
281
  ///
282
  /// A \p NamedDecl* in a diagnostic will also ultimately result in a call to
283
  /// \p DeclarationName::print, but with two customisation points along the
284
  /// way (\p getNameForDiagnostic and \p printName). These are used to print
285
  /// the template arguments if any, and to provide a user-friendly name for
286
  /// some entities (such as unnamed variables and anonymous records).
287
850M
  DeclarationName getDeclName() const { return Name; }
288
289
  /// Set the name of this declaration.
290
4.76M
  void setDeclName(DeclarationName N) { Name = N; }
291
292
  /// Returns a human-readable qualified name for this declaration, like
293
  /// A::B::i, for i being member of namespace A::B.
294
  ///
295
  /// If the declaration is not a member of context which can be named (record,
296
  /// namespace), it will return the same result as printName().
297
  ///
298
  /// Creating this name is expensive, so it should be called only when
299
  /// performance doesn't matter.
300
  void printQualifiedName(raw_ostream &OS) const;
301
  void printQualifiedName(raw_ostream &OS, const PrintingPolicy &Policy) const;
302
303
  /// Print only the nested name specifier part of a fully-qualified name,
304
  /// including the '::' at the end. E.g.
305
  ///    when `printQualifiedName(D)` prints "A::B::i",
306
  ///    this function prints "A::B::".
307
  void printNestedNameSpecifier(raw_ostream &OS) const;
308
  void printNestedNameSpecifier(raw_ostream &OS,
309
                                const PrintingPolicy &Policy) const;
310
311
  // FIXME: Remove string version.
312
  std::string getQualifiedNameAsString() const;
313
314
  /// Appends a human-readable name for this declaration into the given stream.
315
  ///
316
  /// This is the method invoked by Sema when displaying a NamedDecl
317
  /// in a diagnostic.  It does not necessarily produce the same
318
  /// result as printName(); for example, class template
319
  /// specializations are printed with their template arguments.
320
  virtual void getNameForDiagnostic(raw_ostream &OS,
321
                                    const PrintingPolicy &Policy,
322
                                    bool Qualified) const;
323
324
  /// Determine whether this declaration, if known to be well-formed within
325
  /// its context, will replace the declaration OldD if introduced into scope.
326
  ///
327
  /// A declaration will replace another declaration if, for example, it is
328
  /// a redeclaration of the same variable or function, but not if it is a
329
  /// declaration of a different kind (function vs. class) or an overloaded
330
  /// function.
331
  ///
332
  /// \param IsKnownNewer \c true if this declaration is known to be newer
333
  /// than \p OldD (for instance, if this declaration is newly-created).
334
  bool declarationReplaces(NamedDecl *OldD, bool IsKnownNewer = true) const;
335
336
  /// Determine whether this declaration has linkage.
337
  bool hasLinkage() const;
338
339
  using Decl::isModulePrivate;
340
  using Decl::setModulePrivate;
341
342
  /// Determine whether this declaration is a C++ class member.
343
28.9M
  bool isCXXClassMember() const {
344
28.9M
    const DeclContext *DC = getDeclContext();
345
346
    // C++0x [class.mem]p1:
347
    //   The enumerators of an unscoped enumeration defined in
348
    //   the class are members of the class.
349
28.9M
    if (isa<EnumDecl>(DC))
350
528k
      DC = DC->getRedeclContext();
351
352
28.9M
    return DC->isRecord();
353
28.9M
  }
354
355
  /// Determine whether the given declaration is an instance member of
356
  /// a C++ class.
357
  bool isCXXInstanceMember() const;
358
359
  /// Determine what kind of linkage this entity has.
360
  ///
361
  /// This is not the linkage as defined by the standard or the codegen notion
362
  /// of linkage. It is just an implementation detail that is used to compute
363
  /// those.
364
  Linkage getLinkageInternal() const;
365
366
  /// Get the linkage from a semantic point of view. Entities in
367
  /// anonymous namespaces are external (in c++98).
368
5.69M
  Linkage getFormalLinkage() const {
369
5.69M
    return clang::getFormalLinkage(getLinkageInternal());
370
5.69M
  }
371
372
  /// True if this decl has external linkage.
373
32.3M
  bool hasExternalFormalLinkage() const {
374
32.3M
    return isExternalFormalLinkage(getLinkageInternal());
375
32.3M
  }
376
377
37.4M
  bool isExternallyVisible() const {
378
37.4M
    return clang::isExternallyVisible(getLinkageInternal());
379
37.4M
  }
380
381
  /// Determine whether this declaration can be redeclared in a
382
  /// different translation unit.
383
15.0k
  bool isExternallyDeclarable() const {
384
15.0k
    return isExternallyVisible() && 
!getOwningModuleForLinkage()14.9k
;
385
15.0k
  }
386
387
  /// Determines the visibility of this entity.
388
3.98k
  Visibility getVisibility() const {
389
3.98k
    return getLinkageAndVisibility().getVisibility();
390
3.98k
  }
391
392
  /// Determines the linkage and visibility of this entity.
393
  LinkageInfo getLinkageAndVisibility() const;
394
395
  /// Kinds of explicit visibility.
396
  enum ExplicitVisibilityKind {
397
    /// Do an LV computation for, ultimately, a type.
398
    /// Visibility may be restricted by type visibility settings and
399
    /// the visibility of template arguments.
400
    VisibilityForType,
401
402
    /// Do an LV computation for, ultimately, a non-type declaration.
403
    /// Visibility may be restricted by value visibility settings and
404
    /// the visibility of template arguments.
405
    VisibilityForValue
406
  };
407
408
  /// If visibility was explicitly specified for this
409
  /// declaration, return that visibility.
410
  Optional<Visibility>
411
  getExplicitVisibility(ExplicitVisibilityKind kind) const;
412
413
  /// True if the computed linkage is valid. Used for consistency
414
  /// checking. Should always return true.
415
  bool isLinkageValid() const;
416
417
  /// True if something has required us to compute the linkage
418
  /// of this declaration.
419
  ///
420
  /// Language features which can retroactively change linkage (like a
421
  /// typedef name for linkage purposes) may need to consider this,
422
  /// but hopefully only in transitory ways during parsing.
423
204k
  bool hasLinkageBeenComputed() const {
424
204k
    return hasCachedLinkage();
425
204k
  }
426
427
  /// Looks through UsingDecls and ObjCCompatibleAliasDecls for
428
  /// the underlying named decl.
429
341M
  NamedDecl *getUnderlyingDecl() {
430
    // Fast-path the common case.
431
341M
    if (this->getKind() != UsingShadow &&
432
340M
        this->getKind() != ConstructorUsingShadow &&
433
340M
        this->getKind() != ObjCCompatibleAlias &&
434
340M
        this->getKind() != NamespaceAlias)
435
340M
      return this;
436
437
1.38M
    return getUnderlyingDeclImpl();
438
1.38M
  }
439
1.51M
  const NamedDecl *getUnderlyingDecl() const {
440
1.51M
    return const_cast<NamedDecl*>(this)->getUnderlyingDecl();
441
1.51M
  }
442
443
27.5M
  NamedDecl *getMostRecentDecl() {
444
27.5M
    return cast<NamedDecl>(static_cast<Decl *>(this)->getMostRecentDecl());
445
27.5M
  }
446
20.3M
  const NamedDecl *getMostRecentDecl() const {
447
20.3M
    return const_cast<NamedDecl*>(this)->getMostRecentDecl();
448
20.3M
  }
449
450
  ObjCStringFormatFamily getObjCFStringFormattingFamily() const;
451
452
520M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
453
528M
  static bool classofKind(Kind K) { return K >= firstNamed && 
K <= lastNamed526M
; }
454
};
455
456
738k
inline raw_ostream &operator<<(raw_ostream &OS, const NamedDecl &ND) {
457
738k
  ND.printName(OS);
458
738k
  return OS;
459
738k
}
460
461
/// Represents the declaration of a label.  Labels also have a
462
/// corresponding LabelStmt, which indicates the position that the label was
463
/// defined at.  For normal labels, the location of the decl is the same as the
464
/// location of the statement.  For GNU local labels (__label__), the decl
465
/// location is where the __label__ is.
466
class LabelDecl : public NamedDecl {
467
  LabelStmt *TheStmt;
468
  StringRef MSAsmName;
469
  bool MSAsmNameResolved = false;
470
471
  /// For normal labels, this is the same as the main declaration
472
  /// label, i.e., the location of the identifier; for GNU local labels,
473
  /// this is the location of the __label__ keyword.
474
  SourceLocation LocStart;
475
476
  LabelDecl(DeclContext *DC, SourceLocation IdentL, IdentifierInfo *II,
477
            LabelStmt *S, SourceLocation StartL)
478
4.38k
      : NamedDecl(Label, DC, IdentL, II), TheStmt(S), LocStart(StartL) {}
479
480
  void anchor() override;
481
482
public:
483
  static LabelDecl *Create(ASTContext &C, DeclContext *DC,
484
                           SourceLocation IdentL, IdentifierInfo *II);
485
  static LabelDecl *Create(ASTContext &C, DeclContext *DC,
486
                           SourceLocation IdentL, IdentifierInfo *II,
487
                           SourceLocation GnuLabelL);
488
  static LabelDecl *CreateDeserialized(ASTContext &C, unsigned ID);
489
490
19.1k
  LabelStmt *getStmt() const { return TheStmt; }
491
3.99k
  void setStmt(LabelStmt *T) { TheStmt = T; }
492
493
8.24k
  bool isGnuLocal() const { return LocStart != getLocation(); }
494
3.97k
  void setLocStart(SourceLocation L) { LocStart = L; }
495
496
603
  SourceRange getSourceRange() const override LLVM_READONLY {
497
603
    return SourceRange(LocStart, getLocation());
498
603
  }
499
500
12.0k
  bool isMSAsmLabel() const { return !MSAsmName.empty(); }
501
28
  bool isResolvedMSAsmLabel() const { return isMSAsmLabel() && MSAsmNameResolved; }
502
  void setMSAsmLabel(StringRef Name);
503
43
  StringRef getMSAsmLabel() const { return MSAsmName; }
504
18
  void setMSAsmLabelResolved() { MSAsmNameResolved = true; }
505
506
  // Implement isa/cast/dyncast/etc.
507
83.7M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
508
83.7M
  static bool classofKind(Kind K) { return K == Label; }
509
};
510
511
/// Represent a C++ namespace.
512
class NamespaceDecl : public NamedDecl, public DeclContext,
513
                      public Redeclarable<NamespaceDecl>
514
{
515
  /// The starting location of the source range, pointing
516
  /// to either the namespace or the inline keyword.
517
  SourceLocation LocStart;
518
519
  /// The ending location of the source range.
520
  SourceLocation RBraceLoc;
521
522
  /// A pointer to either the anonymous namespace that lives just inside
523
  /// this namespace or to the first namespace in the chain (the latter case
524
  /// only when this is not the first in the chain), along with a
525
  /// boolean value indicating whether this is an inline namespace.
526
  llvm::PointerIntPair<NamespaceDecl *, 1, bool> AnonOrFirstNamespaceAndInline;
527
528
  NamespaceDecl(ASTContext &C, DeclContext *DC, bool Inline,
529
                SourceLocation StartLoc, SourceLocation IdLoc,
530
                IdentifierInfo *Id, NamespaceDecl *PrevDecl);
531
532
  using redeclarable_base = Redeclarable<NamespaceDecl>;
533
534
  NamespaceDecl *getNextRedeclarationImpl() override;
535
  NamespaceDecl *getPreviousDeclImpl() override;
536
  NamespaceDecl *getMostRecentDeclImpl() override;
537
538
public:
539
  friend class ASTDeclReader;
540
  friend class ASTDeclWriter;
541
542
  static NamespaceDecl *Create(ASTContext &C, DeclContext *DC,
543
                               bool Inline, SourceLocation StartLoc,
544
                               SourceLocation IdLoc, IdentifierInfo *Id,
545
                               NamespaceDecl *PrevDecl);
546
547
  static NamespaceDecl *CreateDeserialized(ASTContext &C, unsigned ID);
548
549
  using redecl_range = redeclarable_base::redecl_range;
550
  using redecl_iterator = redeclarable_base::redecl_iterator;
551
552
  using redeclarable_base::redecls_begin;
553
  using redeclarable_base::redecls_end;
554
  using redeclarable_base::redecls;
555
  using redeclarable_base::getPreviousDecl;
556
  using redeclarable_base::getMostRecentDecl;
557
  using redeclarable_base::isFirstDecl;
558
559
  /// Returns true if this is an anonymous namespace declaration.
560
  ///
561
  /// For example:
562
  /// \code
563
  ///   namespace {
564
  ///     ...
565
  ///   };
566
  /// \endcode
567
  /// q.v. C++ [namespace.unnamed]
568
3.55M
  bool isAnonymousNamespace() const {
569
3.55M
    return !getIdentifier();
570
3.55M
  }
571
572
  /// Returns true if this is an inline namespace declaration.
573
3.52M
  bool isInline() const {
574
3.52M
    return AnonOrFirstNamespaceAndInline.getInt();
575
3.52M
  }
576
577
  /// Set whether this is an inline namespace declaration.
578
184k
  void setInline(bool Inline) {
579
184k
    AnonOrFirstNamespaceAndInline.setInt(Inline);
580
184k
  }
581
582
  /// Get the original (first) namespace declaration.
583
  NamespaceDecl *getOriginalNamespace();
584
585
  /// Get the original (first) namespace declaration.
586
  const NamespaceDecl *getOriginalNamespace() const;
587
588
  /// Return true if this declaration is an original (first) declaration
589
  /// of the namespace. This is false for non-original (subsequent) namespace
590
  /// declarations and anonymous namespaces.
591
  bool isOriginalNamespace() const;
592
593
  /// Retrieve the anonymous namespace nested inside this namespace,
594
  /// if any.
595
1.74k
  NamespaceDecl *getAnonymousNamespace() const {
596
1.74k
    return getOriginalNamespace()->AnonOrFirstNamespaceAndInline.getPointer();
597
1.74k
  }
598
599
745
  void setAnonymousNamespace(NamespaceDecl *D) {
600
745
    getOriginalNamespace()->AnonOrFirstNamespaceAndInline.setPointer(D);
601
745
  }
602
603
  /// Retrieves the canonical declaration of this namespace.
604
11.7M
  NamespaceDecl *getCanonicalDecl() override {
605
11.7M
    return getOriginalNamespace();
606
11.7M
  }
607
0
  const NamespaceDecl *getCanonicalDecl() const {
608
0
    return getOriginalNamespace();
609
0
  }
610
611
867
  SourceRange getSourceRange() const override LLVM_READONLY {
612
867
    return SourceRange(LocStart, RBraceLoc);
613
867
  }
614
615
6.70k
  SourceLocation getBeginLoc() const LLVM_READONLY { return LocStart; }
616
6.70k
  SourceLocation getRBraceLoc() const { return RBraceLoc; }
617
0
  void setLocStart(SourceLocation L) { LocStart = L; }
618
73.0k
  void setRBraceLoc(SourceLocation L) { RBraceLoc = L; }
619
620
  // Implement isa/cast/dyncast/etc.
621
134M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
622
166M
  static bool classofKind(Kind K) { return K == Namespace; }
623
11.7k
  static DeclContext *castToDeclContext(const NamespaceDecl *D) {
624
11.7k
    return static_cast<DeclContext *>(const_cast<NamespaceDecl*>(D));
625
11.7k
  }
626
0
  static NamespaceDecl *castFromDeclContext(const DeclContext *DC) {
627
0
    return static_cast<NamespaceDecl *>(const_cast<DeclContext*>(DC));
628
0
  }
629
};
630
631
/// Represent the declaration of a variable (in which case it is
632
/// an lvalue) a function (in which case it is a function designator) or
633
/// an enum constant.
634
class ValueDecl : public NamedDecl {
635
  QualType DeclType;
636
637
  void anchor() override;
638
639
protected:
640
  ValueDecl(Kind DK, DeclContext *DC, SourceLocation L,
641
            DeclarationName N, QualType T)
642
76.3M
    : NamedDecl(DK, DC, L, N), DeclType(T) {}
643
644
public:
645
920M
  QualType getType() const { return DeclType; }
646
6.94M
  void setType(QualType newType) { DeclType = newType; }
647
648
  /// Determine whether this symbol is weakly-imported,
649
  ///        or declared with the weak or weak-ref attr.
650
  bool isWeak() const;
651
652
  // Implement isa/cast/dyncast/etc.
653
100M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
654
100M
  static bool classofKind(Kind K) { return K >= firstValue && 
K <= lastValue99.3M
; }
655
};
656
657
/// A struct with extended info about a syntactic
658
/// name qualifier, to be used for the case of out-of-line declarations.
659
struct QualifierInfo {
660
  NestedNameSpecifierLoc QualifierLoc;
661
662
  /// The number of "outer" template parameter lists.
663
  /// The count includes all of the template parameter lists that were matched
664
  /// against the template-ids occurring into the NNS and possibly (in the
665
  /// case of an explicit specialization) a final "template <>".
666
  unsigned NumTemplParamLists = 0;
667
668
  /// A new-allocated array of size NumTemplParamLists,
669
  /// containing pointers to the "outer" template parameter lists.
670
  /// It includes all of the template parameter lists that were matched
671
  /// against the template-ids occurring into the NNS and possibly (in the
672
  /// case of an explicit specialization) a final "template <>".
673
  TemplateParameterList** TemplParamLists = nullptr;
674
675
326k
  QualifierInfo() = default;
676
  QualifierInfo(const QualifierInfo &) = delete;
677
  QualifierInfo& operator=(const QualifierInfo &) = delete;
678
679
  /// Sets info about "outer" template parameter lists.
680
  void setTemplateParameterListsInfo(ASTContext &Context,
681
                                     ArrayRef<TemplateParameterList *> TPLists);
682
};
683
684
/// Represents a ValueDecl that came out of a declarator.
685
/// Contains type source information through TypeSourceInfo.
686
class DeclaratorDecl : public ValueDecl {
687
  // A struct representing a TInfo, a trailing requires-clause and a syntactic
688
  // qualifier, to be used for the (uncommon) case of out-of-line declarations
689
  // and constrained function decls.
690
  struct ExtInfo : public QualifierInfo {
691
    TypeSourceInfo *TInfo;
692
    Expr *TrailingRequiresClause = nullptr;
693
  };
694
695
  llvm::PointerUnion<TypeSourceInfo *, ExtInfo *> DeclInfo;
696
697
  /// The start of the source range for this declaration,
698
  /// ignoring outer template declarations.
699
  SourceLocation InnerLocStart;
700
701
97.8M
  bool hasExtInfo() const { return DeclInfo.is<ExtInfo*>(); }
702
939k
  ExtInfo *getExtInfo() { return DeclInfo.get<ExtInfo*>(); }
703
1.32M
  const ExtInfo *getExtInfo() const { return DeclInfo.get<ExtInfo*>(); }
704
705
protected:
706
  DeclaratorDecl(Kind DK, DeclContext *DC, SourceLocation L,
707
                 DeclarationName N, QualType T, TypeSourceInfo *TInfo,
708
                 SourceLocation StartL)
709
71.4M
      : ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo), InnerLocStart(StartL) {}
710
711
public:
712
  friend class ASTDeclReader;
713
  friend class ASTDeclWriter;
714
715
59.4M
  TypeSourceInfo *getTypeSourceInfo() const {
716
59.4M
    return hasExtInfo()
717
686k
      ? getExtInfo()->TInfo
718
58.7M
      : DeclInfo.get<TypeSourceInfo*>();
719
59.4M
  }
720
721
1.54M
  void setTypeSourceInfo(TypeSourceInfo *TI) {
722
1.54M
    if (hasExtInfo())
723
41.4k
      getExtInfo()->TInfo = TI;
724
1.50M
    else
725
1.50M
      DeclInfo = TI;
726
1.54M
  }
727
728
  /// Return start of source range ignoring outer template declarations.
729
11.5M
  SourceLocation getInnerLocStart() const { return InnerLocStart; }
730
1.70M
  void setInnerLocStart(SourceLocation L) { InnerLocStart = L; }
731
732
  /// Return start of source range taking into account any outer template
733
  /// declarations.
734
  SourceLocation getOuterLocStart() const;
735
736
  SourceRange getSourceRange() const override LLVM_READONLY;
737
738
1.33M
  SourceLocation getBeginLoc() const LLVM_READONLY {
739
1.33M
    return getOuterLocStart();
740
1.33M
  }
741
742
  /// Retrieve the nested-name-specifier that qualifies the name of this
743
  /// declaration, if it was present in the source.
744
561k
  NestedNameSpecifier *getQualifier() const {
745
369k
    return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
746
191k
                        : nullptr;
747
561k
  }
748
749
  /// Retrieve the nested-name-specifier (with source-location
750
  /// information) that qualifies the name of this declaration, if it was
751
  /// present in the source.
752
3.56M
  NestedNameSpecifierLoc getQualifierLoc() const {
753
62.0k
    return hasExtInfo() ? getExtInfo()->QualifierLoc
754
3.50M
                        : NestedNameSpecifierLoc();
755
3.56M
  }
756
757
  void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc);
758
759
  /// \brief Get the constraint-expression introduced by the trailing
760
  /// requires-clause in the function/member declaration, or null if no
761
  /// requires-clause was provided.
762
10.6M
  Expr *getTrailingRequiresClause() {
763
244k
    return hasExtInfo() ? getExtInfo()->TrailingRequiresClause
764
10.3M
                        : nullptr;
765
10.6M
  }
766
767
6.70M
  const Expr *getTrailingRequiresClause() const {
768
2.08k
    return hasExtInfo() ? getExtInfo()->TrailingRequiresClause
769
6.70M
                        : nullptr;
770
6.70M
  }
771
772
  void setTrailingRequiresClause(Expr *TrailingRequiresClause);
773
774
8.59M
  unsigned getNumTemplateParameterLists() const {
775
8.44M
    return hasExtInfo() ? 
getExtInfo()->NumTemplParamLists155k
: 0;
776
8.59M
  }
777
778
44.8k
  TemplateParameterList *getTemplateParameterList(unsigned index) const {
779
44.8k
    assert(index < getNumTemplateParameterLists());
780
44.8k
    return getExtInfo()->TemplParamLists[index];
781
44.8k
  }
782
783
  void setTemplateParameterListsInfo(ASTContext &Context,
784
                                     ArrayRef<TemplateParameterList *> TPLists);
785
786
  SourceLocation getTypeSpecStartLoc() const;
787
  SourceLocation getTypeSpecEndLoc() const;
788
789
  // Implement isa/cast/dyncast/etc.
790
43.7M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
791
43.7M
  static bool classofKind(Kind K) {
792
43.7M
    return K >= firstDeclarator && 
K <= lastDeclarator37.5M
;
793
43.7M
  }
794
};
795
796
/// Structure used to store a statement, the constant value to
797
/// which it was evaluated (if any), and whether or not the statement
798
/// is an integral constant expression (if known).
799
struct EvaluatedStmt {
800
  /// Whether this statement was already evaluated.
801
  bool WasEvaluated : 1;
802
803
  /// Whether this statement is being evaluated.
804
  bool IsEvaluating : 1;
805
806
  /// Whether we already checked whether this statement was an
807
  /// integral constant expression.
808
  bool CheckedICE : 1;
809
810
  /// Whether we are checking whether this statement is an
811
  /// integral constant expression.
812
  bool CheckingICE : 1;
813
814
  /// Whether this statement is an integral constant expression,
815
  /// or in C++11, whether the statement is a constant expression. Only
816
  /// valid if CheckedICE is true.
817
  bool IsICE : 1;
818
819
  /// Whether this variable is known to have constant destruction. That is,
820
  /// whether running the destructor on the initial value is a side-effect
821
  /// (and doesn't inspect any state that might have changed during program
822
  /// execution). This is currently only computed if the destructor is
823
  /// non-trivial.
824
  bool HasConstantDestruction : 1;
825
826
  Stmt *Value;
827
  APValue Evaluated;
828
829
  EvaluatedStmt()
830
      : WasEvaluated(false), IsEvaluating(false), CheckedICE(false),
831
376k
        CheckingICE(false), IsICE(false), HasConstantDestruction(false) {}
832
};
833
834
/// Represents a variable declaration or definition.
835
class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
836
public:
837
  /// Initialization styles.
838
  enum InitializationStyle {
839
    /// C-style initialization with assignment
840
    CInit,
841
842
    /// Call-style initialization (C++98)
843
    CallInit,
844
845
    /// Direct list-initialization (C++11)
846
    ListInit
847
  };
848
849
  /// Kinds of thread-local storage.
850
  enum TLSKind {
851
    /// Not a TLS variable.
852
    TLS_None,
853
854
    /// TLS with a known-constant initializer.
855
    TLS_Static,
856
857
    /// TLS with a dynamic initializer.
858
    TLS_Dynamic
859
  };
860
861
  /// Return the string used to specify the storage class \p SC.
862
  ///
863
  /// It is illegal to call this function with SC == None.
864
  static const char *getStorageClassSpecifierString(StorageClass SC);
865
866
protected:
867
  // A pointer union of Stmt * and EvaluatedStmt *. When an EvaluatedStmt, we
868
  // have allocated the auxiliary struct of information there.
869
  //
870
  // TODO: It is a bit unfortunate to use a PointerUnion inside the VarDecl for
871
  // this as *many* VarDecls are ParmVarDecls that don't have default
872
  // arguments. We could save some space by moving this pointer union to be
873
  // allocated in trailing space when necessary.
874
  using InitType = llvm::PointerUnion<Stmt *, EvaluatedStmt *>;
875
876
  /// The initializer for this variable or, for a ParmVarDecl, the
877
  /// C++ default argument.
878
  mutable InitType Init;
879
880
private:
881
  friend class ASTDeclReader;
882
  friend class ASTNodeImporter;
883
  friend class StmtIteratorBase;
884
885
  class VarDeclBitfields {
886
    friend class ASTDeclReader;
887
    friend class VarDecl;
888
889
    unsigned SClass : 3;
890
    unsigned TSCSpec : 2;
891
    unsigned InitStyle : 2;
892
893
    /// Whether this variable is an ARC pseudo-__strong variable; see
894
    /// isARCPseudoStrong() for details.
895
    unsigned ARCPseudoStrong : 1;
896
  };
897
  enum { NumVarDeclBits = 8 };
898
899
protected:
900
  enum { NumParameterIndexBits = 8 };
901
902
  enum DefaultArgKind {
903
    DAK_None,
904
    DAK_Unparsed,
905
    DAK_Uninstantiated,
906
    DAK_Normal
907
  };
908
909
  enum { NumScopeDepthOrObjCQualsBits = 7 };
910
911
  class ParmVarDeclBitfields {
912
    friend class ASTDeclReader;
913
    friend class ParmVarDecl;
914
915
    unsigned : NumVarDeclBits;
916
917
    /// Whether this parameter inherits a default argument from a
918
    /// prior declaration.
919
    unsigned HasInheritedDefaultArg : 1;
920
921
    /// Describes the kind of default argument for this parameter. By default
922
    /// this is none. If this is normal, then the default argument is stored in
923
    /// the \c VarDecl initializer expression unless we were unable to parse
924
    /// (even an invalid) expression for the default argument.
925
    unsigned DefaultArgKind : 2;
926
927
    /// Whether this parameter undergoes K&R argument promotion.
928
    unsigned IsKNRPromoted : 1;
929
930
    /// Whether this parameter is an ObjC method parameter or not.
931
    unsigned IsObjCMethodParam : 1;
932
933
    /// If IsObjCMethodParam, a Decl::ObjCDeclQualifier.
934
    /// Otherwise, the number of function parameter scopes enclosing
935
    /// the function parameter scope in which this parameter was
936
    /// declared.
937
    unsigned ScopeDepthOrObjCQuals : NumScopeDepthOrObjCQualsBits;
938
939
    /// The number of parameters preceding this parameter in the
940
    /// function parameter scope in which it was declared.
941
    unsigned ParameterIndex : NumParameterIndexBits;
942
  };
943
944
  class NonParmVarDeclBitfields {
945
    friend class ASTDeclReader;
946
    friend class ImplicitParamDecl;
947
    friend class VarDecl;
948
949
    unsigned : NumVarDeclBits;
950
951
    // FIXME: We need something similar to CXXRecordDecl::DefinitionData.
952
    /// Whether this variable is a definition which was demoted due to
953
    /// module merge.
954
    unsigned IsThisDeclarationADemotedDefinition : 1;
955
956
    /// Whether this variable is the exception variable in a C++ catch
957
    /// or an Objective-C @catch statement.
958
    unsigned ExceptionVar : 1;
959
960
    /// Whether this local variable could be allocated in the return
961
    /// slot of its function, enabling the named return value optimization
962
    /// (NRVO).
963
    unsigned NRVOVariable : 1;
964
965
    /// Whether this variable is the for-range-declaration in a C++0x
966
    /// for-range statement.
967
    unsigned CXXForRangeDecl : 1;
968
969
    /// Whether this variable is the for-in loop declaration in Objective-C.
970
    unsigned ObjCForDecl : 1;
971
972
    /// Whether this variable is (C++1z) inline.
973
    unsigned IsInline : 1;
974
975
    /// Whether this variable has (C++1z) inline explicitly specified.
976
    unsigned IsInlineSpecified : 1;
977
978
    /// Whether this variable is (C++0x) constexpr.
979
    unsigned IsConstexpr : 1;
980
981
    /// Whether this variable is the implicit variable for a lambda
982
    /// init-capture.
983
    unsigned IsInitCapture : 1;
984
985
    /// Whether this local extern variable's previous declaration was
986
    /// declared in the same block scope. This controls whether we should merge
987
    /// the type of this declaration with its previous declaration.
988
    unsigned PreviousDeclInSameBlockScope : 1;
989
990
    /// Defines kind of the ImplicitParamDecl: 'this', 'self', 'vtt', '_cmd' or
991
    /// something else.
992
    unsigned ImplicitParamKind : 3;
993
994
    unsigned EscapingByref : 1;
995
  };
996
997
  union {
998
    unsigned AllBits;
999
    VarDeclBitfields VarDeclBits;
1000
    ParmVarDeclBitfields ParmVarDeclBits;
1001
    NonParmVarDeclBitfields NonParmVarDeclBits;
1002
  };
1003
1004
  VarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
1005
          SourceLocation IdLoc, IdentifierInfo *Id, QualType T,
1006
          TypeSourceInfo *TInfo, StorageClass SC);
1007
1008
  using redeclarable_base = Redeclarable<VarDecl>;
1009
1010
16.8M
  VarDecl *getNextRedeclarationImpl() override {
1011
16.8M
    return getNextRedeclaration();
1012
16.8M
  }
1013
1014
20.4k
  VarDecl *getPreviousDeclImpl() override {
1015
20.4k
    return getPreviousDecl();
1016
20.4k
  }
1017
1018
61.6M
  VarDecl *getMostRecentDeclImpl() override {
1019
61.6M
    return getMostRecentDecl();
1020
61.6M
  }
1021
1022
public:
1023
  using redecl_range = redeclarable_base::redecl_range;
1024
  using redecl_iterator = redeclarable_base::redecl_iterator;
1025
1026
  using redeclarable_base::redecls_begin;
1027
  using redeclarable_base::redecls_end;
1028
  using redeclarable_base::redecls;
1029
  using redeclarable_base::getPreviousDecl;
1030
  using redeclarable_base::getMostRecentDecl;
1031
  using redeclarable_base::isFirstDecl;
1032
1033
  static VarDecl *Create(ASTContext &C, DeclContext *DC,
1034
                         SourceLocation StartLoc, SourceLocation IdLoc,
1035
                         IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo,
1036
                         StorageClass S);
1037
1038
  static VarDecl *CreateDeserialized(ASTContext &C, unsigned ID);
1039
1040
  SourceRange getSourceRange() const override LLVM_READONLY;
1041
1042
  /// Returns the storage class as written in the source. For the
1043
  /// computed linkage of symbol, see getLinkage.
1044
144M
  StorageClass getStorageClass() const {
1045
144M
    return (StorageClass) VarDeclBits.SClass;
1046
144M
  }
1047
  void setStorageClass(StorageClass SC);
1048
1049
335k
  void setTSCSpec(ThreadStorageClassSpecifier TSC) {
1050
335k
    VarDeclBits.TSCSpec = TSC;
1051
335k
    assert(VarDeclBits.TSCSpec == TSC && "truncation");
1052
335k
  }
1053
44.2M
  ThreadStorageClassSpecifier getTSCSpec() const {
1054
44.2M
    return static_cast<ThreadStorageClassSpecifier>(VarDeclBits.TSCSpec);
1055
44.2M
  }
1056
  TLSKind getTLSKind() const;
1057
1058
  /// Returns true if a variable with function scope is a non-static local
1059
  /// variable.
1060
51.1M
  bool hasLocalStorage() const {
1061
51.1M
    if (getStorageClass() == SC_None) {
1062
      // OpenCL v1.2 s6.5.3: The __constant or constant address space name is
1063
      // used to describe variables allocated in global memory and which are
1064
      // accessed inside a kernel(s) as read-only variables. As such, variables
1065
      // in constant address space cannot have local storage.
1066
39.3M
      if (getType().getAddressSpace() == LangAS::opencl_constant)
1067
1.67k
        return false;
1068
      // Second check is for C++11 [dcl.stc]p4.
1069
39.3M
      return !isFileVarDecl() && 
getTSCSpec() == TSCS_unspecified34.0M
;
1070
39.3M
    }
1071
1072
    // Global Named Register (GNU extension)
1073
11.7M
    if (getStorageClass() == SC_Register && 
!isLocalVarDeclOrParm()8.65k
)
1074
677
      return false;
1075
1076
    // Return true for:  Auto, Register.
1077
    // Return false for: Extern, Static, PrivateExtern, OpenCLWorkGroupLocal.
1078
1079
11.7M
    return getStorageClass() >= SC_Auto;
1080
11.7M
  }
1081
1082
  /// Returns true if a variable with function scope is a static local
1083
  /// variable.
1084
9.58M
  bool isStaticLocal() const {
1085
9.58M
    return (getStorageClass() == SC_Static ||
1086
            // C++11 [dcl.stc]p4
1087
8.57M
            (getStorageClass() == SC_None && 
getTSCSpec() == TSCS_thread_local7.26M
))
1088
1.01M
      && !isFileVarDecl();
1089
9.58M
  }
1090
1091
  /// Returns true if a variable has extern or __private_extern__
1092
  /// storage.
1093
19.4M
  bool hasExternalStorage() const {
1094
19.4M
    return getStorageClass() == SC_Extern ||
1095
15.8M
           getStorageClass() == SC_PrivateExtern;
1096
19.4M
  }
1097
1098
  /// Returns true for all variables that do not have local storage.
1099
  ///
1100
  /// This includes all global variables as well as static variables declared
1101
  /// within a function.
1102
11.4M
  bool hasGlobalStorage() const { return !hasLocalStorage(); }
1103
1104
  /// Get the storage duration of this variable, per C++ [basic.stc].
1105
2.58M
  StorageDuration getStorageDuration() const {
1106
2.48M
    return hasLocalStorage() ? SD_Automatic :
1107
105k
           getTSCSpec() ? 
SD_Thread497
:
SD_Static105k
;
1108
2.58M
  }
1109
1110
  /// Compute the language linkage.
1111
  LanguageLinkage getLanguageLinkage() const;
1112
1113
  /// Determines whether this variable is a variable with external, C linkage.
1114
  bool isExternC() const;
1115
1116
  /// Determines whether this variable's context is, or is nested within,
1117
  /// a C++ extern "C" linkage spec.
1118
  bool isInExternCContext() const;
1119
1120
  /// Determines whether this variable's context is, or is nested within,
1121
  /// a C++ extern "C++" linkage spec.
1122
  bool isInExternCXXContext() const;
1123
1124
  /// Returns true for local variable declarations other than parameters.
1125
  /// Note that this includes static variables inside of functions. It also
1126
  /// includes variables inside blocks.
1127
  ///
1128
  ///   void foo() { int x; static int y; extern int z; }
1129
6.37M
  bool isLocalVarDecl() const {
1130
6.37M
    if (getKind() != Decl::Var && 
getKind() != Decl::Decomposition220k
)
1131
219k
      return false;
1132
6.15M
    if (const DeclContext *DC = getLexicalDeclContext())
1133
6.15M
      return DC->getRedeclContext()->isFunctionOrMethod();
1134
0
    return false;
1135
0
  }
1136
1137
  /// Similar to isLocalVarDecl but also includes parameters.
1138
92.7k
  bool isLocalVarDeclOrParm() const {
1139
92.7k
    return isLocalVarDecl() || 
getKind() == Decl::ParmVar62.9k
;
1140
92.7k
  }
1141
1142
  /// Similar to isLocalVarDecl, but excludes variables declared in blocks.
1143
950k
  bool isFunctionOrMethodVarDecl() const {
1144
950k
    if (getKind() != Decl::Var && 
getKind() != Decl::Decomposition181k
)
1145
181k
      return false;
1146
769k
    const DeclContext *DC = getLexicalDeclContext()->getRedeclContext();
1147
769k
    return DC->isFunctionOrMethod() && 
DC->getDeclKind() != Decl::Block264k
;
1148
769k
  }
1149
1150
  /// Determines whether this is a static data member.
1151
  ///
1152
  /// This will only be true in C++, and applies to, e.g., the
1153
  /// variable 'x' in:
1154
  /// \code
1155
  /// struct S {
1156
  ///   static int x;
1157
  /// };
1158
  /// \endcode
1159
231M
  bool isStaticDataMember() const {
1160
    // If it wasn't static, it would be a FieldDecl.
1161
231M
    return getKind() != Decl::ParmVar && 
getDeclContext()->isRecord()195M
;
1162
231M
  }
1163
1164
  VarDecl *getCanonicalDecl() override;
1165
26.4M
  const VarDecl *getCanonicalDecl() const {
1166
26.4M
    return const_cast<VarDecl*>(this)->getCanonicalDecl();
1167
26.4M
  }
1168
1169
  enum DefinitionKind {
1170
    /// This declaration is only a declaration.
1171
    DeclarationOnly,
1172
1173
    /// This declaration is a tentative definition.
1174
    TentativeDefinition,
1175
1176
    /// This declaration is definitely a definition.
1177
    Definition
1178
  };
1179
1180
  /// Check whether this declaration is a definition. If this could be
1181
  /// a tentative definition (in C), don't check whether there's an overriding
1182
  /// definition.
1183
  DefinitionKind isThisDeclarationADefinition(ASTContext &) const;
1184
14.8M
  DefinitionKind isThisDeclarationADefinition() const {
1185
14.8M
    return isThisDeclarationADefinition(getASTContext());
1186
14.8M
  }
1187
1188
  /// Check whether this variable is defined in this translation unit.
1189
  DefinitionKind hasDefinition(ASTContext &) const;
1190
19.6k
  DefinitionKind hasDefinition() const {
1191
19.6k
    return hasDefinition(getASTContext());
1192
19.6k
  }
1193
1194
  /// Get the tentative definition that acts as the real definition in a TU.
1195
  /// Returns null if there is a proper definition available.
1196
  VarDecl *getActingDefinition();
1197
810
  const VarDecl *getActingDefinition() const {
1198
810
    return const_cast<VarDecl*>(this)->getActingDefinition();
1199
810
  }
1200
1201
  /// Get the real (not just tentative) definition for this declaration.
1202
  VarDecl *getDefinition(ASTContext &);
1203
5.98M
  const VarDecl *getDefinition(ASTContext &C) const {
1204
5.98M
    return const_cast<VarDecl*>(this)->getDefinition(C);
1205
5.98M
  }
1206
3.99M
  VarDecl *getDefinition() {
1207
3.99M
    return getDefinition(getASTContext());
1208
3.99M
  }
1209
7.13k
  const VarDecl *getDefinition() const {
1210
7.13k
    return const_cast<VarDecl*>(this)->getDefinition();
1211
7.13k
  }
1212
1213
  /// Determine whether this is or was instantiated from an out-of-line
1214
  /// definition of a static data member.
1215
  bool isOutOfLine() const override;
1216
1217
  /// Returns true for file scoped variable declaration.
1218
59.0M
  bool isFileVarDecl() const {
1219
59.0M
    Kind K = getKind();
1220
59.0M
    if (K == ParmVar || 
K == ImplicitParam45.6M
)
1221
14.4M
      return false;
1222
1223
44.5M
    if (getLexicalDeclContext()->getRedeclContext()->isFileContext())
1224
11.2M
      return true;
1225
1226
33.3M
    if (isStaticDataMember())
1227
1.81M
      return true;
1228
1229
31.4M
    return false;
1230
31.4M
  }
1231
1232
  /// Get the initializer for this variable, no matter which
1233
  /// declaration it is attached to.
1234
2.39M
  const Expr *getAnyInitializer() const {
1235
2.39M
    const VarDecl *D;
1236
2.39M
    return getAnyInitializer(D);
1237
2.39M
  }
1238
1239
  /// Get the initializer for this variable, no matter which
1240
  /// declaration it is attached to. Also get that declaration.
1241
  const Expr *getAnyInitializer(const VarDecl *&D) const;
1242
1243
  bool hasInit() const;
1244
2.30M
  const Expr *getInit() const {
1245
2.30M
    return const_cast<VarDecl *>(this)->getInit();
1246
2.30M
  }
1247
  Expr *getInit();
1248
1249
  /// Retrieve the address of the initializer expression.
1250
  Stmt **getInitAddress();
1251
1252
  void setInit(Expr *I);
1253
1254
  /// Get the initializing declaration of this variable, if any. This is
1255
  /// usually the definition, except that for a static data member it can be
1256
  /// the in-class declaration.
1257
  VarDecl *getInitializingDeclaration();
1258
484
  const VarDecl *getInitializingDeclaration() const {
1259
484
    return const_cast<VarDecl *>(this)->getInitializingDeclaration();
1260
484
  }
1261
1262
  /// Determine whether this variable's value might be usable in a
1263
  /// constant expression, according to the relevant language standard.
1264
  /// This only checks properties of the declaration, and does not check
1265
  /// whether the initializer is in fact a constant expression.
1266
  bool mightBeUsableInConstantExpressions(ASTContext &C) const;
1267
1268
  /// Determine whether this variable's value can be used in a
1269
  /// constant expression, according to the relevant language standard,
1270
  /// including checking whether it was initialized by a constant expression.
1271
  bool isUsableInConstantExpressions(ASTContext &C) const;
1272
1273
  EvaluatedStmt *ensureEvaluatedStmt() const;
1274
1275
  /// Attempt to evaluate the value of the initializer attached to this
1276
  /// declaration, and produce notes explaining why it cannot be evaluated or is
1277
  /// not a constant expression. Returns a pointer to the value if evaluation
1278
  /// succeeded, 0 otherwise.
1279
  APValue *evaluateValue() const;
1280
  APValue *evaluateValue(SmallVectorImpl<PartialDiagnosticAt> &Notes) const;
1281
1282
  /// Return the already-evaluated value of this variable's
1283
  /// initializer, or NULL if the value is not yet known. Returns pointer
1284
  /// to untyped APValue if the value could not be evaluated.
1285
  APValue *getEvaluatedValue() const;
1286
1287
  /// Evaluate the destruction of this variable to determine if it constitutes
1288
  /// constant destruction.
1289
  ///
1290
  /// \pre isInitICE()
1291
  /// \return \c true if this variable has constant destruction, \c false if
1292
  ///         not.
1293
  bool evaluateDestruction(SmallVectorImpl<PartialDiagnosticAt> &Notes) const;
1294
1295
  /// Determines whether it is already known whether the
1296
  /// initializer is an integral constant expression or not.
1297
  bool isInitKnownICE() const;
1298
1299
  /// Determines whether the initializer is an integral constant
1300
  /// expression, or in C++11, whether the initializer is a constant
1301
  /// expression.
1302
  ///
1303
  /// \pre isInitKnownICE()
1304
  bool isInitICE() const;
1305
1306
  /// Determine whether the value of the initializer attached to this
1307
  /// declaration is an integral constant expression.
1308
  bool checkInitIsICE() const;
1309
1310
491k
  void setInitStyle(InitializationStyle Style) {
1311
491k
    VarDeclBits.InitStyle = Style;
1312
491k
  }
1313
1314
  /// The style of initialization for this declaration.
1315
  ///
1316
  /// C-style initialization is "int x = 1;". Call-style initialization is
1317
  /// a C++98 direct-initializer, e.g. "int x(1);". The Init expression will be
1318
  /// the expression inside the parens or a "ClassType(a,b,c)" class constructor
1319
  /// expression for class types. List-style initialization is C++11 syntax,
1320
  /// e.g. "int x{1};". Clients can distinguish between different forms of
1321
  /// initialization by checking this value. In particular, "int x = {1};" is
1322
  /// C-style, "int x({1})" is call-style, and "int x{1};" is list-style; the
1323
  /// Init expression in all three cases is an InitListExpr.
1324
3.36M
  InitializationStyle getInitStyle() const {
1325
3.36M
    return static_cast<InitializationStyle>(VarDeclBits.InitStyle);
1326
3.36M
  }
1327
1328
  /// Whether the initializer is a direct-initializer (list or call).
1329
304k
  bool isDirectInit() const {
1330
304k
    return getInitStyle() != CInit;
1331
304k
  }
1332
1333
  /// If this definition should pretend to be a declaration.
1334
38.4M
  bool isThisDeclarationADemotedDefinition() const {
1335
7.79M
    return isa<ParmVarDecl>(this) ? false :
1336
30.6M
      NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
1337
38.4M
  }
1338
1339
  /// This is a definition which should be demoted to a declaration.
1340
  ///
1341
  /// In some cases (mostly module merging) we can end up with two visible
1342
  /// definitions one of which needs to be demoted to a declaration to keep
1343
  /// the AST invariants.
1344
30
  void demoteThisDefinitionToDeclaration() {
1345
30
    assert(isThisDeclarationADefinition() && "Not a definition!");
1346
30
    assert(!isa<ParmVarDecl>(this) && "Cannot demote ParmVarDecls!");
1347
30
    NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
1348
30
  }
1349
1350
  /// Determine whether this variable is the exception variable in a
1351
  /// C++ catch statememt or an Objective-C \@catch statement.
1352
1.71M
  bool isExceptionVariable() const {
1353
1.00M
    return isa<ParmVarDecl>(this) ? false : 
NonParmVarDeclBits.ExceptionVar709k
;
1354
1.71M
  }
1355
1.06k
  void setExceptionVariable(bool EV) {
1356
1.06k
    assert(!isa<ParmVarDecl>(this));
1357
1.06k
    NonParmVarDeclBits.ExceptionVar = EV;
1358
1.06k
  }
1359
1360
  /// Determine whether this local variable can be used with the named
1361
  /// return value optimization (NRVO).
1362
  ///
1363
  /// The named return value optimization (NRVO) works by marking certain
1364
  /// non-volatile local variables of class type as NRVO objects. These
1365
  /// locals can be allocated within the return slot of their containing
1366
  /// function, in which case there is no need to copy the object to the
1367
  /// return slot when returning from the function. Within the function body,
1368
  /// each return that returns the NRVO object will have this variable as its
1369
  /// NRVO candidate.
1370
970k
  bool isNRVOVariable() const {
1371
968k
    return isa<ParmVarDecl>(this) ? 
false2.05k
: NonParmVarDeclBits.NRVOVariable;
1372
970k
  }
1373
39.6k
  void setNRVOVariable(bool NRVO) {
1374
39.6k
    assert(!isa<ParmVarDecl>(this));
1375
39.6k
    NonParmVarDeclBits.NRVOVariable = NRVO;
1376
39.6k
  }
1377
1378
  /// Determine whether this variable is the for-range-declaration in
1379
  /// a C++0x for-range statement.
1380
890k
  bool isCXXForRangeDecl() const {
1381
890k
    return isa<ParmVarDecl>(this) ? 
false86
: NonParmVarDeclBits.CXXForRangeDecl;
1382
890k
  }
1383
336k
  void setCXXForRangeDecl(bool FRD) {
1384
336k
    assert(!isa<ParmVarDecl>(this));
1385
336k
    NonParmVarDeclBits.CXXForRangeDecl = FRD;
1386
336k
  }
1387
1388
  /// Determine whether this variable is a for-loop declaration for a
1389
  /// for-in statement in Objective-C.
1390
752k
  bool isObjCForDecl() const {
1391
752k
    return NonParmVarDeclBits.ObjCForDecl;
1392
752k
  }
1393
1394
334k
  void setObjCForDecl(bool FRD) {
1395
334k
    NonParmVarDeclBits.ObjCForDecl = FRD;
1396
334k
  }
1397
1398
  /// Determine whether this variable is an ARC pseudo-__strong variable. A
1399
  /// pseudo-__strong variable has a __strong-qualified type but does not
1400
  /// actually retain the object written into it. Generally such variables are
1401
  /// also 'const' for safety. There are 3 cases where this will be set, 1) if
1402
  /// the variable is annotated with the objc_externally_retained attribute, 2)
1403
  /// if its 'self' in a non-init method, or 3) if its the variable in an for-in
1404
  /// loop.
1405
1.40M
  bool isARCPseudoStrong() const { return VarDeclBits.ARCPseudoStrong; }
1406
25.2k
  void setARCPseudoStrong(bool PS) { VarDeclBits.ARCPseudoStrong = PS; }
1407
1408
  /// Whether this variable is (C++1z) inline.
1409
20.4M
  bool isInline() const {
1410
20.4M
    return isa<ParmVarDecl>(this) ? 
false2.05k
: NonParmVarDeclBits.IsInline;
1411
20.4M
  }
1412
751k
  bool isInlineSpecified() const {
1413
0
    return isa<ParmVarDecl>(this) ? false
1414
751k
                                  : NonParmVarDeclBits.IsInlineSpecified;
1415
751k
  }
1416
1.18k
  void setInlineSpecified() {
1417
1.18k
    assert(!isa<ParmVarDecl>(this));
1418
1.18k
    NonParmVarDeclBits.IsInline = true;
1419
1.18k
    NonParmVarDeclBits.IsInlineSpecified = true;
1420
1.18k
  }
1421
4.33k
  void setImplicitlyInline() {
1422
4.33k
    assert(!isa<ParmVarDecl>(this));
1423
4.33k
    NonParmVarDeclBits.IsInline = true;
1424
4.33k
  }
1425
1426
  /// Whether this variable is (C++11) constexpr.
1427
20.4M
  bool isConstexpr() const {
1428
17.9M
    return isa<ParmVarDecl>(this) ? 
false2.50M
: NonParmVarDeclBits.IsConstexpr;
1429
20.4M
  }
1430
492k
  void setConstexpr(bool IC) {
1431
492k
    assert(!isa<ParmVarDecl>(this));
1432
492k
    NonParmVarDeclBits.IsConstexpr = IC;
1433
492k
  }
1434
1435
  /// Whether this variable is the implicit variable for a lambda init-capture.
1436
34.4M
  bool isInitCapture() const {
1437
21.0M
    return isa<ParmVarDecl>(this) ? false : 
NonParmVarDeclBits.IsInitCapture13.4M
;
1438
34.4M
  }
1439
335k
  void setInitCapture(bool IC) {
1440
335k
    assert(!isa<ParmVarDecl>(this));
1441
335k
    NonParmVarDeclBits.IsInitCapture = IC;
1442
335k
  }
1443
1444
  /// Determine whether this variable is actually a function parameter pack or
1445
  /// init-capture pack.
1446
  bool isParameterPack() const;
1447
1448
  /// Whether this local extern variable declaration's previous declaration
1449
  /// was declared in the same block scope. Only correct in C++.
1450
803k
  bool isPreviousDeclInSameBlockScope() const {
1451
803k
    return isa<ParmVarDecl>(this)
1452
0
               ? false
1453
803k
               : NonParmVarDeclBits.PreviousDeclInSameBlockScope;
1454
803k
  }
1455
335k
  void setPreviousDeclInSameBlockScope(bool Same) {
1456
335k
    assert(!isa<ParmVarDecl>(this));
1457
335k
    NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
1458
335k
  }
1459
1460
  /// Indicates the capture is a __block variable that is captured by a block
1461
  /// that can potentially escape (a block for which BlockDecl::doesNotEscape
1462
  /// returns false).
1463
  bool isEscapingByref() const;
1464
1465
  /// Indicates the capture is a __block variable that is never captured by an
1466
  /// escaping block.
1467
  bool isNonEscapingByref() const;
1468
1469
457
  void setEscapingByref() {
1470
457
    NonParmVarDeclBits.EscapingByref = true;
1471
457
  }
1472
1473
  /// Retrieve the variable declaration from which this variable could
1474
  /// be instantiated, if it is an instantiation (rather than a non-template).
1475
  VarDecl *getTemplateInstantiationPattern() const;
1476
1477
  /// If this variable is an instantiated static data member of a
1478
  /// class template specialization, returns the templated static data member
1479
  /// from which it was instantiated.
1480
  VarDecl *getInstantiatedFromStaticDataMember() const;
1481
1482
  /// If this variable is an instantiation of a variable template or a
1483
  /// static data member of a class template, determine what kind of
1484
  /// template specialization or instantiation this is.
1485
  TemplateSpecializationKind getTemplateSpecializationKind() const;
1486
1487
  /// Get the template specialization kind of this variable for the purposes of
1488
  /// template instantiation. This differs from getTemplateSpecializationKind()
1489
  /// for an instantiation of a class-scope explicit specialization.
1490
  TemplateSpecializationKind
1491
  getTemplateSpecializationKindForInstantiation() const;
1492
1493
  /// If this variable is an instantiation of a variable template or a
1494
  /// static data member of a class template, determine its point of
1495
  /// instantiation.
1496
  SourceLocation getPointOfInstantiation() const;
1497
1498
  /// If this variable is an instantiation of a static data member of a
1499
  /// class template specialization, retrieves the member specialization
1500
  /// information.
1501
  MemberSpecializationInfo *getMemberSpecializationInfo() const;
1502
1503
  /// For a static data member that was instantiated from a static
1504
  /// data member of a class template, set the template specialiation kind.
1505
  void setTemplateSpecializationKind(TemplateSpecializationKind TSK,
1506
                        SourceLocation PointOfInstantiation = SourceLocation());
1507
1508
  /// Specify that this variable is an instantiation of the
1509
  /// static data member VD.
1510
  void setInstantiationOfStaticDataMember(VarDecl *VD,
1511
                                          TemplateSpecializationKind TSK);
1512
1513
  /// Retrieves the variable template that is described by this
1514
  /// variable declaration.
1515
  ///
1516
  /// Every variable template is represented as a VarTemplateDecl and a
1517
  /// VarDecl. The former contains template properties (such as
1518
  /// the template parameter lists) while the latter contains the
1519
  /// actual description of the template's
1520
  /// contents. VarTemplateDecl::getTemplatedDecl() retrieves the
1521
  /// VarDecl that from a VarTemplateDecl, while
1522
  /// getDescribedVarTemplate() retrieves the VarTemplateDecl from
1523
  /// a VarDecl.
1524
  VarTemplateDecl *getDescribedVarTemplate() const;
1525
1526
  void setDescribedVarTemplate(VarTemplateDecl *Template);
1527
1528
  // Is this variable known to have a definition somewhere in the complete
1529
  // program? This may be true even if the declaration has internal linkage and
1530
  // has no definition within this source file.
1531
  bool isKnownToBeDefined() const;
1532
1533
  /// Is destruction of this variable entirely suppressed? If so, the variable
1534
  /// need not have a usable destructor at all.
1535
  bool isNoDestroy(const ASTContext &) const;
1536
1537
  /// Would the destruction of this variable have any effect, and if so, what
1538
  /// kind?
1539
  QualType::DestructionKind needsDestruction(const ASTContext &Ctx) const;
1540
1541
  // Implement isa/cast/dyncast/etc.
1542
574M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1543
574M
  static bool classofKind(Kind K) { return K >= firstVar && 
K <= lastVar394M
; }
1544
};
1545
1546
class ImplicitParamDecl : public VarDecl {
1547
  void anchor() override;
1548
1549
public:
1550
  /// Defines the kind of the implicit parameter: is this an implicit parameter
1551
  /// with pointer to 'this', 'self', '_cmd', virtual table pointers, captured
1552
  /// context or something else.
1553
  enum ImplicitParamKind : unsigned {
1554
    /// Parameter for Objective-C 'self' argument
1555
    ObjCSelf,
1556
1557
    /// Parameter for Objective-C '_cmd' argument
1558
    ObjCCmd,
1559
1560
    /// Parameter for C++ 'this' argument
1561
    CXXThis,
1562
1563
    /// Parameter for C++ virtual table pointers
1564
    CXXVTT,
1565
1566
    /// Parameter for captured context
1567
    CapturedContext,
1568
1569
    /// Other implicit parameter
1570
    Other,
1571
  };
1572
1573
  /// Create implicit parameter.
1574
  static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC,
1575
                                   SourceLocation IdLoc, IdentifierInfo *Id,
1576
                                   QualType T, ImplicitParamKind ParamKind);
1577
  static ImplicitParamDecl *Create(ASTContext &C, QualType T,
1578
                                   ImplicitParamKind ParamKind);
1579
1580
  static ImplicitParamDecl *CreateDeserialized(ASTContext &C, unsigned ID);
1581
1582
  ImplicitParamDecl(ASTContext &C, DeclContext *DC, SourceLocation IdLoc,
1583
                    IdentifierInfo *Id, QualType Type,
1584
                    ImplicitParamKind ParamKind)
1585
      : VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
1586
5.14M
                /*TInfo=*/nullptr, SC_None) {
1587
5.14M
    NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1588
5.14M
    setImplicit();
1589
5.14M
  }
1590
1591
  ImplicitParamDecl(ASTContext &C, QualType Type, ImplicitParamKind ParamKind)
1592
      : VarDecl(ImplicitParam, C, /*DC=*/nullptr, SourceLocation(),
1593
                SourceLocation(), /*Id=*/nullptr, Type,
1594
165k
                /*TInfo=*/nullptr, SC_None) {
1595
165k
    NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1596
165k
    setImplicit();
1597
165k
  }
1598
1599
  /// Returns the implicit parameter kind.
1600
280k
  ImplicitParamKind getParameterKind() const {
1601
280k
    return static_cast<ImplicitParamKind>(NonParmVarDeclBits.ImplicitParamKind);
1602
280k
  }
1603
1604
  // Implement isa/cast/dyncast/etc.
1605
2.67M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1606
2.67M
  static bool classofKind(Kind K) { return K == ImplicitParam; }
1607
};
1608
1609
/// Represents a parameter to a function.
1610
class ParmVarDecl : public VarDecl {
1611
public:
1612
  enum { MaxFunctionScopeDepth = 255 };
1613
  enum { MaxFunctionScopeIndex = 255 };
1614
1615
protected:
1616
  ParmVarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
1617
              SourceLocation IdLoc, IdentifierInfo *Id, QualType T,
1618
              TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
1619
40.3M
      : VarDecl(DK, C, DC, StartLoc, IdLoc, Id, T, TInfo, S) {
1620
40.3M
    assert(ParmVarDeclBits.HasInheritedDefaultArg == false);
1621
40.3M
    assert(ParmVarDeclBits.DefaultArgKind == DAK_None);
1622
40.3M
    assert(ParmVarDeclBits.IsKNRPromoted == false);
1623
40.3M
    assert(ParmVarDeclBits.IsObjCMethodParam == false);
1624
40.3M
    setDefaultArg(DefArg);
1625
40.3M
  }
1626
1627
public:
1628
  static ParmVarDecl *Create(ASTContext &C, DeclContext *DC,
1629
                             SourceLocation StartLoc,
1630
                             SourceLocation IdLoc, IdentifierInfo *Id,
1631
                             QualType T, TypeSourceInfo *TInfo,
1632
                             StorageClass S, Expr *DefArg);
1633
1634
  static ParmVarDecl *CreateDeserialized(ASTContext &C, unsigned ID);
1635
1636
  SourceRange getSourceRange() const override LLVM_READONLY;
1637
1638
1.29M
  void setObjCMethodScopeInfo(unsigned parameterIndex) {
1639
1.29M
    ParmVarDeclBits.IsObjCMethodParam = true;
1640
1.29M
    setParameterIndex(parameterIndex);
1641
1.29M
  }
1642
1643
38.4M
  void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex) {
1644
38.4M
    assert(!ParmVarDeclBits.IsObjCMethodParam);
1645
1646
38.4M
    ParmVarDeclBits.ScopeDepthOrObjCQuals = scopeDepth;
1647
38.4M
    assert(ParmVarDeclBits.ScopeDepthOrObjCQuals == scopeDepth
1648
38.4M
           && "truncation!");
1649
1650
38.4M
    setParameterIndex(parameterIndex);
1651
38.4M
  }
1652
1653
1.08M
  bool isObjCMethodParameter() const {
1654
1.08M
    return ParmVarDeclBits.IsObjCMethodParam;
1655
1.08M
  }
1656
1657
3.44M
  unsigned getFunctionScopeDepth() const {
1658
3.44M
    if (ParmVarDeclBits.IsObjCMethodParam) 
return 072.5k
;
1659
3.37M
    return ParmVarDeclBits.ScopeDepthOrObjCQuals;
1660
3.37M
  }
1661
1662
13.7M
  static constexpr unsigned getMaxFunctionScopeDepth() {
1663
13.7M
    return (1u << NumScopeDepthOrObjCQualsBits) - 1;
1664
13.7M
  }
1665
1666
  /// Returns the index of this parameter in its prototype or method scope.
1667
9.52M
  unsigned getFunctionScopeIndex() const {
1668
9.52M
    return getParameterIndex();
1669
9.52M
  }
1670
1671
1.73M
  ObjCDeclQualifier getObjCDeclQualifier() const {
1672
1.73M
    if (!ParmVarDeclBits.IsObjCMethodParam) 
return OBJC_TQ_None1.63M
;
1673
100k
    return ObjCDeclQualifier(ParmVarDeclBits.ScopeDepthOrObjCQuals);
1674
100k
  }
1675
1.27M
  void setObjCDeclQualifier(ObjCDeclQualifier QTVal) {
1676
1.27M
    assert(ParmVarDeclBits.IsObjCMethodParam);
1677
1.27M
    ParmVarDeclBits.ScopeDepthOrObjCQuals = QTVal;
1678
1.27M
  }
1679
1680
  /// True if the value passed to this parameter must undergo
1681
  /// K&R-style default argument promotion:
1682
  ///
1683
  /// C99 6.5.2.2.
1684
  ///   If the expression that denotes the called function has a type
1685
  ///   that does not include a prototype, the integer promotions are
1686
  ///   performed on each argument, and arguments that have type float
1687
  ///   are promoted to double.
1688
2.06M
  bool isKNRPromoted() const {
1689
2.06M
    return ParmVarDeclBits.IsKNRPromoted;
1690
2.06M
  }
1691
83.0k
  void setKNRPromoted(bool promoted) {
1692
83.0k
    ParmVarDeclBits.IsKNRPromoted = promoted;
1693
83.0k
  }
1694
1695
  Expr *getDefaultArg();
1696
10.5k
  const Expr *getDefaultArg() const {
1697
10.5k
    return const_cast<ParmVarDecl *>(this)->getDefaultArg();
1698
10.5k
  }
1699
1700
  void setDefaultArg(Expr *defarg);
1701
1702
  /// Retrieve the source range that covers the entire default
1703
  /// argument.
1704
  SourceRange getDefaultArgRange() const;
1705
  void setUninstantiatedDefaultArg(Expr *arg);
1706
  Expr *getUninstantiatedDefaultArg();
1707
841
  const Expr *getUninstantiatedDefaultArg() const {
1708
841
    return const_cast<ParmVarDecl *>(this)->getUninstantiatedDefaultArg();
1709
841
  }
1710
1711
  /// Determines whether this parameter has a default argument,
1712
  /// either parsed or not.
1713
  bool hasDefaultArg() const;
1714
1715
  /// Determines whether this parameter has a default argument that has not
1716
  /// yet been parsed. This will occur during the processing of a C++ class
1717
  /// whose member functions have default arguments, e.g.,
1718
  /// @code
1719
  ///   class X {
1720
  ///   public:
1721
  ///     void f(int x = 17); // x has an unparsed default argument now
1722
  ///   }; // x has a regular default argument now
1723
  /// @endcode
1724
54.3M
  bool hasUnparsedDefaultArg() const {
1725
54.3M
    return ParmVarDeclBits.DefaultArgKind == DAK_Unparsed;
1726
54.3M
  }
1727
1728
55.6M
  bool hasUninstantiatedDefaultArg() const {
1729
55.6M
    return ParmVarDeclBits.DefaultArgKind == DAK_Uninstantiated;
1730
55.6M
  }
1731
1732
  /// Specify that this parameter has an unparsed default argument.
1733
  /// The argument will be replaced with a real default argument via
1734
  /// setDefaultArg when the class definition enclosing the function
1735
  /// declaration that owns this default argument is completed.
1736
65.6k
  void setUnparsedDefaultArg() {
1737
65.6k
    ParmVarDeclBits.DefaultArgKind = DAK_Unparsed;
1738
65.6k
  }
1739
1740
3.48M
  bool hasInheritedDefaultArg() const {
1741
3.48M
    return ParmVarDeclBits.HasInheritedDefaultArg;
1742
3.48M
  }
1743
1744
1.65M
  void setHasInheritedDefaultArg(bool I = true) {
1745
1.65M
    ParmVarDeclBits.HasInheritedDefaultArg = I;
1746
1.65M
  }
1747
1748
  QualType getOriginalType() const;
1749
1750
  /// Sets the function declaration that owns this
1751
  /// ParmVarDecl. Since ParmVarDecls are often created before the
1752
  /// FunctionDecls that own them, this routine is required to update
1753
  /// the DeclContext appropriately.
1754
7.28M
  void setOwningFunction(DeclContext *FD) { setDeclContext(FD); }
1755
1756
  // Implement isa/cast/dyncast/etc.
1757
585M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1758
585M
  static bool classofKind(Kind K) { return K == ParmVar; }
1759
1760
private:
1761
  enum { ParameterIndexSentinel = (1 << NumParameterIndexBits) - 1 };
1762
1763
39.7M
  void setParameterIndex(unsigned parameterIndex) {
1764
39.7M
    if (parameterIndex >= ParameterIndexSentinel) {
1765
47
      setParameterIndexLarge(parameterIndex);
1766
47
      return;
1767
47
    }
1768
1769
39.7M
    ParmVarDeclBits.ParameterIndex = parameterIndex;
1770
39.7M
    assert(ParmVarDeclBits.ParameterIndex == parameterIndex && "truncation!");
1771
39.7M
  }
1772
9.52M
  unsigned getParameterIndex() const {
1773
9.52M
    unsigned d = ParmVarDeclBits.ParameterIndex;
1774
9.52M
    return d == ParameterIndexSentinel ? 
getParameterIndexLarge()0
: d;
1775
9.52M
  }
1776
1777
  void setParameterIndexLarge(unsigned parameterIndex);
1778
  unsigned getParameterIndexLarge() const;
1779
};
1780
1781
enum class MultiVersionKind {
1782
  None,
1783
  Target,
1784
  CPUSpecific,
1785
  CPUDispatch
1786
};
1787
1788
/// Represents a function declaration or definition.
1789
///
1790
/// Since a given function can be declared several times in a program,
1791
/// there may be several FunctionDecls that correspond to that
1792
/// function. Only one of those FunctionDecls will be found when
1793
/// traversing the list of declarations in the context of the
1794
/// FunctionDecl (e.g., the translation unit); this FunctionDecl
1795
/// contains all of the information known about the function. Other,
1796
/// previous declarations of the function are available via the
1797
/// getPreviousDecl() chain.
1798
class FunctionDecl : public DeclaratorDecl,
1799
                     public DeclContext,
1800
                     public Redeclarable<FunctionDecl> {
1801
  // This class stores some data in DeclContext::FunctionDeclBits
1802
  // to save some space. Use the provided accessors to access it.
1803
public:
1804
  /// The kind of templated function a FunctionDecl can be.
1805
  enum TemplatedKind {
1806
    // Not templated.
1807
    TK_NonTemplate,
1808
    // The pattern in a function template declaration.
1809
    TK_FunctionTemplate,
1810
    // A non-template function that is an instantiation or explicit
1811
    // specialization of a member of a templated class.
1812
    TK_MemberSpecialization,
1813
    // An instantiation or explicit specialization of a function template.
1814
    // Note: this might have been instantiated from a templated class if it
1815
    // is a class-scope explicit specialization.
1816
    TK_FunctionTemplateSpecialization,
1817
    // A function template specialization that hasn't yet been resolved to a
1818
    // particular specialized function template.
1819
    TK_DependentFunctionTemplateSpecialization
1820
  };
1821
1822
  /// Stashed information about a defaulted function definition whose body has
1823
  /// not yet been lazily generated.
1824
  class DefaultedFunctionInfo final
1825
      : llvm::TrailingObjects<DefaultedFunctionInfo, DeclAccessPair> {
1826
    friend TrailingObjects;
1827
    unsigned NumLookups;
1828
1829
  public:
1830
    static DefaultedFunctionInfo *Create(ASTContext &Context,
1831
                                         ArrayRef<DeclAccessPair> Lookups);
1832
    /// Get the unqualified lookup results that should be used in this
1833
    /// defaulted function definition.
1834
1.73k
    ArrayRef<DeclAccessPair> getUnqualifiedLookups() const {
1835
1.73k
      return {getTrailingObjects<DeclAccessPair>(), NumLookups};
1836
1.73k
    }
1837
  };
1838
1839
private:
1840
  /// A new[]'d array of pointers to VarDecls for the formal
1841
  /// parameters of this function.  This is null if a prototype or if there are
1842
  /// no formals.
1843
  ParmVarDecl **ParamInfo = nullptr;
1844
1845
  /// The active member of this union is determined by
1846
  /// FunctionDeclBits.HasDefaultedFunctionInfo.
1847
  union {
1848
    /// The body of the function.
1849
    LazyDeclStmtPtr Body;
1850
    /// Information about a future defaulted function definition.
1851
    DefaultedFunctionInfo *DefaultedInfo;
1852
  };
1853
1854
  unsigned ODRHash;
1855
1856
  /// End part of this FunctionDecl's source range.
1857
  ///
1858
  /// We could compute the full range in getSourceRange(). However, when we're
1859
  /// dealing with a function definition deserialized from a PCH/AST file,
1860
  /// we can only compute the full range once the function body has been
1861
  /// de-serialized, so it's far better to have the (sometimes-redundant)
1862
  /// EndRangeLoc.
1863
  SourceLocation EndRangeLoc;
1864
1865
  /// The template or declaration that this declaration
1866
  /// describes or was instantiated from, respectively.
1867
  ///
1868
  /// For non-templates, this value will be NULL. For function
1869
  /// declarations that describe a function template, this will be a
1870
  /// pointer to a FunctionTemplateDecl. For member functions
1871
  /// of class template specializations, this will be a MemberSpecializationInfo
1872
  /// pointer containing information about the specialization.
1873
  /// For function template specializations, this will be a
1874
  /// FunctionTemplateSpecializationInfo, which contains information about
1875
  /// the template being specialized and the template arguments involved in
1876
  /// that specialization.
1877
  llvm::PointerUnion<FunctionTemplateDecl *,
1878
                     MemberSpecializationInfo *,
1879
                     FunctionTemplateSpecializationInfo *,
1880
                     DependentFunctionTemplateSpecializationInfo *>
1881
    TemplateOrSpecialization;
1882
1883
  /// Provides source/type location info for the declaration name embedded in
1884
  /// the DeclaratorDecl base class.
1885
  DeclarationNameLoc DNLoc;
1886
1887
  /// Specify that this function declaration is actually a function
1888
  /// template specialization.
1889
  ///
1890
  /// \param C the ASTContext.
1891
  ///
1892
  /// \param Template the function template that this function template
1893
  /// specialization specializes.
1894
  ///
1895
  /// \param TemplateArgs the template arguments that produced this
1896
  /// function template specialization from the template.
1897
  ///
1898
  /// \param InsertPos If non-NULL, the position in the function template
1899
  /// specialization set where the function template specialization data will
1900
  /// be inserted.
1901
  ///
1902
  /// \param TSK the kind of template specialization this is.
1903
  ///
1904
  /// \param TemplateArgsAsWritten location info of template arguments.
1905
  ///
1906
  /// \param PointOfInstantiation point at which the function template
1907
  /// specialization was first instantiated.
1908
  void setFunctionTemplateSpecialization(ASTContext &C,
1909
                                         FunctionTemplateDecl *Template,
1910
                                       const TemplateArgumentList *TemplateArgs,
1911
                                         void *InsertPos,
1912
                                         TemplateSpecializationKind TSK,
1913
                          const TemplateArgumentListInfo *TemplateArgsAsWritten,
1914
                                         SourceLocation PointOfInstantiation);
1915
1916
  /// Specify that this record is an instantiation of the
1917
  /// member function FD.
1918
  void setInstantiationOfMemberFunction(ASTContext &C, FunctionDecl *FD,
1919
                                        TemplateSpecializationKind TSK);
1920
1921
  void setParams(ASTContext &C, ArrayRef<ParmVarDecl *> NewParamInfo);
1922
1923
  // This is unfortunately needed because ASTDeclWriter::VisitFunctionDecl
1924
  // need to access this bit but we want to avoid making ASTDeclWriter
1925
  // a friend of FunctionDeclBitfields just for this.
1926
497k
  bool isDeletedBit() const { return FunctionDeclBits.IsDeleted; }
1927
1928
  /// Whether an ODRHash has been stored.
1929
662k
  bool hasODRHash() const { return FunctionDeclBits.HasODRHash; }
1930
1931
  /// State that an ODRHash has been stored.
1932
969k
  void setHasODRHash(bool B = true) { FunctionDeclBits.HasODRHash = B; }
1933
1934
protected:
1935
  FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
1936
               const DeclarationNameInfo &NameInfo, QualType T,
1937
               TypeSourceInfo *TInfo, StorageClass S, bool isInlineSpecified,
1938
               ConstexprSpecKind ConstexprKind,
1939
               Expr *TrailingRequiresClause = nullptr);
1940
1941
  using redeclarable_base = Redeclarable<FunctionDecl>;
1942
1943
4.40M
  FunctionDecl *getNextRedeclarationImpl() override {
1944
4.40M
    return getNextRedeclaration();
1945
4.40M
  }
1946
1947
4.14M
  FunctionDecl *getPreviousDeclImpl() override {
1948
4.14M
    return getPreviousDecl();
1949
4.14M
  }
1950
1951
36.7M
  FunctionDecl *getMostRecentDeclImpl() override {
1952
36.7M
    return getMostRecentDecl();
1953
36.7M
  }
1954
1955
public:
1956
  friend class ASTDeclReader;
1957
  friend class ASTDeclWriter;
1958
1959
  using redecl_range = redeclarable_base::redecl_range;
1960
  using redecl_iterator = redeclarable_base::redecl_iterator;
1961
1962
  using redeclarable_base::redecls_begin;
1963
  using redeclarable_base::redecls_end;
1964
  using redeclarable_base::redecls;
1965
  using redeclarable_base::getPreviousDecl;
1966
  using redeclarable_base::getMostRecentDecl;
1967
  using redeclarable_base::isFirstDecl;
1968
1969
  static FunctionDecl *
1970
  Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
1971
         SourceLocation NLoc, DeclarationName N, QualType T,
1972
         TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified = false,
1973
         bool hasWrittenPrototype = true,
1974
         ConstexprSpecKind ConstexprKind = CSK_unspecified,
1975
726k
         Expr *TrailingRequiresClause = nullptr) {
1976
726k
    DeclarationNameInfo NameInfo(N, NLoc);
1977
726k
    return FunctionDecl::Create(C, DC, StartLoc, NameInfo, T, TInfo, SC,
1978
726k
                                isInlineSpecified, hasWrittenPrototype,
1979
726k
                                ConstexprKind, TrailingRequiresClause);
1980
726k
  }
1981
1982
  static FunctionDecl *Create(ASTContext &C, DeclContext *DC,
1983
                              SourceLocation StartLoc,
1984
                              const DeclarationNameInfo &NameInfo, QualType T,
1985
                              TypeSourceInfo *TInfo, StorageClass SC,
1986
                              bool isInlineSpecified, bool hasWrittenPrototype,
1987
                              ConstexprSpecKind ConstexprKind,
1988
                              Expr *TrailingRequiresClause);
1989
1990
  static FunctionDecl *CreateDeserialized(ASTContext &C, unsigned ID);
1991
1992
1.79M
  DeclarationNameInfo getNameInfo() const {
1993
1.79M
    return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc);
1994
1.79M
  }
1995
1996
  void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy,
1997
                            bool Qualified) const override;
1998
1999
15.0M
  void setRangeEnd(SourceLocation E) { EndRangeLoc = E; }
2000
2001
  /// Returns the location of the ellipsis of a variadic function.
2002
14
  SourceLocation getEllipsisLoc() const {
2003
14
    const auto *FPT = getType()->getAs<FunctionProtoType>();
2004
14
    if (FPT && FPT->isVariadic())
2005
4
      return FPT->getEllipsisLoc();
2006
10
    return SourceLocation();
2007
10
  }
2008
2009
  SourceRange getSourceRange() const override LLVM_READONLY;
2010
2011
  // Function definitions.
2012
  //
2013
  // A function declaration may be:
2014
  // - a non defining declaration,
2015
  // - a definition. A function may be defined because:
2016
  //   - it has a body, or will have it in the case of late parsing.
2017
  //   - it has an uninstantiated body. The body does not exist because the
2018
  //     function is not used yet, but the declaration is considered a
2019
  //     definition and does not allow other definition of this function.
2020
  //   - it does not have a user specified body, but it does not allow
2021
  //     redefinition, because it is deleted/defaulted or is defined through
2022
  //     some other mechanism (alias, ifunc).
2023
2024
  /// Returns true if the function has a body.
2025
  ///
2026
  /// The function body might be in any of the (re-)declarations of this
2027
  /// function. The variant that accepts a FunctionDecl pointer will set that
2028
  /// function declaration to the actual declaration containing the body (if
2029
  /// there is one).
2030
  bool hasBody(const FunctionDecl *&Definition) const;
2031
2032
931k
  bool hasBody() const override {
2033
931k
    const FunctionDecl* Definition;
2034
931k
    return hasBody(Definition);
2035
931k
  }
2036
2037
  /// Returns whether the function has a trivial body that does not require any
2038
  /// specific codegen.
2039
  bool hasTrivialBody() const;
2040
2041
  /// Returns true if the function has a definition that does not need to be
2042
  /// instantiated.
2043
  ///
2044
  /// The variant that accepts a FunctionDecl pointer will set that function
2045
  /// declaration to the declaration that is a definition (if there is one).
2046
  bool isDefined(const FunctionDecl *&Definition) const;
2047
2048
1.83M
  bool isDefined() const {
2049
1.83M
    const FunctionDecl* Definition;
2050
1.83M
    return isDefined(Definition);
2051
1.83M
  }
2052
2053
  /// Get the definition for this declaration.
2054
2.63M
  FunctionDecl *getDefinition() {
2055
2.63M
    const FunctionDecl *Definition;
2056
2.63M
    if (isDefined(Definition))
2057
2.38M
      return const_cast<FunctionDecl *>(Definition);
2058
255k
    return nullptr;
2059
255k
  }
2060
222k
  const FunctionDecl *getDefinition() const {
2061
222k
    return const_cast<FunctionDecl *>(this)->getDefinition();
2062
222k
  }
2063
2064
  /// Retrieve the body (definition) of the function. The function body might be
2065
  /// in any of the (re-)declarations of this function. The variant that accepts
2066
  /// a FunctionDecl pointer will set that function declaration to the actual
2067
  /// declaration containing the body (if there is one).
2068
  /// NOTE: For checking if there is a body, use hasBody() instead, to avoid
2069
  /// unnecessary AST de-serialization of the body.
2070
  Stmt *getBody(const FunctionDecl *&Definition) const;
2071
2072
9.41M
  Stmt *getBody() const override {
2073
9.41M
    const FunctionDecl* Definition;
2074
9.41M
    return getBody(Definition);
2075
9.41M
  }
2076
2077
  /// Returns whether this specific declaration of the function is also a
2078
  /// definition that does not contain uninstantiated body.
2079
  ///
2080
  /// This does not determine whether the function has been defined (e.g., in a
2081
  /// previous definition); for that information, use isDefined.
2082
  ///
2083
  /// Note: the function declaration does not become a definition until the
2084
  /// parser reaches the definition, if called before, this function will return
2085
  /// `false`.
2086
10.9M
  bool isThisDeclarationADefinition() const {
2087
10.9M
    return isDeletedAsWritten() || 
isDefaulted()10.9M
||
2088
10.7M
           doesThisDeclarationHaveABody() || 
hasSkippedBody()6.64M
||
2089
6.64M
           willHaveBody() || 
hasDefiningAttr()6.63M
;
2090
10.9M
  }
2091
2092
  /// Returns whether this specific declaration of the function has a body.
2093
51.7M
  bool doesThisDeclarationHaveABody() const {
2094
51.7M
    return (!FunctionDeclBits.HasDefaultedFunctionInfo && 
Body51.7M
) ||
2095
31.2M
           isLateTemplateParsed();
2096
51.7M
  }
2097
2098
  void setBody(Stmt *B);
2099
210k
  void setLazyBody(uint64_t Offset) {
2100
210k
    FunctionDeclBits.HasDefaultedFunctionInfo = false;
2101
210k
    Body = LazyDeclStmtPtr(Offset);
2102
210k
  }
2103
2104
  void setDefaultedFunctionInfo(DefaultedFunctionInfo *Info);
2105
  DefaultedFunctionInfo *getDefaultedFunctionInfo() const;
2106
2107
  /// Whether this function is variadic.
2108
  bool isVariadic() const;
2109
2110
  /// Whether this function is marked as virtual explicitly.
2111
11.0M
  bool isVirtualAsWritten() const {
2112
11.0M
    return FunctionDeclBits.IsVirtualAsWritten;
2113
11.0M
  }
2114
2115
  /// State that this function is marked as virtual explicitly.
2116
669k
  void setVirtualAsWritten(bool V) { FunctionDeclBits.IsVirtualAsWritten = V; }
2117
2118
  /// Whether this virtual function is pure, i.e. makes the containing class
2119
  /// abstract.
2120
11.2M
  bool isPure() const { return FunctionDeclBits.IsPure; }
2121
  void setPure(bool P = true);
2122
2123
  /// Whether this templated function will be late parsed.
2124
34.7M
  bool isLateTemplateParsed() const {
2125
34.7M
    return FunctionDeclBits.IsLateTemplateParsed;
2126
34.7M
  }
2127
2128
  /// State that this templated function will be late parsed.
2129
473k
  void setLateTemplateParsed(bool ILT = true) {
2130
473k
    FunctionDeclBits.IsLateTemplateParsed = ILT;
2131
473k
  }
2132
2133
  /// Whether this function is "trivial" in some specialized C++ senses.
2134
  /// Can only be true for default constructors, copy constructors,
2135
  /// copy assignment operators, and destructors.  Not meaningful until
2136
  /// the class has been fully built by Sema.
2137
6.28M
  bool isTrivial() const { return FunctionDeclBits.IsTrivial; }
2138
1.12M
  void setTrivial(bool IT) { FunctionDeclBits.IsTrivial = IT; }
2139
2140
917k
  bool isTrivialForCall() const { return FunctionDeclBits.IsTrivialForCall; }
2141
833k
  void setTrivialForCall(bool IT) { FunctionDeclBits.IsTrivialForCall = IT; }
2142
2143
  /// Whether this function is defaulted. Valid for e.g.
2144
  /// special member functions, defaulted comparisions (not methods!).
2145
31.7M
  bool isDefaulted() const { return FunctionDeclBits.IsDefaulted; }
2146
997k
  void setDefaulted(bool D = true) { FunctionDeclBits.IsDefaulted = D; }
2147
2148
  /// Whether this function is explicitly defaulted.
2149
4.79M
  bool isExplicitlyDefaulted() const {
2150
4.79M
    return FunctionDeclBits.IsExplicitlyDefaulted;
2151
4.79M
  }
2152
2153
  /// State that this function is explicitly defaulted.
2154
583k
  void setExplicitlyDefaulted(bool ED = true) {
2155
583k
    FunctionDeclBits.IsExplicitlyDefaulted = ED;
2156
583k
  }
2157
2158
  /// True if this method is user-declared and was not
2159
  /// deleted or defaulted on its first declaration.
2160
5.16M
  bool isUserProvided() const {
2161
5.16M
    auto *DeclAsWritten = this;
2162
5.16M
    if (FunctionDecl *Pattern = getTemplateInstantiationPattern())
2163
2.06M
      DeclAsWritten = Pattern;
2164
5.16M
    return !(DeclAsWritten->isDeleted() ||
2165
5.03M
             DeclAsWritten->getCanonicalDecl()->isDefaulted());
2166
5.16M
  }
2167
2168
  /// Whether falling off this function implicitly returns null/zero.
2169
  /// If a more specific implicit return value is required, front-ends
2170
  /// should synthesize the appropriate return statements.
2171
4.20M
  bool hasImplicitReturnZero() const {
2172
4.20M
    return FunctionDeclBits.HasImplicitReturnZero;
2173
4.20M
  }
2174
2175
  /// State that falling off this function implicitly returns null/zero.
2176
  /// If a more specific implicit return value is required, front-ends
2177
  /// should synthesize the appropriate return statements.
2178
481k
  void setHasImplicitReturnZero(bool IRZ) {
2179
481k
    FunctionDeclBits.HasImplicitReturnZero = IRZ;
2180
481k
  }
2181
2182
  /// Whether this function has a prototype, either because one
2183
  /// was explicitly written or because it was "inherited" by merging
2184
  /// a declaration without a prototype with a declaration that has a
2185
  /// prototype.
2186
2.26M
  bool hasPrototype() const {
2187
2.26M
    return hasWrittenPrototype() || 
hasInheritedPrototype()21.6k
;
2188
2.26M
  }
2189
2190
  /// Whether this function has a written prototype.
2191
3.07M
  bool hasWrittenPrototype() const {
2192
3.07M
    return FunctionDeclBits.HasWrittenPrototype;
2193
3.07M
  }
2194
2195
  /// State that this function has a written prototype.
2196
14.0M
  void setHasWrittenPrototype(bool P = true) {
2197
14.0M
    FunctionDeclBits.HasWrittenPrototype = P;
2198
14.0M
  }
2199
2200
  /// Whether this function inherited its prototype from a
2201
  /// previous declaration.
2202
540k
  bool hasInheritedPrototype() const {
2203
540k
    return FunctionDeclBits.HasInheritedPrototype;
2204
540k
  }
2205
2206
  /// State that this function inherited its prototype from a
2207
  /// previous declaration.
2208
472k
  void setHasInheritedPrototype(bool P = true) {
2209
472k
    FunctionDeclBits.HasInheritedPrototype = P;
2210
472k
  }
2211
2212
  /// Whether this is a (C++11) constexpr function or constexpr constructor.
2213
12.1M
  bool isConstexpr() const {
2214
12.1M
    return FunctionDeclBits.ConstexprKind != CSK_unspecified;
2215
12.1M
  }
2216
560k
  void setConstexprKind(ConstexprSpecKind CSK) {
2217
560k
    FunctionDeclBits.ConstexprKind = CSK;
2218
560k
  }
2219
2.07M
  ConstexprSpecKind getConstexprKind() const {
2220
2.07M
    return static_cast<ConstexprSpecKind>(FunctionDeclBits.ConstexprKind);
2221
2.07M
  }
2222
10.3k
  bool isConstexprSpecified() const {
2223
10.3k
    return FunctionDeclBits.ConstexprKind == CSK_constexpr;
2224
10.3k
  }
2225
20.3M
  bool isConsteval() const {
2226
20.3M
    return FunctionDeclBits.ConstexprKind == CSK_consteval;
2227
20.3M
  }
2228
2229
  /// Whether the instantiation of this function is pending.
2230
  /// This bit is set when the decision to instantiate this function is made
2231
  /// and unset if and when the function body is created. That leaves out
2232
  /// cases where instantiation did not happen because the template definition
2233
  /// was not seen in this TU. This bit remains set in those cases, under the
2234
  /// assumption that the instantiation will happen in some other TU.
2235
30
  bool instantiationIsPending() const {
2236
30
    return FunctionDeclBits.InstantiationIsPending;
2237
30
  }
2238
2239
  /// State that the instantiation of this function is pending.
2240
  /// (see instantiationIsPending)
2241
239k
  void setInstantiationIsPending(bool IC) {
2242
239k
    FunctionDeclBits.InstantiationIsPending = IC;
2243
239k
  }
2244
2245
  /// Indicates the function uses __try.
2246
782k
  bool usesSEHTry() const { return FunctionDeclBits.UsesSEHTry; }
2247
472k
  void setUsesSEHTry(bool UST) { FunctionDeclBits.UsesSEHTry = UST; }
2248
2249
  /// Indicates the function uses Floating Point constrained intrinsics
2250
1.73M
  bool usesFPIntrin() const { return FunctionDeclBits.UsesFPIntrin; }
2251
687k
  void setUsesFPIntrin(bool Val) { FunctionDeclBits.UsesFPIntrin = Val; }
2252
2253
  /// Whether this function has been deleted.
2254
  ///
2255
  /// A function that is "deleted" (via the C++0x "= delete" syntax)
2256
  /// acts like a normal function, except that it cannot actually be
2257
  /// called or have its address taken. Deleted functions are
2258
  /// typically used in C++ overload resolution to attract arguments
2259
  /// whose type or lvalue/rvalue-ness would permit the use of a
2260
  /// different overload that would behave incorrectly. For example,
2261
  /// one might use deleted functions to ban implicit conversion from
2262
  /// a floating-point number to an Integer type:
2263
  ///
2264
  /// @code
2265
  /// struct Integer {
2266
  ///   Integer(long); // construct from a long
2267
  ///   Integer(double) = delete; // no construction from float or double
2268
  ///   Integer(long double) = delete; // no construction from long double
2269
  /// };
2270
  /// @endcode
2271
  // If a function is deleted, its first declaration must be.
2272
17.9M
  bool isDeleted() const {
2273
17.9M
    return getCanonicalDecl()->FunctionDeclBits.IsDeleted;
2274
17.9M
  }
2275
2276
12.3M
  bool isDeletedAsWritten() const {
2277
12.3M
    return FunctionDeclBits.IsDeleted && 
!isDefaulted()36.1k
;
2278
12.3M
  }
2279
2280
603k
  void setDeletedAsWritten(bool D = true) { FunctionDeclBits.IsDeleted = D; }
2281
2282
  /// Determines whether this function is "main", which is the
2283
  /// entry point into an executable program.
2284
  bool isMain() const;
2285
2286
  /// Determines whether this function is a MSVCRT user defined entry
2287
  /// point.
2288
  bool isMSVCRTEntryPoint() const;
2289
2290
  /// Determines whether this operator new or delete is one
2291
  /// of the reserved global placement operators:
2292
  ///    void *operator new(size_t, void *);
2293
  ///    void *operator new[](size_t, void *);
2294
  ///    void operator delete(void *, void *);
2295
  ///    void operator delete[](void *, void *);
2296
  /// These functions have special behavior under [new.delete.placement]:
2297
  ///    These functions are reserved, a C++ program may not define
2298
  ///    functions that displace the versions in the Standard C++ library.
2299
  ///    The provisions of [basic.stc.dynamic] do not apply to these
2300
  ///    reserved placement forms of operator new and operator delete.
2301
  ///
2302
  /// This function must be an allocation or deallocation function.
2303
  bool isReservedGlobalPlacementOperator() const;
2304
2305
  /// Determines whether this function is one of the replaceable
2306
  /// global allocation functions:
2307
  ///    void *operator new(size_t);
2308
  ///    void *operator new(size_t, const std::nothrow_t &) noexcept;
2309
  ///    void *operator new[](size_t);
2310
  ///    void *operator new[](size_t, const std::nothrow_t &) noexcept;
2311
  ///    void operator delete(void *) noexcept;
2312
  ///    void operator delete(void *, std::size_t) noexcept;      [C++1y]
2313
  ///    void operator delete(void *, const std::nothrow_t &) noexcept;
2314
  ///    void operator delete[](void *) noexcept;
2315
  ///    void operator delete[](void *, std::size_t) noexcept;    [C++1y]
2316
  ///    void operator delete[](void *, const std::nothrow_t &) noexcept;
2317
  /// These functions have special behavior under C++1y [expr.new]:
2318
  ///    An implementation is allowed to omit a call to a replaceable global
2319
  ///    allocation function. [...]
2320
  ///
2321
  /// If this function is an aligned allocation/deallocation function, return
2322
  /// the parameter number of the requested alignment through AlignmentParam.
2323
  ///
2324
  /// If this function is an allocation/deallocation function that takes
2325
  /// the `std::nothrow_t` tag, return true through IsNothrow,
2326
  bool isReplaceableGlobalAllocationFunction(
2327
      Optional<unsigned> *AlignmentParam = nullptr,
2328
      bool *IsNothrow = nullptr) const;
2329
2330
  /// Determine if this function provides an inline implementation of a builtin.
2331
  bool isInlineBuiltinDeclaration() const;
2332
2333
  /// Determine whether this is a destroying operator delete.
2334
  bool isDestroyingOperatorDelete() const;
2335
2336
  /// Compute the language linkage.
2337
  LanguageLinkage getLanguageLinkage() const;
2338
2339
  /// Determines whether this function is a function with
2340
  /// external, C linkage.
2341
  bool isExternC() const;
2342
2343
  /// Determines whether this function's context is, or is nested within,
2344
  /// a C++ extern "C" linkage spec.
2345
  bool isInExternCContext() const;
2346
2347
  /// Determines whether this function's context is, or is nested within,
2348
  /// a C++ extern "C++" linkage spec.
2349
  bool isInExternCXXContext() const;
2350
2351
  /// Determines whether this is a global function.
2352
  bool isGlobal() const;
2353
2354
  /// Determines whether this function is known to be 'noreturn', through
2355
  /// an attribute on its declaration or its type.
2356
  bool isNoReturn() const;
2357
2358
  /// True if the function was a definition but its body was skipped.
2359
10.6M
  bool hasSkippedBody() const { return FunctionDeclBits.HasSkippedBody; }
2360
473k
  void setHasSkippedBody(bool Skipped = true) {
2361
473k
    FunctionDeclBits.HasSkippedBody = Skipped;
2362
473k
  }
2363
2364
  /// True if this function will eventually have a body, once it's fully parsed.
2365
10.1M
  bool willHaveBody() const { return FunctionDeclBits.WillHaveBody; }
2366
7.40M
  void setWillHaveBody(bool V = true) { FunctionDeclBits.WillHaveBody = V; }
2367
2368
  /// True if this function is considered a multiversioned function.
2369
27.5M
  bool isMultiVersion() const {
2370
27.5M
    return getCanonicalDecl()->FunctionDeclBits.IsMultiVersion;
2371
27.5M
  }
2372
2373
  /// Sets the multiversion state for this declaration and all of its
2374
  /// redeclarations.
2375
472k
  void setIsMultiVersion(bool V = true) {
2376
472k
    getCanonicalDecl()->FunctionDeclBits.IsMultiVersion = V;
2377
472k
  }
2378
2379
  /// Gets the kind of multiversioning attribute this declaration has. Note that
2380
  /// this can return a value even if the function is not multiversion, such as
2381
  /// the case of 'target'.
2382
  MultiVersionKind getMultiVersionKind() const;
2383
2384
2385
  /// True if this function is a multiversioned dispatch function as a part of
2386
  /// the cpu_specific/cpu_dispatch functionality.
2387
  bool isCPUDispatchMultiVersion() const;
2388
  /// True if this function is a multiversioned processor specific function as a
2389
  /// part of the cpu_specific/cpu_dispatch functionality.
2390
  bool isCPUSpecificMultiVersion() const;
2391
2392
  /// True if this function is a multiversioned dispatch function as a part of
2393
  /// the target functionality.
2394
  bool isTargetMultiVersion() const;
2395
2396
  /// \brief Get the associated-constraints of this function declaration.
2397
  /// Currently, this will either be a vector of size 1 containing the
2398
  /// trailing-requires-clause or an empty vector.
2399
  ///
2400
  /// Use this instead of getTrailingRequiresClause for concepts APIs that
2401
  /// accept an ArrayRef of constraint expressions.
2402
4.04k
  void getAssociatedConstraints(SmallVectorImpl<const Expr *> &AC) const {
2403
4.04k
    if (auto *TRC = getTrailingRequiresClause())
2404
16
      AC.push_back(TRC);
2405
4.04k
  }
2406
2407
  void setPreviousDeclaration(FunctionDecl * PrevDecl);
2408
2409
  FunctionDecl *getCanonicalDecl() override;
2410
63.9M
  const FunctionDecl *getCanonicalDecl() const {
2411
63.9M
    return const_cast<FunctionDecl*>(this)->getCanonicalDecl();
2412
63.9M
  }
2413
2414
  unsigned getBuiltinID(bool ConsiderWrapperFunctions = false) const;
2415
2416
  // ArrayRef interface to parameters.
2417
24.8M
  ArrayRef<ParmVarDecl *> parameters() const {
2418
24.8M
    return {ParamInfo, getNumParams()};
2419
24.8M
  }
2420
28.0M
  MutableArrayRef<ParmVarDecl *> parameters() {
2421
28.0M
    return {ParamInfo, getNumParams()};
2422
28.0M
  }
2423
2424
  // Iterator access to formal parameters.
2425
  using param_iterator = MutableArrayRef<ParmVarDecl *>::iterator;
2426
  using param_const_iterator = ArrayRef<ParmVarDecl *>::const_iterator;
2427
2428
3.33k
  bool param_empty() const { return parameters().empty(); }
2429
174
  param_iterator param_begin() { return parameters().begin(); }
2430
0
  param_iterator param_end() { return parameters().end(); }
2431
1.00M
  param_const_iterator param_begin() const { return parameters().begin(); }
2432
823k
  param_const_iterator param_end() const { return parameters().end(); }
2433
1.73M
  size_t param_size() const { return parameters().size(); }
2434
2435
  /// Return the number of parameters this function must have based on its
2436
  /// FunctionType.  This is the length of the ParamInfo array after it has been
2437
  /// created.
2438
  unsigned getNumParams() const;
2439
2440
16.9M
  const ParmVarDecl *getParamDecl(unsigned i) const {
2441
16.9M
    assert(i < getNumParams() && "Illegal param #");
2442
16.9M
    return ParamInfo[i];
2443
16.9M
  }
2444
13.8M
  ParmVarDecl *getParamDecl(unsigned i) {
2445
13.8M
    assert(i < getNumParams() && "Illegal param #");
2446
13.8M
    return ParamInfo[i];
2447
13.8M
  }
2448
16.0M
  void setParams(ArrayRef<ParmVarDecl *> NewParamInfo) {
2449
16.0M
    setParams(getASTContext(), NewParamInfo);
2450
16.0M
  }
2451
2452
  /// Returns the minimum number of arguments needed to call this function. This
2453
  /// may be fewer than the number of function parameters, if some of the
2454
  /// parameters have default arguments (in C++).
2455
  unsigned getMinRequiredArguments() const;
2456
2457
  /// Determine whether this function has a single parameter, or multiple
2458
  /// parameters where all but the first have default arguments.
2459
  ///
2460
  /// This notion is used in the definition of copy/move constructors and
2461
  /// initializer list constructors. Note that, unlike getMinRequiredArguments,
2462
  /// parameter packs are not treated specially here.
2463
  bool hasOneParamOrDefaultArgs() const;
2464
2465
  /// Find the source location information for how the type of this function
2466
  /// was written. May be absent (for example if the function was declared via
2467
  /// a typedef) and may contain a different type from that of the function
2468
  /// (for example if the function type was adjusted by an attribute).
2469
  FunctionTypeLoc getFunctionTypeLoc() const;
2470
2471
71.2M
  QualType getReturnType() const {
2472
71.2M
    return getType()->castAs<FunctionType>()->getReturnType();
2473
71.2M
  }
2474
2475
  /// Attempt to compute an informative source range covering the
2476
  /// function return type. This may omit qualifiers and other information with
2477
  /// limited representation in the AST.
2478
  SourceRange getReturnTypeSourceRange() const;
2479
2480
  /// Attempt to compute an informative source range covering the
2481
  /// function parameters, including the ellipsis of a variadic function.
2482
  /// The source range excludes the parentheses, and is invalid if there are
2483
  /// no parameters and no ellipsis.
2484
  SourceRange getParametersSourceRange() const;
2485
2486
  /// Get the declared return type, which may differ from the actual return
2487
  /// type if the return type is deduced.
2488
595k
  QualType getDeclaredReturnType() const {
2489
595k
    auto *TSI = getTypeSourceInfo();
2490
592k
    QualType T = TSI ? TSI->getType() : 
getType()3.51k
;
2491
595k
    return T->castAs<FunctionType>()->getReturnType();
2492
595k
  }
2493
2494
  /// Gets the ExceptionSpecificationType as declared.
2495
368
  ExceptionSpecificationType getExceptionSpecType() const {
2496
368
    auto *TSI = getTypeSourceInfo();
2497
368
    QualType T = TSI ? TSI->getType() : 
getType()0
;
2498
368
    const auto *FPT = T->getAs<FunctionProtoType>();
2499
368
    return FPT ? FPT->getExceptionSpecType() : 
EST_None0
;
2500
368
  }
2501
2502
  /// Attempt to compute an informative source range covering the
2503
  /// function exception specification, if any.
2504
  SourceRange getExceptionSpecSourceRange() const;
2505
2506
  /// Determine the type of an expression that calls this function.
2507
1.57M
  QualType getCallResultType() const {
2508
1.57M
    return getType()->castAs<FunctionType>()->getCallResultType(
2509
1.57M
        getASTContext());
2510
1.57M
  }
2511
2512
  /// Returns the storage class as written in the source. For the
2513
  /// computed linkage of symbol, see getLinkage.
2514
49.6M
  StorageClass getStorageClass() const {
2515
49.6M
    return static_cast<StorageClass>(FunctionDeclBits.SClass);
2516
49.6M
  }
2517
2518
  /// Sets the storage class as written in the source.
2519
520k
  void setStorageClass(StorageClass SClass) {
2520
520k
    FunctionDeclBits.SClass = SClass;
2521
520k
  }
2522
2523
  /// Determine whether the "inline" keyword was specified for this
2524
  /// function.
2525
9.73M
  bool isInlineSpecified() const { return FunctionDeclBits.IsInlineSpecified; }
2526
2527
  /// Set whether the "inline" keyword was specified for this function.
2528
534k
  void setInlineSpecified(bool I) {
2529
534k
    FunctionDeclBits.IsInlineSpecified = I;
2530
534k
    FunctionDeclBits.IsInline = I;
2531
534k
  }
2532
2533
  /// Flag that this function is implicitly inline.
2534
2.20M
  void setImplicitlyInline(bool I = true) { FunctionDeclBits.IsInline = I; }
2535
2536
  /// Determine whether this function should be inlined, because it is
2537
  /// either marked "inline" or "constexpr" or is a member function of a class
2538
  /// that was defined in the class body.
2539
32.1M
  bool isInlined() const { return FunctionDeclBits.IsInline; }
2540
2541
  bool isInlineDefinitionExternallyVisible() const;
2542
2543
  bool isMSExternInline() const;
2544
2545
  bool doesDeclarationForceExternallyVisibleDefinition() const;
2546
2547
401
  bool isStatic() const { return getStorageClass() == SC_Static; }
2548
2549
  /// Whether this function declaration represents an C++ overloaded
2550
  /// operator, e.g., "operator+".
2551
7.52M
  bool isOverloadedOperator() const {
2552
7.52M
    return getOverloadedOperator() != OO_None;
2553
7.52M
  }
2554
2555
  OverloadedOperatorKind getOverloadedOperator() const;
2556
2557
  const IdentifierInfo *getLiteralIdentifier() const;
2558
2559
  /// If this function is an instantiation of a member function
2560
  /// of a class template specialization, retrieves the function from
2561
  /// which it was instantiated.
2562
  ///
2563
  /// This routine will return non-NULL for (non-templated) member
2564
  /// functions of class templates and for instantiations of function
2565
  /// templates. For example, given:
2566
  ///
2567
  /// \code
2568
  /// template<typename T>
2569
  /// struct X {
2570
  ///   void f(T);
2571
  /// };
2572
  /// \endcode
2573
  ///
2574
  /// The declaration for X<int>::f is a (non-templated) FunctionDecl
2575
  /// whose parent is the class template specialization X<int>. For
2576
  /// this declaration, getInstantiatedFromFunction() will return
2577
  /// the FunctionDecl X<T>::A. When a complete definition of
2578
  /// X<int>::A is required, it will be instantiated from the
2579
  /// declaration returned by getInstantiatedFromMemberFunction().
2580
  FunctionDecl *getInstantiatedFromMemberFunction() const;
2581
2582
  /// What kind of templated function this is.
2583
  TemplatedKind getTemplatedKind() const;
2584
2585
  /// If this function is an instantiation of a member function of a
2586
  /// class template specialization, retrieves the member specialization
2587
  /// information.
2588
  MemberSpecializationInfo *getMemberSpecializationInfo() const;
2589
2590
  /// Specify that this record is an instantiation of the
2591
  /// member function FD.
2592
  void setInstantiationOfMemberFunction(FunctionDecl *FD,
2593
656k
                                        TemplateSpecializationKind TSK) {
2594
656k
    setInstantiationOfMemberFunction(getASTContext(), FD, TSK);
2595
656k
  }
2596
2597
  /// Retrieves the function template that is described by this
2598
  /// function declaration.
2599
  ///
2600
  /// Every function template is represented as a FunctionTemplateDecl
2601
  /// and a FunctionDecl (or something derived from FunctionDecl). The
2602
  /// former contains template properties (such as the template
2603
  /// parameter lists) while the latter contains the actual
2604
  /// description of the template's
2605
  /// contents. FunctionTemplateDecl::getTemplatedDecl() retrieves the
2606
  /// FunctionDecl that describes the function template,
2607
  /// getDescribedFunctionTemplate() retrieves the
2608
  /// FunctionTemplateDecl from a FunctionDecl.
2609
  FunctionTemplateDecl *getDescribedFunctionTemplate() const;
2610
2611
  void setDescribedFunctionTemplate(FunctionTemplateDecl *Template);
2612
2613
  /// Determine whether this function is a function template
2614
  /// specialization.
2615
33.2M
  bool isFunctionTemplateSpecialization() const {
2616
33.2M
    return getPrimaryTemplate() != nullptr;
2617
33.2M
  }
2618
2619
  /// If this function is actually a function template specialization,
2620
  /// retrieve information about this function template specialization.
2621
  /// Otherwise, returns NULL.
2622
  FunctionTemplateSpecializationInfo *getTemplateSpecializationInfo() const;
2623
2624
  /// Determines whether this function is a function template
2625
  /// specialization or a member of a class template specialization that can
2626
  /// be implicitly instantiated.
2627
  bool isImplicitlyInstantiable() const;
2628
2629
  /// Determines if the given function was instantiated from a
2630
  /// function template.
2631
  bool isTemplateInstantiation() const;
2632
2633
  /// Retrieve the function declaration from which this function could
2634
  /// be instantiated, if it is an instantiation (rather than a non-template
2635
  /// or a specialization, for example).
2636
  ///
2637
  /// If \p ForDefinition is \c false, explicit specializations will be treated
2638
  /// as if they were implicit instantiations. This will then find the pattern
2639
  /// corresponding to non-definition portions of the declaration, such as
2640
  /// default arguments and the exception specification.
2641
  FunctionDecl *
2642
  getTemplateInstantiationPattern(bool ForDefinition = true) const;
2643
2644
  /// Retrieve the primary template that this function template
2645
  /// specialization either specializes or was instantiated from.
2646
  ///
2647
  /// If this function declaration is not a function template specialization,
2648
  /// returns NULL.
2649
  FunctionTemplateDecl *getPrimaryTemplate() const;
2650
2651
  /// Retrieve the template arguments used to produce this function
2652
  /// template specialization from the primary template.
2653
  ///
2654
  /// If this function declaration is not a function template specialization,
2655
  /// returns NULL.
2656
  const TemplateArgumentList *getTemplateSpecializationArgs() const;
2657
2658
  /// Retrieve the template argument list as written in the sources,
2659
  /// if any.
2660
  ///
2661
  /// If this function declaration is not a function template specialization
2662
  /// or if it had no explicit template argument list, returns NULL.
2663
  /// Note that it an explicit template argument list may be written empty,
2664
  /// e.g., template<> void foo<>(char* s);
2665
  const ASTTemplateArgumentListInfo*
2666
  getTemplateSpecializationArgsAsWritten() const;
2667
2668
  /// Specify that this function declaration is actually a function
2669
  /// template specialization.
2670
  ///
2671
  /// \param Template the function template that this function template
2672
  /// specialization specializes.
2673
  ///
2674
  /// \param TemplateArgs the template arguments that produced this
2675
  /// function template specialization from the template.
2676
  ///
2677
  /// \param InsertPos If non-NULL, the position in the function template
2678
  /// specialization set where the function template specialization data will
2679
  /// be inserted.
2680
  ///
2681
  /// \param TSK the kind of template specialization this is.
2682
  ///
2683
  /// \param TemplateArgsAsWritten location info of template arguments.
2684
  ///
2685
  /// \param PointOfInstantiation point at which the function template
2686
  /// specialization was first instantiated.
2687
  void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
2688
                const TemplateArgumentList *TemplateArgs,
2689
                void *InsertPos,
2690
                TemplateSpecializationKind TSK = TSK_ImplicitInstantiation,
2691
                const TemplateArgumentListInfo *TemplateArgsAsWritten = nullptr,
2692
212k
                SourceLocation PointOfInstantiation = SourceLocation()) {
2693
212k
    setFunctionTemplateSpecialization(getASTContext(), Template, TemplateArgs,
2694
212k
                                      InsertPos, TSK, TemplateArgsAsWritten,
2695
212k
                                      PointOfInstantiation);
2696
212k
  }
2697
2698
  /// Specifies that this function declaration is actually a
2699
  /// dependent function template specialization.
2700
  void setDependentTemplateSpecialization(ASTContext &Context,
2701
                             const UnresolvedSetImpl &Templates,
2702
                      const TemplateArgumentListInfo &TemplateArgs);
2703
2704
  DependentFunctionTemplateSpecializationInfo *
2705
  getDependentSpecializationInfo() const;
2706
2707
  /// Determine what kind of template instantiation this function
2708
  /// represents.
2709
  TemplateSpecializationKind getTemplateSpecializationKind() const;
2710
2711
  /// Determine the kind of template specialization this function represents
2712
  /// for the purpose of template instantiation.
2713
  TemplateSpecializationKind
2714
  getTemplateSpecializationKindForInstantiation() const;
2715
2716
  /// Determine what kind of template instantiation this function
2717
  /// represents.
2718
  void setTemplateSpecializationKind(TemplateSpecializationKind TSK,
2719
                        SourceLocation PointOfInstantiation = SourceLocation());
2720
2721
  /// Retrieve the (first) point of instantiation of a function template
2722
  /// specialization or a member of a class template specialization.
2723
  ///
2724
  /// \returns the first point of instantiation, if this function was
2725
  /// instantiated from a template; otherwise, returns an invalid source
2726
  /// location.
2727
  SourceLocation getPointOfInstantiation() const;
2728
2729
  /// Determine whether this is or was instantiated from an out-of-line
2730
  /// definition of a member function.
2731
  bool isOutOfLine() const override;
2732
2733
  /// Identify a memory copying or setting function.
2734
  /// If the given function is a memory copy or setting function, returns
2735
  /// the corresponding Builtin ID. If the function is not a memory function,
2736
  /// returns 0.
2737
  unsigned getMemoryFunctionKind() const;
2738
2739
  /// Returns ODRHash of the function.  This value is calculated and
2740
  /// stored on first call, then the stored value returned on the other calls.
2741
  unsigned getODRHash();
2742
2743
  /// Returns cached ODRHash of the function.  This must have been previously
2744
  /// computed and stored.
2745
  unsigned getODRHash() const;
2746
2747
  // Implement isa/cast/dyncast/etc.
2748
1.00G
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2749
1.30G
  static bool classofKind(Kind K) {
2750
1.30G
    return K >= firstFunction && 
K <= lastFunction966M
;
2751
1.30G
  }
2752
0
  static DeclContext *castToDeclContext(const FunctionDecl *D) {
2753
0
    return static_cast<DeclContext *>(const_cast<FunctionDecl*>(D));
2754
0
  }
2755
0
  static FunctionDecl *castFromDeclContext(const DeclContext *DC) {
2756
0
    return static_cast<FunctionDecl *>(const_cast<DeclContext*>(DC));
2757
0
  }
2758
};
2759
2760
/// Represents a member of a struct/union/class.
2761
class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
2762
  unsigned BitField : 1;
2763
  unsigned Mutable : 1;
2764
  mutable unsigned CachedFieldIndex : 30;
2765
2766
  /// The kinds of value we can store in InitializerOrBitWidth.
2767
  ///
2768
  /// Note that this is compatible with InClassInitStyle except for
2769
  /// ISK_CapturedVLAType.
2770
  enum InitStorageKind {
2771
    /// If the pointer is null, there's nothing special.  Otherwise,
2772
    /// this is a bitfield and the pointer is the Expr* storing the
2773
    /// bit-width.
2774
    ISK_NoInit = (unsigned) ICIS_NoInit,
2775
2776
    /// The pointer is an (optional due to delayed parsing) Expr*
2777
    /// holding the copy-initializer.
2778
    ISK_InClassCopyInit = (unsigned) ICIS_CopyInit,
2779
2780
    /// The pointer is an (optional due to delayed parsing) Expr*
2781
    /// holding the list-initializer.
2782
    ISK_InClassListInit = (unsigned) ICIS_ListInit,
2783
2784
    /// The pointer is a VariableArrayType* that's been captured;
2785
    /// the enclosing context is a lambda or captured statement.
2786
    ISK_CapturedVLAType,
2787
  };
2788
2789
  /// If this is a bitfield with a default member initializer, this
2790
  /// structure is used to represent the two expressions.
2791
  struct InitAndBitWidth {
2792
    Expr *Init;
2793
    Expr *BitWidth;
2794
  };
2795
2796
  /// Storage for either the bit-width, the in-class initializer, or
2797
  /// both (via InitAndBitWidth), or the captured variable length array bound.
2798
  ///
2799
  /// If the storage kind is ISK_InClassCopyInit or
2800
  /// ISK_InClassListInit, but the initializer is null, then this
2801
  /// field has an in-class initializer that has not yet been parsed
2802
  /// and attached.
2803
  // FIXME: Tail-allocate this to reduce the size of FieldDecl in the
2804
  // overwhelmingly common case that we have none of these things.
2805
  llvm::PointerIntPair<void *, 2, InitStorageKind> InitStorage;
2806
2807
protected:
2808
  FieldDecl(Kind DK, DeclContext *DC, SourceLocation StartLoc,
2809
            SourceLocation IdLoc, IdentifierInfo *Id,
2810
            QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable,
2811
            InClassInitStyle InitStyle)
2812
    : DeclaratorDecl(DK, DC, IdLoc, Id, T, TInfo, StartLoc),
2813
      BitField(false), Mutable(Mutable), CachedFieldIndex(0),
2814
4.63M
      InitStorage(nullptr, (InitStorageKind) InitStyle) {
2815
4.63M
    if (BW)
2816
65.3k
      setBitWidth(BW);
2817
4.63M
  }
2818
2819
public:
2820
  friend class ASTDeclReader;
2821
  friend class ASTDeclWriter;
2822
2823
  static FieldDecl *Create(const ASTContext &C, DeclContext *DC,
2824
                           SourceLocation StartLoc, SourceLocation IdLoc,
2825
                           IdentifierInfo *Id, QualType T,
2826
                           TypeSourceInfo *TInfo, Expr *BW, bool Mutable,
2827
                           InClassInitStyle InitStyle);
2828
2829
  static FieldDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2830
2831
  /// Returns the index of this field within its record,
2832
  /// as appropriate for passing to ASTRecordLayout::getFieldOffset.
2833
  unsigned getFieldIndex() const;
2834
2835
  /// Determines whether this field is mutable (C++ only).
2836
5.41M
  bool isMutable() const { return Mutable; }
2837
2838
  /// Determines whether this field is a bitfield.
2839
10.3M
  bool isBitField() const { return BitField; }
2840
2841
  /// Determines whether this is an unnamed bitfield.
2842
5.68M
  bool isUnnamedBitfield() const { return isBitField() && 
!getDeclName()87.6k
; }
2843
2844
  /// Determines whether this field is a
2845
  /// representative for an anonymous struct or union. Such fields are
2846
  /// unnamed and are implicitly generated by the implementation to
2847
  /// store the data for the anonymous union or struct.
2848
  bool isAnonymousStructOrUnion() const;
2849
2850
647k
  Expr *getBitWidth() const {
2851
647k
    if (!BitField)
2852
582k
      return nullptr;
2853
65.2k
    void *Ptr = InitStorage.getPointer();
2854
65.2k
    if (getInClassInitStyle())
2855
93
      return static_cast<InitAndBitWidth*>(Ptr)->BitWidth;
2856
65.1k
    return static_cast<Expr*>(Ptr);
2857
65.1k
  }
2858
2859
  unsigned getBitWidthValue(const ASTContext &Ctx) const;
2860
2861
  /// Set the bit-field width for this member.
2862
  // Note: used by some clients (i.e., do not remove it).
2863
65.9k
  void setBitWidth(Expr *Width) {
2864
65.9k
    assert(!hasCapturedVLAType() && !BitField &&
2865
65.9k
           "bit width or captured type already set");
2866
65.9k
    assert(Width && "no bit width specified");
2867
65.9k
    InitStorage.setPointer(
2868
65.9k
        InitStorage.getInt()
2869
11
            ? new (getASTContext())
2870
11
                  InitAndBitWidth{getInClassInitializer(), Width}
2871
65.9k
            : static_cast<void*>(Width));
2872
65.9k
    BitField = true;
2873
65.9k
  }
2874
2875
  /// Remove the bit-field width from this member.
2876
  // Note: used by some clients (i.e., do not remove it).
2877
0
  void removeBitWidth() {
2878
0
    assert(isBitField() && "no bitfield width to remove");
2879
0
    InitStorage.setPointer(getInClassInitializer());
2880
0
    BitField = false;
2881
0
  }
2882
2883
  /// Is this a zero-length bit-field? Such bit-fields aren't really bit-fields
2884
  /// at all and instead act as a separator between contiguous runs of other
2885
  /// bit-fields.
2886
  bool isZeroLengthBitField(const ASTContext &Ctx) const;
2887
2888
  /// Determine if this field is a subobject of zero size, that is, either a
2889
  /// zero-length bit-field or a field of empty class type with the
2890
  /// [[no_unique_address]] attribute.
2891
  bool isZeroSize(const ASTContext &Ctx) const;
2892
2893
  /// Get the kind of (C++11) default member initializer that this field has.
2894
6.81M
  InClassInitStyle getInClassInitStyle() const {
2895
6.81M
    InitStorageKind storageKind = InitStorage.getInt();
2896
6.81M
    return (storageKind == ISK_CapturedVLAType
2897
6.81M
              ? 
ICIS_NoInit0
: (InClassInitStyle) storageKind);
2898
6.81M
  }
2899
2900
  /// Determine whether this member has a C++11 default member initializer.
2901
6.66M
  bool hasInClassInitializer() const {
2902
6.66M
    return getInClassInitStyle() != ICIS_NoInit;
2903
6.66M
  }
2904
2905
  /// Get the C++11 default member initializer for this member, or null if one
2906
  /// has not been set. If a valid declaration has a default member initializer,
2907
  /// but this returns null, then we have not parsed and attached it yet.
2908
172k
  Expr *getInClassInitializer() const {
2909
172k
    if (!hasInClassInitializer())
2910
142k
      return nullptr;
2911
29.7k
    void *Ptr = InitStorage.getPointer();
2912
29.7k
    if (BitField)
2913
241
      return static_cast<InitAndBitWidth*>(Ptr)->Init;
2914
29.5k
    return static_cast<Expr*>(Ptr);
2915
29.5k
  }
2916
2917
  /// Set the C++11 in-class initializer for this member.
2918
2.96k
  void setInClassInitializer(Expr *Init) {
2919
2.96k
    assert(hasInClassInitializer() && !getInClassInitializer());
2920
2.96k
    if (BitField)
2921
9
      static_cast<InitAndBitWidth*>(InitStorage.getPointer())->Init = Init;
2922
2.95k
    else
2923
2.95k
      InitStorage.setPointer(Init);
2924
2.96k
  }
2925
2926
  /// Remove the C++11 in-class initializer from this member.
2927
29
  void removeInClassInitializer() {
2928
29
    assert(hasInClassInitializer() && "no initializer to remove");
2929
29
    InitStorage.setPointerAndInt(getBitWidth(), ISK_NoInit);
2930
29
  }
2931
2932
  /// Determine whether this member captures the variable length array
2933
  /// type.
2934
369k
  bool hasCapturedVLAType() const {
2935
369k
    return InitStorage.getInt() == ISK_CapturedVLAType;
2936
369k
  }
2937
2938
  /// Get the captured variable length array type.
2939
9.44k
  const VariableArrayType *getCapturedVLAType() const {
2940
9.44k
    return hasCapturedVLAType() ? static_cast<const VariableArrayType *>(
2941
9.44k
                                      InitStorage.getPointer())
2942
0
                                : nullptr;
2943
9.44k
  }
2944
2945
  /// Set the captured variable length array type for this field.
2946
  void setCapturedVLAType(const VariableArrayType *VLAType);
2947
2948
  /// Returns the parent of this field declaration, which
2949
  /// is the struct in which this field is defined.
2950
  ///
2951
  /// Returns null if this is not a normal class/struct field declaration, e.g.
2952
  /// ObjCAtDefsFieldDecl, ObjCIvarDecl.
2953
955k
  const RecordDecl *getParent() const {
2954
955k
    return dyn_cast<RecordDecl>(getDeclContext());
2955
955k
  }
2956
2957
401k
  RecordDecl *getParent() {
2958
401k
    return dyn_cast<RecordDecl>(getDeclContext());
2959
401k
  }
2960
2961
  SourceRange getSourceRange() const override LLVM_READONLY;
2962
2963
  /// Retrieves the canonical declaration of this field.
2964
8.99M
  FieldDecl *getCanonicalDecl() override { return getFirstDecl(); }
2965
1.14M
  const FieldDecl *getCanonicalDecl() const { return getFirstDecl(); }
2966
2967
  // Implement isa/cast/dyncast/etc.
2968
136M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2969
137M
  static bool classofKind(Kind K) { return K >= firstField && 
K <= lastField114M
; }
2970
};
2971
2972
/// An instance of this object exists for each enum constant
2973
/// that is defined.  For example, in "enum X {a,b}", each of a/b are
2974
/// EnumConstantDecl's, X is an instance of EnumDecl, and the type of a/b is a
2975
/// TagType for the X EnumDecl.
2976
class EnumConstantDecl : public ValueDecl, public Mergeable<EnumConstantDecl> {
2977
  Stmt *Init; // an integer constant expression
2978
  llvm::APSInt Val; // The value.
2979
2980
protected:
2981
  EnumConstantDecl(DeclContext *DC, SourceLocation L,
2982
                   IdentifierInfo *Id, QualType T, Expr *E,
2983
                   const llvm::APSInt &V)
2984
4.93M
    : ValueDecl(EnumConstant, DC, L, Id, T), Init((Stmt*)E), Val(V) {}
2985
2986
public:
2987
  friend class StmtIteratorBase;
2988
2989
  static EnumConstantDecl *Create(ASTContext &C, EnumDecl *DC,
2990
                                  SourceLocation L, IdentifierInfo *Id,
2991
                                  QualType T, Expr *E,
2992
                                  const llvm::APSInt &V);
2993
  static EnumConstantDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2994
2995
175k
  const Expr *getInitExpr() const { return (const Expr*) Init; }
2996
7.75M
  Expr *getInitExpr() { return (Expr*) Init; }
2997
12.3M
  const llvm::APSInt &getInitVal() const { return Val; }
2998
2999
295k
  void setInitExpr(Expr *E) { Init = (Stmt*) E; }
3000
3.41M
  void setInitVal(const llvm::APSInt &V) { Val = V; }
3001
3002
  SourceRange getSourceRange() const override LLVM_READONLY;
3003
3004
  /// Retrieves the canonical declaration of this enumerator.
3005
836k
  EnumConstantDecl *getCanonicalDecl() override { return getFirstDecl(); }
3006
0
  const EnumConstantDecl *getCanonicalDecl() const { return getFirstDecl(); }
3007
3008
  // Implement isa/cast/dyncast/etc.
3009
116M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3010
116M
  static bool classofKind(Kind K) { return K == EnumConstant; }
3011
};
3012
3013
/// Represents a field injected from an anonymous union/struct into the parent
3014
/// scope. These are always implicit.
3015
class IndirectFieldDecl : public ValueDecl,
3016
                          public Mergeable<IndirectFieldDecl> {
3017
  NamedDecl **Chaining;
3018
  unsigned ChainingSize;
3019
3020
  IndirectFieldDecl(ASTContext &C, DeclContext *DC, SourceLocation L,
3021
                    DeclarationName N, QualType T,
3022
                    MutableArrayRef<NamedDecl *> CH);
3023
3024
  void anchor() override;
3025
3026
public:
3027
  friend class ASTDeclReader;
3028
3029
  static IndirectFieldDecl *Create(ASTContext &C, DeclContext *DC,
3030
                                   SourceLocation L, IdentifierInfo *Id,
3031
                                   QualType T, llvm::MutableArrayRef<NamedDecl *> CH);
3032
3033
  static IndirectFieldDecl *CreateDeserialized(ASTContext &C, unsigned ID);
3034
3035
  using chain_iterator = ArrayRef<NamedDecl *>::const_iterator;
3036
3037
30.5k
  ArrayRef<NamedDecl *> chain() const {
3038
30.5k
    return llvm::makeArrayRef(Chaining, ChainingSize);
3039
30.5k
  }
3040
4.52k
  chain_iterator chain_begin() const { return chain().begin(); }
3041
4.49k
  chain_iterator chain_end() const { return chain().end(); }
3042
3043
8.30k
  unsigned getChainingSize() const { return ChainingSize; }
3044
3045
3.39k
  FieldDecl *getAnonField() const {
3046
3.39k
    assert(chain().size() >= 2);
3047
3.39k
    return cast<FieldDecl>(chain().back());
3048
3.39k
  }
3049
3050
4.08k
  VarDecl *getVarDecl() const {
3051
4.08k
    assert(chain().size() >= 2);
3052
4.08k
    return dyn_cast<VarDecl>(chain().front());
3053
4.08k
  }
3054
3055
9.78k
  IndirectFieldDecl *getCanonicalDecl() override { return getFirstDecl(); }
3056
0
  const IndirectFieldDecl *getCanonicalDecl() const { return getFirstDecl(); }
3057
3058
  // Implement isa/cast/dyncast/etc.
3059
58.1M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3060
58.2M
  static bool classofKind(Kind K) { return K == IndirectField; }
3061
};
3062
3063
/// Represents a declaration of a type.
3064
class TypeDecl : public NamedDecl {
3065
  friend class ASTContext;
3066
3067
  /// This indicates the Type object that represents
3068
  /// this TypeDecl.  It is a cache maintained by
3069
  /// ASTContext::getTypedefType, ASTContext::getTagDeclType, and
3070
  /// ASTContext::getTemplateTypeParmType, and TemplateTypeParmDecl.
3071
  mutable const Type *TypeForDecl = nullptr;
3072
3073
  /// The start of the source range for this declaration.
3074
  SourceLocation LocStart;
3075
3076
  void anchor() override;
3077
3078
protected:
3079
  TypeDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
3080
           SourceLocation StartL = SourceLocation())
3081
13.0M
    : NamedDecl(DK, DC, L, Id), LocStart(StartL) {}
3082
3083
public:
3084
  // Low-level accessor. If you just want the type defined by this node,
3085
  // check out ASTContext::getTypeDeclType or one of
3086
  // ASTContext::getTypedefType, ASTContext::getRecordType, etc. if you
3087
  // already know the specific kind of node this is.
3088
52.5M
  const Type *getTypeForDecl() const { return TypeForDecl; }
3089
4.64M
  void setTypeForDecl(const Type *TD) { TypeForDecl = TD; }
3090
3091
4.75M
  SourceLocation getBeginLoc() const LLVM_READONLY { return LocStart; }
3092
3.06M
  void setLocStart(SourceLocation L) { LocStart = L; }
3093
2.37k
  SourceRange getSourceRange() const override LLVM_READONLY {
3094
2.37k
    if (LocStart.isValid())
3095
2.37k
      return SourceRange(LocStart, getLocation());
3096
3
    else
3097
3
      return SourceRange(getLocation());
3098
2.37k
  }
3099
3100
  // Implement isa/cast/dyncast/etc.
3101
232M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3102
232M
  static bool classofKind(Kind K) { return K >= firstType && 
K <= lastType201M
; }
3103
};
3104
3105
/// Base class for declarations which introduce a typedef-name.
3106
class TypedefNameDecl : public TypeDecl, public Redeclarable<TypedefNameDecl> {
3107
  struct alignas(8) ModedTInfo {
3108
    TypeSourceInfo *first;
3109
    QualType second;
3110
  };
3111
3112
  /// If int part is 0, we have not computed IsTransparentTag.
3113
  /// Otherwise, IsTransparentTag is (getInt() >> 1).
3114
  mutable llvm::PointerIntPair<
3115
      llvm::PointerUnion<TypeSourceInfo *, ModedTInfo *>, 2>
3116
      MaybeModedTInfo;
3117
3118
  void anchor() override;
3119
3120
protected:
3121
  TypedefNameDecl(Kind DK, ASTContext &C, DeclContext *DC,
3122
                  SourceLocation StartLoc, SourceLocation IdLoc,
3123
                  IdentifierInfo *Id, TypeSourceInfo *TInfo)
3124
      : TypeDecl(DK, DC, IdLoc, Id, StartLoc), redeclarable_base(C),
3125
3.72M
        MaybeModedTInfo(TInfo, 0) {}
3126
3127
  using redeclarable_base = Redeclarable<TypedefNameDecl>;
3128
3129
289k
  TypedefNameDecl *getNextRedeclarationImpl() override {
3130
289k
    return getNextRedeclaration();
3131
289k
  }
3132
3133
28.2k
  TypedefNameDecl *getPreviousDeclImpl() override {
3134
28.2k
    return getPreviousDecl();
3135
28.2k
  }
3136
3137
705k
  TypedefNameDecl *getMostRecentDeclImpl() override {
3138
705k
    return getMostRecentDecl();
3139
705k
  }
3140
3141
public:
3142
  using redecl_range = redeclarable_base::redecl_range;
3143
  using redecl_iterator = redeclarable_base::redecl_iterator;
3144
3145
  using redeclarable_base::redecls_begin;
3146
  using redeclarable_base::redecls_end;
3147
  using redeclarable_base::redecls;
3148
  using redeclarable_base::getPreviousDecl;
3149
  using redeclarable_base::getMostRecentDecl;
3150
  using redeclarable_base::isFirstDecl;
3151
3152
123M
  bool isModed() const {
3153
123M
    return MaybeModedTInfo.getPointer().is<ModedTInfo *>();
3154
123M
  }
3155
3156
3.54M
  TypeSourceInfo *getTypeSourceInfo() const {
3157
207
    return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->first
3158
3.54M
                     : MaybeModedTInfo.getPointer().get<TypeSourceInfo *>();
3159
3.54M
  }
3160
3161
119M
  QualType getUnderlyingType() const {
3162
1.03k
    return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->second
3163
119M
                     : MaybeModedTInfo.getPointer()
3164
119M
                           .get<TypeSourceInfo *>()
3165
119M
                           ->getType();
3166
119M
  }
3167
3168
147k
  void setTypeSourceInfo(TypeSourceInfo *newType) {
3169
147k
    MaybeModedTInfo.setPointer(newType);
3170
147k
  }
3171
3172
244
  void setModedTypeSourceInfo(TypeSourceInfo *unmodedTSI, QualType modedTy) {
3173
244
    MaybeModedTInfo.setPointer(new (getASTContext(), 8)
3174
244
                                   ModedTInfo({unmodedTSI, modedTy}));
3175
244
  }
3176
3177
  /// Retrieves the canonical declaration of this typedef-name.
3178
17.0M
  TypedefNameDecl *getCanonicalDecl() override { return getFirstDecl(); }
3179
143
  const TypedefNameDecl *getCanonicalDecl() const { return getFirstDecl(); }
3180
3181
  /// Retrieves the tag declaration for which this is the typedef name for
3182
  /// linkage purposes, if any.
3183
  ///
3184
  /// \param AnyRedecl Look for the tag declaration in any redeclaration of
3185
  /// this typedef declaration.
3186
  TagDecl *getAnonDeclWithTypedefName(bool AnyRedecl = false) const;
3187
3188
  /// Determines if this typedef shares a name and spelling location with its
3189
  /// underlying tag type, as is the case with the NS_ENUM macro.
3190
872
  bool isTransparentTag() const {
3191
872
    if (MaybeModedTInfo.getInt())
3192
527
      return MaybeModedTInfo.getInt() & 0x2;
3193
345
    return isTransparentTagSlow();
3194
345
  }
3195
3196
  // Implement isa/cast/dyncast/etc.
3197
179M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3198
179M
  static bool classofKind(Kind K) {
3199
179M
    return K >= firstTypedefName && 
K <= lastTypedefName159M
;
3200
179M
  }
3201
3202
private:
3203
  bool isTransparentTagSlow() const;
3204
};
3205
3206
/// Represents the declaration of a typedef-name via the 'typedef'
3207
/// type specifier.
3208
class TypedefDecl : public TypedefNameDecl {
3209
  TypedefDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
3210
              SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
3211
3.53M
      : TypedefNameDecl(Typedef, C, DC, StartLoc, IdLoc, Id, TInfo) {}
3212
3213
public:
3214
  static TypedefDecl *Create(ASTContext &C, DeclContext *DC,
3215
                             SourceLocation StartLoc, SourceLocation IdLoc,
3216
                             IdentifierInfo *Id, TypeSourceInfo *TInfo);
3217
  static TypedefDecl *CreateDeserialized(ASTContext &C, unsigned ID);
3218
3219
  SourceRange getSourceRange() const override LLVM_READONLY;
3220
3221
  // Implement isa/cast/dyncast/etc.
3222
164k
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3223
164k
  static bool classofKind(Kind K) { return K == Typedef; }
3224
};
3225
3226
/// Represents the declaration of a typedef-name via a C++11
3227
/// alias-declaration.
3228
class TypeAliasDecl : public TypedefNameDecl {
3229
  /// The template for which this is the pattern, if any.
3230
  TypeAliasTemplateDecl *Template;
3231
3232
  TypeAliasDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
3233
                SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
3234
      : TypedefNameDecl(TypeAlias, C, DC, StartLoc, IdLoc, Id, TInfo),
3235
95.0k
        Template(nullptr) {}
3236
3237
public:
3238
  static TypeAliasDecl *Create(ASTContext &C, DeclContext *DC,
3239
                               SourceLocation StartLoc, SourceLocation IdLoc,
3240
                               IdentifierInfo *Id, TypeSourceInfo *TInfo);
3241
  static TypeAliasDecl *CreateDeserialized(ASTContext &C, unsigned ID);
3242
3243
  SourceRange getSourceRange() const override LLVM_READONLY;
3244
3245
8.60k
  TypeAliasTemplateDecl *getDescribedAliasTemplate() const { return Template; }
3246
74.1k
  void setDescribedAliasTemplate(TypeAliasTemplateDecl *TAT) { Template = TAT; }
3247
3248
  // Implement isa/cast/dyncast/etc.
3249
2.22M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3250
2.22M
  static bool classofKind(Kind K) { return K == TypeAlias; }
3251
};
3252
3253
/// Represents the declaration of a struct/union/class/enum.
3254
class TagDecl : public TypeDecl,
3255
                public DeclContext,
3256
                public Redeclarable<TagDecl> {
3257
  // This class stores some data in DeclContext::TagDeclBits
3258
  // to save some space. Use the provided accessors to access it.
3259
public:
3260
  // This is really ugly.
3261
  using TagKind = TagTypeKind;
3262
3263
private:
3264
  SourceRange BraceRange;
3265
3266
  // A struct representing syntactic qualifier info,
3267
  // to be used for the (uncommon) case of out-of-line declarations.
3268
  using ExtInfo = QualifierInfo;
3269
3270
  /// If the (out-of-line) tag declaration name
3271
  /// is qualified, it points to the qualifier info (nns and range);
3272
  /// otherwise, if the tag declaration is anonymous and it is part of
3273
  /// a typedef or alias, it points to the TypedefNameDecl (used for mangling);
3274
  /// otherwise, if the tag declaration is anonymous and it is used as a
3275
  /// declaration specifier for variables, it points to the first VarDecl (used
3276
  /// for mangling);
3277
  /// otherwise, it is a null (TypedefNameDecl) pointer.
3278
  llvm::PointerUnion<TypedefNameDecl *, ExtInfo *> TypedefNameDeclOrQualifier;
3279
3280
2.85M
  bool hasExtInfo() const { return TypedefNameDeclOrQualifier.is<ExtInfo *>(); }
3281
54.1k
  ExtInfo *getExtInfo() { return TypedefNameDeclOrQualifier.get<ExtInfo *>(); }
3282
6.87k
  const ExtInfo *getExtInfo() const {
3283
6.87k
    return TypedefNameDeclOrQualifier.get<ExtInfo *>();
3284
6.87k
  }
3285
3286
protected:
3287
  TagDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC,
3288
          SourceLocation L, IdentifierInfo *Id, TagDecl *PrevDecl,
3289
          SourceLocation StartL);
3290
3291
  using redeclarable_base = Redeclarable<TagDecl>;
3292
3293
3.17M
  TagDecl *getNextRedeclarationImpl() override {
3294
3.17M
    return getNextRedeclaration();
3295
3.17M
  }
3296
3297
328k
  TagDecl *getPreviousDeclImpl() override {
3298
328k
    return getPreviousDecl();
3299
328k
  }
3300
3301
6.69M
  TagDecl *getMostRecentDeclImpl() override {
3302
6.69M
    return getMostRecentDecl();
3303
6.69M
  }
3304
3305
  /// Completes the definition of this tag declaration.
3306
  ///
3307
  /// This is a helper function for derived classes.
3308
  void completeDefinition();
3309
3310
  /// True if this decl is currently being defined.
3311
12.9M
  void setBeingDefined(bool V = true) { TagDeclBits.IsBeingDefined = V; }
3312
3313
  /// Indicates whether it is possible for declarations of this kind
3314
  /// to have an out-of-date definition.
3315
  ///
3316
  /// This option is only enabled when modules are enabled.
3317
6.55M
  void setMayHaveOutOfDateDef(bool V = true) {
3318
6.55M
    TagDeclBits.MayHaveOutOfDateDef = V;
3319
6.55M
  }
3320
3321
public:
3322
  friend class ASTDeclReader;
3323
  friend class ASTDeclWriter;
3324
3325
  using redecl_range = redeclarable_base::redecl_range;
3326
  using redecl_iterator = redeclarable_base::redecl_iterator;
3327
3328
  using redeclarable_base::redecls_begin;
3329
  using redeclarable_base::redecls_end;
3330
  using redeclarable_base::redecls;
3331
  using redeclarable_base::getPreviousDecl;
3332
  using redeclarable_base::getMostRecentDecl;
3333
  using redeclarable_base::isFirstDecl;
3334
3335
1.39M
  SourceRange getBraceRange() const { return BraceRange; }
3336
4.15M
  void setBraceRange(SourceRange R) { BraceRange = R; }
3337
3338
  /// Return SourceLocation representing start of source
3339
  /// range ignoring outer template declarations.
3340
1.04M
  SourceLocation getInnerLocStart() const { return getBeginLoc(); }
3341
3342
  /// Return SourceLocation representing start of source
3343
  /// range taking into account any outer template declarations.
3344
  SourceLocation getOuterLocStart() const;
3345
  SourceRange getSourceRange() const override LLVM_READONLY;
3346
3347
  TagDecl *getCanonicalDecl() override;
3348
125k
  const TagDecl *getCanonicalDecl() const {
3349
125k
    return const_cast<TagDecl*>(this)->getCanonicalDecl();
3350
125k
  }
3351
3352
  /// Return true if this declaration is a completion definition of the type.
3353
  /// Provided for consistency.
3354
767k
  bool isThisDeclarationADefinition() const {
3355
767k
    return isCompleteDefinition();
3356
767k
  }
3357
3358
  /// Return true if this decl has its body fully specified.
3359
476M
  bool isCompleteDefinition() const { return TagDeclBits.IsCompleteDefinition; }
3360
3361
  /// True if this decl has its body fully specified.
3362
10.6M
  void setCompleteDefinition(bool V = true) {
3363
10.6M
    TagDeclBits.IsCompleteDefinition = V;
3364
10.6M
  }
3365
3366
  /// Return true if this complete decl is
3367
  /// required to be complete for some existing use.
3368
6.44M
  bool isCompleteDefinitionRequired() const {
3369
6.44M
    return TagDeclBits.IsCompleteDefinitionRequired;
3370
6.44M
  }
3371
3372
  /// True if this complete decl is
3373
  /// required to be complete for some existing use.
3374
9.39M
  void setCompleteDefinitionRequired(bool V = true) {
3375
9.39M
    TagDeclBits.IsCompleteDefinitionRequired = V;
3376
9.39M
  }
3377
3378
  /// Return true if this decl is currently being defined.
3379
90.8M
  bool isBeingDefined() const { return TagDeclBits.IsBeingDefined; }
3380
3381
  /// True if this tag declaration is "embedded" (i.e., defined or declared
3382
  /// for the very first time) in the syntax of a declarator.
3383
251k
  bool isEmbeddedInDeclarator() const {
3384
251k
    return TagDeclBits.IsEmbeddedInDeclarator;
3385
251k
  }
3386
3387
  /// True if this tag declaration is "embedded" (i.e., defined or declared
3388
  /// for the very first time) in the syntax of a declarator.
3389
8.79M
  void setEmbeddedInDeclarator(bool isInDeclarator) {
3390
8.79M
    TagDeclBits.IsEmbeddedInDeclarator = isInDeclarator;
3391
8.79M
  }
3392
3393
  /// True if this tag is free standing, e.g. "struct foo;".
3394
253k
  bool isFreeStanding() const { return TagDeclBits.IsFreeStanding; }
3395
3396
  /// True if this tag is free standing, e.g. "struct foo;".
3397
9.69M
  void setFreeStanding(bool isFreeStanding = true) {
3398
9.69M
    TagDeclBits.IsFreeStanding = isFreeStanding;
3399
9.69M
  }
3400
3401
  /// Indicates whether it is possible for declarations of this kind
3402
  /// to have an out-of-date definition.
3403
  ///
3404
  /// This option is only enabled when modules are enabled.
3405
78.8M
  bool mayHaveOutOfDateDef() const { return TagDeclBits.MayHaveOutOfDateDef; }
3406
3407
  /// Whether this declaration declares a type that is
3408
  /// dependent, i.e., a type that somehow depends on template
3409
  /// parameters.
3410
20.6M
  bool isDependentType() const { return isDependentContext(); }
3411
3412
  /// Starts the definition of this tag declaration.
3413
  ///
3414
  /// This method should be invoked at the beginning of the definition
3415
  /// of this tag declaration. It will set the tag type into a state
3416
  /// where it is in the process of being defined.
3417
  void startDefinition();
3418
3419
  /// Returns the TagDecl that actually defines this
3420
  ///  struct/union/class/enum.  When determining whether or not a
3421
  ///  struct/union/class/enum has a definition, one should use this
3422
  ///  method as opposed to 'isDefinition'.  'isDefinition' indicates
3423
  ///  whether or not a specific TagDecl is defining declaration, not
3424
  ///  whether or not the struct/union/class/enum type is defined.
3425
  ///  This method returns NULL if there is no TagDecl that defines
3426
  ///  the struct/union/class/enum.
3427
  TagDecl *getDefinition() const;
3428
3429
134k
  StringRef getKindName() const {
3430
134k
    return TypeWithKeyword::getTagTypeKindName(getTagKind());
3431
134k
  }
3432
3433
22.6M
  TagKind getTagKind() const {
3434
22.6M
    return static_cast<TagKind>(TagDeclBits.TagDeclKind);
3435
22.6M
  }
3436
3437
8.96M
  void setTagKind(TagKind TK) { TagDeclBits.TagDeclKind = TK; }
3438
3439
782k
  bool isStruct() const { return getTagKind() == TTK_Struct; }
3440
3.83M
  bool isInterface() const { return getTagKind() == TTK_Interface; }
3441
726k
  bool isClass()  const { return getTagKind() == TTK_Class; }
3442
12.2M
  bool isUnion()  const { return getTagKind() == TTK_Union; }
3443
90
  bool isEnum()   const { return getTagKind() == TTK_Enum; }
3444
3445
  /// Is this tag type named, either directly or via being defined in
3446
  /// a typedef of this type?
3447
  ///
3448
  /// C++11 [basic.link]p8:
3449
  ///   A type is said to have linkage if and only if:
3450
  ///     - it is a class or enumeration type that is named (or has a
3451
  ///       name for linkage purposes) and the name has linkage; ...
3452
  /// C++11 [dcl.typedef]p9:
3453
  ///   If the typedef declaration defines an unnamed class (or enum),
3454
  ///   the first typedef-name declared by the declaration to be that
3455
  ///   class type (or enum type) is used to denote the class type (or
3456
  ///   enum type) for linkage purposes only.
3457
  ///
3458
  /// C does not have an analogous rule, but the same concept is
3459
  /// nonetheless useful in some places.
3460
5.37M
  bool hasNameForLinkage() const {
3461
5.37M
    return (getDeclName() || 
getTypedefNameForAnonDecl()242k
);
3462
5.37M
  }
3463
3464
787k
  TypedefNameDecl *getTypedefNameForAnonDecl() const {
3465
636
    return hasExtInfo() ? nullptr
3466
786k
                        : TypedefNameDeclOrQualifier.get<TypedefNameDecl *>();
3467
787k
  }
3468
3469
  void setTypedefNameForAnonDecl(TypedefNameDecl *TDD);
3470
3471
  /// Retrieve the nested-name-specifier that qualifies the name of this
3472
  /// declaration, if it was present in the source.
3473
0
  NestedNameSpecifier *getQualifier() const {
3474
0
    return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
3475
0
                        : nullptr;
3476
0
  }
3477
3478
  /// Retrieve the nested-name-specifier (with source-location
3479
  /// information) that qualifies the name of this declaration, if it was
3480
  /// present in the source.
3481
1.05M
  NestedNameSpecifierLoc getQualifierLoc() const {
3482
6.36k
    return hasExtInfo() ? getExtInfo()->QualifierLoc
3483
1.05M
                        : NestedNameSpecifierLoc();
3484
1.05M
  }
3485
3486
  void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc);
3487
3488
583k
  unsigned getNumTemplateParameterLists() const {
3489
582k
    return hasExtInfo() ? 
getExtInfo()->NumTemplParamLists416
: 0;
3490
583k
  }
3491
3492
98
  TemplateParameterList *getTemplateParameterList(unsigned i) const {
3493
98
    assert(i < getNumTemplateParameterLists());
3494
98
    return getExtInfo()->TemplParamLists[i];
3495
98
  }
3496
3497
  void setTemplateParameterListsInfo(ASTContext &Context,
3498
                                     ArrayRef<TemplateParameterList *> TPLists);
3499
3500
  // Implement isa/cast/dyncast/etc.
3501
186M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3502
434M
  static bool classofKind(Kind K) { return K >= firstTag && 
K <= lastTag397M
; }
3503
3504
229k
  static DeclContext *castToDeclContext(const TagDecl *D) {
3505
229k
    return static_cast<DeclContext *>(const_cast<TagDecl*>(D));
3506
229k
  }
3507
3508
12
  static TagDecl *castFromDeclContext(const DeclContext *DC) {
3509
12
    return static_cast<TagDecl *>(const_cast<DeclContext*>(DC));
3510
12
  }
3511
};
3512
3513
/// Represents an enum.  In C++11, enums can be forward-declared
3514
/// with a fixed underlying type, and in C we allow them to be forward-declared
3515
/// with no underlying type as an extension.
3516
class EnumDecl : public TagDecl {
3517
  // This class stores some data in DeclContext::EnumDeclBits
3518
  // to save some space. Use the provided accessors to access it.
3519
3520
  /// This represent the integer type that the enum corresponds
3521
  /// to for code generation purposes.  Note that the enumerator constants may
3522
  /// have a different type than this does.
3523
  ///
3524
  /// If the underlying integer type was explicitly stated in the source
3525
  /// code, this is a TypeSourceInfo* for that type. Otherwise this type
3526
  /// was automatically deduced somehow, and this is a Type*.
3527
  ///
3528
  /// Normally if IsFixed(), this would contain a TypeSourceInfo*, but in
3529
  /// some cases it won't.
3530
  ///
3531
  /// The underlying type of an enumeration never has any qualifiers, so
3532
  /// we can get away with just storing a raw Type*, and thus save an
3533
  /// extra pointer when TypeSourceInfo is needed.
3534
  llvm::PointerUnion<const Type *, TypeSourceInfo *> IntegerType;
3535
3536
  /// The integer type that values of this type should
3537
  /// promote to.  In C, enumerators are generally of an integer type
3538
  /// directly, but gcc-style large enumerators (and all enumerators
3539
  /// in C++) are of the enum type instead.
3540
  QualType PromotionType;
3541
3542
  /// If this enumeration is an instantiation of a member enumeration
3543
  /// of a class template specialization, this is the member specialization
3544
  /// information.
3545
  MemberSpecializationInfo *SpecializationInfo = nullptr;
3546
3547
  /// Store the ODRHash after first calculation.
3548
  /// The corresponding flag HasODRHash is in EnumDeclBits
3549
  /// and can be accessed with the provided accessors.
3550
  unsigned ODRHash;
3551
3552
  EnumDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
3553
           SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl,
3554
           bool Scoped, bool ScopedUsingClassTag, bool Fixed);
3555
3556
  void anchor() override;
3557
3558
  void setInstantiationOfMemberEnum(ASTContext &C, EnumDecl *ED,
3559
                                    TemplateSpecializationKind TSK);
3560
3561
  /// Sets the width in bits required to store all the
3562
  /// non-negative enumerators of this enum.
3563
1.30M
  void setNumPositiveBits(unsigned Num) {
3564
1.30M
    EnumDeclBits.NumPositiveBits = Num;
3565
1.30M
    assert(EnumDeclBits.NumPositiveBits == Num && "can't store this bitcount");
3566
1.30M
  }
3567
3568
  /// Returns the width in bits required to store all the
3569
  /// negative enumerators of this enum. (see getNumNegativeBits)
3570
1.30M
  void setNumNegativeBits(unsigned Num) { EnumDeclBits.NumNegativeBits = Num; }
3571
3572
public:
3573
  /// True if this tag declaration is a scoped enumeration. Only
3574
  /// possible in C++11 mode.
3575
704k
  void setScoped(bool Scoped = true) { EnumDeclBits.IsScoped = Scoped; }
3576
3577
  /// If this tag declaration is a scoped enum,
3578
  /// then this is true if the scoped enum was declared using the class
3579
  /// tag, false if it was declared with the struct tag. No meaning is
3580
  /// associated if this tag declaration is not a scoped enum.
3581
704k
  void setScopedUsingClassTag(bool ScopedUCT = true) {
3582
704k
    EnumDeclBits.IsScopedUsingClassTag = ScopedUCT;
3583
704k
  }
3584
3585
  /// True if this is an Objective-C, C++11, or
3586
  /// Microsoft-style enumeration with a fixed underlying type.
3587
704k
  void setFixed(bool Fixed = true) { EnumDeclBits.IsFixed = Fixed; }
3588
3589
private:
3590
  /// True if a valid hash is stored in ODRHash.
3591
24.1k
  bool hasODRHash() const { return EnumDeclBits.HasODRHash; }
3592
728k
  void setHasODRHash(bool Hash = true) { EnumDeclBits.HasODRHash = Hash; }
3593
3594
public:
3595
  friend class ASTDeclReader;
3596
3597
936k
  EnumDecl *getCanonicalDecl() override {
3598
936k
    return cast<EnumDecl>(TagDecl::getCanonicalDecl());
3599
936k
  }
3600
0
  const EnumDecl *getCanonicalDecl() const {
3601
0
    return const_cast<EnumDecl*>(this)->getCanonicalDecl();
3602
0
  }
3603
3604
610k
  EnumDecl *getPreviousDecl() {
3605
610k
    return cast_or_null<EnumDecl>(
3606
610k
            static_cast<TagDecl *>(this)->getPreviousDecl());
3607
610k
  }
3608
607k
  const EnumDecl *getPreviousDecl() const {
3609
607k
    return const_cast<EnumDecl*>(this)->getPreviousDecl();
3610
607k
  }
3611
3612
18.4k
  EnumDecl *getMostRecentDecl() {
3613
18.4k
    return cast<EnumDecl>(static_cast<TagDecl *>(this)->getMostRecentDecl());
3614
18.4k
  }
3615
0
  const EnumDecl *getMostRecentDecl() const {
3616
0
    return const_cast<EnumDecl*>(this)->getMostRecentDecl();
3617
0
  }
3618
3619
1.54M
  EnumDecl *getDefinition() const {
3620
1.54M
    return cast_or_null<EnumDecl>(TagDecl::getDefinition());
3621
1.54M
  }
3622
3623
  static EnumDecl *Create(ASTContext &C, DeclContext *DC,
3624
                          SourceLocation StartLoc, SourceLocation IdLoc,
3625
                          IdentifierInfo *Id, EnumDecl *PrevDecl,
3626
                          bool IsScoped, bool IsScopedUsingClassTag,
3627
                          bool IsFixed);
3628
  static EnumDecl *CreateDeserialized(ASTContext &C, unsigned ID);
3629
3630
  /// When created, the EnumDecl corresponds to a
3631
  /// forward-declared enum. This method is used to mark the
3632
  /// declaration as being defined; its enumerators have already been
3633
  /// added (via DeclContext::addDecl). NewType is the new underlying
3634
  /// type of the enumeration type.
3635
  void completeDefinition(QualType NewType,
3636
                          QualType PromotionType,
3637
                          unsigned NumPositiveBits,
3638
                          unsigned NumNegativeBits);
3639
3640
  // Iterates through the enumerators of this enumeration.
3641
  using enumerator_iterator = specific_decl_iterator<EnumConstantDecl>;
3642
  using enumerator_range =
3643
      llvm::iterator_range<specific_decl_iterator<EnumConstantDecl>>;
3644
3645
23.8k
  enumerator_range enumerators() const {
3646
23.8k
    return enumerator_range(enumerator_begin(), enumerator_end());
3647
23.8k
  }
3648
3649
105k
  enumerator_iterator enumerator_begin() const {
3650
105k
    const EnumDecl *E = getDefinition();
3651
105k
    if (!E)
3652
339
      E = this;
3653
105k
    return enumerator_iterator(E->decls_begin());
3654
105k
  }
3655
3656
105k
  enumerator_iterator enumerator_end() const {
3657
105k
    const EnumDecl *E = getDefinition();
3658
105k
    if (!E)
3659
339
      E = this;
3660
105k
    return enumerator_iterator(E->decls_end());
3661
105k
  }
3662
3663
  /// Return the integer type that enumerators should promote to.
3664
12.8M
  QualType getPromotionType() const { return PromotionType; }
3665
3666
  /// Set the promotion type.
3667
230k
  void setPromotionType(QualType T) { PromotionType = T; }
3668
3669
  /// Return the integer type this enum decl corresponds to.
3670
  /// This returns a null QualType for an enum forward definition with no fixed
3671
  /// underlying type.
3672
2.74M
  QualType getIntegerType() const {
3673
2.74M
    if (!IntegerType)
3674
34
      return QualType();
3675
2.74M
    if (const Type *T = IntegerType.dyn_cast<const Type*>())
3676
553k
      return QualType(T, 0);
3677
2.18M
    return IntegerType.get<TypeSourceInfo*>()->getType().getUnqualifiedType();
3678
2.18M
  }
3679
3680
  /// Set the underlying integer type.
3681
4.16k
  void setIntegerType(QualType T) { IntegerType = T.getTypePtrOrNull(); }
3682
3683
  /// Set the underlying integer type source info.
3684
226k
  void setIntegerTypeSourceInfo(TypeSourceInfo *TInfo) { IntegerType = TInfo; }
3685
3686
  /// Return the type source info for the underlying integer type,
3687
  /// if no type source info exists, return 0.
3688
88.3k
  TypeSourceInfo *getIntegerTypeSourceInfo() const {
3689
88.3k
    return IntegerType.dyn_cast<TypeSourceInfo*>();
3690
88.3k
  }
3691
3692
  /// Retrieve the source range that covers the underlying type if
3693
  /// specified.
3694
  SourceRange getIntegerTypeRange() const LLVM_READONLY;
3695
3696
  /// Returns the width in bits required to store all the
3697
  /// non-negative enumerators of this enum.
3698
138k
  unsigned getNumPositiveBits() const { return EnumDeclBits.NumPositiveBits; }
3699
3700
  /// Returns the width in bits required to store all the
3701
  /// negative enumerators of this enum.  These widths include
3702
  /// the rightmost leading 1;  that is:
3703
  ///
3704
  /// MOST NEGATIVE ENUMERATOR     PATTERN     NUM NEGATIVE BITS
3705
  /// ------------------------     -------     -----------------
3706
  ///                       -1     1111111                     1
3707
  ///                      -10     1110110                     5
3708
  ///                     -101     1001011                     8
3709
138k
  unsigned getNumNegativeBits() const { return EnumDeclBits.NumNegativeBits; }
3710
3711
  /// Returns true if this is a C++11 scoped enumeration.
3712
35.4M
  bool isScoped() const { return EnumDeclBits.IsScoped; }
3713
3714
  /// Returns true if this is a C++11 scoped enumeration.
3715
27.6k
  bool isScopedUsingClassTag() const {
3716
27.6k
    return EnumDeclBits.IsScopedUsingClassTag;
3717
27.6k
  }
3718
3719
  /// Returns true if this is an Objective-C, C++11, or
3720
  /// Microsoft-style enumeration with a fixed underlying type.
3721
13.6M
  bool isFixed() const { return EnumDeclBits.IsFixed; }
3722
3723
  unsigned getODRHash();
3724
3725
  /// Returns true if this can be considered a complete type.
3726
13.0M
  bool isComplete() const {
3727
    // IntegerType is set for fixed type enums and non-fixed but implicitly
3728
    // int-sized Microsoft enums.
3729
13.0M
    return isCompleteDefinition() || 
IntegerType5.37M
;
3730
13.0M
  }
3731
3732
  /// Returns true if this enum is either annotated with
3733
  /// enum_extensibility(closed) or isn't annotated with enum_extensibility.
3734
  bool isClosed() const;
3735
3736
  /// Returns true if this enum is annotated with flag_enum and isn't annotated
3737
  /// with enum_extensibility(open).
3738
  bool isClosedFlag() const;
3739
3740
  /// Returns true if this enum is annotated with neither flag_enum nor
3741
  /// enum_extensibility(open).
3742
  bool isClosedNonFlag() const;
3743
3744
  /// Retrieve the enum definition from which this enumeration could
3745
  /// be instantiated, if it is an instantiation (rather than a non-template).
3746
  EnumDecl *getTemplateInstantiationPattern() const;
3747
3748
  /// Returns the enumeration (declared within the template)
3749
  /// from which this enumeration type was instantiated, or NULL if
3750
  /// this enumeration was not instantiated from any template.
3751
  EnumDecl *getInstantiatedFromMemberEnum() const;
3752
3753
  /// If this enumeration is a member of a specialization of a
3754
  /// templated class, determine what kind of template specialization
3755
  /// or instantiation this is.
3756
  TemplateSpecializationKind getTemplateSpecializationKind() const;
3757
3758
  /// For an enumeration member that was instantiated from a member
3759
  /// enumeration of a templated class, set the template specialiation kind.
3760
  void setTemplateSpecializationKind(TemplateSpecializationKind TSK,
3761
                        SourceLocation PointOfInstantiation = SourceLocation());
3762
3763
  /// If this enumeration is an instantiation of a member enumeration of
3764
  /// a class template specialization, retrieves the member specialization
3765
  /// information.
3766
1.63M
  MemberSpecializationInfo *getMemberSpecializationInfo() const {
3767
1.63M
    return SpecializationInfo;
3768
1.63M
  }
3769
3770
  /// Specify that this enumeration is an instantiation of the
3771
  /// member enumeration ED.
3772
  void setInstantiationOfMemberEnum(EnumDecl *ED,
3773
2.75k
                                    TemplateSpecializationKind TSK) {
3774
2.75k
    setInstantiationOfMemberEnum(getASTContext(), ED, TSK);
3775
2.75k
  }
3776
3777
46.5M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3778
190M
  static bool classofKind(Kind K) { return K == Enum; }
3779
};
3780
3781
/// Represents a struct/union/class.  For example:
3782
///   struct X;                  // Forward declaration, no "body".
3783
///   union Y { int A, B; };     // Has body with members A and B (FieldDecls).
3784
/// This decl will be marked invalid if *any* members are invalid.
3785
class RecordDecl : public TagDecl {
3786
  // This class stores some data in DeclContext::RecordDeclBits
3787
  // to save some space. Use the provided accessors to access it.
3788
public:
3789
  friend class DeclContext;
3790
  /// Enum that represents the different ways arguments are passed to and
3791
  /// returned from function calls. This takes into account the target-specific
3792
  /// and version-specific rules along with the rules determined by the
3793
  /// language.
3794
  enum ArgPassingKind : unsigned {
3795
    /// The argument of this type can be passed directly in registers.
3796
    APK_CanPassInRegs,
3797
3798
    /// The argument of this type cannot be passed directly in registers.
3799
    /// Records containing this type as a subobject are not forced to be passed
3800
    /// indirectly. This value is used only in C++. This value is required by
3801
    /// C++ because, in uncommon situations, it is possible for a class to have
3802
    /// only trivial copy/move constructors even when one of its subobjects has
3803
    /// a non-trivial copy/move constructor (if e.g. the corresponding copy/move
3804
    /// constructor in the derived class is deleted).
3805
    APK_CannotPassInRegs,
3806
3807
    /// The argument of this type cannot be passed directly in registers.
3808
    /// Records containing this type as a subobject are forced to be passed
3809
    /// indirectly.
3810
    APK_CanNeverPassInRegs
3811
  };
3812
3813
protected:
3814
  RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC,
3815
             SourceLocation StartLoc, SourceLocation IdLoc,
3816
             IdentifierInfo *Id, RecordDecl *PrevDecl);
3817
3818
public:
3819
  static RecordDecl *Create(const ASTContext &C, TagKind TK, DeclContext *DC,
3820
                            SourceLocation StartLoc, SourceLocation IdLoc,
3821
                            IdentifierInfo *Id, RecordDecl* PrevDecl = nullptr);
3822
  static RecordDecl *CreateDeserialized(const ASTContext &C, unsigned ID);
3823
3824
6.43M
  RecordDecl *getPreviousDecl() {
3825
6.43M
    return cast_or_null<RecordDecl>(
3826
6.43M
            static_cast<TagDecl *>(this)->getPreviousDecl());
3827
6.43M
  }
3828
3.27M
  const RecordDecl *getPreviousDecl() const {
3829
3.27M
    return const_cast<RecordDecl*>(this)->getPreviousDecl();
3830
3.27M
  }
3831
3832
254M
  RecordDecl *getMostRecentDecl() {
3833
254M
    return cast<RecordDecl>(static_cast<TagDecl *>(this)->getMostRecentDecl());
3834
254M
  }
3835
0
  const RecordDecl *getMostRecentDecl() const {
3836
0
    return const_cast<RecordDecl*>(this)->getMostRecentDecl();
3837
0
  }
3838
3839
2.04M
  bool hasFlexibleArrayMember() const {
3840
2.04M
    return RecordDeclBits.HasFlexibleArrayMember;
3841
2.04M
  }
3842
3843
7.52M
  void setHasFlexibleArrayMember(bool V) {
3844
7.52M
    RecordDeclBits.HasFlexibleArrayMember = V;
3845
7.52M
  }
3846
3847
  /// Whether this is an anonymous struct or union. To be an anonymous
3848
  /// struct or union, it must have been declared without a name and
3849
  /// there must be no objects of this type declared, e.g.,
3850
  /// @code
3851
  ///   union { int i; float f; };
3852
  /// @endcode
3853
  /// is an anonymous union but neither of the following are:
3854
  /// @code
3855
  ///  union X { int i; float f; };
3856
  ///  union { int i; float f; } obj;
3857
  /// @endcode
3858
4.35M
  bool isAnonymousStructOrUnion() const {
3859
4.35M
    return RecordDeclBits.AnonymousStructOrUnion;
3860
4.35M
  }
3861
3862
7.52M
  void setAnonymousStructOrUnion(bool Anon) {
3863
7.52M
    RecordDeclBits.AnonymousStructOrUnion = Anon;
3864
7.52M
  }
3865
3866
1.85M
  bool hasObjectMember() const { return RecordDeclBits.HasObjectMember; }
3867
7.52M
  void setHasObjectMember(bool val) { RecordDeclBits.HasObjectMember = val; }
3868
3869
1.85M
  bool hasVolatileMember() const { return RecordDeclBits.HasVolatileMember; }
3870
3871
7.52M
  void setHasVolatileMember(bool val) {
3872
7.52M
    RecordDeclBits.HasVolatileMember = val;
3873
7.52M
  }
3874
3875
137k
  bool hasLoadedFieldsFromExternalStorage() const {
3876
137k
    return RecordDeclBits.LoadedFieldsFromExternalStorage;
3877
137k
  }
3878
3879
5.88M
  void setHasLoadedFieldsFromExternalStorage(bool val) const {
3880
5.88M
    RecordDeclBits.LoadedFieldsFromExternalStorage = val;
3881
5.88M
  }
3882
3883
  /// Functions to query basic properties of non-trivial C structs.
3884
924k
  bool isNonTrivialToPrimitiveDefaultInitialize() const {
3885
924k
    return RecordDeclBits.NonTrivialToPrimitiveDefaultInitialize;
3886
924k
  }
3887
3888
7.52M
  void setNonTrivialToPrimitiveDefaultInitialize(bool V) {
3889
7.52M
    RecordDeclBits.NonTrivialToPrimitiveDefaultInitialize = V;
3890
7.52M
  }
3891
3892
927k
  bool isNonTrivialToPrimitiveCopy() const {
3893
927k
    return RecordDeclBits.NonTrivialToPrimitiveCopy;
3894
927k
  }
3895
3896
7.52M
  void setNonTrivialToPrimitiveCopy(bool V) {
3897
7.52M
    RecordDeclBits.NonTrivialToPrimitiveCopy = V;
3898
7.52M
  }
3899
3900
981k
  bool isNonTrivialToPrimitiveDestroy() const {
3901
981k
    return RecordDeclBits.NonTrivialToPrimitiveDestroy;
3902
981k
  }
3903
3904
7.52M
  void setNonTrivialToPrimitiveDestroy(bool V) {
3905
7.52M
    RecordDeclBits.NonTrivialToPrimitiveDestroy = V;
3906
7.52M
  }
3907
3908
371k
  bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const {
3909
371k
    return RecordDeclBits.HasNonTrivialToPrimitiveDefaultInitializeCUnion;
3910
371k
  }
3911
3912
7.52M
  void setHasNonTrivialToPrimitiveDefaultInitializeCUnion(bool V) {
3913
7.52M
    RecordDeclBits.HasNonTrivialToPrimitiveDefaultInitializeCUnion = V;
3914
7.52M
  }
3915
3916
1.02M
  bool hasNonTrivialToPrimitiveDestructCUnion() const {
3917
1.02M
    return RecordDeclBits.HasNonTrivialToPrimitiveDestructCUnion;
3918
1.02M
  }
3919
3920
7.52M
  void setHasNonTrivialToPrimitiveDestructCUnion(bool V) {
3921
7.52M
    RecordDeclBits.HasNonTrivialToPrimitiveDestructCUnion = V;
3922
7.52M
  }
3923
3924
904k
  bool hasNonTrivialToPrimitiveCopyCUnion() const {
3925
904k
    return RecordDeclBits.HasNonTrivialToPrimitiveCopyCUnion;
3926
904k
  }
3927
3928
7.52M
  void setHasNonTrivialToPrimitiveCopyCUnion(bool V) {
3929
7.52M
    RecordDeclBits.HasNonTrivialToPrimitiveCopyCUnion = V;
3930
7.52M
  }
3931
3932
  /// Determine whether this class can be passed in registers. In C++ mode,
3933
  /// it must have at least one trivial, non-deleted copy or move constructor.
3934
  /// FIXME: This should be set as part of completeDefinition.
3935
133k
  bool canPassInRegisters() const {
3936
133k
    return getArgPassingRestrictions() == APK_CanPassInRegs;
3937
133k
  }
3938
3939
3.05M
  ArgPassingKind getArgPassingRestrictions() const {
3940
3.05M
    return static_cast<ArgPassingKind>(RecordDeclBits.ArgPassingRestrictions);
3941
3.05M
  }
3942
3943
8.89M
  void setArgPassingRestrictions(ArgPassingKind Kind) {
3944
8.89M
    RecordDeclBits.ArgPassingRestrictions = Kind;
3945
8.89M
  }
3946
3947
254k
  bool isParamDestroyedInCallee() const {
3948
254k
    return RecordDeclBits.ParamDestroyedInCallee;
3949
254k
  }
3950
3951
7.58M
  void setParamDestroyedInCallee(bool V) {
3952
7.58M
    RecordDeclBits.ParamDestroyedInCallee = V;
3953
7.58M
  }
3954
3955
  /// Determines whether this declaration represents the
3956
  /// injected class name.
3957
  ///
3958
  /// The injected class name in C++ is the name of the class that
3959
  /// appears inside the class itself. For example:
3960
  ///
3961
  /// \code
3962
  /// struct C {
3963
  ///   // C is implicitly declared here as a synonym for the class name.
3964
  /// };
3965
  ///
3966
  /// C::C c; // same as "C c;"
3967
  /// \endcode
3968
  bool isInjectedClassName() const;
3969
3970
  /// Determine whether this record is a class describing a lambda
3971
  /// function object.
3972
  bool isLambda() const;
3973
3974
  /// Determine whether this record is a record for captured variables in
3975
  /// CapturedStmt construct.
3976
  bool isCapturedRecord() const;
3977
3978
  /// Mark the record as a record for captured variables in CapturedStmt
3979
  /// construct.
3980
  void setCapturedRecord();
3981
3982
  /// Returns the RecordDecl that actually defines
3983
  ///  this struct/union/class.  When determining whether or not a
3984
  ///  struct/union/class is completely defined, one should use this
3985
  ///  method as opposed to 'isCompleteDefinition'.
3986
  ///  'isCompleteDefinition' indicates whether or not a specific
3987
  ///  RecordDecl is a completed definition, not whether or not the
3988
  ///  record type is defined.  This method returns NULL if there is
3989
  ///  no RecordDecl that defines the struct/union/tag.
3990
5.92M
  RecordDecl *getDefinition() const {
3991
5.92M
    return cast_or_null<RecordDecl>(TagDecl::getDefinition());
3992
5.92M
  }
3993
3994
  /// Returns whether this record is a union, or contains (at any nesting level)
3995
  /// a union member. This is used by CMSE to warn about possible information
3996
  /// leaks.
3997
  bool isOrContainsUnion() const;
3998
3999
  // Iterator access to field members. The field iterator only visits
4000
  // the non-static data members of this class, ignoring any static
4001
  // data members, functions, constructors, destructors, etc.
4002
  using field_iterator = specific_decl_iterator<FieldDecl>;
4003
  using field_range = llvm::iterator_range<specific_decl_iterator<FieldDecl>>;
4004
4005
2.36M
  field_range fields() const { return field_range(field_begin(), field_end()); }
4006
  field_iterator field_begin() const;
4007
4008
5.81M
  field_iterator field_end() const {
4009
5.81M
    return field_iterator(decl_iterator());
4010
5.81M
  }
4011
4012
  // Whether there are any fields (non-static data members) in this record.
4013
426k
  bool field_empty() const {
4014
426k
    return field_begin() == field_end();
4015
426k
  }
4016
4017
  /// Note that the definition of this type is now complete.
4018
  virtual void completeDefinition();
4019
4020
363M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
4021
397M
  static bool classofKind(Kind K) {
4022
397M
    return K >= firstRecord && 
K <= lastRecord388M
;
4023
397M
  }
4024
4025
  /// Get whether or not this is an ms_struct which can
4026
  /// be turned on with an attribute, pragma, or -mms-bitfields
4027
  /// commandline option.
4028
  bool isMsStruct(const ASTContext &C) const;
4029
4030
  /// Whether we are allowed to insert extra padding between fields.
4031
  /// These padding are added to help AddressSanitizer detect
4032
  /// intra-object-overflow bugs.
4033
  bool mayInsertExtraPadding(bool EmitRemark = false) const;
4034
4035
  /// Finds the first data member which has a name.
4036
  /// nullptr is returned if no named data member exists.
4037
  const FieldDecl *findFirstNamedDataMember() const;
4038
4039
private:
4040
  /// Deserialize just the fields.
4041
  void LoadFieldsFromExternalStorage() const;
4042
};
4043
4044
class FileScopeAsmDecl : public Decl {
4045
  StringLiteral *AsmString;
4046
  SourceLocation RParenLoc;
4047
4048
  FileScopeAsmDecl(DeclContext *DC, StringLiteral *asmstring,
4049
                   SourceLocation StartL, SourceLocation EndL)
4050
210
    : Decl(FileScopeAsm, DC, StartL), AsmString(asmstring), RParenLoc(EndL) {}
4051
4052
  virtual void anchor();
4053
4054
public:
4055
  static FileScopeAsmDecl *Create(ASTContext &C, DeclContext *DC,
4056
                                  StringLiteral *Str, SourceLocation AsmLoc,
4057
                                  SourceLocation RParenLoc);
4058
4059
  static FileScopeAsmDecl *CreateDeserialized(ASTContext &C, unsigned ID);
4060
4061
3
  SourceLocation getAsmLoc() const { return getLocation(); }
4062
62
  SourceLocation getRParenLoc() const { return RParenLoc; }
4063
113
  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
4064
3
  SourceRange getSourceRange() const override LLVM_READONLY {
4065
3
    return SourceRange(getAsmLoc(), getRParenLoc());
4066
3
  }
4067
4068
3
  const StringLiteral *getAsmString() const { return AsmString; }
4069
88
  StringLiteral *getAsmString() { return AsmString; }
4070
113
  void setAsmString(StringLiteral *Asm) { AsmString = Asm; }
4071
4072
7.75M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
4073
7.75M
  static bool classofKind(Kind K) { return K == FileScopeAsm; }
4074
};
4075
4076
/// Represents a block literal declaration, which is like an
4077
/// unnamed FunctionDecl.  For example:
4078
/// ^{ statement-body }   or   ^(int arg1, float arg2){ statement-body }
4079
class BlockDecl : public Decl, public DeclContext {
4080
  // This class stores some data in DeclContext::BlockDeclBits
4081
  // to save some space. Use the provided accessors to access it.
4082
public:
4083
  /// A class which contains all the information about a particular
4084
  /// captured value.
4085
  class Capture {
4086
    enum {
4087
      flag_isByRef = 0x1,
4088
      flag_isNested = 0x2
4089
    };
4090
4091
    /// The variable being captured.
4092
    llvm::PointerIntPair<VarDecl*, 2> VariableAndFlags;
4093
4094
    /// The copy expression, expressed in terms of a DeclRef (or
4095
    /// BlockDeclRef) to the captured variable.  Only required if the
4096
    /// variable has a C++ class type.
4097
    Expr *CopyExpr;
4098
4099
  public:
4100
    Capture(VarDecl *variable, bool byRef, bool nested, Expr *copy)
4101
      : VariableAndFlags(variable,
4102
                  (byRef ? flag_isByRef : 0) | (nested ? flag_isNested : 0)),
4103
3.07k
        CopyExpr(copy) {}
4104
4105
    /// The variable being captured.
4106
49.3k
    VarDecl *getVariable() const { return VariableAndFlags.getPointer(); }
4107
4108
    /// Whether this is a "by ref" capture, i.e. a capture of a __block
4109
    /// variable.
4110
9.52k
    bool isByRef() const { return VariableAndFlags.getInt() & flag_isByRef; }
4111
4112
14.7k
    bool isEscapingByref() const {
4113
14.7k
      return getVariable()->isEscapingByref();
4114
14.7k
    }
4115
4116
0
    bool isNonEscapingByref() const {
4117
0
      return getVariable()->isNonEscapingByref();
4118
0
    }
4119
4120
    /// Whether this is a nested capture, i.e. the variable captured
4121
    /// is not from outside the immediately enclosing function/block.
4122
3.90k
    bool isNested() const { return VariableAndFlags.getInt() & flag_isNested; }
4123
4124
2.52k
    bool hasCopyExpr() const { return CopyExpr != nullptr; }
4125
7.15k
    Expr *getCopyExpr() const { return CopyExpr; }
4126
0
    void setCopyExpr(Expr *e) { CopyExpr = e; }
4127
  };
4128
4129
private:
4130
  /// A new[]'d array of pointers to ParmVarDecls for the formal
4131
  /// parameters of this function.  This is null if a prototype or if there are
4132
  /// no formals.
4133
  ParmVarDecl **ParamInfo = nullptr;
4134
  unsigned NumParams = 0;
4135
4136
  Stmt *Body = nullptr;
4137
  TypeSourceInfo *SignatureAsWritten = nullptr;
4138
4139
  const Capture *Captures = nullptr;
4140
  unsigned NumCaptures = 0;
4141
4142
  unsigned ManglingNumber = 0;
4143
  Decl *ManglingContextDecl = nullptr;
4144
4145
protected:
4146
  BlockDecl(DeclContext *DC, SourceLocation CaretLoc);
4147
4148
public:
4149
  static BlockDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L);
4150
  static BlockDecl *CreateDeserialized(ASTContext &C, unsigned ID);
4151
4152
23.8k
  SourceLocation getCaretLocation() const { return getLocation(); }
4153
4154
256
  bool isVariadic() const { return BlockDeclBits.IsVariadic; }
4155
5.97k
  void setIsVariadic(bool value) { BlockDeclBits.IsVariadic = value; }
4156
4157
0
  CompoundStmt *getCompoundBody() const { return (CompoundStmt*) Body; }
4158
24.3k
  Stmt *getBody() const override { return (Stmt*) Body; }
4159
2.80k
  void setBody(CompoundStmt *B) { Body = (Stmt*) B; }
4160
4161
2.89k
  void setSignatureAsWritten(TypeSourceInfo *Sig) { SignatureAsWritten = Sig; }
4162
1.13k
  TypeSourceInfo *getSignatureAsWritten() const { return SignatureAsWritten; }
4163
4164
  // ArrayRef access to formal parameters.
4165
8.59k
  ArrayRef<ParmVarDecl *> parameters() const {
4166
8.59k
    return {ParamInfo, getNumParams()};
4167
8.59k
  }
4168
6.62k
  MutableArrayRef<ParmVarDecl *> parameters() {
4169
6.62k
    return {ParamInfo, getNumParams()};
4170
6.62k
  }
4171
4172
  // Iterator access to formal parameters.
4173
  using param_iterator = MutableArrayRef<ParmVarDecl *>::iterator;
4174
  using param_const_iterator = ArrayRef<ParmVarDecl *>::const_iterator;
4175
4176
158
  bool param_empty() const { return parameters().empty(); }
4177
55
  param_iterator param_begin() { return parameters().begin(); }
4178
23
  param_iterator param_end() { return parameters().end(); }
4179
1.07k
  param_const_iterator param_begin() const { return parameters().begin(); }
4180
1.07k
  param_const_iterator param_end() const { return parameters().end(); }
4181
1.56k
  size_t param_size() const { return parameters().size(); }
4182
4183
15.3k
  unsigned getNumParams() const { return NumParams; }
4184
4185
108
  const ParmVarDecl *getParamDecl(unsigned i) const {
4186
108
    assert(i < getNumParams() && "Illegal param #");
4187
108
    return ParamInfo[i];
4188
108
  }
4189
16
  ParmVarDecl *getParamDecl(unsigned i) {
4190
16
    assert(i < getNumParams() && "Illegal param #");
4191
16
    return ParamInfo[i];
4192
16
  }
4193
4194
  void setParams(ArrayRef<ParmVarDecl *> NewParamInfo);
4195
4196
  /// True if this block (or its nested blocks) captures
4197
  /// anything of local storage from its enclosing scopes.
4198
6.94k
  bool hasCaptures() const { return NumCaptures || 
capturesCXXThis()3.24k
; }
4199
4200
  /// Returns the number of captured variables.
4201
  /// Does not include an entry for 'this'.
4202
52
  unsigned getNumCaptures() const { return NumCaptures; }
4203
4204
  using capture_const_iterator = ArrayRef<Capture>::const_iterator;
4205
4206
13.6k
  ArrayRef<Capture> captures() const { return {Captures, NumCaptures}; }
4207
4208
1.09k
  capture_const_iterator capture_begin() const { return captures().begin(); }
4209
1.08k
  capture_const_iterator capture_end() const { return captures().end(); }
4210
4211
6.65k
  bool capturesCXXThis() const { return BlockDeclBits.CapturesCXXThis; }
4212
5.83k
  void setCapturesCXXThis(bool B = true) { BlockDeclBits.CapturesCXXThis = B; }
4213
4214
140
  bool blockMissingReturnType() const {
4215
140
    return BlockDeclBits.BlockMissingReturnType;
4216
140
  }
4217
4218
3.42k
  void setBlockMissingReturnType(bool val = true) {
4219
3.42k
    BlockDeclBits.BlockMissingReturnType = val;
4220
3.42k
  }
4221
4222
3.87k
  bool isConversionFromLambda() const {
4223
3.87k
    return BlockDeclBits.IsConversionFromLambda;
4224
3.87k
  }
4225
4226
3.08k
  void setIsConversionFromLambda(bool val = true) {
4227
3.08k
    BlockDeclBits.IsConversionFromLambda = val;
4228
3.08k
  }
4229
4230
3.22k
  bool doesNotEscape() const { return BlockDeclBits.DoesNotEscape; }
4231
3.08k
  void setDoesNotEscape(bool B = true) { BlockDeclBits.DoesNotEscape = B; }
4232
4233
205
  bool canAvoidCopyToHeap() const {
4234
205
    return BlockDeclBits.CanAvoidCopyToHeap;
4235
205
  }
4236
3.29k
  void setCanAvoidCopyToHeap(bool B = true) {
4237
3.29k
    BlockDeclBits.CanAvoidCopyToHeap = B;
4238
3.29k
  }
4239
4240
  bool capturesVariable(const VarDecl *var) const;
4241
4242
  void setCaptures(ASTContext &Context, ArrayRef<Capture> Captures,
4243
                   bool CapturesCXXThis);
4244
4245
144
  unsigned getBlockManglingNumber() const { return ManglingNumber; }
4246
4247
468
  Decl *getBlockManglingContextDecl() const { return ManglingContextDecl; }
4248
4249
315
  void setBlockMangling(unsigned Number, Decl *Ctx) {
4250
315
    ManglingNumber = Number;
4251
315
    ManglingContextDecl = Ctx;
4252
315
  }
4253
4254
  SourceRange getSourceRange() const override LLVM_READONLY;
4255
4256
  // Implement isa/cast/dyncast/etc.
4257
62.1M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
4258
177M
  static bool classofKind(Kind K) { return K == Block; }
4259
36
  static DeclContext *castToDeclContext(const BlockDecl *D) {
4260
36
    return static_cast<DeclContext *>(const_cast<BlockDecl*>(D));
4261
36
  }
4262
0
  static BlockDecl *castFromDeclContext(const DeclContext *DC) {
4263
0
    return static_cast<BlockDecl *>(const_cast<DeclContext*>(DC));
4264
0
  }
4265
};
4266
4267
/// Represents the body of a CapturedStmt, and serves as its DeclContext.
4268
class CapturedDecl final
4269
    : public Decl,
4270
      public DeclContext,
4271
      private llvm::TrailingObjects<CapturedDecl, ImplicitParamDecl *> {
4272
protected:
4273
0
  size_t numTrailingObjects(OverloadToken<ImplicitParamDecl>) {
4274
0
    return NumParams;
4275
0
  }
4276
4277
private:
4278
  /// The number of parameters to the outlined function.
4279
  unsigned NumParams;
4280
4281
  /// The position of context parameter in list of parameters.
4282
  unsigned ContextParam;
4283
4284
  /// The body of the outlined function.
4285
  llvm::PointerIntPair<Stmt *, 1, bool> BodyAndNothrow;
4286
4287
  explicit CapturedDecl(DeclContext *DC, unsigned NumParams);
4288
4289
902k
  ImplicitParamDecl *const *getParams() const {
4290
902k
    return getTrailingObjects<ImplicitParamDecl *>();
4291
902k
  }
4292
4293
2.13M
  ImplicitParamDecl **getParams() {
4294
2.13M
    return getTrailingObjects<ImplicitParamDecl *>();
4295
2.13M
  }
4296
4297
public:
4298
  friend class ASTDeclReader;
4299
  friend class ASTDeclWriter;
4300
  friend TrailingObjects;
4301
4302
  static CapturedDecl *Create(ASTContext &C, DeclContext *DC,
4303
                              unsigned NumParams);
4304
  static CapturedDecl *CreateDeserialized(ASTContext &C, unsigned ID,
4305
                                          unsigned NumParams);
4306
4307
  Stmt *getBody() const override;
4308
  void setBody(Stmt *B);
4309
4310
  bool isNothrow() const;
4311
  void setNothrow(bool Nothrow = true);
4312
4313
192k
  unsigned getNumParams() const { return NumParams; }
4314
4315
709k
  ImplicitParamDecl *getParam(unsigned i) const {
4316
709k
    assert(i < NumParams);
4317
709k
    return getParams()[i];
4318
709k
  }
4319
2.13M
  void setParam(unsigned i, ImplicitParamDecl *P) {
4320
2.13M
    assert(i < NumParams);
4321
2.13M
    getParams()[i] = P;
4322
2.13M
  }
4323
4324
  // ArrayRef interface to parameters.
4325
0
  ArrayRef<ImplicitParamDecl *> parameters() const {
4326
0
    return {getParams(), getNumParams()};
4327
0
  }
4328
0
  MutableArrayRef<ImplicitParamDecl *> parameters() {
4329
0
    return {getParams(), getNumParams()};
4330
0
  }
4331
4332
  /// Retrieve the parameter containing captured variables.
4333
551k
  ImplicitParamDecl *getContextParam() const {
4334
551k
    assert(ContextParam < NumParams);
4335
551k
    return getParam(ContextParam);
4336
551k
  }
4337
579k
  void setContextParam(unsigned i, ImplicitParamDecl *P) {
4338
579k
    assert(i < NumParams);
4339
579k
    ContextParam = i;
4340
579k
    setParam(i, P);
4341
579k
  }
4342
142k
  unsigned getContextParamPosition() const { return ContextParam; }
4343
4344
  using param_iterator = ImplicitParamDecl *const *;
4345
  using param_range = llvm::iterator_range<param_iterator>;
4346
4347
  /// Retrieve an iterator pointing to the first parameter decl.
4348
147k
  param_iterator param_begin() const { return getParams(); }
4349
  /// Retrieve an iterator one past the last parameter decl.
4350
45.7k
  param_iterator param_end() const { return getParams() + NumParams; }
4351
4352
  // Implement isa/cast/dyncast/etc.
4353
2.21M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
4354
138M
  static bool classofKind(Kind K) { return K == Captured; }
4355
550k
  static DeclContext *castToDeclContext(const CapturedDecl *D) {
4356
550k
    return static_cast<DeclContext *>(const_cast<CapturedDecl *>(D));
4357
550k
  }
4358
0
  static CapturedDecl *castFromDeclContext(const DeclContext *DC) {
4359
0
    return static_cast<CapturedDecl *>(const_cast<DeclContext *>(DC));
4360
0
  }
4361
};
4362
4363
/// Describes a module import declaration, which makes the contents
4364
/// of the named module visible in the current translation unit.
4365
///
4366
/// An import declaration imports the named module (or submodule). For example:
4367
/// \code
4368
///   @import std.vector;
4369
/// \endcode
4370
///
4371
/// Import declarations can also be implicitly generated from
4372
/// \#include/\#import directives.
4373
class ImportDecl final : public Decl,
4374
                         llvm::TrailingObjects<ImportDecl, SourceLocation> {
4375
  friend class ASTContext;
4376
  friend class ASTDeclReader;
4377
  friend class ASTReader;
4378
  friend TrailingObjects;
4379
4380
  /// The imported module.
4381
  Module *ImportedModule = nullptr;
4382
4383
  /// The next import in the list of imports local to the translation
4384
  /// unit being parsed (not loaded from an AST file).
4385
  ///
4386
  /// Includes a bit that indicates whether we have source-location information
4387
  /// for each identifier in the module name.
4388
  ///
4389
  /// When the bit is false, we only have a single source location for the
4390
  /// end of the import declaration.
4391
  llvm::PointerIntPair<ImportDecl *, 1, bool> NextLocalImportAndComplete;
4392
4393
  ImportDecl(DeclContext *DC, SourceLocation StartLoc, Module *Imported,
4394
             ArrayRef<SourceLocation> IdentifierLocs);
4395
4396
  ImportDecl(DeclContext *DC, SourceLocation StartLoc, Module *Imported,
4397
             SourceLocation EndLoc);
4398
4399
156
  ImportDecl(EmptyShell Empty) : Decl(Import, Empty) {}
4400
4401
155k
  bool isImportComplete() const { return NextLocalImportAndComplete.getInt(); }
4402
4403
156
  void setImportComplete(bool C) { NextLocalImportAndComplete.setInt(C); }
4404
4405
  /// The next import in the list of imports local to the translation
4406
  /// unit being parsed (not loaded from an AST file).
4407
81.1k
  ImportDecl *getNextLocalImport() const {
4408
81.1k
    return NextLocalImportAndComplete.getPointer();
4409
81.1k
  }
4410
4411
77.3k
  void setNextLocalImport(ImportDecl *Import) {
4412
77.3k
    NextLocalImportAndComplete.setPointer(Import);
4413
77.3k
  }
4414
4415
public:
4416
  /// Create a new module import declaration.
4417
  static ImportDecl *Create(ASTContext &C, DeclContext *DC,
4418
                            SourceLocation StartLoc, Module *Imported,
4419
                            ArrayRef<SourceLocation> IdentifierLocs);
4420
4421
  /// Create a new module import declaration for an implicitly-generated
4422
  /// import.
4423
  static ImportDecl *CreateImplicit(ASTContext &C, DeclContext *DC,
4424
                                    SourceLocation StartLoc, Module *Imported,
4425
                                    SourceLocation EndLoc);
4426
4427
  /// Create a new, deserialized module import declaration.
4428
  static ImportDecl *CreateDeserialized(ASTContext &C, unsigned ID,
4429
                                        unsigned NumLocations);
4430
4431
  /// Retrieve the module that was imported by the import declaration.
4432
212k
  Module *getImportedModule() const { return ImportedModule; }
4433
4434
  /// Retrieves the locations of each of the identifiers that make up
4435
  /// the complete module name in the import declaration.
4436
  ///
4437
  /// This will return an empty array if the locations of the individual
4438
  /// identifiers aren't available.
4439
  ArrayRef<SourceLocation> getIdentifierLocs() const;
4440
4441
  SourceRange getSourceRange() const override LLVM_READONLY;
4442
4443
61.1M
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
4444
61.1M
  static bool classofKind(Kind K) { return K == Import; }
4445
};
4446
4447
/// Represents a C++ Modules TS module export declaration.
4448
///
4449
/// For example:
4450
/// \code
4451
///   export void foo();
4452
/// \endcode
4453
class ExportDecl final : public Decl, public DeclContext {
4454
  virtual void anchor();
4455
4456
private:
4457
  friend class ASTDeclReader;
4458
4459
  /// The source location for the right brace (if valid).
4460
  SourceLocation RBraceLoc;
4461
4462
  ExportDecl(DeclContext *DC, SourceLocation ExportLoc)
4463
      : Decl(Export, DC, ExportLoc), DeclContext(Export),
4464
152
        RBraceLoc(SourceLocation()) {}
4465
4466
public:
4467
  static ExportDecl *Create(ASTContext &C, DeclContext *DC,
4468
                            SourceLocation ExportLoc);
4469
  static ExportDecl *CreateDeserialized(ASTContext &C, unsigned ID);
4470
4471
0
  SourceLocation getExportLoc() const { return getLocation(); }
4472
38
  SourceLocation getRBraceLoc() const { return RBraceLoc; }
4473
123
  void setRBraceLoc(SourceLocation L) { RBraceLoc = L; }
4474
4475
123
  bool hasBraces() const { return RBraceLoc.isValid(); }
4476
4477
20
  SourceLocation getEndLoc() const LLVM_READONLY {
4478
20
    if (hasBraces())
4479
20
      return RBraceLoc;
4480
    // No braces: get the end location of the (only) declaration in context
4481
    // (if present).
4482
0
    return decls_empty() ? getLocation() : decls_begin()->getEndLoc();
4483
0
  }
4484
4485
20
  SourceRange getSourceRange() const override LLVM_READONLY {
4486
20
    return SourceRange(getLocation(), getEndLoc());
4487
20
  }
4488
4489
104
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
4490
89.9k
  static bool classofKind(Kind K) { return K == Export; }
4491
0
  static DeclContext *castToDeclContext(const ExportDecl *D) {
4492
0
    return static_cast<DeclContext *>(const_cast<ExportDecl*>(D));
4493
0
  }
4494
0
  static ExportDecl *castFromDeclContext(const DeclContext *DC) {
4495
0
    return static_cast<ExportDecl *>(const_cast<DeclContext*>(DC));
4496
0
  }
4497
};
4498
4499
/// Represents an empty-declaration.
4500
class EmptyDecl : public Decl {
4501
5.37k
  EmptyDecl(DeclContext *DC, SourceLocation L) : Decl(Empty, DC, L) {}
4502
4503
  virtual void anchor();
4504
4505
public:
4506
  static EmptyDecl *Create(ASTContext &C, DeclContext *DC,
4507
                           SourceLocation L);
4508
  static EmptyDecl *CreateDeserialized(ASTContext &C, unsigned ID);
4509
4510
615
  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
4511
615
  static bool classofKind(Kind K) { return K == Empty; }
4512
};
4513
4514
/// Insertion operator for diagnostics.  This allows sending NamedDecl's
4515
/// into a diagnostic with <<.
4516
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
4517
511k
                                           const NamedDecl* ND) {
4518
511k
  DB.AddTaggedVal(reinterpret_cast<intptr_t>(ND),
4519
511k
                  DiagnosticsEngine::ak_nameddecl);
4520
511k
  return DB;
4521
511k
}
4522
inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
4523
594k
                                           const NamedDecl* ND) {
4524
594k
  PD.AddTaggedVal(reinterpret_cast<intptr_t>(ND),
4525
594k
                  DiagnosticsEngine::ak_nameddecl);
4526
594k
  return PD;
4527
594k
}
4528
4529
template<typename decl_type>
4530
7.97M
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
4531
  // Note: This routine is implemented here because we need both NamedDecl
4532
  // and Redeclarable to be defined.
4533
7.97M
  assert(RedeclLink.isFirst() &&
4534
7.97M
         "setPreviousDecl on a decl already in a redeclaration chain");
4535
4536
7.97M
  if (PrevDecl) {
4537
    // Point to previous. Make sure that this is actually the most recent
4538
    // redeclaration, or we can build invalid chains. If the most recent
4539
    // redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
4540
1.45M
    First = PrevDecl->getFirstDecl();
4541
1.45M
    assert(First->RedeclLink.isFirst() && "Expected first");
4542
1.45M
    decl_type *MostRecent = First->getNextRedeclaration();
4543
1.45M
    RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4544
4545
    // If the declaration was previously visible, a redeclaration of it remains
4546
    // visible even if it wouldn't be visible by itself.
4547
1.45M
    static_cast<decl_type*>(this)->IdentifierNamespace |=
4548
1.45M
      MostRecent->getIdentifierNamespace() &
4549
1.45M
      (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
4550
6.52M
  } else {
4551
    // Make this first.
4552
6.52M
    First = static_cast<decl_type*>(this);
4553
6.52M
  }
4554
4555
  // First one will point to this one as latest.
4556
7.97M
  First->RedeclLink.setLatest(static_cast<decl_type*>(this));
4557
4558
7.97M
  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
4559
7.97M
         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
4560
7.97M
}
clang::Redeclarable<clang::FunctionDecl>::setPreviousDecl(clang::FunctionDecl*)
Line
Count
Source
4530
244k
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
4531
  // Note: This routine is implemented here because we need both NamedDecl
4532
  // and Redeclarable to be defined.
4533
244k
  assert(RedeclLink.isFirst() &&
4534
244k
         "setPreviousDecl on a decl already in a redeclaration chain");
4535
4536
244k
  if (PrevDecl) {
4537
    // Point to previous. Make sure that this is actually the most recent
4538
    // redeclaration, or we can build invalid chains. If the most recent
4539
    // redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
4540
244k
    First = PrevDecl->getFirstDecl();
4541
244k
    assert(First->RedeclLink.isFirst() && "Expected first");
4542
244k
    decl_type *MostRecent = First->getNextRedeclaration();
4543
244k
    RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4544
4545
    // If the declaration was previously visible, a redeclaration of it remains
4546
    // visible even if it wouldn't be visible by itself.
4547
244k
    static_cast<decl_type*>(this)->IdentifierNamespace |=
4548
244k
      MostRecent->getIdentifierNamespace() &
4549
244k
      (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
4550
0
  } else {
4551
    // Make this first.
4552
0
    First = static_cast<decl_type*>(this);
4553
0
  }
4554
4555
  // First one will point to this one as latest.
4556
244k
  First->RedeclLink.setLatest(static_cast<decl_type*>(this));
4557
4558
244k
  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
4559
244k
         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
4560
244k
}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::setPreviousDecl(clang::RedeclarableTemplateDecl*)
Line
Count
Source
4530
299k
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
4531
  // Note: This routine is implemented here because we need both NamedDecl
4532
  // and Redeclarable to be defined.
4533
299k
  assert(RedeclLink.isFirst() &&
4534
299k
         "setPreviousDecl on a decl already in a redeclaration chain");
4535
4536
299k
  if (PrevDecl) {
4537
    // Point to previous. Make sure that this is actually the most recent
4538
    // redeclaration, or we can build invalid chains. If the most recent
4539
    // redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
4540
76.8k
    First = PrevDecl->getFirstDecl();
4541
76.8k
    assert(First->RedeclLink.isFirst() && "Expected first");
4542
76.8k
    decl_type *MostRecent = First->getNextRedeclaration();
4543
76.8k
    RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4544
4545
    // If the declaration was previously visible, a redeclaration of it remains
4546
    // visible even if it wouldn't be visible by itself.
4547
76.8k
    static_cast<decl_type*>(this)->IdentifierNamespace |=
4548
76.8k
      MostRecent->getIdentifierNamespace() &
4549
76.8k
      (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
4550
223k
  } else {
4551
    // Make this first.
4552
223k
    First = static_cast<decl_type*>(this);
4553
223k
  }
4554
4555
  // First one will point to this one as latest.
4556
299k
  First->RedeclLink.setLatest(static_cast<decl_type*>(this));
4557
4558
299k
  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
4559
299k
         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
4560
299k
}
clang::Redeclarable<clang::TagDecl>::setPreviousDecl(clang::TagDecl*)
Line
Count
Source
4530
6.55M
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
4531
  // Note: This routine is implemented here because we need both NamedDecl
4532
  // and Redeclarable to be defined.
4533
6.55M
  assert(RedeclLink.isFirst() &&
4534
6.55M
         "setPreviousDecl on a decl already in a redeclaration chain");
4535
4536
6.55M
  if (PrevDecl) {
4537
    // Point to previous. Make sure that this is actually the most recent
4538
    // redeclaration, or we can build invalid chains. If the most recent
4539
    // redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
4540
848k
    First = PrevDecl->getFirstDecl();
4541
848k
    assert(First->RedeclLink.isFirst() && "Expected first");
4542
848k
    decl_type *MostRecent = First->getNextRedeclaration();
4543
848k
    RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4544
4545
    // If the declaration was previously visible, a redeclaration of it remains
4546
    // visible even if it wouldn't be visible by itself.
4547
848k
    static_cast<decl_type*>(this)->IdentifierNamespace |=
4548
848k
      MostRecent->getIdentifierNamespace() &
4549
848k
      (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
4550
5.70M
  } else {
4551
    // Make this first.
4552
5.70M
    First = static_cast<decl_type*>(this);
4553
5.70M
  }
4554
4555
  // First one will point to this one as latest.
4556
6.55M
  First->RedeclLink.setLatest(static_cast<decl_type*>(this));
4557
4558
6.55M
  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
4559
6.55M
         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
4560
6.55M
}
clang::Redeclarable<clang::NamespaceDecl>::setPreviousDecl(clang::NamespaceDecl*)
Line
Count
Source
4530
265k
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
4531
  // Note: This routine is implemented here because we need both NamedDecl
4532
  // and Redeclarable to be defined.
4533
265k
  assert(RedeclLink.isFirst() &&
4534
265k
         "setPreviousDecl on a decl already in a redeclaration chain");
4535
4536
265k
  if (PrevDecl) {
4537
    // Point to previous. Make sure that this is actually the most recent
4538
    // redeclaration, or we can build invalid chains. If the most recent
4539
    // redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
4540
42.5k
    First = PrevDecl->getFirstDecl();
4541
42.5k
    assert(First->RedeclLink.isFirst() && "Expected first");
4542
42.5k
    decl_type *MostRecent = First->getNextRedeclaration();
4543
42.5k
    RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4544
4545
    // If the declaration was previously visible, a redeclaration of it remains
4546
    // visible even if it wouldn't be visible by itself.
4547
42.5k
    static_cast<decl_type*>(this)->IdentifierNamespace |=
4548
42.5k
      MostRecent->getIdentifierNamespace() &
4549
42.5k
      (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
4550
222k
  } else {
4551
    // Make this first.
4552
222k
    First = static_cast<decl_type*>(this);
4553
222k
  }
4554
4555
  // First one will point to this one as latest.
4556
265k
  First->RedeclLink.setLatest(static_cast<decl_type*>(this));
4557
4558
265k
  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
4559
265k
         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
4560
265k
}
clang::Redeclarable<clang::ObjCInterfaceDecl>::setPreviousDecl(clang::ObjCInterfaceDecl*)
Line
Count
Source
4530
354k
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
4531
  // Note: This routine is implemented here because we need both NamedDecl
4532
  // and Redeclarable to be defined.
4533
354k
  assert(RedeclLink.isFirst() &&
4534
354k
         "setPreviousDecl on a decl already in a redeclaration chain");
4535
4536
354k
  if (PrevDecl) {
4537
    // Point to previous. Make sure that this is actually the most recent
4538
    // redeclaration, or we can build invalid chains. If the most recent
4539
    // redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
4540
165k
    First = PrevDecl->getFirstDecl();
4541
165k
    assert(First->RedeclLink.isFirst() && "Expected first");
4542
165k
    decl_type *MostRecent = First->getNextRedeclaration();
4543
165k
    RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4544
4545
    // If the declaration was previously visible, a redeclaration of it remains
4546
    // visible even if it wouldn't be visible by itself.
4547
165k
    static_cast<decl_type*>(this)->IdentifierNamespace |=
4548
165k
      MostRecent->getIdentifierNamespace() &
4549
165k
      (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
4550
188k
  } else {
4551
    // Make this first.
4552
188k
    First = static_cast<decl_type*>(this);
4553
188k
  }
4554
4555
  // First one will point to this one as latest.
4556
354k
  First->RedeclLink.setLatest(static_cast<decl_type*>(this));
4557
4558
354k
  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
4559
354k
         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
4560
354k
}
clang::Redeclarable<clang::ObjCProtocolDecl>::setPreviousDecl(clang::ObjCProtocolDecl*)
Line
Count
Source
4530
32.4k
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
4531
  // Note: This routine is implemented here because we need both NamedDecl
4532
  // and Redeclarable to be defined.
4533
32.4k
  assert(RedeclLink.isFirst() &&
4534
32.4k
         "setPreviousDecl on a decl already in a redeclaration chain");
4535
4536
32.4k
  if (PrevDecl) {
4537
    // Point to previous. Make sure that this is actually the most recent
4538
    // redeclaration, or we can build invalid chains. If the most recent
4539
    // redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
4540
6.50k
    First = PrevDecl->getFirstDecl();
4541
6.50k
    assert(First->RedeclLink.isFirst() && "Expected first");
4542
6.50k
    decl_type *MostRecent = First->getNextRedeclaration();
4543
6.50k
    RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4544
4545
    // If the declaration was previously visible, a redeclaration of it remains
4546
    // visible even if it wouldn't be visible by itself.
4547
6.50k
    static_cast<decl_type*>(this)->IdentifierNamespace |=
4548
6.50k
      MostRecent->getIdentifierNamespace() &
4549
6.50k
      (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
4550
25.9k
  } else {
4551
    // Make this first.
4552
25.9k
    First = static_cast<decl_type*>(this);
4553
25.9k
  }
4554
4555
  // First one will point to this one as latest.
4556
32.4k
  First->RedeclLink.setLatest(static_cast<decl_type*>(this));
4557
4558
32.4k
  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
4559
32.4k
         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
4560
32.4k
}
clang::Redeclarable<clang::TypedefNameDecl>::setPreviousDecl(clang::TypedefNameDecl*)
Line
Count
Source
4530
5.99k
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
4531
  // Note: This routine is implemented here because we need both NamedDecl
4532
  // and Redeclarable to be defined.
4533
5.99k
  assert(RedeclLink.isFirst() &&
4534
5.99k
         "setPreviousDecl on a decl already in a redeclaration chain");
4535
4536
5.99k
  if (PrevDecl) {
4537
    // Point to previous. Make sure that this is actually the most recent
4538
    // redeclaration, or we can build invalid chains. If the most recent
4539
    // redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
4540
5.99k
    First = PrevDecl->getFirstDecl();
4541
5.99k
    assert(First->RedeclLink.isFirst() && "Expected first");
4542
5.99k
    decl_type *MostRecent = First->getNextRedeclaration();
4543
5.99k
    RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4544
4545
    // If the declaration was previously visible, a redeclaration of it remains
4546
    // visible even if it wouldn't be visible by itself.
4547
5.99k
    static_cast<decl_type*>(this)->IdentifierNamespace |=
4548
5.99k
      MostRecent->getIdentifierNamespace() &
4549
5.99k
      (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
4550
0
  } else {
4551
    // Make this first.
4552
0
    First = static_cast<decl_type*>(this);
4553
0
  }
4554
4555
  // First one will point to this one as latest.
4556
5.99k
  First->RedeclLink.setLatest(static_cast<decl_type*>(this));
4557
4558
5.99k
  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
4559
5.99k
         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
4560
5.99k
}
clang::Redeclarable<clang::VarDecl>::setPreviousDecl(clang::VarDecl*)
Line
Count
Source
4530
56.8k
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
4531
  // Note: This routine is implemented here because we need both NamedDecl
4532
  // and Redeclarable to be defined.
4533
56.8k
  assert(RedeclLink.isFirst() &&
4534
56.8k
         "setPreviousDecl on a decl already in a redeclaration chain");
4535
4536
56.8k
  if (PrevDecl) {
4537
    // Point to previous. Make sure that this is actually the most recent
4538
    // redeclaration, or we can build invalid chains. If the most recent
4539
    // redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
4540
56.8k
    First = PrevDecl->getFirstDecl();
4541
56.8k
    assert(First->RedeclLink.isFirst() && "Expected first");
4542
56.8k
    decl_type *MostRecent = First->getNextRedeclaration();
4543
56.8k
    RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4544
4545
    // If the declaration was previously visible, a redeclaration of it remains
4546
    // visible even if it wouldn't be visible by itself.
4547
56.8k
    static_cast<decl_type*>(this)->IdentifierNamespace |=
4548
56.8k
      MostRecent->getIdentifierNamespace() &
4549
56.8k
      (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
4550
0
  } else {
4551
    // Make this first.
4552
0
    First = static_cast<decl_type*>(this);
4553
0
  }
4554
4555
  // First one will point to this one as latest.
4556
56.8k
  First->RedeclLink.setLatest(static_cast<decl_type*>(this));
4557
4558
56.8k
  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
4559
56.8k
         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
4560
56.8k
}
clang::Redeclarable<clang::UsingShadowDecl>::setPreviousDecl(clang::UsingShadowDecl*)
Line
Count
Source
4530
159k
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
4531
  // Note: This routine is implemented here because we need both NamedDecl
4532
  // and Redeclarable to be defined.
4533
159k
  assert(RedeclLink.isFirst() &&
4534
159k
         "setPreviousDecl on a decl already in a redeclaration chain");
4535
4536
159k
  if (PrevDecl) {
4537
    // Point to previous. Make sure that this is actually the most recent
4538
    // redeclaration, or we can build invalid chains. If the most recent
4539
    // redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
4540
3.04k
    First = PrevDecl->getFirstDecl();
4541
3.04k
    assert(First->RedeclLink.isFirst() && "Expected first");
4542
3.04k
    decl_type *MostRecent = First->getNextRedeclaration();
4543
3.04k
    RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4544
4545
    // If the declaration was previously visible, a redeclaration of it remains
4546
    // visible even if it wouldn't be visible by itself.
4547
3.04k
    static_cast<decl_type*>(this)->IdentifierNamespace |=
4548
3.04k
      MostRecent->getIdentifierNamespace() &
4549
3.04k
      (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
4550
156k
  } else {
4551
    // Make this first.
4552
156k
    First = static_cast<decl_type*>(this);
4553
156k
  }
4554
4555
  // First one will point to this one as latest.
4556
159k
  First->RedeclLink.setLatest(static_cast<decl_type*>(this));
4557
4558
159k
  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
4559
159k
         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
4560
159k
}
clang::Redeclarable<clang::NamespaceAliasDecl>::setPreviousDecl(clang::NamespaceAliasDecl*)
Line
Count
Source
4530
12
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
4531
  // Note: This routine is implemented here because we need both NamedDecl
4532
  // and Redeclarable to be defined.
4533
12
  assert(RedeclLink.isFirst() &&
4534
12
         "setPreviousDecl on a decl already in a redeclaration chain");
4535
4536
12
  if (PrevDecl) {
4537
    // Point to previous. Make sure that this is actually the most recent
4538
    // redeclaration, or we can build invalid chains. If the most recent
4539
    // redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
4540
12
    First = PrevDecl->getFirstDecl();
4541
12
    assert(First->RedeclLink.isFirst() && "Expected first");
4542
12
    decl_type *MostRecent = First->getNextRedeclaration();
4543
12
    RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4544
4545
    // If the declaration was previously visible, a redeclaration of it remains
4546
    // visible even if it wouldn't be visible by itself.
4547
12
    static_cast<decl_type*>(this)->IdentifierNamespace |=
4548
12
      MostRecent->getIdentifierNamespace() &
4549
12
      (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
4550
0
  } else {
4551
    // Make this first.
4552
0
    First = static_cast<decl_type*>(this);
4553
0
  }
4554
4555
  // First one will point to this one as latest.
4556
12
  First->RedeclLink.setLatest(static_cast<decl_type*>(this));
4557
4558
12
  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
4559
12
         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
4560
12
}
4561
4562
// Inline function definitions.
4563
4564
/// Check if the given decl is complete.
4565
///
4566
/// We use this function to break a cycle between the inline definitions in
4567
/// Type.h and Decl.h.
4568
532k
inline bool IsEnumDeclComplete(EnumDecl *ED) {
4569
532k
  return ED->isComplete();
4570
532k
}
4571
4572
/// Check if the given decl is scoped.
4573
///
4574
/// We use this function to break a cycle between the inline definitions in
4575
/// Type.h and Decl.h.
4576
88.5k
inline bool IsEnumDeclScoped(EnumDecl *ED) {
4577
88.5k
  return ED->isScoped();
4578
88.5k
}
4579
4580
/// OpenMP variants are mangled early based on their OpenMP context selector.
4581
/// The new name looks likes this:
4582
///  <name> + OpenMPVariantManglingSeparatorStr + <mangled OpenMP context>
4583
15.9k
static constexpr StringRef getOpenMPVariantManglingSeparatorStr() {
4584
15.9k
  return "$ompvariant";
4585
15.9k
}
Unexecuted instantiation: ClangRefactor.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TestSupport.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: APValue.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTConcept.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTConsumer.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTContext.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTDiagnostic.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTDumper.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTStructuralEquivalence.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTTypeTraits.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: AttrImpl.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Comment.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CommentParser.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CommentSema.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ComparisonCategories.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ComputeDependence.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CXXInheritance.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Decl.cpp:clang::getOpenMPVariantManglingSeparatorStr()
DeclarationName.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Line
Count
Source
4583
348
static constexpr StringRef getOpenMPVariantManglingSeparatorStr() {
4584
348
  return "$ompvariant";
4585
348
}
Unexecuted instantiation: DeclBase.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DeclCXX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DeclFriend.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DeclGroup.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DeclObjC.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DeclOpenMP.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DeclPrinter.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DeclTemplate.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParentMapContext.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Expr.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExprClassification.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExprConcepts.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExprConstant.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExprCXX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExprObjC.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExternalASTSource.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: FormatString.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ByteCodeEmitter.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ByteCodeExprGen.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ByteCodeGenError.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ByteCodeStmtGen.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Context.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Descriptor.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: EvalEmitter.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Function.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Interp.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: InterpBlock.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: InterpFrame.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: InterpState.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Pointer.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PrimType.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Program.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Record.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Source.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: State.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ItaniumCXXABI.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ItaniumMangle.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: JSONNodeDumper.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Mangle.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MicrosoftCXXABI.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MicrosoftMangle.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NestedNameSpecifier.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NSAPI.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ODRHash.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: OpenMPClause.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: OSLog.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParentMap.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PrintfFormatString.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: QualTypeNames.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RawCommentList.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RecordLayout.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RecordLayoutBuilder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ScanfFormatString.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SelectorLocationsKind.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Stmt.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: StmtCXX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: StmtIterator.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: StmtObjC.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: StmtOpenMP.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: StmtPrinter.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: StmtProfile.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: StmtViz.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TemplateBase.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TemplateName.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TextNodeDumper.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Type.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TypeLoc.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TypePrinter.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: VTableBuilder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTConsumers.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTUnit.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ChainedIncludesSource.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CompilerInstance.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CompilerInvocation.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DependencyFile.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: FrontendAction.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: FrontendActions.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: InitPreprocessor.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LayoutOverrideSource.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ModuleDependencyCollector.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PrecompiledPreamble.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TestModuleFileExtension.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTCommon.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTReader.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTReaderDecl.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTReaderStmt.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTWriter.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTWriterDecl.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTWriterStmt.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: GeneratePCH.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CommonOptionsParser.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CompilationDatabase.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: GuessTargetAndModeCompilationDatabase.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: JSONCompilationDatabase.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Tooling.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Lookup.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTSelection.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTSelectionRequirements.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: AtomicChange.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Extract.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SourceExtraction.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RefactoringActions.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RenamingAction.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: USRFinder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: USRFindingAction.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: USRLocFinder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: USRGeneration.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseAST.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseCXXInlineMethods.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseDecl.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseDeclCXX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseExpr.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseExprCXX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseInit.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseObjc.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseOpenMP.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParsePragma.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseStmt.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseStmtAsm.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseTemplate.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParseTentative.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Parser.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: AnalysisBasedWarnings.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CodeCompleteConsumer.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DeclSpec.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DelayedDiagnostic.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IdentifierResolver.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: JumpDiagnostics.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MultiplexExternalSemaSource.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ParsedAttr.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Scope.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ScopeInfo.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Sema.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaAccess.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaAttr.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaAvailability.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaCXXScopeSpec.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaCast.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaChecking.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaCodeComplete.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaConcept.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaCoroutine.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaCUDA.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaDecl.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaDeclAttr.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaDeclCXX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaDeclObjC.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaExceptionSpec.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaExpr.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaExprCXX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaExprMember.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaExprObjC.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaFixItUtils.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaInit.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaLambda.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaLookup.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaModule.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaObjCProperty.cpp:clang::getOpenMPVariantManglingSeparatorStr()
SemaOpenMP.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Line
Count
Source
4583
15.5k
static constexpr StringRef getOpenMPVariantManglingSeparatorStr() {
4584
15.5k
  return "$ompvariant";
4585
15.5k
}
Unexecuted instantiation: SemaOverload.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaPseudoObject.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaStmt.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaStmtAsm.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaStmtAttr.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaSYCL.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaTemplate.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaTemplateDeduction.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaTemplateInstantiate.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaTemplateInstantiateDecl.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaTemplateVariadic.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SemaType.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TypeLocBuilder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RewriteObjCFoundationAPI.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: AnalysisDeclContext.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: BodyFarm.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CFG.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CFGReachabilityAnalysis.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CFGStmtMap.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CocoaConventions.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ConstructionContext.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Consumed.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCNoReturn.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PostOrderCFGView.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ReachableCode.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ThreadSafety.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ThreadSafetyCommon.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ThreadSafetyTIL.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UninitializedValues.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangRename.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Refactoring.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGAtomic.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGBlocks.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGBuiltin.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGCUDANV.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGCUDARuntime.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGCXX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGCXXABI.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGCall.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGClass.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGCleanup.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGCoroutine.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGDebugInfo.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGDecl.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGDeclCXX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGException.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGExpr.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGExprAgg.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGExprCXX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGExprComplex.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGExprConstant.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGExprScalar.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGGPUBuiltin.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGLoopInfo.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGNonTrivialStruct.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGObjC.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGObjCGNU.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGObjCMac.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGObjCRuntime.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGOpenCLRuntime.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGOpenMPRuntime.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGOpenMPRuntimeAMDGCN.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGOpenMPRuntimeGPU.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGOpenMPRuntimeNVPTX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGRecordLayoutBuilder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGStmt.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGStmtOpenMP.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGVTT.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CGVTables.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CodeGenAction.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CodeGenFunction.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CodeGenModule.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CodeGenPGO.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CodeGenTBAA.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CodeGenTypes.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ConstantInitBuilder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CoverageMappingGen.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MacroPPCallbacks.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ModuleBuilder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjectFilePCHContainerOperations.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PatternInit.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SanitizerMetadata.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SwiftCallingConv.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TargetInfo.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: VarBypassDetector.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTMerge.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: InterfaceStubFunctionsConsumer.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExecuteCompilerInvocation.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: HTMLPrint.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RewriteModernObjC.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RewriteObjC.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ARCMT.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ARCMTActions.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCMT.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransAPIUses.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransARCAssign.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransAutoreleasePool.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransBlockObjCVariable.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransEmptyStatementsAndDealloc.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransGCAttrs.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransGCCalls.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransProperties.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransProtectedScope.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransRetainReleaseDealloc.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransUnbridgedCasts.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransUnusedInitDelegate.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransZeroOutPropsInDealloc.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TransformActions.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Transforms.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: AnalysisConsumer.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: AnalyzerHelpFlags.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CheckerRegistry.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CreateCheckerManager.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ModelConsumer.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ModelInjector.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: AnalysisOrderChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: AnalyzerStatsChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ArrayBoundChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ArrayBoundCheckerV2.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: BasicObjCFoundationChecks.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: BlockInCriticalSectionChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: BoolAssignmentChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: BuiltinFunctionChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CStringChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CStringSyntaxChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CallAndMessageChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CastSizeChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CastToStructChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CastValueChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CheckObjCDealloc.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CheckObjCInstMethSignature.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CheckPlacementNew.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CheckSecuritySyntaxOnly.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CheckSizeofPointer.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ChrootChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CloneChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ContainerModeling.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ConversionChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CXXSelfAssignmentChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DeadStoresChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DebugCheckers.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DebugContainerModeling.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DebugIteratorModeling.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DeleteWithNonVirtualDtorChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DereferenceChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DirectIvarAssignment.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DivZeroChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DynamicTypePropagation.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DynamicTypeChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: EnumCastOutOfRangeChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExprInspectionChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: FixedAddressChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: FuchsiaHandleChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: GCDAntipatternChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: GenericTaintChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: GTestChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IdenticalExprChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: InnerPointerChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: InvalidatedIteratorChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Iterator.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IteratorModeling.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IteratorRangeChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IvarInvalidationChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LLVMConventionsChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LocalizationChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MacOSKeychainAPIChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MacOSXAPIChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MallocChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MallocOverflowSecurityChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MallocSizeofChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MismatchedIteratorChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MmapWriteExecChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MIGChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MoveChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MPIBugReporter.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MPIChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MPIFunctionClassifier.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NSAutoreleasePoolChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NSErrorChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NoReturnFunctionChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NonNullParamChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NonnullGlobalConstantsChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NullabilityChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NumberObjectConversionChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCAtSyncChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCAutoreleaseWriteChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCContainersASTChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCContainersChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCMissingSuperCallChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCPropertyChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCSelfInitChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCSuperDeallocChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCUnusedIVarsChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: OSObjectCStyleCast.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PaddingChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PointerArithChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PointerIterationChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PointerSortingChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PointerSubChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PthreadLockChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PutenvWithAutoChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RetainCountChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RetainCountDiagnostics.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ReturnPointerRangeChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ReturnUndefChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ReturnValueChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RunLoopAutoreleaseLeakChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SimpleStreamChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SmartPtrChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SmartPtrModeling.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: StackAddrEscapeChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: StdLibraryFunctionsChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: STLAlgorithmModeling.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: StreamChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Taint.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TaintTesterChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TestAfterDivZeroChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TraversalChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TrustNonnullChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UndefBranchChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UndefCapturedBlockVarChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UndefResultChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UndefinedArraySubscriptChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UndefinedAssignmentChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UninitializedObjectChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UninitializedPointee.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UnixAPIChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UnreachableCodeChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: VforkChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: VLASizeChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ValistChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: VirtualCallChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NoUncountedMembersChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTUtils.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PtrTypesSemantics.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RefCntblBaseVirtualDtorChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UncountedCallArgsChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: UncountedLambdaCapturesChecker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: AnalysisManager.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: AnalyzerOptions.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: BasicValueFactory.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: BugReporter.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: BugReporterVisitors.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CallEvent.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Checker.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CheckerContext.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CheckerHelpers.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CheckerManager.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ConstraintManager.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CoreEngine.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DynamicSize.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DynamicType.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Environment.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExplodedGraph.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExprEngine.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExprEngineC.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExprEngineCXX.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExprEngineCallAndReturn.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ExprEngineObjC.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: FunctionSummary.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: HTMLDiagnostics.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IssueHash.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LoopUnrolling.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LoopWidening.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: MemRegion.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PlistDiagnostics.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ProgramState.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RangeConstraintManager.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RangedConstraintManager.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RegionStore.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SarifDiagnostics.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SimpleConstraintManager.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SimpleSValBuilder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SMTConstraintManager.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Store.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SValBuilder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SVals.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: SymbolManager.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: TextDiagnostics.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: WorkList.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CrossTranslationUnit.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CallGraph.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CloneDetection.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Dominators.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LiveVariables.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: PathDiagnostic.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ProgramPoint.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: RetainSummaryManager.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTMatchFinder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTMatchersInternal.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTImporter.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTImporterLookupTable.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: DataCollection.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: VTTBuilder.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangCheck.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: core_main.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IndexBody.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IndexDecl.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IndexingAction.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IndexingContext.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IndexSymbol.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: IndexTypeSourceInfo.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangDiff.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTDiff.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: BlockPointer.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CxxStringTypes.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LibCxx.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LibCxxBitset.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LibCxxList.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LibCxxMap.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LibCxxUnorderedMap.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: LibStdcpp.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ObjCLanguage.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CF.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: Cocoa.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NSArray.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NSDictionary.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NSError.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NSException.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NSIndexPath.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NSSet.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: NSString.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTResultSynthesizer.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ASTStructExtractor.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangASTImporter.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangASTSource.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangDeclVendor.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangExpressionDeclMap.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangExpressionParser.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangExpressionVariable.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangExternalASTSourceCallbacks.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangFunctionCaller.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangModulesDeclVendor.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangPersistentVariables.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangUserExpression.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangUtil.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: ClangUtilityFunction.cpp:clang::getOpenMPVariantManglingSeparatorStr()
Unexecuted instantiation: CxxModuleHandler.c