Coverage Report

Created: 2021-09-21 08:58

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