Coverage Report

Created: 2022-05-14 11:35

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/AST/ODRHash.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- ODRHash.cpp - Hashing to diagnose ODR failures ----------*- 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
/// \file
10
/// This file implements the ODRHash class, which calculates a hash based
11
/// on AST nodes, which is stable across different runs.
12
///
13
//===----------------------------------------------------------------------===//
14
15
#include "clang/AST/ODRHash.h"
16
17
#include "clang/AST/DeclVisitor.h"
18
#include "clang/AST/NestedNameSpecifier.h"
19
#include "clang/AST/StmtVisitor.h"
20
#include "clang/AST/TypeVisitor.h"
21
22
using namespace clang;
23
24
401k
void ODRHash::AddStmt(const Stmt *S) {
25
401k
  assert(S && "Expecting non-null pointer.");
26
0
  S->ProcessODRHash(ID, *this);
27
401k
}
28
29
2.74M
void ODRHash::AddIdentifierInfo(const IdentifierInfo *II) {
30
2.74M
  assert(II && "Expecting non-null pointer.");
31
0
  ID.AddString(II->getName());
32
2.74M
}
33
34
5.16M
void ODRHash::AddDeclarationName(DeclarationName Name, bool TreatAsDecl) {
35
5.16M
  if (TreatAsDecl)
36
    // Matches the NamedDecl check in AddDecl
37
34.8k
    AddBoolean(true);
38
39
5.16M
  AddDeclarationNameImpl(Name);
40
41
5.16M
  if (TreatAsDecl)
42
    // Matches the ClassTemplateSpecializationDecl check in AddDecl
43
34.8k
    AddBoolean(false);
44
5.16M
}
45
46
5.16M
void ODRHash::AddDeclarationNameImpl(DeclarationName Name) {
47
  // Index all DeclarationName and use index numbers to refer to them.
48
5.16M
  auto Result = DeclNameMap.insert(std::make_pair(Name, DeclNameMap.size()));
49
5.16M
  ID.AddInteger(Result.first->second);
50
5.16M
  if (!Result.second) {
51
    // If found in map, the DeclarationName has previously been processed.
52
2.24M
    return;
53
2.24M
  }
54
55
  // First time processing each DeclarationName, also process its details.
56
2.91M
  AddBoolean(Name.isEmpty());
57
2.91M
  if (Name.isEmpty())
58
203k
    return;
59
60
2.70M
  auto Kind = Name.getNameKind();
61
2.70M
  ID.AddInteger(Kind);
62
2.70M
  switch (Kind) {
63
2.62M
  case DeclarationName::Identifier:
64
2.62M
    AddIdentifierInfo(Name.getAsIdentifierInfo());
65
2.62M
    break;
66
23
  case DeclarationName::ObjCZeroArgSelector:
67
30
  case DeclarationName::ObjCOneArgSelector:
68
37
  case DeclarationName::ObjCMultiArgSelector: {
69
37
    Selector S = Name.getObjCSelector();
70
37
    AddBoolean(S.isNull());
71
37
    AddBoolean(S.isKeywordSelector());
72
37
    AddBoolean(S.isUnarySelector());
73
37
    unsigned NumArgs = S.getNumArgs();
74
37
    ID.AddInteger(NumArgs);
75
60
    for (unsigned i = 0; i < NumArgs; 
++i23
) {
76
23
      const IdentifierInfo *II = S.getIdentifierInfoForSlot(i);
77
23
      AddBoolean(II);
78
23
      if (II) {
79
20
        AddIdentifierInfo(II);
80
20
      }
81
23
    }
82
37
    break;
83
30
  }
84
36.8k
  case DeclarationName::CXXConstructorName:
85
46.7k
  case DeclarationName::CXXDestructorName:
86
46.7k
    AddQualType(Name.getCXXNameType());
87
46.7k
    break;
88
36.4k
  case DeclarationName::CXXOperatorName:
89
36.4k
    ID.AddInteger(Name.getCXXOverloadedOperator());
90
36.4k
    break;
91
108
  case DeclarationName::CXXLiteralOperatorName:
92
108
    AddIdentifierInfo(Name.getCXXLiteralIdentifier());
93
108
    break;
94
1.14k
  case DeclarationName::CXXConversionFunctionName:
95
1.14k
    AddQualType(Name.getCXXNameType());
96
1.14k
    break;
97
77
  case DeclarationName::CXXUsingDirective:
98
77
    break;
99
1.43k
  case DeclarationName::CXXDeductionGuideName: {
100
1.43k
    auto *Template = Name.getCXXDeductionGuideTemplate();
101
1.43k
    AddBoolean(Template);
102
1.43k
    if (Template) {
103
1.43k
      AddDecl(Template);
104
1.43k
    }
105
1.43k
  }
106
2.70M
  }
107
2.70M
}
108
109
207k
void ODRHash::AddNestedNameSpecifier(const NestedNameSpecifier *NNS) {
110
207k
  assert(NNS && "Expecting non-null pointer.");
111
0
  const auto *Prefix = NNS->getPrefix();
112
207k
  AddBoolean(Prefix);
113
207k
  if (Prefix) {
114
5.01k
    AddNestedNameSpecifier(Prefix);
115
5.01k
  }
116
207k
  auto Kind = NNS->getKind();
117
207k
  ID.AddInteger(Kind);
118
207k
  switch (Kind) {
119
533
  case NestedNameSpecifier::Identifier:
120
533
    AddIdentifierInfo(NNS->getAsIdentifier());
121
533
    break;
122
34.7k
  case NestedNameSpecifier::Namespace:
123
34.7k
    AddDecl(NNS->getAsNamespace());
124
34.7k
    break;
125
12
  case NestedNameSpecifier::NamespaceAlias:
126
12
    AddDecl(NNS->getAsNamespaceAlias());
127
12
    break;
128
170k
  case NestedNameSpecifier::TypeSpec:
129
170k
  case NestedNameSpecifier::TypeSpecWithTemplate:
130
170k
    AddType(NNS->getAsType());
131
170k
    break;
132
1.70k
  case NestedNameSpecifier::Global:
133
1.70k
  case NestedNameSpecifier::Super:
134
1.70k
    break;
135
207k
  }
136
207k
}
137
138
288k
void ODRHash::AddTemplateName(TemplateName Name) {
139
288k
  auto Kind = Name.getKind();
140
288k
  ID.AddInteger(Kind);
141
142
288k
  switch (Kind) {
143
288k
  case TemplateName::Template:
144
288k
    AddDecl(Name.getAsTemplateDecl());
145
288k
    break;
146
  // TODO: Support these cases.
147
0
  case TemplateName::OverloadedTemplate:
148
0
  case TemplateName::AssumedTemplate:
149
2
  case TemplateName::QualifiedTemplate:
150
17
  case TemplateName::DependentTemplate:
151
17
  case TemplateName::SubstTemplateTemplateParm:
152
17
  case TemplateName::SubstTemplateTemplateParmPack:
153
17
  case TemplateName::UsingTemplate:
154
17
    break;
155
288k
  }
156
288k
}
157
158
498k
void ODRHash::AddTemplateArgument(TemplateArgument TA) {
159
498k
  const auto Kind = TA.getKind();
160
498k
  ID.AddInteger(Kind);
161
162
498k
  switch (Kind) {
163
0
    case TemplateArgument::Null:
164
0
      llvm_unreachable("Expected valid TemplateArgument");
165
458k
    case TemplateArgument::Type:
166
458k
      AddQualType(TA.getAsType());
167
458k
      break;
168
74
    case TemplateArgument::Declaration:
169
74
      AddDecl(TA.getAsDecl());
170
74
      break;
171
0
    case TemplateArgument::NullPtr:
172
4.20k
    case TemplateArgument::Integral:
173
4.20k
      break;
174
466
    case TemplateArgument::Template:
175
466
    case TemplateArgument::TemplateExpansion:
176
466
      AddTemplateName(TA.getAsTemplateOrTemplatePattern());
177
466
      break;
178
35.1k
    case TemplateArgument::Expression:
179
35.1k
      AddStmt(TA.getAsExpr());
180
35.1k
      break;
181
78
    case TemplateArgument::Pack:
182
78
      ID.AddInteger(TA.pack_size());
183
78
      for (auto SubTA : TA.pack_elements()) {
184
51
        AddTemplateArgument(SubTA);
185
51
      }
186
78
      break;
187
498k
  }
188
498k
}
189
190
19.5k
void ODRHash::AddTemplateParameterList(const TemplateParameterList *TPL) {
191
19.5k
  assert(TPL && "Expecting non-null pointer.");
192
193
0
  ID.AddInteger(TPL->size());
194
29.8k
  for (auto *ND : TPL->asArray()) {
195
29.8k
    AddSubDecl(ND);
196
29.8k
  }
197
19.5k
}
198
199
963
void ODRHash::clear() {
200
963
  DeclNameMap.clear();
201
963
  Bools.clear();
202
963
  ID.clear();
203
963
}
204
205
567k
unsigned ODRHash::CalculateHash() {
206
  // Append the bools to the end of the data segment backwards.  This allows
207
  // for the bools data to be compressed 32 times smaller compared to using
208
  // ID.AddBoolean
209
567k
  const unsigned unsigned_bits = sizeof(unsigned) * CHAR_BIT;
210
567k
  const unsigned size = Bools.size();
211
567k
  const unsigned remainder = size % unsigned_bits;
212
567k
  const unsigned loops = size / unsigned_bits;
213
567k
  auto I = Bools.rbegin();
214
567k
  unsigned value = 0;
215
7.66M
  for (unsigned i = 0; i < remainder; 
++i7.10M
) {
216
7.10M
    value <<= 1;
217
7.10M
    value |= *I;
218
7.10M
    ++I;
219
7.10M
  }
220
567k
  ID.AddInteger(value);
221
222
1.11M
  for (unsigned i = 0; i < loops; 
++i546k
) {
223
546k
    value = 0;
224
18.0M
    for (unsigned j = 0; j < unsigned_bits; 
++j17.4M
) {
225
17.4M
      value <<= 1;
226
17.4M
      value |= *I;
227
17.4M
      ++I;
228
17.4M
    }
229
546k
    ID.AddInteger(value);
230
546k
  }
231
232
567k
  assert(I == Bools.rend());
233
0
  Bools.clear();
234
567k
  return ID.ComputeHash();
235
567k
}
236
237
namespace {
238
// Process a Decl pointer.  Add* methods call back into ODRHash while Visit*
239
// methods process the relevant parts of the Decl.
240
class ODRDeclVisitor : public ConstDeclVisitor<ODRDeclVisitor> {
241
  typedef ConstDeclVisitor<ODRDeclVisitor> Inherited;
242
  llvm::FoldingSetNodeID &ID;
243
  ODRHash &Hash;
244
245
public:
246
  ODRDeclVisitor(llvm::FoldingSetNodeID &ID, ODRHash &Hash)
247
1.18M
      : ID(ID), Hash(Hash) {}
248
249
347k
  void AddStmt(const Stmt *S) {
250
347k
    Hash.AddBoolean(S);
251
347k
    if (S) {
252
214k
      Hash.AddStmt(S);
253
214k
    }
254
347k
  }
255
256
0
  void AddIdentifierInfo(const IdentifierInfo *II) {
257
0
    Hash.AddBoolean(II);
258
0
    if (II) {
259
0
      Hash.AddIdentifierInfo(II);
260
0
    }
261
0
  }
262
263
1.07M
  void AddQualType(QualType T) {
264
1.07M
    Hash.AddQualType(T);
265
1.07M
  }
266
267
14.2k
  void AddDecl(const Decl *D) {
268
14.2k
    Hash.AddBoolean(D);
269
14.2k
    if (D) {
270
14.2k
      Hash.AddDecl(D);
271
14.2k
    }
272
14.2k
  }
273
274
3.00k
  void AddTemplateArgument(TemplateArgument TA) {
275
3.00k
    Hash.AddTemplateArgument(TA);
276
3.00k
  }
277
278
1.18M
  void Visit(const Decl *D) {
279
1.18M
    ID.AddInteger(D->getKind());
280
1.18M
    Inherited::Visit(D);
281
1.18M
  }
282
283
1.16M
  void VisitNamedDecl(const NamedDecl *D) {
284
1.16M
    Hash.AddDeclarationName(D->getDeclName());
285
1.16M
    Inherited::VisitNamedDecl(D);
286
1.16M
  }
287
288
1.10M
  void VisitValueDecl(const ValueDecl *D) {
289
1.10M
    if (!isa<FunctionDecl>(D)) {
290
1.05M
      AddQualType(D->getType());
291
1.05M
    }
292
1.10M
    Inherited::VisitValueDecl(D);
293
1.10M
  }
294
295
769k
  void VisitVarDecl(const VarDecl *D) {
296
769k
    Hash.AddBoolean(D->isStaticLocal());
297
769k
    Hash.AddBoolean(D->isConstexpr());
298
769k
    const bool HasInit = D->hasInit();
299
769k
    Hash.AddBoolean(HasInit);
300
769k
    if (HasInit) {
301
56.9k
      AddStmt(D->getInit());
302
56.9k
    }
303
769k
    Inherited::VisitVarDecl(D);
304
769k
  }
305
306
705k
  void VisitParmVarDecl(const ParmVarDecl *D) {
307
    // TODO: Handle default arguments.
308
705k
    Inherited::VisitParmVarDecl(D);
309
705k
  }
310
311
9.44k
  void VisitAccessSpecDecl(const AccessSpecDecl *D) {
312
9.44k
    ID.AddInteger(D->getAccess());
313
9.44k
    Inherited::VisitAccessSpecDecl(D);
314
9.44k
  }
315
316
2.83k
  void VisitStaticAssertDecl(const StaticAssertDecl *D) {
317
2.83k
    AddStmt(D->getAssertExpr());
318
2.83k
    AddStmt(D->getMessage());
319
320
2.83k
    Inherited::VisitStaticAssertDecl(D);
321
2.83k
  }
322
323
125k
  void VisitFieldDecl(const FieldDecl *D) {
324
125k
    const bool IsBitfield = D->isBitField();
325
125k
    Hash.AddBoolean(IsBitfield);
326
327
125k
    if (IsBitfield) {
328
1.82k
      AddStmt(D->getBitWidth());
329
1.82k
    }
330
331
125k
    Hash.AddBoolean(D->isMutable());
332
125k
    AddStmt(D->getInClassInitializer());
333
334
125k
    Inherited::VisitFieldDecl(D);
335
125k
  }
336
337
54.2k
  void VisitFunctionDecl(const FunctionDecl *D) {
338
    // Handled by the ODRHash for FunctionDecl
339
54.2k
    ID.AddInteger(D->getODRHash());
340
341
54.2k
    Inherited::VisitFunctionDecl(D);
342
54.2k
  }
343
344
54.2k
  void VisitCXXMethodDecl(const CXXMethodDecl *D) {
345
    // Handled by the ODRHash for FunctionDecl
346
347
54.2k
    Inherited::VisitCXXMethodDecl(D);
348
54.2k
  }
349
350
24.0k
  void VisitTypedefNameDecl(const TypedefNameDecl *D) {
351
24.0k
    AddQualType(D->getUnderlyingType());
352
353
24.0k
    Inherited::VisitTypedefNameDecl(D);
354
24.0k
  }
355
356
22.7k
  void VisitTypedefDecl(const TypedefDecl *D) {
357
22.7k
    Inherited::VisitTypedefDecl(D);
358
22.7k
  }
359
360
1.34k
  void VisitTypeAliasDecl(const TypeAliasDecl *D) {
361
1.34k
    Inherited::VisitTypeAliasDecl(D);
362
1.34k
  }
363
364
5.09k
  void VisitFriendDecl(const FriendDecl *D) {
365
5.09k
    TypeSourceInfo *TSI = D->getFriendType();
366
5.09k
    Hash.AddBoolean(TSI);
367
5.09k
    if (TSI) {
368
444
      AddQualType(TSI->getType());
369
4.65k
    } else {
370
4.65k
      AddDecl(D->getFriendDecl());
371
4.65k
    }
372
5.09k
  }
373
374
25.5k
  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {
375
    // Only care about default arguments as part of the definition.
376
25.5k
    const bool hasDefaultArgument =
377
25.5k
        D->hasDefaultArgument() && 
!D->defaultArgumentWasInherited()3.15k
;
378
25.5k
    Hash.AddBoolean(hasDefaultArgument);
379
25.5k
    if (hasDefaultArgument) {
380
2.74k
      AddTemplateArgument(D->getDefaultArgument());
381
2.74k
    }
382
25.5k
    Hash.AddBoolean(D->isParameterPack());
383
384
25.5k
    const TypeConstraint *TC = D->getTypeConstraint();
385
25.5k
    Hash.AddBoolean(TC != nullptr);
386
25.5k
    if (TC)
387
6
      AddStmt(TC->getImmediatelyDeclaredConstraint());
388
389
25.5k
    Inherited::VisitTemplateTypeParmDecl(D);
390
25.5k
  }
391
392
4.02k
  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D) {
393
    // Only care about default arguments as part of the definition.
394
4.02k
    const bool hasDefaultArgument =
395
4.02k
        D->hasDefaultArgument() && 
!D->defaultArgumentWasInherited()1.80k
;
396
4.02k
    Hash.AddBoolean(hasDefaultArgument);
397
4.02k
    if (hasDefaultArgument) {
398
1.78k
      AddStmt(D->getDefaultArgument());
399
1.78k
    }
400
4.02k
    Hash.AddBoolean(D->isParameterPack());
401
402
4.02k
    Inherited::VisitNonTypeTemplateParmDecl(D);
403
4.02k
  }
404
405
406
  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D) {
406
    // Only care about default arguments as part of the definition.
407
406
    const bool hasDefaultArgument =
408
406
        D->hasDefaultArgument() && 
!D->defaultArgumentWasInherited()262
;
409
406
    Hash.AddBoolean(hasDefaultArgument);
410
406
    if (hasDefaultArgument) {
411
262
      AddTemplateArgument(D->getDefaultArgument().getArgument());
412
262
    }
413
406
    Hash.AddBoolean(D->isParameterPack());
414
415
406
    Inherited::VisitTemplateTemplateParmDecl(D);
416
406
  }
417
418
10.0k
  void VisitTemplateDecl(const TemplateDecl *D) {
419
10.0k
    Hash.AddTemplateParameterList(D->getTemplateParameters());
420
421
10.0k
    Inherited::VisitTemplateDecl(D);
422
10.0k
  }
423
424
9.60k
  void VisitRedeclarableTemplateDecl(const RedeclarableTemplateDecl *D) {
425
9.60k
    Hash.AddBoolean(D->isMemberSpecialization());
426
9.60k
    Inherited::VisitRedeclarableTemplateDecl(D);
427
9.60k
  }
428
429
9.60k
  void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {
430
9.60k
    AddDecl(D->getTemplatedDecl());
431
9.60k
    ID.AddInteger(D->getTemplatedDecl()->getODRHash());
432
9.60k
    Inherited::VisitFunctionTemplateDecl(D);
433
9.60k
  }
434
435
155k
  void VisitEnumConstantDecl(const EnumConstantDecl *D) {
436
155k
    AddStmt(D->getInitExpr());
437
155k
    Inherited::VisitEnumConstantDecl(D);
438
155k
  }
439
};
440
} // namespace
441
442
// Only allow a small portion of Decl's to be processed.  Remove this once
443
// all Decl's can be handled.
444
822k
bool ODRHash::isDeclToBeProcessed(const Decl *D, const DeclContext *Parent) {
445
822k
  if (D->isImplicit()) 
return false104k
;
446
717k
  if (D->getDeclContext() != Parent) 
return false1.54k
;
447
448
716k
  switch (D->getKind()) {
449
266k
    default:
450
266k
      return false;
451
9.44k
    case Decl::AccessSpec:
452
23.1k
    case Decl::CXXConstructor:
453
26.2k
    case Decl::CXXDestructor:
454
63.6k
    case Decl::CXXMethod:
455
218k
    case Decl::EnumConstant: // Only found in EnumDecl's.
456
344k
    case Decl::Field:
457
349k
    case Decl::Friend:
458
359k
    case Decl::FunctionTemplate:
459
362k
    case Decl::StaticAssert:
460
363k
    case Decl::TypeAlias:
461
386k
    case Decl::Typedef:
462
449k
    case Decl::Var:
463
449k
      return true;
464
716k
  }
465
716k
}
466
467
1.18M
void ODRHash::AddSubDecl(const Decl *D) {
468
1.18M
  assert(D && "Expecting non-null pointer.");
469
470
0
  ODRDeclVisitor(ID, *this).Visit(D);
471
1.18M
}
472
473
114k
void ODRHash::AddCXXRecordDecl(const CXXRecordDecl *Record) {
474
114k
  assert(Record && Record->hasDefinition() &&
475
114k
         "Expected non-null record to be a definition.");
476
477
0
  const DeclContext *DC = Record;
478
383k
  while (DC) {
479
314k
    if (isa<ClassTemplateSpecializationDecl>(DC)) {
480
44.8k
      return;
481
44.8k
    }
482
269k
    DC = DC->getParent();
483
269k
  }
484
485
69.1k
  AddDecl(Record);
486
487
  // Filter out sub-Decls which will not be processed in order to get an
488
  // accurate count of Decl's.
489
69.1k
  llvm::SmallVector<const Decl *, 16> Decls;
490
305k
  for (Decl *SubDecl : Record->decls()) {
491
305k
    if (isDeclToBeProcessed(SubDecl, Record)) {
492
224k
      Decls.push_back(SubDecl);
493
224k
      if (auto *Function = dyn_cast<FunctionDecl>(SubDecl)) {
494
        // Compute/Preload ODRHash into FunctionDecl.
495
54.0k
        Function->getODRHash();
496
54.0k
      }
497
224k
    }
498
305k
  }
499
500
69.1k
  ID.AddInteger(Decls.size());
501
224k
  for (auto SubDecl : Decls) {
502
224k
    AddSubDecl(SubDecl);
503
224k
  }
504
505
69.1k
  const ClassTemplateDecl *TD = Record->getDescribedClassTemplate();
506
69.1k
  AddBoolean(TD);
507
69.1k
  if (TD) {
508
9.53k
    AddTemplateParameterList(TD->getTemplateParameters());
509
9.53k
  }
510
511
69.1k
  ID.AddInteger(Record->getNumBases());
512
69.1k
  auto Bases = Record->bases();
513
69.1k
  for (auto Base : Bases) {
514
4.82k
    AddQualType(Base.getType());
515
4.82k
    ID.AddInteger(Base.isVirtual());
516
4.82k
    ID.AddInteger(Base.getAccessSpecifierAsWritten());
517
4.82k
  }
518
69.1k
}
519
520
void ODRHash::AddFunctionDecl(const FunctionDecl *Function,
521
430k
                              bool SkipBody) {
522
430k
  assert(Function && "Expecting non-null pointer.");
523
524
  // Skip functions that are specializations or in specialization context.
525
0
  const DeclContext *DC = Function;
526
1.70M
  while (DC) {
527
1.32M
    if (isa<ClassTemplateSpecializationDecl>(DC)) 
return43.3k
;
528
1.28M
    if (auto *F = dyn_cast<FunctionDecl>(DC)) {
529
433k
      if (F->isFunctionTemplateSpecialization()) {
530
10.8k
        if (!isa<CXXMethodDecl>(DC)) 
return6.25k
;
531
4.56k
        if (DC->getLexicalParent()->isFileContext()) 
return33
;
532
        // Inline method specializations are the only supported
533
        // specialization for now.
534
4.56k
      }
535
433k
    }
536
1.27M
    DC = DC->getParent();
537
1.27M
  }
538
539
381k
  ID.AddInteger(Function->getDeclKind());
540
541
381k
  const auto *SpecializationArgs = Function->getTemplateSpecializationArgs();
542
381k
  AddBoolean(SpecializationArgs);
543
381k
  if (SpecializationArgs) {
544
2.53k
    ID.AddInteger(SpecializationArgs->size());
545
2.64k
    for (const TemplateArgument &TA : SpecializationArgs->asArray()) {
546
2.64k
      AddTemplateArgument(TA);
547
2.64k
    }
548
2.53k
  }
549
550
381k
  if (const auto *Method = dyn_cast<CXXMethodDecl>(Function)) {
551
90.6k
    AddBoolean(Method->isConst());
552
90.6k
    AddBoolean(Method->isVolatile());
553
90.6k
  }
554
555
381k
  ID.AddInteger(Function->getStorageClass());
556
381k
  AddBoolean(Function->isInlineSpecified());
557
381k
  AddBoolean(Function->isVirtualAsWritten());
558
381k
  AddBoolean(Function->isPure());
559
381k
  AddBoolean(Function->isDeletedAsWritten());
560
381k
  AddBoolean(Function->isExplicitlyDefaulted());
561
562
381k
  AddDecl(Function);
563
564
381k
  AddQualType(Function->getReturnType());
565
566
381k
  ID.AddInteger(Function->param_size());
567
381k
  for (auto Param : Function->parameters())
568
705k
    AddSubDecl(Param);
569
570
381k
  if (SkipBody) {
571
14
    AddBoolean(false);
572
14
    return;
573
14
  }
574
575
381k
  const bool HasBody = Function->isThisDeclarationADefinition() &&
576
381k
                       
!Function->isDefaulted()159k
&&
!Function->isDeleted()149k
&&
577
381k
                       
!Function->isLateTemplateParsed()148k
;
578
381k
  AddBoolean(HasBody);
579
381k
  if (!HasBody) {
580
232k
    return;
581
232k
  }
582
583
148k
  auto *Body = Function->getBody();
584
148k
  AddBoolean(Body);
585
148k
  if (Body)
586
148k
    AddStmt(Body);
587
588
  // Filter out sub-Decls which will not be processed in order to get an
589
  // accurate count of Decl's.
590
148k
  llvm::SmallVector<const Decl *, 16> Decls;
591
360k
  for (Decl *SubDecl : Function->decls()) {
592
360k
    if (isDeclToBeProcessed(SubDecl, Function)) {
593
69.6k
      Decls.push_back(SubDecl);
594
69.6k
    }
595
360k
  }
596
597
148k
  ID.AddInteger(Decls.size());
598
148k
  for (auto SubDecl : Decls) {
599
69.6k
    AddSubDecl(SubDecl);
600
69.6k
  }
601
148k
}
602
603
21.5k
void ODRHash::AddEnumDecl(const EnumDecl *Enum) {
604
21.5k
  assert(Enum);
605
0
  AddDeclarationName(Enum->getDeclName());
606
607
21.5k
  AddBoolean(Enum->isScoped());
608
21.5k
  if (Enum->isScoped())
609
210
    AddBoolean(Enum->isScopedUsingClassTag());
610
611
21.5k
  if (Enum->getIntegerTypeSourceInfo())
612
5.89k
    AddQualType(Enum->getIntegerType());
613
614
  // Filter out sub-Decls which will not be processed in order to get an
615
  // accurate count of Decl's.
616
21.5k
  llvm::SmallVector<const Decl *, 16> Decls;
617
155k
  for (Decl *SubDecl : Enum->decls()) {
618
155k
    if (isDeclToBeProcessed(SubDecl, Enum)) {
619
155k
      assert(isa<EnumConstantDecl>(SubDecl) && "Unexpected Decl");
620
0
      Decls.push_back(SubDecl);
621
155k
    }
622
155k
  }
623
624
21.5k
  ID.AddInteger(Decls.size());
625
155k
  for (auto SubDecl : Decls) {
626
155k
    AddSubDecl(SubDecl);
627
155k
  }
628
629
21.5k
}
630
631
3.78M
void ODRHash::AddDecl(const Decl *D) {
632
3.78M
  assert(D && "Expecting non-null pointer.");
633
0
  D = D->getCanonicalDecl();
634
635
3.78M
  const NamedDecl *ND = dyn_cast<NamedDecl>(D);
636
3.78M
  AddBoolean(ND);
637
3.78M
  if (!ND) {
638
1.79k
    ID.AddInteger(D->getKind());
639
1.79k
    return;
640
1.79k
  }
641
642
3.78M
  AddDeclarationName(ND->getDeclName());
643
644
3.78M
  const auto *Specialization =
645
3.78M
            dyn_cast<ClassTemplateSpecializationDecl>(D);
646
3.78M
  AddBoolean(Specialization);
647
3.78M
  if (Specialization) {
648
8.01k
    const TemplateArgumentList &List = Specialization->getTemplateArgs();
649
8.01k
    ID.AddInteger(List.size());
650
8.01k
    for (const TemplateArgument &TA : List.asArray())
651
14.6k
      AddTemplateArgument(TA);
652
8.01k
  }
653
3.78M
}
654
655
namespace {
656
// Process a Type pointer.  Add* methods call back into ODRHash while Visit*
657
// methods process the relevant parts of the Type.
658
class ODRTypeVisitor : public TypeVisitor<ODRTypeVisitor> {
659
  typedef TypeVisitor<ODRTypeVisitor> Inherited;
660
  llvm::FoldingSetNodeID &ID;
661
  ODRHash &Hash;
662
663
public:
664
  ODRTypeVisitor(llvm::FoldingSetNodeID &ID, ODRHash &Hash)
665
4.90M
      : ID(ID), Hash(Hash) {}
666
667
3.44k
  void AddStmt(Stmt *S) {
668
3.44k
    Hash.AddBoolean(S);
669
3.44k
    if (S) {
670
3.43k
      Hash.AddStmt(S);
671
3.43k
    }
672
3.44k
  }
673
674
2.12M
  void AddDecl(Decl *D) {
675
2.12M
    Hash.AddBoolean(D);
676
2.12M
    if (D) {
677
2.11M
      Hash.AddDecl(D);
678
2.11M
    }
679
2.12M
  }
680
681
1.21M
  void AddQualType(QualType T) {
682
1.21M
    Hash.AddQualType(T);
683
1.21M
  }
684
685
1.31M
  void AddType(const Type *T) {
686
1.31M
    Hash.AddBoolean(T);
687
1.31M
    if (T) {
688
1.31M
      Hash.AddType(T);
689
1.31M
    }
690
1.31M
  }
691
692
224k
  void AddNestedNameSpecifier(const NestedNameSpecifier *NNS) {
693
224k
    Hash.AddBoolean(NNS);
694
224k
    if (NNS) {
695
127k
      Hash.AddNestedNameSpecifier(NNS);
696
127k
    }
697
224k
  }
698
699
118k
  void AddIdentifierInfo(const IdentifierInfo *II) {
700
118k
    Hash.AddBoolean(II);
701
118k
    if (II) {
702
118k
      Hash.AddIdentifierInfo(II);
703
118k
    }
704
118k
  }
705
706
1.32M
  void VisitQualifiers(Qualifiers Quals) {
707
1.32M
    ID.AddInteger(Quals.getAsOpaqueValue());
708
1.32M
  }
709
710
  // Return the RecordType if the typedef only strips away a keyword.
711
  // Otherwise, return the original type.
712
4.90M
  static const Type *RemoveTypedef(const Type *T) {
713
4.90M
    const auto *TypedefT = dyn_cast<TypedefType>(T);
714
4.90M
    if (!TypedefT) {
715
3.57M
      return T;
716
3.57M
    }
717
718
1.32M
    const TypedefNameDecl *D = TypedefT->getDecl();
719
1.32M
    QualType UnderlyingType = D->getUnderlyingType();
720
721
1.32M
    if (UnderlyingType.hasLocalQualifiers()) {
722
121
      return T;
723
121
    }
724
725
1.32M
    const auto *ElaboratedT = dyn_cast<ElaboratedType>(UnderlyingType);
726
1.32M
    if (!ElaboratedT) {
727
1.24M
      return T;
728
1.24M
    }
729
730
82.5k
    if (ElaboratedT->getQualifier() != nullptr) {
731
9.23k
      return T;
732
9.23k
    }
733
734
73.3k
    QualType NamedType = ElaboratedT->getNamedType();
735
73.3k
    if (NamedType.hasLocalQualifiers()) {
736
0
      return T;
737
0
    }
738
739
73.3k
    const auto *RecordT = dyn_cast<RecordType>(NamedType);
740
73.3k
    if (!RecordT) {
741
6.83k
      return T;
742
6.83k
    }
743
744
66.4k
    const IdentifierInfo *TypedefII = TypedefT->getDecl()->getIdentifier();
745
66.4k
    const IdentifierInfo *RecordII = RecordT->getDecl()->getIdentifier();
746
66.4k
    if (!TypedefII || !RecordII ||
747
66.4k
        
TypedefII->getName() != RecordII->getName()33.4k
) {
748
50.0k
      return T;
749
50.0k
    }
750
751
16.4k
    return RecordT;
752
66.4k
  }
753
754
4.90M
  void Visit(const Type *T) {
755
4.90M
    T = RemoveTypedef(T);
756
4.90M
    ID.AddInteger(T->getTypeClass());
757
4.90M
    Inherited::Visit(T);
758
4.90M
  }
759
760
4.48M
  void VisitType(const Type *T) {}
761
762
4.22k
  void VisitAdjustedType(const AdjustedType *T) {
763
4.22k
    QualType Original = T->getOriginalType();
764
4.22k
    QualType Adjusted = T->getAdjustedType();
765
766
    // The original type and pointee type can be the same, as in the case of
767
    // function pointers decaying to themselves.  Set a bool and only process
768
    // the type once, to prevent doubling the work.
769
4.22k
    SplitQualType split = Adjusted.split();
770
4.22k
    if (auto Pointer = dyn_cast<PointerType>(split.Ty)) {
771
3.95k
      if (Pointer->getPointeeType() == Original) {
772
221
        Hash.AddBoolean(true);
773
221
        ID.AddInteger(split.Quals.getAsOpaqueValue());
774
221
        AddQualType(Original);
775
221
        VisitType(T);
776
221
        return;
777
221
      }
778
3.95k
    }
779
780
    // The original type and pointee type are different, such as in the case
781
    // of a array decaying to an element pointer.  Set a bool to false and
782
    // process both types.
783
4.00k
    Hash.AddBoolean(false);
784
4.00k
    AddQualType(Original);
785
4.00k
    AddQualType(Adjusted);
786
787
4.00k
    VisitType(T);
788
4.00k
  }
789
790
4.22k
  void VisitDecayedType(const DecayedType *T) {
791
    // getDecayedType and getPointeeType are derived from getAdjustedType
792
    // and don't need to be separately processed.
793
4.22k
    VisitAdjustedType(T);
794
4.22k
  }
795
796
18.3k
  void VisitArrayType(const ArrayType *T) {
797
18.3k
    AddQualType(T->getElementType());
798
18.3k
    ID.AddInteger(T->getSizeModifier());
799
18.3k
    VisitQualifiers(T->getIndexTypeQualifiers());
800
18.3k
    VisitType(T);
801
18.3k
  }
802
14.1k
  void VisitConstantArrayType(const ConstantArrayType *T) {
803
14.1k
    T->getSize().Profile(ID);
804
14.1k
    VisitArrayType(T);
805
14.1k
  }
806
807
853
  void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
808
853
    AddStmt(T->getSizeExpr());
809
853
    VisitArrayType(T);
810
853
  }
811
812
2.00k
  void VisitIncompleteArrayType(const IncompleteArrayType *T) {
813
2.00k
    VisitArrayType(T);
814
2.00k
  }
815
816
1.36k
  void VisitVariableArrayType(const VariableArrayType *T) {
817
1.36k
    AddStmt(T->getSizeExpr());
818
1.36k
    VisitArrayType(T);
819
1.36k
  }
820
821
49.2k
  void VisitAttributedType(const AttributedType *T) {
822
49.2k
    ID.AddInteger(T->getAttrKind());
823
49.2k
    AddQualType(T->getModifiedType());
824
49.2k
    AddQualType(T->getEquivalentType());
825
826
49.2k
    VisitType(T);
827
49.2k
  }
828
829
1.74k
  void VisitBlockPointerType(const BlockPointerType *T) {
830
1.74k
    AddQualType(T->getPointeeType());
831
1.74k
    VisitType(T);
832
1.74k
  }
833
834
1.25M
  void VisitBuiltinType(const BuiltinType *T) {
835
1.25M
    ID.AddInteger(T->getKind());
836
1.25M
    VisitType(T);
837
1.25M
  }
838
839
4.72k
  void VisitComplexType(const ComplexType *T) {
840
4.72k
    AddQualType(T->getElementType());
841
4.72k
    VisitType(T);
842
4.72k
  }
843
844
1.17k
  void VisitDecltypeType(const DecltypeType *T) {
845
1.17k
    AddStmt(T->getUnderlyingExpr());
846
1.17k
    AddQualType(T->getUnderlyingType());
847
1.17k
    VisitType(T);
848
1.17k
  }
849
850
0
  void VisitDependentDecltypeType(const DependentDecltypeType *T) {
851
0
    VisitDecltypeType(T);
852
0
  }
853
854
1.34k
  void VisitDeducedType(const DeducedType *T) {
855
1.34k
    AddQualType(T->getDeducedType());
856
1.34k
    VisitType(T);
857
1.34k
  }
858
859
1.34k
  void VisitAutoType(const AutoType *T) {
860
1.34k
    ID.AddInteger((unsigned)T->getKeyword());
861
1.34k
    ID.AddInteger(T->isConstrained());
862
1.34k
    if (T->isConstrained()) {
863
0
      AddDecl(T->getTypeConstraintConcept());
864
0
      ID.AddInteger(T->getNumArgs());
865
0
      for (const auto &TA : T->getTypeConstraintArguments())
866
0
        Hash.AddTemplateArgument(TA);
867
0
    }
868
1.34k
    VisitDeducedType(T);
869
1.34k
  }
870
871
  void VisitDeducedTemplateSpecializationType(
872
8
      const DeducedTemplateSpecializationType *T) {
873
8
    Hash.AddTemplateName(T->getTemplateName());
874
8
    VisitDeducedType(T);
875
8
  }
876
877
11
  void VisitDependentAddressSpaceType(const DependentAddressSpaceType *T) {
878
11
    AddQualType(T->getPointeeType());
879
11
    AddStmt(T->getAddrSpaceExpr());
880
11
    VisitType(T);
881
11
  }
882
883
6
  void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *T) {
884
6
    AddQualType(T->getElementType());
885
6
    AddStmt(T->getSizeExpr());
886
6
    VisitType(T);
887
6
  }
888
889
23.8k
  void VisitFunctionType(const FunctionType *T) {
890
23.8k
    AddQualType(T->getReturnType());
891
23.8k
    T->getExtInfo().Profile(ID);
892
23.8k
    Hash.AddBoolean(T->isConst());
893
23.8k
    Hash.AddBoolean(T->isVolatile());
894
23.8k
    Hash.AddBoolean(T->isRestrict());
895
23.8k
    VisitType(T);
896
23.8k
  }
897
898
3
  void VisitFunctionNoProtoType(const FunctionNoProtoType *T) {
899
3
    VisitFunctionType(T);
900
3
  }
901
902
23.8k
  void VisitFunctionProtoType(const FunctionProtoType *T) {
903
23.8k
    ID.AddInteger(T->getNumParams());
904
23.8k
    for (auto ParamType : T->getParamTypes())
905
62.1k
      AddQualType(ParamType);
906
907
23.8k
    VisitFunctionType(T);
908
23.8k
  }
909
910
39.6k
  void VisitInjectedClassNameType(const InjectedClassNameType *T) {
911
39.6k
    AddDecl(T->getDecl());
912
39.6k
    VisitType(T);
913
39.6k
  }
914
915
531
  void VisitMemberPointerType(const MemberPointerType *T) {
916
531
    AddQualType(T->getPointeeType());
917
531
    AddType(T->getClass());
918
531
    VisitType(T);
919
531
  }
920
921
8.78k
  void VisitObjCObjectPointerType(const ObjCObjectPointerType *T) {
922
8.78k
    AddQualType(T->getPointeeType());
923
8.78k
    VisitType(T);
924
8.78k
  }
925
926
8.81k
  void VisitObjCObjectType(const ObjCObjectType *T) {
927
8.81k
    AddDecl(T->getInterface());
928
929
8.81k
    auto TypeArgs = T->getTypeArgsAsWritten();
930
8.81k
    ID.AddInteger(TypeArgs.size());
931
8.81k
    for (auto Arg : TypeArgs) {
932
50
      AddQualType(Arg);
933
50
    }
934
935
8.81k
    auto Protocols = T->getProtocols();
936
8.81k
    ID.AddInteger(Protocols.size());
937
8.81k
    for (auto Protocol : Protocols) {
938
4.26k
      AddDecl(Protocol);
939
4.26k
    }
940
941
8.81k
    Hash.AddBoolean(T->isKindOfType());
942
943
8.81k
    VisitType(T);
944
8.81k
  }
945
946
1.74k
  void VisitObjCInterfaceType(const ObjCInterfaceType *T) {
947
    // This type is handled by the parent type ObjCObjectType.
948
1.74k
    VisitObjCObjectType(T);
949
1.74k
  }
950
951
8
  void VisitObjCTypeParamType(const ObjCTypeParamType *T) {
952
8
    AddDecl(T->getDecl());
953
8
    auto Protocols = T->getProtocols();
954
8
    ID.AddInteger(Protocols.size());
955
8
    for (auto Protocol : Protocols) {
956
7
      AddDecl(Protocol);
957
7
    }
958
959
8
    VisitType(T);
960
8
  }
961
962
5.28k
  void VisitPackExpansionType(const PackExpansionType *T) {
963
5.28k
    AddQualType(T->getPattern());
964
5.28k
    VisitType(T);
965
5.28k
  }
966
967
23.2k
  void VisitParenType(const ParenType *T) {
968
23.2k
    AddQualType(T->getInnerType());
969
23.2k
    VisitType(T);
970
23.2k
  }
971
972
12
  void VisitPipeType(const PipeType *T) {
973
12
    AddQualType(T->getElementType());
974
12
    Hash.AddBoolean(T->isReadOnly());
975
12
    VisitType(T);
976
12
  }
977
978
347k
  void VisitPointerType(const PointerType *T) {
979
347k
    AddQualType(T->getPointeeType());
980
347k
    VisitType(T);
981
347k
  }
982
983
95.0k
  void VisitReferenceType(const ReferenceType *T) {
984
95.0k
    AddQualType(T->getPointeeTypeAsWritten());
985
95.0k
    VisitType(T);
986
95.0k
  }
987
988
83.6k
  void VisitLValueReferenceType(const LValueReferenceType *T) {
989
83.6k
    VisitReferenceType(T);
990
83.6k
  }
991
992
11.4k
  void VisitRValueReferenceType(const RValueReferenceType *T) {
993
11.4k
    VisitReferenceType(T);
994
11.4k
  }
995
996
  void
997
0
  VisitSubstTemplateTypeParmPackType(const SubstTemplateTypeParmPackType *T) {
998
0
    AddType(T->getReplacedParameter());
999
0
    Hash.AddTemplateArgument(T->getArgumentPack());
1000
0
    VisitType(T);
1001
0
  }
1002
1003
2.62k
  void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T) {
1004
2.62k
    AddType(T->getReplacedParameter());
1005
2.62k
    AddQualType(T->getReplacementType());
1006
2.62k
    VisitType(T);
1007
2.62k
  }
1008
1009
342k
  void VisitTagType(const TagType *T) {
1010
342k
    AddDecl(T->getDecl());
1011
342k
    VisitType(T);
1012
342k
  }
1013
1014
250k
  void VisitRecordType(const RecordType *T) { VisitTagType(T); }
1015
92.4k
  void VisitEnumType(const EnumType *T) { VisitTagType(T); }
1016
1017
288k
  void VisitTemplateSpecializationType(const TemplateSpecializationType *T) {
1018
288k
    ID.AddInteger(T->getNumArgs());
1019
477k
    for (const auto &TA : T->template_arguments()) {
1020
477k
      Hash.AddTemplateArgument(TA);
1021
477k
    }
1022
288k
    Hash.AddTemplateName(T->getTemplateName());
1023
288k
    VisitType(T);
1024
288k
  }
1025
1026
419k
  void VisitTemplateTypeParmType(const TemplateTypeParmType *T) {
1027
419k
    ID.AddInteger(T->getDepth());
1028
419k
    ID.AddInteger(T->getIndex());
1029
419k
    Hash.AddBoolean(T->isParameterPack());
1030
419k
    AddDecl(T->getDecl());
1031
419k
  }
1032
1033
1.30M
  void VisitTypedefType(const TypedefType *T) {
1034
1.30M
    AddDecl(T->getDecl());
1035
1.30M
    QualType UnderlyingType = T->getDecl()->getUnderlyingType();
1036
1.30M
    VisitQualifiers(UnderlyingType.getQualifiers());
1037
1.59M
    while (true) {
1038
1.59M
      if (const TypedefType *Underlying =
1039
1.59M
              dyn_cast<TypedefType>(UnderlyingType.getTypePtr())) {
1040
211k
        UnderlyingType = Underlying->getDecl()->getUnderlyingType();
1041
211k
        continue;
1042
211k
      }
1043
1.38M
      if (const ElaboratedType *Underlying =
1044
1.38M
              dyn_cast<ElaboratedType>(UnderlyingType.getTypePtr())) {
1045
73.1k
        UnderlyingType = Underlying->getNamedType();
1046
73.1k
        continue;
1047
73.1k
      }
1048
1049
1.30M
      break;
1050
1.38M
    }
1051
1.30M
    AddType(UnderlyingType.getTypePtr());
1052
1.30M
    VisitType(T);
1053
1.30M
  }
1054
1055
39
  void VisitTypeOfExprType(const TypeOfExprType *T) {
1056
39
    AddStmt(T->getUnderlyingExpr());
1057
39
    Hash.AddBoolean(T->isSugared());
1058
39
    if (T->isSugared())
1059
38
      AddQualType(T->desugar());
1060
1061
39
    VisitType(T);
1062
39
  }
1063
20
  void VisitTypeOfType(const TypeOfType *T) {
1064
20
    AddQualType(T->getUnderlyingType());
1065
20
    VisitType(T);
1066
20
  }
1067
1068
224k
  void VisitTypeWithKeyword(const TypeWithKeyword *T) {
1069
224k
    ID.AddInteger(T->getKeyword());
1070
224k
    VisitType(T);
1071
224k
  };
1072
1073
118k
  void VisitDependentNameType(const DependentNameType *T) {
1074
118k
    AddNestedNameSpecifier(T->getQualifier());
1075
118k
    AddIdentifierInfo(T->getIdentifier());
1076
118k
    VisitTypeWithKeyword(T);
1077
118k
  }
1078
1079
  void VisitDependentTemplateSpecializationType(
1080
122
      const DependentTemplateSpecializationType *T) {
1081
122
    AddIdentifierInfo(T->getIdentifier());
1082
122
    AddNestedNameSpecifier(T->getQualifier());
1083
122
    ID.AddInteger(T->getNumArgs());
1084
122
    for (const auto &TA : T->template_arguments()) {
1085
122
      Hash.AddTemplateArgument(TA);
1086
122
    }
1087
122
    VisitTypeWithKeyword(T);
1088
122
  }
1089
1090
106k
  void VisitElaboratedType(const ElaboratedType *T) {
1091
106k
    AddNestedNameSpecifier(T->getQualifier());
1092
106k
    AddQualType(T->getNamedType());
1093
106k
    VisitTypeWithKeyword(T);
1094
106k
  }
1095
1096
428
  void VisitUnaryTransformType(const UnaryTransformType *T) {
1097
428
    AddQualType(T->getUnderlyingType());
1098
428
    AddQualType(T->getBaseType());
1099
428
    VisitType(T);
1100
428
  }
1101
1102
140
  void VisitUnresolvedUsingType(const UnresolvedUsingType *T) {
1103
140
    AddDecl(T->getDecl());
1104
140
    VisitType(T);
1105
140
  }
1106
1107
409k
  void VisitVectorType(const VectorType *T) {
1108
409k
    AddQualType(T->getElementType());
1109
409k
    ID.AddInteger(T->getNumElements());
1110
409k
    ID.AddInteger(T->getVectorKind());
1111
409k
    VisitType(T);
1112
409k
  }
1113
1114
106k
  void VisitExtVectorType(const ExtVectorType * T) {
1115
106k
    VisitVectorType(T);
1116
106k
  }
1117
};
1118
} // namespace
1119
1120
4.90M
void ODRHash::AddType(const Type *T) {
1121
4.90M
  assert(T && "Expecting non-null pointer.");
1122
0
  ODRTypeVisitor(ID, *this).Visit(T);
1123
4.90M
}
1124
1125
3.42M
void ODRHash::AddQualType(QualType T) {
1126
3.42M
  AddBoolean(T.isNull());
1127
3.42M
  if (T.isNull())
1128
1.78k
    return;
1129
3.42M
  SplitQualType split = T.split();
1130
3.42M
  ID.AddInteger(split.Quals.getAsOpaqueValue());
1131
3.42M
  AddType(split.Ty);
1132
3.42M
}
1133
1134
24.5M
void ODRHash::AddBoolean(bool Value) {
1135
24.5M
  Bools.push_back(Value);
1136
24.5M
}