Coverage Report

Created: 2022-07-16 07:03

/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
411k
void ODRHash::AddStmt(const Stmt *S) {
25
411k
  assert(S && "Expecting non-null pointer.");
26
0
  S->ProcessODRHash(ID, *this);
27
411k
}
28
29
2.80M
void ODRHash::AddIdentifierInfo(const IdentifierInfo *II) {
30
2.80M
  assert(II && "Expecting non-null pointer.");
31
0
  ID.AddString(II->getName());
32
2.80M
}
33
34
5.30M
void ODRHash::AddDeclarationName(DeclarationName Name, bool TreatAsDecl) {
35
5.30M
  if (TreatAsDecl)
36
    // Matches the NamedDecl check in AddDecl
37
39.7k
    AddBoolean(true);
38
39
5.30M
  AddDeclarationNameImpl(Name);
40
41
5.30M
  if (TreatAsDecl)
42
    // Matches the ClassTemplateSpecializationDecl check in AddDecl
43
39.7k
    AddBoolean(false);
44
5.30M
}
45
46
5.30M
void ODRHash::AddDeclarationNameImpl(DeclarationName Name) {
47
  // Index all DeclarationName and use index numbers to refer to them.
48
5.30M
  auto Result = DeclNameMap.insert(std::make_pair(Name, DeclNameMap.size()));
49
5.30M
  ID.AddInteger(Result.first->second);
50
5.30M
  if (!Result.second) {
51
    // If found in map, the DeclarationName has previously been processed.
52
2.32M
    return;
53
2.32M
  }
54
55
  // First time processing each DeclarationName, also process its details.
56
2.98M
  AddBoolean(Name.isEmpty());
57
2.98M
  if (Name.isEmpty())
58
212k
    return;
59
60
2.77M
  auto Kind = Name.getNameKind();
61
2.77M
  ID.AddInteger(Kind);
62
2.77M
  switch (Kind) {
63
2.68M
  case DeclarationName::Identifier:
64
2.68M
    AddIdentifierInfo(Name.getAsIdentifierInfo());
65
2.68M
    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
37.8k
  case DeclarationName::CXXConstructorName:
85
47.9k
  case DeclarationName::CXXDestructorName:
86
47.9k
    AddQualType(Name.getCXXNameType());
87
47.9k
    break;
88
38.5k
  case DeclarationName::CXXOperatorName:
89
38.5k
    ID.AddInteger(Name.getCXXOverloadedOperator());
90
38.5k
    break;
91
138
  case DeclarationName::CXXLiteralOperatorName:
92
138
    AddIdentifierInfo(Name.getCXXLiteralIdentifier());
93
138
    break;
94
1.22k
  case DeclarationName::CXXConversionFunctionName:
95
1.22k
    AddQualType(Name.getCXXNameType());
96
1.22k
    break;
97
77
  case DeclarationName::CXXUsingDirective:
98
77
    break;
99
2.00k
  case DeclarationName::CXXDeductionGuideName: {
100
2.00k
    auto *Template = Name.getCXXDeductionGuideTemplate();
101
2.00k
    AddBoolean(Template);
102
2.00k
    if (Template) {
103
2.00k
      AddDecl(Template);
104
2.00k
    }
105
2.00k
  }
106
2.77M
  }
107
2.77M
}
108
109
216k
void ODRHash::AddNestedNameSpecifier(const NestedNameSpecifier *NNS) {
110
216k
  assert(NNS && "Expecting non-null pointer.");
111
0
  const auto *Prefix = NNS->getPrefix();
112
216k
  AddBoolean(Prefix);
113
216k
  if (Prefix) {
114
5.44k
    AddNestedNameSpecifier(Prefix);
115
5.44k
  }
116
216k
  auto Kind = NNS->getKind();
117
216k
  ID.AddInteger(Kind);
118
216k
  switch (Kind) {
119
553
  case NestedNameSpecifier::Identifier:
120
553
    AddIdentifierInfo(NNS->getAsIdentifier());
121
553
    break;
122
41.1k
  case NestedNameSpecifier::Namespace:
123
41.1k
    AddDecl(NNS->getAsNamespace());
124
41.1k
    break;
125
12
  case NestedNameSpecifier::NamespaceAlias:
126
12
    AddDecl(NNS->getAsNamespaceAlias());
127
12
    break;
128
173k
  case NestedNameSpecifier::TypeSpec:
129
173k
  case NestedNameSpecifier::TypeSpecWithTemplate:
130
173k
    AddType(NNS->getAsType());
131
173k
    break;
132
1.72k
  case NestedNameSpecifier::Global:
133
1.72k
  case NestedNameSpecifier::Super:
134
1.72k
    break;
135
216k
  }
136
216k
}
137
138
300k
void ODRHash::AddTemplateName(TemplateName Name) {
139
300k
  auto Kind = Name.getKind();
140
300k
  ID.AddInteger(Kind);
141
142
300k
  switch (Kind) {
143
300k
  case TemplateName::Template:
144
300k
    AddDecl(Name.getAsTemplateDecl());
145
300k
    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
300k
  }
156
300k
}
157
158
518k
void ODRHash::AddTemplateArgument(TemplateArgument TA) {
159
518k
  const auto Kind = TA.getKind();
160
518k
  ID.AddInteger(Kind);
161
162
518k
  switch (Kind) {
163
0
    case TemplateArgument::Null:
164
0
      llvm_unreachable("Expected valid TemplateArgument");
165
475k
    case TemplateArgument::Type:
166
475k
      AddQualType(TA.getAsType());
167
475k
      break;
168
74
    case TemplateArgument::Declaration:
169
74
      AddDecl(TA.getAsDecl());
170
74
      break;
171
0
    case TemplateArgument::NullPtr:
172
4.35k
    case TemplateArgument::Integral:
173
4.35k
      break;
174
469
    case TemplateArgument::Template:
175
469
    case TemplateArgument::TemplateExpansion:
176
469
      AddTemplateName(TA.getAsTemplateOrTemplatePattern());
177
469
      break;
178
38.4k
    case TemplateArgument::Expression:
179
38.4k
      AddStmt(TA.getAsExpr());
180
38.4k
      break;
181
94
    case TemplateArgument::Pack:
182
94
      ID.AddInteger(TA.pack_size());
183
94
      for (auto SubTA : TA.pack_elements()) {
184
68
        AddTemplateArgument(SubTA);
185
68
      }
186
94
      break;
187
518k
  }
188
518k
}
189
190
20.7k
void ODRHash::AddTemplateParameterList(const TemplateParameterList *TPL) {
191
20.7k
  assert(TPL && "Expecting non-null pointer.");
192
193
0
  ID.AddInteger(TPL->size());
194
32.2k
  for (auto *ND : TPL->asArray()) {
195
32.2k
    AddSubDecl(ND);
196
32.2k
  }
197
20.7k
}
198
199
963
void ODRHash::clear() {
200
963
  DeclNameMap.clear();
201
963
  Bools.clear();
202
963
  ID.clear();
203
963
}
204
205
590k
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
590k
  const unsigned unsigned_bits = sizeof(unsigned) * CHAR_BIT;
210
590k
  const unsigned size = Bools.size();
211
590k
  const unsigned remainder = size % unsigned_bits;
212
590k
  const unsigned loops = size / unsigned_bits;
213
590k
  auto I = Bools.rbegin();
214
590k
  unsigned value = 0;
215
7.90M
  for (unsigned i = 0; i < remainder; 
++i7.31M
) {
216
7.31M
    value <<= 1;
217
7.31M
    value |= *I;
218
7.31M
    ++I;
219
7.31M
  }
220
590k
  ID.AddInteger(value);
221
222
1.14M
  for (unsigned i = 0; i < loops; 
++i559k
) {
223
559k
    value = 0;
224
18.4M
    for (unsigned j = 0; j < unsigned_bits; 
++j17.9M
) {
225
17.9M
      value <<= 1;
226
17.9M
      value |= *I;
227
17.9M
      ++I;
228
17.9M
    }
229
559k
    ID.AddInteger(value);
230
559k
  }
231
232
590k
  assert(I == Bools.rend());
233
0
  Bools.clear();
234
590k
  return ID.ComputeHash();
235
590k
}
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.21M
      : ID(ID), Hash(Hash) {}
248
249
356k
  void AddStmt(const Stmt *S) {
250
356k
    Hash.AddBoolean(S);
251
356k
    if (S) {
252
217k
      Hash.AddStmt(S);
253
217k
    }
254
356k
  }
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.10M
  void AddQualType(QualType T) {
264
1.10M
    Hash.AddQualType(T);
265
1.10M
  }
266
267
15.3k
  void AddDecl(const Decl *D) {
268
15.3k
    Hash.AddBoolean(D);
269
15.3k
    if (D) {
270
15.3k
      Hash.AddDecl(D);
271
15.3k
    }
272
15.3k
  }
273
274
3.45k
  void AddTemplateArgument(TemplateArgument TA) {
275
3.45k
    Hash.AddTemplateArgument(TA);
276
3.45k
  }
277
278
1.21M
  void Visit(const Decl *D) {
279
1.21M
    ID.AddInteger(D->getKind());
280
1.21M
    Inherited::Visit(D);
281
1.21M
  }
282
283
1.19M
  void VisitNamedDecl(const NamedDecl *D) {
284
1.19M
    Hash.AddDeclarationName(D->getDeclName());
285
1.19M
    Inherited::VisitNamedDecl(D);
286
1.19M
  }
287
288
1.13M
  void VisitValueDecl(const ValueDecl *D) {
289
1.13M
    if (!isa<FunctionDecl>(D)) {
290
1.08M
      AddQualType(D->getType());
291
1.08M
    }
292
1.13M
    Inherited::VisitValueDecl(D);
293
1.13M
  }
294
295
788k
  void VisitVarDecl(const VarDecl *D) {
296
788k
    Hash.AddBoolean(D->isStaticLocal());
297
788k
    Hash.AddBoolean(D->isConstexpr());
298
788k
    const bool HasInit = D->hasInit();
299
788k
    Hash.AddBoolean(HasInit);
300
788k
    if (HasInit) {
301
58.3k
      AddStmt(D->getInit());
302
58.3k
    }
303
788k
    Inherited::VisitVarDecl(D);
304
788k
  }
305
306
723k
  void VisitParmVarDecl(const ParmVarDecl *D) {
307
    // TODO: Handle default arguments.
308
723k
    Inherited::VisitParmVarDecl(D);
309
723k
  }
310
311
9.68k
  void VisitAccessSpecDecl(const AccessSpecDecl *D) {
312
9.68k
    ID.AddInteger(D->getAccess());
313
9.68k
    Inherited::VisitAccessSpecDecl(D);
314
9.68k
  }
315
316
2.95k
  void VisitStaticAssertDecl(const StaticAssertDecl *D) {
317
2.95k
    AddStmt(D->getAssertExpr());
318
2.95k
    AddStmt(D->getMessage());
319
320
2.95k
    Inherited::VisitStaticAssertDecl(D);
321
2.95k
  }
322
323
132k
  void VisitFieldDecl(const FieldDecl *D) {
324
132k
    const bool IsBitfield = D->isBitField();
325
132k
    Hash.AddBoolean(IsBitfield);
326
327
132k
    if (IsBitfield) {
328
1.94k
      AddStmt(D->getBitWidth());
329
1.94k
    }
330
331
132k
    Hash.AddBoolean(D->isMutable());
332
132k
    AddStmt(D->getInClassInitializer());
333
334
132k
    Inherited::VisitFieldDecl(D);
335
132k
  }
336
337
55.3k
  void VisitFunctionDecl(const FunctionDecl *D) {
338
    // Handled by the ODRHash for FunctionDecl
339
55.3k
    ID.AddInteger(D->getODRHash());
340
341
55.3k
    Inherited::VisitFunctionDecl(D);
342
55.3k
  }
343
344
55.3k
  void VisitCXXMethodDecl(const CXXMethodDecl *D) {
345
    // Handled by the ODRHash for FunctionDecl
346
347
55.3k
    Inherited::VisitCXXMethodDecl(D);
348
55.3k
  }
349
350
23.7k
  void VisitTypedefNameDecl(const TypedefNameDecl *D) {
351
23.7k
    AddQualType(D->getUnderlyingType());
352
353
23.7k
    Inherited::VisitTypedefNameDecl(D);
354
23.7k
  }
355
356
21.8k
  void VisitTypedefDecl(const TypedefDecl *D) {
357
21.8k
    Inherited::VisitTypedefDecl(D);
358
21.8k
  }
359
360
1.97k
  void VisitTypeAliasDecl(const TypeAliasDecl *D) {
361
1.97k
    Inherited::VisitTypeAliasDecl(D);
362
1.97k
  }
363
364
5.36k
  void VisitFriendDecl(const FriendDecl *D) {
365
5.36k
    TypeSourceInfo *TSI = D->getFriendType();
366
5.36k
    Hash.AddBoolean(TSI);
367
5.36k
    if (TSI) {
368
452
      AddQualType(TSI->getType());
369
4.91k
    } else {
370
4.91k
      AddDecl(D->getFriendDecl());
371
4.91k
    }
372
5.36k
  }
373
374
27.6k
  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {
375
    // Only care about default arguments as part of the definition.
376
27.6k
    const bool hasDefaultArgument =
377
27.6k
        D->hasDefaultArgument() && 
!D->defaultArgumentWasInherited()3.61k
;
378
27.6k
    Hash.AddBoolean(hasDefaultArgument);
379
27.6k
    if (hasDefaultArgument) {
380
3.19k
      AddTemplateArgument(D->getDefaultArgument());
381
3.19k
    }
382
27.6k
    Hash.AddBoolean(D->isParameterPack());
383
384
27.6k
    const TypeConstraint *TC = D->getTypeConstraint();
385
27.6k
    Hash.AddBoolean(TC != nullptr);
386
27.6k
    if (TC)
387
557
      AddStmt(TC->getImmediatelyDeclaredConstraint());
388
389
27.6k
    Inherited::VisitTemplateTypeParmDecl(D);
390
27.6k
  }
391
392
4.21k
  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D) {
393
    // Only care about default arguments as part of the definition.
394
4.21k
    const bool hasDefaultArgument =
395
4.21k
        D->hasDefaultArgument() && 
!D->defaultArgumentWasInherited()1.88k
;
396
4.21k
    Hash.AddBoolean(hasDefaultArgument);
397
4.21k
    if (hasDefaultArgument) {
398
1.85k
      AddStmt(D->getDefaultArgument());
399
1.85k
    }
400
4.21k
    Hash.AddBoolean(D->isParameterPack());
401
402
4.21k
    Inherited::VisitNonTypeTemplateParmDecl(D);
403
4.21k
  }
404
405
435
  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D) {
406
    // Only care about default arguments as part of the definition.
407
435
    const bool hasDefaultArgument =
408
435
        D->hasDefaultArgument() && 
!D->defaultArgumentWasInherited()262
;
409
435
    Hash.AddBoolean(hasDefaultArgument);
410
435
    if (hasDefaultArgument) {
411
262
      AddTemplateArgument(D->getDefaultArgument().getArgument());
412
262
    }
413
435
    Hash.AddBoolean(D->isParameterPack());
414
415
435
    Inherited::VisitTemplateTemplateParmDecl(D);
416
435
  }
417
418
10.8k
  void VisitTemplateDecl(const TemplateDecl *D) {
419
10.8k
    Hash.AddTemplateParameterList(D->getTemplateParameters());
420
421
10.8k
    Inherited::VisitTemplateDecl(D);
422
10.8k
  }
423
424
10.3k
  void VisitRedeclarableTemplateDecl(const RedeclarableTemplateDecl *D) {
425
10.3k
    Hash.AddBoolean(D->isMemberSpecialization());
426
10.3k
    Inherited::VisitRedeclarableTemplateDecl(D);
427
10.3k
  }
428
429
10.3k
  void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {
430
10.3k
    AddDecl(D->getTemplatedDecl());
431
10.3k
    ID.AddInteger(D->getTemplatedDecl()->getODRHash());
432
10.3k
    Inherited::VisitFunctionTemplateDecl(D);
433
10.3k
  }
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
840k
bool ODRHash::isDeclToBeProcessed(const Decl *D, const DeclContext *Parent) {
445
840k
  if (D->isImplicit()) 
return false106k
;
446
734k
  if (D->getDeclContext() != Parent) 
return false1.65k
;
447
448
732k
  switch (D->getKind()) {
449
271k
    default:
450
271k
      return false;
451
9.68k
    case Decl::AccessSpec:
452
23.7k
    case Decl::CXXConstructor:
453
26.8k
    case Decl::CXXDestructor:
454
65.0k
    case Decl::CXXMethod:
455
220k
    case Decl::EnumConstant: // Only found in EnumDecl's.
456
353k
    case Decl::Field:
457
358k
    case Decl::Friend:
458
368k
    case Decl::FunctionTemplate:
459
371k
    case Decl::StaticAssert:
460
373k
    case Decl::TypeAlias:
461
395k
    case Decl::Typedef:
462
460k
    case Decl::Var:
463
460k
      return true;
464
732k
  }
465
732k
}
466
467
1.21M
void ODRHash::AddSubDecl(const Decl *D) {
468
1.21M
  assert(D && "Expecting non-null pointer.");
469
470
0
  ODRDeclVisitor(ID, *this).Visit(D);
471
1.21M
}
472
473
122k
void ODRHash::AddCXXRecordDecl(const CXXRecordDecl *Record) {
474
122k
  assert(Record && Record->hasDefinition() &&
475
122k
         "Expected non-null record to be a definition.");
476
477
0
  const DeclContext *DC = Record;
478
399k
  while (DC) {
479
328k
    if (isa<ClassTemplateSpecializationDecl>(DC)) {
480
50.7k
      return;
481
50.7k
    }
482
277k
    DC = DC->getParent();
483
277k
  }
484
485
71.2k
  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
71.2k
  llvm::SmallVector<const Decl *, 16> Decls;
490
316k
  for (Decl *SubDecl : Record->decls()) {
491
316k
    if (isDeclToBeProcessed(SubDecl, Record)) {
492
233k
      Decls.push_back(SubDecl);
493
233k
      if (auto *Function = dyn_cast<FunctionDecl>(SubDecl)) {
494
        // Compute/Preload ODRHash into FunctionDecl.
495
55.2k
        Function->getODRHash();
496
55.2k
      }
497
233k
    }
498
316k
  }
499
500
71.2k
  ID.AddInteger(Decls.size());
501
233k
  for (auto SubDecl : Decls) {
502
233k
    AddSubDecl(SubDecl);
503
233k
  }
504
505
71.2k
  const ClassTemplateDecl *TD = Record->getDescribedClassTemplate();
506
71.2k
  AddBoolean(TD);
507
71.2k
  if (TD) {
508
9.92k
    AddTemplateParameterList(TD->getTemplateParameters());
509
9.92k
  }
510
511
71.2k
  ID.AddInteger(Record->getNumBases());
512
71.2k
  auto Bases = Record->bases();
513
71.2k
  for (auto Base : Bases) {
514
5.02k
    AddQualType(Base.getType());
515
5.02k
    ID.AddInteger(Base.isVirtual());
516
5.02k
    ID.AddInteger(Base.getAccessSpecifierAsWritten());
517
5.02k
  }
518
71.2k
}
519
520
void ODRHash::AddFunctionDecl(const FunctionDecl *Function,
521
445k
                              bool SkipBody) {
522
445k
  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.76M
  while (DC) {
527
1.37M
    if (isa<ClassTemplateSpecializationDecl>(DC)) 
return45.3k
;
528
1.33M
    if (auto *F = dyn_cast<FunctionDecl>(DC)) {
529
448k
      if (F->isFunctionTemplateSpecialization()) {
530
13.9k
        if (!isa<CXXMethodDecl>(DC)) 
return8.32k
;
531
5.62k
        if (DC->getLexicalParent()->isFileContext()) 
return33
;
532
        // Inline method specializations are the only supported
533
        // specialization for now.
534
5.62k
      }
535
448k
    }
536
1.32M
    DC = DC->getParent();
537
1.32M
  }
538
539
391k
  ID.AddInteger(Function->getDeclKind());
540
541
391k
  const auto *SpecializationArgs = Function->getTemplateSpecializationArgs();
542
391k
  AddBoolean(SpecializationArgs);
543
391k
  if (SpecializationArgs) {
544
2.99k
    ID.AddInteger(SpecializationArgs->size());
545
3.10k
    for (const TemplateArgument &TA : SpecializationArgs->asArray()) {
546
3.10k
      AddTemplateArgument(TA);
547
3.10k
    }
548
2.99k
  }
549
550
391k
  if (const auto *Method = dyn_cast<CXXMethodDecl>(Function)) {
551
93.5k
    AddBoolean(Method->isConst());
552
93.5k
    AddBoolean(Method->isVolatile());
553
93.5k
  }
554
555
391k
  ID.AddInteger(Function->getStorageClass());
556
391k
  AddBoolean(Function->isInlineSpecified());
557
391k
  AddBoolean(Function->isVirtualAsWritten());
558
391k
  AddBoolean(Function->isPure());
559
391k
  AddBoolean(Function->isDeletedAsWritten());
560
391k
  AddBoolean(Function->isExplicitlyDefaulted());
561
562
391k
  AddDecl(Function);
563
564
391k
  AddQualType(Function->getReturnType());
565
566
391k
  ID.AddInteger(Function->param_size());
567
391k
  for (auto Param : Function->parameters())
568
723k
    AddSubDecl(Param);
569
570
391k
  if (SkipBody) {
571
14
    AddBoolean(false);
572
14
    return;
573
14
  }
574
575
391k
  const bool HasBody = Function->isThisDeclarationADefinition() &&
576
391k
                       
!Function->isDefaulted()163k
&&
!Function->isDeleted()153k
&&
577
391k
                       
!Function->isLateTemplateParsed()151k
;
578
391k
  AddBoolean(HasBody);
579
391k
  if (!HasBody) {
580
239k
    return;
581
239k
  }
582
583
151k
  auto *Body = Function->getBody();
584
151k
  AddBoolean(Body);
585
151k
  if (Body)
586
151k
    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
151k
  llvm::SmallVector<const Decl *, 16> Decls;
591
367k
  for (Decl *SubDecl : Function->decls()) {
592
367k
    if (isDeclToBeProcessed(SubDecl, Function)) {
593
71.0k
      Decls.push_back(SubDecl);
594
71.0k
    }
595
367k
  }
596
597
151k
  ID.AddInteger(Decls.size());
598
151k
  for (auto SubDecl : Decls) {
599
71.0k
    AddSubDecl(SubDecl);
600
71.0k
  }
601
151k
}
602
603
21.6k
void ODRHash::AddEnumDecl(const EnumDecl *Enum) {
604
21.6k
  assert(Enum);
605
0
  AddDeclarationName(Enum->getDeclName());
606
607
21.6k
  AddBoolean(Enum->isScoped());
608
21.6k
  if (Enum->isScoped())
609
225
    AddBoolean(Enum->isScopedUsingClassTag());
610
611
21.6k
  if (Enum->getIntegerTypeSourceInfo())
612
5.90k
    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.6k
  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.6k
  ID.AddInteger(Decls.size());
625
155k
  for (auto SubDecl : Decls) {
626
155k
    AddSubDecl(SubDecl);
627
155k
  }
628
629
21.6k
}
630
631
3.89M
void ODRHash::AddDecl(const Decl *D) {
632
3.89M
  assert(D && "Expecting non-null pointer.");
633
0
  D = D->getCanonicalDecl();
634
635
3.89M
  const NamedDecl *ND = dyn_cast<NamedDecl>(D);
636
3.89M
  AddBoolean(ND);
637
3.89M
  if (!ND) {
638
1.87k
    ID.AddInteger(D->getKind());
639
1.87k
    return;
640
1.87k
  }
641
642
3.89M
  AddDeclarationName(ND->getDeclName());
643
644
3.89M
  const auto *Specialization =
645
3.89M
            dyn_cast<ClassTemplateSpecializationDecl>(D);
646
3.89M
  AddBoolean(Specialization);
647
3.89M
  if (Specialization) {
648
8.40k
    const TemplateArgumentList &List = Specialization->getTemplateArgs();
649
8.40k
    ID.AddInteger(List.size());
650
8.40k
    for (const TemplateArgument &TA : List.asArray())
651
15.2k
      AddTemplateArgument(TA);
652
8.40k
  }
653
3.89M
}
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
5.00M
      : ID(ID), Hash(Hash) {}
666
667
3.97k
  void AddStmt(Stmt *S) {
668
3.97k
    Hash.AddBoolean(S);
669
3.97k
    if (S) {
670
3.96k
      Hash.AddStmt(S);
671
3.96k
    }
672
3.97k
  }
673
674
2.16M
  void AddDecl(Decl *D) {
675
2.16M
    Hash.AddBoolean(D);
676
2.16M
    if (D) {
677
2.15M
      Hash.AddDecl(D);
678
2.15M
    }
679
2.16M
  }
680
681
1.23M
  void AddQualType(QualType T) {
682
1.23M
    Hash.AddQualType(T);
683
1.23M
  }
684
685
1.33M
  void AddType(const Type *T) {
686
1.33M
    Hash.AddBoolean(T);
687
1.33M
    if (T) {
688
1.33M
      Hash.AddType(T);
689
1.33M
    }
690
1.33M
  }
691
692
227k
  void AddNestedNameSpecifier(const NestedNameSpecifier *NNS) {
693
227k
    Hash.AddBoolean(NNS);
694
227k
    if (NNS) {
695
129k
      Hash.AddNestedNameSpecifier(NNS);
696
129k
    }
697
227k
  }
698
699
119k
  void AddIdentifierInfo(const IdentifierInfo *II) {
700
119k
    Hash.AddBoolean(II);
701
119k
    if (II) {
702
119k
      Hash.AddIdentifierInfo(II);
703
119k
    }
704
119k
  }
705
706
1.34M
  void VisitQualifiers(Qualifiers Quals) {
707
1.34M
    ID.AddInteger(Quals.getAsOpaqueValue());
708
1.34M
  }
709
710
  // Return the RecordType if the typedef only strips away a keyword.
711
  // Otherwise, return the original type.
712
5.00M
  static const Type *RemoveTypedef(const Type *T) {
713
5.00M
    const auto *TypedefT = dyn_cast<TypedefType>(T);
714
5.00M
    if (!TypedefT) {
715
3.65M
      return T;
716
3.65M
    }
717
718
1.34M
    const TypedefNameDecl *D = TypedefT->getDecl();
719
1.34M
    QualType UnderlyingType = D->getUnderlyingType();
720
721
1.34M
    if (UnderlyingType.hasLocalQualifiers()) {
722
125
      return T;
723
125
    }
724
725
1.34M
    const auto *ElaboratedT = dyn_cast<ElaboratedType>(UnderlyingType);
726
1.34M
    if (!ElaboratedT) {
727
1.25M
      return T;
728
1.25M
    }
729
730
85.5k
    if (ElaboratedT->getQualifier() != nullptr) {
731
9.72k
      return T;
732
9.72k
    }
733
734
75.8k
    QualType NamedType = ElaboratedT->getNamedType();
735
75.8k
    if (NamedType.hasLocalQualifiers()) {
736
0
      return T;
737
0
    }
738
739
75.8k
    const auto *RecordT = dyn_cast<RecordType>(NamedType);
740
75.8k
    if (!RecordT) {
741
6.77k
      return T;
742
6.77k
    }
743
744
69.0k
    const IdentifierInfo *TypedefII = TypedefT->getDecl()->getIdentifier();
745
69.0k
    const IdentifierInfo *RecordII = RecordT->getDecl()->getIdentifier();
746
69.0k
    if (!TypedefII || !RecordII ||
747
69.0k
        
TypedefII->getName() != RecordII->getName()34.0k
) {
748
52.5k
      return T;
749
52.5k
    }
750
751
16.5k
    return RecordT;
752
69.0k
  }
753
754
5.00M
  void Visit(const Type *T) {
755
5.00M
    T = RemoveTypedef(T);
756
5.00M
    ID.AddInteger(T->getTypeClass());
757
5.00M
    Inherited::Visit(T);
758
5.00M
  }
759
760
4.56M
  void VisitType(const Type *T) {}
761
762
4.33k
  void VisitAdjustedType(const AdjustedType *T) {
763
4.33k
    QualType Original = T->getOriginalType();
764
4.33k
    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.33k
    SplitQualType split = Adjusted.split();
770
4.33k
    if (auto Pointer = dyn_cast<PointerType>(split.Ty)) {
771
4.07k
      if (Pointer->getPointeeType() == Original) {
772
227
        Hash.AddBoolean(true);
773
227
        ID.AddInteger(split.Quals.getAsOpaqueValue());
774
227
        AddQualType(Original);
775
227
        VisitType(T);
776
227
        return;
777
227
      }
778
4.07k
    }
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.10k
    Hash.AddBoolean(false);
784
4.10k
    AddQualType(Original);
785
4.10k
    AddQualType(Adjusted);
786
787
4.10k
    VisitType(T);
788
4.10k
  }
789
790
4.33k
  void VisitDecayedType(const DecayedType *T) {
791
    // getDecayedType and getPointeeType are derived from getAdjustedType
792
    // and don't need to be separately processed.
793
4.33k
    VisitAdjustedType(T);
794
4.33k
  }
795
796
18.9k
  void VisitArrayType(const ArrayType *T) {
797
18.9k
    AddQualType(T->getElementType());
798
18.9k
    ID.AddInteger(T->getSizeModifier());
799
18.9k
    VisitQualifiers(T->getIndexTypeQualifiers());
800
18.9k
    VisitType(T);
801
18.9k
  }
802
14.6k
  void VisitConstantArrayType(const ConstantArrayType *T) {
803
14.6k
    T->getSize().Profile(ID);
804
14.6k
    VisitArrayType(T);
805
14.6k
  }
806
807
910
  void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
808
910
    AddStmt(T->getSizeExpr());
809
910
    VisitArrayType(T);
810
910
  }
811
812
2.02k
  void VisitIncompleteArrayType(const IncompleteArrayType *T) {
813
2.02k
    VisitArrayType(T);
814
2.02k
  }
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.4k
  void VisitAttributedType(const AttributedType *T) {
822
49.4k
    ID.AddInteger(T->getAttrKind());
823
49.4k
    AddQualType(T->getModifiedType());
824
49.4k
    AddQualType(T->getEquivalentType());
825
826
49.4k
    VisitType(T);
827
49.4k
  }
828
829
1.75k
  void VisitBlockPointerType(const BlockPointerType *T) {
830
1.75k
    AddQualType(T->getPointeeType());
831
1.75k
    VisitType(T);
832
1.75k
  }
833
834
1.28M
  void VisitBuiltinType(const BuiltinType *T) {
835
1.28M
    ID.AddInteger(T->getKind());
836
1.28M
    VisitType(T);
837
1.28M
  }
838
839
5.95k
  void VisitComplexType(const ComplexType *T) {
840
5.95k
    AddQualType(T->getElementType());
841
5.95k
    VisitType(T);
842
5.95k
  }
843
844
1.64k
  void VisitDecltypeType(const DecltypeType *T) {
845
1.64k
    AddStmt(T->getUnderlyingExpr());
846
1.64k
    AddQualType(T->getUnderlyingType());
847
1.64k
    VisitType(T);
848
1.64k
  }
849
850
0
  void VisitDependentDecltypeType(const DependentDecltypeType *T) {
851
0
    VisitDecltypeType(T);
852
0
  }
853
854
2.24k
  void VisitDeducedType(const DeducedType *T) {
855
2.24k
    AddQualType(T->getDeducedType());
856
2.24k
    VisitType(T);
857
2.24k
  }
858
859
2.15k
  void VisitAutoType(const AutoType *T) {
860
2.15k
    ID.AddInteger((unsigned)T->getKeyword());
861
2.15k
    ID.AddInteger(T->isConstrained());
862
2.15k
    if (T->isConstrained()) {
863
6
      AddDecl(T->getTypeConstraintConcept());
864
6
      ID.AddInteger(T->getNumArgs());
865
6
      for (const auto &TA : T->getTypeConstraintArguments())
866
0
        Hash.AddTemplateArgument(TA);
867
6
    }
868
2.15k
    VisitDeducedType(T);
869
2.15k
  }
870
871
  void VisitDeducedTemplateSpecializationType(
872
88
      const DeducedTemplateSpecializationType *T) {
873
88
    Hash.AddTemplateName(T->getTemplateName());
874
88
    VisitDeducedType(T);
875
88
  }
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
24.0k
  void VisitFunctionType(const FunctionType *T) {
890
24.0k
    AddQualType(T->getReturnType());
891
24.0k
    T->getExtInfo().Profile(ID);
892
24.0k
    Hash.AddBoolean(T->isConst());
893
24.0k
    Hash.AddBoolean(T->isVolatile());
894
24.0k
    Hash.AddBoolean(T->isRestrict());
895
24.0k
    VisitType(T);
896
24.0k
  }
897
898
3
  void VisitFunctionNoProtoType(const FunctionNoProtoType *T) {
899
3
    VisitFunctionType(T);
900
3
  }
901
902
24.0k
  void VisitFunctionProtoType(const FunctionProtoType *T) {
903
24.0k
    ID.AddInteger(T->getNumParams());
904
24.0k
    for (auto ParamType : T->getParamTypes())
905
62.4k
      AddQualType(ParamType);
906
907
24.0k
    VisitFunctionType(T);
908
24.0k
  }
909
910
41.3k
  void VisitInjectedClassNameType(const InjectedClassNameType *T) {
911
41.3k
    AddDecl(T->getDecl());
912
41.3k
    VisitType(T);
913
41.3k
  }
914
915
508
  void VisitMemberPointerType(const MemberPointerType *T) {
916
508
    AddQualType(T->getPointeeType());
917
508
    AddType(T->getClass());
918
508
    VisitType(T);
919
508
  }
920
921
8.82k
  void VisitObjCObjectPointerType(const ObjCObjectPointerType *T) {
922
8.82k
    AddQualType(T->getPointeeType());
923
8.82k
    VisitType(T);
924
8.82k
  }
925
926
8.84k
  void VisitObjCObjectType(const ObjCObjectType *T) {
927
8.84k
    AddDecl(T->getInterface());
928
929
8.84k
    auto TypeArgs = T->getTypeArgsAsWritten();
930
8.84k
    ID.AddInteger(TypeArgs.size());
931
8.84k
    for (auto Arg : TypeArgs) {
932
50
      AddQualType(Arg);
933
50
    }
934
935
8.84k
    auto Protocols = T->getProtocols();
936
8.84k
    ID.AddInteger(Protocols.size());
937
8.84k
    for (auto Protocol : Protocols) {
938
4.26k
      AddDecl(Protocol);
939
4.26k
    }
940
941
8.84k
    Hash.AddBoolean(T->isKindOfType());
942
943
8.84k
    VisitType(T);
944
8.84k
  }
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.17k
  void VisitPackExpansionType(const PackExpansionType *T) {
963
5.17k
    AddQualType(T->getPattern());
964
5.17k
    VisitType(T);
965
5.17k
  }
966
967
23.4k
  void VisitParenType(const ParenType *T) {
968
23.4k
    AddQualType(T->getInnerType());
969
23.4k
    VisitType(T);
970
23.4k
  }
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
354k
  void VisitPointerType(const PointerType *T) {
979
354k
    AddQualType(T->getPointeeType());
980
354k
    VisitType(T);
981
354k
  }
982
983
99.8k
  void VisitReferenceType(const ReferenceType *T) {
984
99.8k
    AddQualType(T->getPointeeTypeAsWritten());
985
99.8k
    VisitType(T);
986
99.8k
  }
987
988
87.2k
  void VisitLValueReferenceType(const LValueReferenceType *T) {
989
87.2k
    VisitReferenceType(T);
990
87.2k
  }
991
992
12.6k
  void VisitRValueReferenceType(const RValueReferenceType *T) {
993
12.6k
    VisitReferenceType(T);
994
12.6k
  }
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.99k
  void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T) {
1004
2.99k
    AddType(T->getReplacedParameter());
1005
2.99k
    AddQualType(T->getReplacementType());
1006
2.99k
    VisitType(T);
1007
2.99k
  }
1008
1009
349k
  void VisitTagType(const TagType *T) {
1010
349k
    AddDecl(T->getDecl());
1011
349k
    VisitType(T);
1012
349k
  }
1013
1014
256k
  void VisitRecordType(const RecordType *T) { VisitTagType(T); }
1015
93.2k
  void VisitEnumType(const EnumType *T) { VisitTagType(T); }
1016
1017
300k
  void VisitTemplateSpecializationType(const TemplateSpecializationType *T) {
1018
300k
    ID.AddInteger(T->getNumArgs());
1019
496k
    for (const auto &TA : T->template_arguments()) {
1020
496k
      Hash.AddTemplateArgument(TA);
1021
496k
    }
1022
300k
    Hash.AddTemplateName(T->getTemplateName());
1023
300k
    VisitType(T);
1024
300k
  }
1025
1026
433k
  void VisitTemplateTypeParmType(const TemplateTypeParmType *T) {
1027
433k
    ID.AddInteger(T->getDepth());
1028
433k
    ID.AddInteger(T->getIndex());
1029
433k
    Hash.AddBoolean(T->isParameterPack());
1030
433k
    AddDecl(T->getDecl());
1031
433k
  }
1032
1033
1.32M
  void VisitTypedefType(const TypedefType *T) {
1034
1.32M
    AddDecl(T->getDecl());
1035
1.32M
    QualType UnderlyingType = T->getDecl()->getUnderlyingType();
1036
1.32M
    VisitQualifiers(UnderlyingType.getQualifiers());
1037
1.62M
    while (true) {
1038
1.62M
      if (const TypedefType *Underlying =
1039
1.62M
              dyn_cast<TypedefType>(UnderlyingType.getTypePtr())) {
1040
217k
        UnderlyingType = Underlying->getDecl()->getUnderlyingType();
1041
217k
        continue;
1042
217k
      }
1043
1.40M
      if (const ElaboratedType *Underlying =
1044
1.40M
              dyn_cast<ElaboratedType>(UnderlyingType.getTypePtr())) {
1045
76.3k
        UnderlyingType = Underlying->getNamedType();
1046
76.3k
        continue;
1047
76.3k
      }
1048
1049
1.32M
      break;
1050
1.40M
    }
1051
1.32M
    AddType(UnderlyingType.getTypePtr());
1052
1.32M
    VisitType(T);
1053
1.32M
  }
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
227k
  void VisitTypeWithKeyword(const TypeWithKeyword *T) {
1069
227k
    ID.AddInteger(T->getKeyword());
1070
227k
    VisitType(T);
1071
227k
  };
1072
1073
119k
  void VisitDependentNameType(const DependentNameType *T) {
1074
119k
    AddNestedNameSpecifier(T->getQualifier());
1075
119k
    AddIdentifierInfo(T->getIdentifier());
1076
119k
    VisitTypeWithKeyword(T);
1077
119k
  }
1078
1079
  void VisitDependentTemplateSpecializationType(
1080
126
      const DependentTemplateSpecializationType *T) {
1081
126
    AddIdentifierInfo(T->getIdentifier());
1082
126
    AddNestedNameSpecifier(T->getQualifier());
1083
126
    ID.AddInteger(T->getNumArgs());
1084
126
    for (const auto &TA : T->template_arguments()) {
1085
126
      Hash.AddTemplateArgument(TA);
1086
126
    }
1087
126
    VisitTypeWithKeyword(T);
1088
126
  }
1089
1090
108k
  void VisitElaboratedType(const ElaboratedType *T) {
1091
108k
    AddNestedNameSpecifier(T->getQualifier());
1092
108k
    AddQualType(T->getNamedType());
1093
108k
    VisitTypeWithKeyword(T);
1094
108k
  }
1095
1096
429
  void VisitUnaryTransformType(const UnaryTransformType *T) {
1097
429
    AddQualType(T->getUnderlyingType());
1098
429
    AddQualType(T->getBaseType());
1099
429
    VisitType(T);
1100
429
  }
1101
1102
140
  void VisitUnresolvedUsingType(const UnresolvedUsingType *T) {
1103
140
    AddDecl(T->getDecl());
1104
140
    VisitType(T);
1105
140
  }
1106
1107
408k
  void VisitVectorType(const VectorType *T) {
1108
408k
    AddQualType(T->getElementType());
1109
408k
    ID.AddInteger(T->getNumElements());
1110
408k
    ID.AddInteger(T->getVectorKind());
1111
408k
    VisitType(T);
1112
408k
  }
1113
1114
106k
  void VisitExtVectorType(const ExtVectorType * T) {
1115
106k
    VisitVectorType(T);
1116
106k
  }
1117
};
1118
} // namespace
1119
1120
5.00M
void ODRHash::AddType(const Type *T) {
1121
5.00M
  assert(T && "Expecting non-null pointer.");
1122
0
  ODRTypeVisitor(ID, *this).Visit(T);
1123
5.00M
}
1124
1125
3.50M
void ODRHash::AddQualType(QualType T) {
1126
3.50M
  AddBoolean(T.isNull());
1127
3.50M
  if (T.isNull())
1128
2.60k
    return;
1129
3.49M
  SplitQualType split = T.split();
1130
3.49M
  ID.AddInteger(split.Quals.getAsOpaqueValue());
1131
3.49M
  AddType(split.Ty);
1132
3.49M
}
1133
1134
25.2M
void ODRHash::AddBoolean(bool Value) {
1135
25.2M
  Bools.push_back(Value);
1136
25.2M
}