Coverage Report

Created: 2022-07-16 07:03

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