clang 20.0.0git
ASTWriterStmt.cpp
Go to the documentation of this file.
1//===--- ASTWriterStmt.cpp - Statement and Expression Serialization -------===//
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/// Implements serialization for Statements and Expressions.
11///
12//===----------------------------------------------------------------------===//
13
16#include "clang/AST/DeclCXX.h"
17#include "clang/AST/DeclObjC.h"
21#include "clang/Lex/Token.h"
24#include "llvm/Bitstream/BitstreamWriter.h"
25using namespace clang;
26
27//===----------------------------------------------------------------------===//
28// Statement/expression serialization
29//===----------------------------------------------------------------------===//
30
31namespace clang {
32
33 class ASTStmtWriter : public StmtVisitor<ASTStmtWriter, void> {
34 ASTWriter &Writer;
36
38 unsigned AbbrevToUse;
39
40 /// A helper that can help us to write a packed bit across function
41 /// calls. For example, we may write separate bits in separate functions:
42 ///
43 /// void VisitA(A* a) {
44 /// Record.push_back(a->isSomething());
45 /// }
46 ///
47 /// void Visitb(B *b) {
48 /// VisitA(b);
49 /// Record.push_back(b->isAnother());
50 /// }
51 ///
52 /// In such cases, it'll be better if we can pack these 2 bits. We achieve
53 /// this by writing a zero value in `VisitA` and recorded that first and add
54 /// the new bit to the recorded value.
55 class PakedBitsWriter {
56 public:
57 PakedBitsWriter(ASTRecordWriter &Record) : RecordRef(Record) {}
58 ~PakedBitsWriter() { assert(!CurrentIndex); }
59
60 void addBit(bool Value) {
61 assert(CurrentIndex && "Writing Bits without recording first!");
62 PackingBits.addBit(Value);
63 }
64 void addBits(uint32_t Value, uint32_t BitsWidth) {
65 assert(CurrentIndex && "Writing Bits without recording first!");
66 PackingBits.addBits(Value, BitsWidth);
67 }
68
69 void writeBits() {
70 if (!CurrentIndex)
71 return;
72
73 RecordRef[*CurrentIndex] = (uint32_t)PackingBits;
74 CurrentIndex = std::nullopt;
75 PackingBits.reset(0);
76 }
77
78 void updateBits() {
79 writeBits();
80
81 CurrentIndex = RecordRef.size();
82 RecordRef.push_back(0);
83 }
84
85 private:
86 BitsPacker PackingBits;
87 ASTRecordWriter &RecordRef;
88 std::optional<unsigned> CurrentIndex;
89 };
90
91 PakedBitsWriter CurrentPackingBits;
92
93 public:
96 : Writer(Writer), Record(Context, Writer, Record),
97 Code(serialization::STMT_NULL_PTR), AbbrevToUse(0),
98 CurrentPackingBits(this->Record) {}
99
100 ASTStmtWriter(const ASTStmtWriter&) = delete;
102
103 uint64_t Emit() {
104 CurrentPackingBits.writeBits();
105 assert(Code != serialization::STMT_NULL_PTR &&
106 "unhandled sub-statement writing AST file");
107 return Record.EmitStmt(Code, AbbrevToUse);
108 }
109
111 const TemplateArgumentLoc *Args);
112
113 void VisitStmt(Stmt *S);
114#define STMT(Type, Base) \
115 void Visit##Type(Type *);
116#include "clang/AST/StmtNodes.inc"
117 };
118}
119
121 const ASTTemplateKWAndArgsInfo &ArgInfo, const TemplateArgumentLoc *Args) {
122 Record.AddSourceLocation(ArgInfo.TemplateKWLoc);
123 Record.AddSourceLocation(ArgInfo.LAngleLoc);
124 Record.AddSourceLocation(ArgInfo.RAngleLoc);
125 for (unsigned i = 0; i != ArgInfo.NumTemplateArgs; ++i)
126 Record.AddTemplateArgumentLoc(Args[i]);
127}
128
130}
131
132void ASTStmtWriter::VisitNullStmt(NullStmt *S) {
133 VisitStmt(S);
134 Record.AddSourceLocation(S->getSemiLoc());
135 Record.push_back(S->NullStmtBits.HasLeadingEmptyMacro);
137}
138
139void ASTStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
140 VisitStmt(S);
141
142 Record.push_back(S->size());
143 Record.push_back(S->hasStoredFPFeatures());
144
145 for (auto *CS : S->body())
146 Record.AddStmt(CS);
147 if (S->hasStoredFPFeatures())
148 Record.push_back(S->getStoredFPFeatures().getAsOpaqueInt());
149 Record.AddSourceLocation(S->getLBracLoc());
150 Record.AddSourceLocation(S->getRBracLoc());
151
152 if (!S->hasStoredFPFeatures())
153 AbbrevToUse = Writer.getCompoundStmtAbbrev();
154
156}
157
158void ASTStmtWriter::VisitSwitchCase(SwitchCase *S) {
159 VisitStmt(S);
160 Record.push_back(Writer.getSwitchCaseID(S));
161 Record.AddSourceLocation(S->getKeywordLoc());
162 Record.AddSourceLocation(S->getColonLoc());
163}
164
165void ASTStmtWriter::VisitCaseStmt(CaseStmt *S) {
166 VisitSwitchCase(S);
167 Record.push_back(S->caseStmtIsGNURange());
168 Record.AddStmt(S->getLHS());
169 Record.AddStmt(S->getSubStmt());
170 if (S->caseStmtIsGNURange()) {
171 Record.AddStmt(S->getRHS());
172 Record.AddSourceLocation(S->getEllipsisLoc());
173 }
175}
176
177void ASTStmtWriter::VisitDefaultStmt(DefaultStmt *S) {
178 VisitSwitchCase(S);
179 Record.AddStmt(S->getSubStmt());
181}
182
183void ASTStmtWriter::VisitLabelStmt(LabelStmt *S) {
184 VisitStmt(S);
185 Record.push_back(S->isSideEntry());
186 Record.AddDeclRef(S->getDecl());
187 Record.AddStmt(S->getSubStmt());
188 Record.AddSourceLocation(S->getIdentLoc());
190}
191
192void ASTStmtWriter::VisitAttributedStmt(AttributedStmt *S) {
193 VisitStmt(S);
194 Record.push_back(S->getAttrs().size());
195 Record.AddAttributes(S->getAttrs());
196 Record.AddStmt(S->getSubStmt());
197 Record.AddSourceLocation(S->getAttrLoc());
199}
200
201void ASTStmtWriter::VisitIfStmt(IfStmt *S) {
202 VisitStmt(S);
203
204 bool HasElse = S->getElse() != nullptr;
205 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
206 bool HasInit = S->getInit() != nullptr;
207
208 CurrentPackingBits.updateBits();
209
210 CurrentPackingBits.addBit(HasElse);
211 CurrentPackingBits.addBit(HasVar);
212 CurrentPackingBits.addBit(HasInit);
213 Record.push_back(static_cast<uint64_t>(S->getStatementKind()));
214 Record.AddStmt(S->getCond());
215 Record.AddStmt(S->getThen());
216 if (HasElse)
217 Record.AddStmt(S->getElse());
218 if (HasVar)
219 Record.AddStmt(S->getConditionVariableDeclStmt());
220 if (HasInit)
221 Record.AddStmt(S->getInit());
222
223 Record.AddSourceLocation(S->getIfLoc());
224 Record.AddSourceLocation(S->getLParenLoc());
225 Record.AddSourceLocation(S->getRParenLoc());
226 if (HasElse)
227 Record.AddSourceLocation(S->getElseLoc());
228
230}
231
232void ASTStmtWriter::VisitSwitchStmt(SwitchStmt *S) {
233 VisitStmt(S);
234
235 bool HasInit = S->getInit() != nullptr;
236 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
237 Record.push_back(HasInit);
238 Record.push_back(HasVar);
239 Record.push_back(S->isAllEnumCasesCovered());
240
241 Record.AddStmt(S->getCond());
242 Record.AddStmt(S->getBody());
243 if (HasInit)
244 Record.AddStmt(S->getInit());
245 if (HasVar)
246 Record.AddStmt(S->getConditionVariableDeclStmt());
247
248 Record.AddSourceLocation(S->getSwitchLoc());
249 Record.AddSourceLocation(S->getLParenLoc());
250 Record.AddSourceLocation(S->getRParenLoc());
251
252 for (SwitchCase *SC = S->getSwitchCaseList(); SC;
253 SC = SC->getNextSwitchCase())
254 Record.push_back(Writer.RecordSwitchCaseID(SC));
256}
257
258void ASTStmtWriter::VisitWhileStmt(WhileStmt *S) {
259 VisitStmt(S);
260
261 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
262 Record.push_back(HasVar);
263
264 Record.AddStmt(S->getCond());
265 Record.AddStmt(S->getBody());
266 if (HasVar)
267 Record.AddStmt(S->getConditionVariableDeclStmt());
268
269 Record.AddSourceLocation(S->getWhileLoc());
270 Record.AddSourceLocation(S->getLParenLoc());
271 Record.AddSourceLocation(S->getRParenLoc());
273}
274
275void ASTStmtWriter::VisitDoStmt(DoStmt *S) {
276 VisitStmt(S);
277 Record.AddStmt(S->getCond());
278 Record.AddStmt(S->getBody());
279 Record.AddSourceLocation(S->getDoLoc());
280 Record.AddSourceLocation(S->getWhileLoc());
281 Record.AddSourceLocation(S->getRParenLoc());
283}
284
285void ASTStmtWriter::VisitForStmt(ForStmt *S) {
286 VisitStmt(S);
287 Record.AddStmt(S->getInit());
288 Record.AddStmt(S->getCond());
289 Record.AddStmt(S->getConditionVariableDeclStmt());
290 Record.AddStmt(S->getInc());
291 Record.AddStmt(S->getBody());
292 Record.AddSourceLocation(S->getForLoc());
293 Record.AddSourceLocation(S->getLParenLoc());
294 Record.AddSourceLocation(S->getRParenLoc());
296}
297
298void ASTStmtWriter::VisitGotoStmt(GotoStmt *S) {
299 VisitStmt(S);
300 Record.AddDeclRef(S->getLabel());
301 Record.AddSourceLocation(S->getGotoLoc());
302 Record.AddSourceLocation(S->getLabelLoc());
304}
305
306void ASTStmtWriter::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
307 VisitStmt(S);
308 Record.AddSourceLocation(S->getGotoLoc());
309 Record.AddSourceLocation(S->getStarLoc());
310 Record.AddStmt(S->getTarget());
312}
313
314void ASTStmtWriter::VisitContinueStmt(ContinueStmt *S) {
315 VisitStmt(S);
316 Record.AddSourceLocation(S->getContinueLoc());
318}
319
320void ASTStmtWriter::VisitBreakStmt(BreakStmt *S) {
321 VisitStmt(S);
322 Record.AddSourceLocation(S->getBreakLoc());
324}
325
326void ASTStmtWriter::VisitReturnStmt(ReturnStmt *S) {
327 VisitStmt(S);
328
329 bool HasNRVOCandidate = S->getNRVOCandidate() != nullptr;
330 Record.push_back(HasNRVOCandidate);
331
332 Record.AddStmt(S->getRetValue());
333 if (HasNRVOCandidate)
334 Record.AddDeclRef(S->getNRVOCandidate());
335
336 Record.AddSourceLocation(S->getReturnLoc());
338}
339
340void ASTStmtWriter::VisitDeclStmt(DeclStmt *S) {
341 VisitStmt(S);
342 Record.AddSourceLocation(S->getBeginLoc());
343 Record.AddSourceLocation(S->getEndLoc());
344 DeclGroupRef DG = S->getDeclGroup();
345 for (DeclGroupRef::iterator D = DG.begin(), DEnd = DG.end(); D != DEnd; ++D)
346 Record.AddDeclRef(*D);
348}
349
350void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) {
351 VisitStmt(S);
352 Record.push_back(S->getNumOutputs());
353 Record.push_back(S->getNumInputs());
354 Record.push_back(S->getNumClobbers());
355 Record.AddSourceLocation(S->getAsmLoc());
356 Record.push_back(S->isVolatile());
357 Record.push_back(S->isSimple());
358}
359
360void ASTStmtWriter::VisitGCCAsmStmt(GCCAsmStmt *S) {
361 VisitAsmStmt(S);
362 Record.push_back(S->getNumLabels());
363 Record.AddSourceLocation(S->getRParenLoc());
364 Record.AddStmt(S->getAsmString());
365
366 // Outputs
367 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
368 Record.AddIdentifierRef(S->getOutputIdentifier(I));
369 Record.AddStmt(S->getOutputConstraintLiteral(I));
370 Record.AddStmt(S->getOutputExpr(I));
371 }
372
373 // Inputs
374 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
375 Record.AddIdentifierRef(S->getInputIdentifier(I));
376 Record.AddStmt(S->getInputConstraintLiteral(I));
377 Record.AddStmt(S->getInputExpr(I));
378 }
379
380 // Clobbers
381 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
382 Record.AddStmt(S->getClobberStringLiteral(I));
383
384 // Labels
385 for (unsigned I = 0, N = S->getNumLabels(); I != N; ++I) {
386 Record.AddIdentifierRef(S->getLabelIdentifier(I));
387 Record.AddStmt(S->getLabelExpr(I));
388 }
389
391}
392
393void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) {
394 VisitAsmStmt(S);
395 Record.AddSourceLocation(S->getLBraceLoc());
396 Record.AddSourceLocation(S->getEndLoc());
397 Record.push_back(S->getNumAsmToks());
398 Record.AddString(S->getAsmString());
399
400 // Tokens
401 for (unsigned I = 0, N = S->getNumAsmToks(); I != N; ++I) {
402 // FIXME: Move this to ASTRecordWriter?
403 Writer.AddToken(S->getAsmToks()[I], Record.getRecordData());
404 }
405
406 // Clobbers
407 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) {
408 Record.AddString(S->getClobber(I));
409 }
410
411 // Outputs
412 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
413 Record.AddStmt(S->getOutputExpr(I));
414 Record.AddString(S->getOutputConstraint(I));
415 }
416
417 // Inputs
418 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
419 Record.AddStmt(S->getInputExpr(I));
420 Record.AddString(S->getInputConstraint(I));
421 }
422
424}
425
426void ASTStmtWriter::VisitCoroutineBodyStmt(CoroutineBodyStmt *CoroStmt) {
427 VisitStmt(CoroStmt);
428 Record.push_back(CoroStmt->getParamMoves().size());
429 for (Stmt *S : CoroStmt->children())
430 Record.AddStmt(S);
432}
433
434void ASTStmtWriter::VisitCoreturnStmt(CoreturnStmt *S) {
435 VisitStmt(S);
436 Record.AddSourceLocation(S->getKeywordLoc());
437 Record.AddStmt(S->getOperand());
438 Record.AddStmt(S->getPromiseCall());
439 Record.push_back(S->isImplicit());
441}
442
443void ASTStmtWriter::VisitCoroutineSuspendExpr(CoroutineSuspendExpr *E) {
444 VisitExpr(E);
445 Record.AddSourceLocation(E->getKeywordLoc());
446 for (Stmt *S : E->children())
447 Record.AddStmt(S);
448 Record.AddStmt(E->getOpaqueValue());
449}
450
451void ASTStmtWriter::VisitCoawaitExpr(CoawaitExpr *E) {
452 VisitCoroutineSuspendExpr(E);
453 Record.push_back(E->isImplicit());
455}
456
457void ASTStmtWriter::VisitCoyieldExpr(CoyieldExpr *E) {
458 VisitCoroutineSuspendExpr(E);
460}
461
462void ASTStmtWriter::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
463 VisitExpr(E);
464 Record.AddSourceLocation(E->getKeywordLoc());
465 for (Stmt *S : E->children())
466 Record.AddStmt(S);
468}
469
470static void
472 const ASTConstraintSatisfaction &Satisfaction) {
473 Record.push_back(Satisfaction.IsSatisfied);
474 Record.push_back(Satisfaction.ContainsErrors);
475 if (!Satisfaction.IsSatisfied) {
476 Record.push_back(Satisfaction.NumRecords);
477 for (const auto &DetailRecord : Satisfaction) {
478 auto *E = DetailRecord.dyn_cast<Expr *>();
479 Record.push_back(/* IsDiagnostic */ E == nullptr);
480 if (E)
481 Record.AddStmt(E);
482 else {
483 auto *Diag = cast<std::pair<SourceLocation, StringRef> *>(DetailRecord);
484 Record.AddSourceLocation(Diag->first);
485 Record.AddString(Diag->second);
486 }
487 }
488 }
489}
490
491static void
495 Record.AddString(D->SubstitutedEntity);
496 Record.AddSourceLocation(D->DiagLoc);
497 Record.AddString(D->DiagMessage);
498}
499
500void ASTStmtWriter::VisitConceptSpecializationExpr(
502 VisitExpr(E);
503 Record.AddDeclRef(E->getSpecializationDecl());
504 const ConceptReference *CR = E->getConceptReference();
505 Record.push_back(CR != nullptr);
506 if (CR)
507 Record.AddConceptReference(CR);
508 if (!E->isValueDependent())
509 addConstraintSatisfaction(Record, E->getSatisfaction());
510
512}
513
514void ASTStmtWriter::VisitRequiresExpr(RequiresExpr *E) {
515 VisitExpr(E);
516 Record.push_back(E->getLocalParameters().size());
517 Record.push_back(E->getRequirements().size());
518 Record.AddSourceLocation(E->RequiresExprBits.RequiresKWLoc);
519 Record.push_back(E->RequiresExprBits.IsSatisfied);
520 Record.AddDeclRef(E->getBody());
521 for (ParmVarDecl *P : E->getLocalParameters())
522 Record.AddDeclRef(P);
523 for (concepts::Requirement *R : E->getRequirements()) {
524 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(R)) {
526 Record.push_back(TypeReq->Status);
528 addSubstitutionDiagnostic(Record, TypeReq->getSubstitutionDiagnostic());
529 else
530 Record.AddTypeSourceInfo(TypeReq->getType());
531 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(R)) {
532 Record.push_back(ExprReq->getKind());
533 Record.push_back(ExprReq->Status);
534 if (ExprReq->isExprSubstitutionFailure()) {
536 Record, cast<concepts::Requirement::SubstitutionDiagnostic *>(
537 ExprReq->Value));
538 } else
539 Record.AddStmt(cast<Expr *>(ExprReq->Value));
540 if (ExprReq->getKind() == concepts::Requirement::RK_Compound) {
541 Record.AddSourceLocation(ExprReq->NoexceptLoc);
542 const auto &RetReq = ExprReq->getReturnTypeRequirement();
543 if (RetReq.isSubstitutionFailure()) {
544 Record.push_back(2);
545 addSubstitutionDiagnostic(Record, RetReq.getSubstitutionDiagnostic());
546 } else if (RetReq.isTypeConstraint()) {
547 Record.push_back(1);
548 Record.AddTemplateParameterList(
549 RetReq.getTypeConstraintTemplateParameterList());
550 if (ExprReq->Status >=
552 Record.AddStmt(
553 ExprReq->getReturnTypeRequirementSubstitutedConstraintExpr());
554 } else {
555 assert(RetReq.isEmpty());
556 Record.push_back(0);
557 }
558 }
559 } else {
560 auto *NestedReq = cast<concepts::NestedRequirement>(R);
562 Record.push_back(NestedReq->hasInvalidConstraint());
563 if (NestedReq->hasInvalidConstraint()) {
564 Record.AddString(NestedReq->getInvalidConstraintEntity());
565 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
566 } else {
567 Record.AddStmt(NestedReq->getConstraintExpr());
568 if (!NestedReq->isDependent())
569 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
570 }
571 }
572 }
573 Record.AddSourceLocation(E->getLParenLoc());
574 Record.AddSourceLocation(E->getRParenLoc());
575 Record.AddSourceLocation(E->getEndLoc());
576
578}
579
580
581void ASTStmtWriter::VisitCapturedStmt(CapturedStmt *S) {
582 VisitStmt(S);
583 // NumCaptures
584 Record.push_back(std::distance(S->capture_begin(), S->capture_end()));
585
586 // CapturedDecl and captured region kind
587 Record.AddDeclRef(S->getCapturedDecl());
588 Record.push_back(S->getCapturedRegionKind());
589
590 Record.AddDeclRef(S->getCapturedRecordDecl());
591
592 // Capture inits
593 for (auto *I : S->capture_inits())
594 Record.AddStmt(I);
595
596 // Body
597 Record.AddStmt(S->getCapturedStmt());
598
599 // Captures
600 for (const auto &I : S->captures()) {
601 if (I.capturesThis() || I.capturesVariableArrayType())
602 Record.AddDeclRef(nullptr);
603 else
604 Record.AddDeclRef(I.getCapturedVar());
605 Record.push_back(I.getCaptureKind());
606 Record.AddSourceLocation(I.getLocation());
607 }
608
610}
611
612void ASTStmtWriter::VisitExpr(Expr *E) {
613 VisitStmt(E);
614
615 CurrentPackingBits.updateBits();
616 CurrentPackingBits.addBits(E->getDependence(), /*BitsWidth=*/5);
617 CurrentPackingBits.addBits(E->getValueKind(), /*BitsWidth=*/2);
618 CurrentPackingBits.addBits(E->getObjectKind(), /*BitsWidth=*/3);
619
620 Record.AddTypeRef(E->getType());
621}
622
623void ASTStmtWriter::VisitConstantExpr(ConstantExpr *E) {
624 VisitExpr(E);
625 Record.push_back(E->ConstantExprBits.ResultKind);
626
627 Record.push_back(E->ConstantExprBits.APValueKind);
628 Record.push_back(E->ConstantExprBits.IsUnsigned);
629 Record.push_back(E->ConstantExprBits.BitWidth);
630 // HasCleanup not serialized since we can just query the APValue.
631 Record.push_back(E->ConstantExprBits.IsImmediateInvocation);
632
633 switch (E->getResultStorageKind()) {
635 break;
637 Record.push_back(E->Int64Result());
638 break;
640 Record.AddAPValue(E->APValueResult());
641 break;
642 }
643
644 Record.AddStmt(E->getSubExpr());
646}
647
648void ASTStmtWriter::VisitOpenACCAsteriskSizeExpr(OpenACCAsteriskSizeExpr *E) {
649 VisitExpr(E);
650 Record.AddSourceLocation(E->getLocation());
652}
653
654void ASTStmtWriter::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *E) {
655 VisitExpr(E);
656
657 Record.AddSourceLocation(E->getLocation());
658 Record.AddSourceLocation(E->getLParenLocation());
659 Record.AddSourceLocation(E->getRParenLocation());
660 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
661
663}
664
665void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
666 VisitExpr(E);
667
668 bool HasFunctionName = E->getFunctionName() != nullptr;
669 Record.push_back(HasFunctionName);
670 Record.push_back(
671 llvm::to_underlying(E->getIdentKind())); // FIXME: stable encoding
672 Record.push_back(E->isTransparent());
673 Record.AddSourceLocation(E->getLocation());
674 if (HasFunctionName)
675 Record.AddStmt(E->getFunctionName());
677}
678
679void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
680 VisitExpr(E);
681
682 CurrentPackingBits.updateBits();
683
684 CurrentPackingBits.addBit(E->hadMultipleCandidates());
685 CurrentPackingBits.addBit(E->refersToEnclosingVariableOrCapture());
686 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
687 CurrentPackingBits.addBit(E->isImmediateEscalating());
688 CurrentPackingBits.addBit(E->getDecl() != E->getFoundDecl());
689 CurrentPackingBits.addBit(E->hasQualifier());
690 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
691
692 if (E->hasTemplateKWAndArgsInfo()) {
693 unsigned NumTemplateArgs = E->getNumTemplateArgs();
694 Record.push_back(NumTemplateArgs);
695 }
696
697 DeclarationName::NameKind nk = (E->getDecl()->getDeclName().getNameKind());
698
699 if ((!E->hasTemplateKWAndArgsInfo()) && (!E->hasQualifier()) &&
700 (E->getDecl() == E->getFoundDecl()) &&
702 AbbrevToUse = Writer.getDeclRefExprAbbrev();
703 }
704
705 if (E->hasQualifier())
706 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
707
708 if (E->getDecl() != E->getFoundDecl())
709 Record.AddDeclRef(E->getFoundDecl());
710
711 if (E->hasTemplateKWAndArgsInfo())
713 E->getTrailingObjects<TemplateArgumentLoc>());
714
715 Record.AddDeclRef(E->getDecl());
716 Record.AddSourceLocation(E->getLocation());
717 Record.AddDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
719}
720
721void ASTStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
722 VisitExpr(E);
723 Record.AddSourceLocation(E->getLocation());
724 Record.AddAPInt(E->getValue());
725
726 if (E->getValue().getBitWidth() == 32) {
727 AbbrevToUse = Writer.getIntegerLiteralAbbrev();
728 }
729
731}
732
733void ASTStmtWriter::VisitFixedPointLiteral(FixedPointLiteral *E) {
734 VisitExpr(E);
735 Record.AddSourceLocation(E->getLocation());
736 Record.push_back(E->getScale());
737 Record.AddAPInt(E->getValue());
739}
740
741void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
742 VisitExpr(E);
743 Record.push_back(E->getRawSemantics());
744 Record.push_back(E->isExact());
745 Record.AddAPFloat(E->getValue());
746 Record.AddSourceLocation(E->getLocation());
748}
749
750void ASTStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
751 VisitExpr(E);
752 Record.AddStmt(E->getSubExpr());
754}
755
756void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
757 VisitExpr(E);
758
759 // Store the various bits of data of StringLiteral.
760 Record.push_back(E->getNumConcatenated());
761 Record.push_back(E->getLength());
762 Record.push_back(E->getCharByteWidth());
763 Record.push_back(llvm::to_underlying(E->getKind()));
764 Record.push_back(E->isPascal());
765
766 // Store the trailing array of SourceLocation.
767 for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
768 Record.AddSourceLocation(E->getStrTokenLoc(I));
769
770 // Store the trailing array of char holding the string data.
771 StringRef StrData = E->getBytes();
772 for (unsigned I = 0, N = E->getByteLength(); I != N; ++I)
773 Record.push_back(StrData[I]);
774
776}
777
778void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
779 VisitExpr(E);
780 Record.push_back(E->getValue());
781 Record.AddSourceLocation(E->getLocation());
782 Record.push_back(llvm::to_underlying(E->getKind()));
783
784 AbbrevToUse = Writer.getCharacterLiteralAbbrev();
785
787}
788
789void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
790 VisitExpr(E);
791 Record.push_back(E->isProducedByFoldExpansion());
792 Record.AddSourceLocation(E->getLParen());
793 Record.AddSourceLocation(E->getRParen());
794 Record.AddStmt(E->getSubExpr());
796}
797
798void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
799 VisitExpr(E);
800 Record.push_back(E->getNumExprs());
801 for (auto *SubStmt : E->exprs())
802 Record.AddStmt(SubStmt);
803 Record.AddSourceLocation(E->getLParenLoc());
804 Record.AddSourceLocation(E->getRParenLoc());
806}
807
808void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
809 VisitExpr(E);
810 bool HasFPFeatures = E->hasStoredFPFeatures();
811 // Write this first for easy access when deserializing, as they affect the
812 // size of the UnaryOperator.
813 CurrentPackingBits.addBit(HasFPFeatures);
814 Record.AddStmt(E->getSubExpr());
815 CurrentPackingBits.addBits(E->getOpcode(),
816 /*Width=*/5); // FIXME: stable encoding
817 Record.AddSourceLocation(E->getOperatorLoc());
818 CurrentPackingBits.addBit(E->canOverflow());
819
820 if (HasFPFeatures)
821 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
823}
824
825void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
826 VisitExpr(E);
827 Record.push_back(E->getNumComponents());
828 Record.push_back(E->getNumExpressions());
829 Record.AddSourceLocation(E->getOperatorLoc());
830 Record.AddSourceLocation(E->getRParenLoc());
831 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
832 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
833 const OffsetOfNode &ON = E->getComponent(I);
834 Record.push_back(ON.getKind()); // FIXME: Stable encoding
835 Record.AddSourceLocation(ON.getSourceRange().getBegin());
836 Record.AddSourceLocation(ON.getSourceRange().getEnd());
837 switch (ON.getKind()) {
839 Record.push_back(ON.getArrayExprIndex());
840 break;
841
843 Record.AddDeclRef(ON.getField());
844 break;
845
847 Record.AddIdentifierRef(ON.getFieldName());
848 break;
849
851 Record.AddCXXBaseSpecifier(*ON.getBase());
852 break;
853 }
854 }
855 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
856 Record.AddStmt(E->getIndexExpr(I));
858}
859
860void ASTStmtWriter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
861 VisitExpr(E);
862 Record.push_back(E->getKind());
863 if (E->isArgumentType())
864 Record.AddTypeSourceInfo(E->getArgumentTypeInfo());
865 else {
866 Record.push_back(0);
867 Record.AddStmt(E->getArgumentExpr());
868 }
869 Record.AddSourceLocation(E->getOperatorLoc());
870 Record.AddSourceLocation(E->getRParenLoc());
872}
873
874void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
875 VisitExpr(E);
876 Record.AddStmt(E->getLHS());
877 Record.AddStmt(E->getRHS());
878 Record.AddSourceLocation(E->getRBracketLoc());
880}
881
882void ASTStmtWriter::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
883 VisitExpr(E);
884 Record.AddStmt(E->getBase());
885 Record.AddStmt(E->getRowIdx());
886 Record.AddStmt(E->getColumnIdx());
887 Record.AddSourceLocation(E->getRBracketLoc());
889}
890
891void ASTStmtWriter::VisitArraySectionExpr(ArraySectionExpr *E) {
892 VisitExpr(E);
893 Record.writeEnum(E->ASType);
894 Record.AddStmt(E->getBase());
895 Record.AddStmt(E->getLowerBound());
896 Record.AddStmt(E->getLength());
897 if (E->isOMPArraySection())
898 Record.AddStmt(E->getStride());
899 Record.AddSourceLocation(E->getColonLocFirst());
900
901 if (E->isOMPArraySection())
902 Record.AddSourceLocation(E->getColonLocSecond());
903
904 Record.AddSourceLocation(E->getRBracketLoc());
906}
907
908void ASTStmtWriter::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
909 VisitExpr(E);
910 Record.push_back(E->getDimensions().size());
911 Record.AddStmt(E->getBase());
912 for (Expr *Dim : E->getDimensions())
913 Record.AddStmt(Dim);
914 for (SourceRange SR : E->getBracketsRanges())
915 Record.AddSourceRange(SR);
916 Record.AddSourceLocation(E->getLParenLoc());
917 Record.AddSourceLocation(E->getRParenLoc());
919}
920
921void ASTStmtWriter::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
922 VisitExpr(E);
923 Record.push_back(E->numOfIterators());
924 Record.AddSourceLocation(E->getIteratorKwLoc());
925 Record.AddSourceLocation(E->getLParenLoc());
926 Record.AddSourceLocation(E->getRParenLoc());
927 for (unsigned I = 0, End = E->numOfIterators(); I < End; ++I) {
928 Record.AddDeclRef(E->getIteratorDecl(I));
929 Record.AddSourceLocation(E->getAssignLoc(I));
930 OMPIteratorExpr::IteratorRange Range = E->getIteratorRange(I);
931 Record.AddStmt(Range.Begin);
932 Record.AddStmt(Range.End);
933 Record.AddStmt(Range.Step);
934 Record.AddSourceLocation(E->getColonLoc(I));
935 if (Range.Step)
936 Record.AddSourceLocation(E->getSecondColonLoc(I));
937 // Serialize helpers
938 OMPIteratorHelperData &HD = E->getHelper(I);
939 Record.AddDeclRef(HD.CounterVD);
940 Record.AddStmt(HD.Upper);
941 Record.AddStmt(HD.Update);
942 Record.AddStmt(HD.CounterUpdate);
943 }
945}
946
947void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
948 VisitExpr(E);
949
950 Record.push_back(E->getNumArgs());
951 CurrentPackingBits.updateBits();
952 CurrentPackingBits.addBit(static_cast<bool>(E->getADLCallKind()));
953 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
954
955 Record.AddSourceLocation(E->getRParenLoc());
956 Record.AddStmt(E->getCallee());
957 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
958 Arg != ArgEnd; ++Arg)
959 Record.AddStmt(*Arg);
960
961 if (E->hasStoredFPFeatures())
962 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
963
964 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
965 E->getStmtClass() == Stmt::CallExprClass)
966 AbbrevToUse = Writer.getCallExprAbbrev();
967
969}
970
971void ASTStmtWriter::VisitRecoveryExpr(RecoveryExpr *E) {
972 VisitExpr(E);
973 Record.push_back(std::distance(E->children().begin(), E->children().end()));
974 Record.AddSourceLocation(E->getBeginLoc());
975 Record.AddSourceLocation(E->getEndLoc());
976 for (Stmt *Child : E->children())
977 Record.AddStmt(Child);
979}
980
981void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
982 VisitExpr(E);
983
984 bool HasQualifier = E->hasQualifier();
985 bool HasFoundDecl = E->hasFoundDecl();
986 bool HasTemplateInfo = E->hasTemplateKWAndArgsInfo();
987 unsigned NumTemplateArgs = E->getNumTemplateArgs();
988
989 // Write these first for easy access when deserializing, as they affect the
990 // size of the MemberExpr.
991 CurrentPackingBits.updateBits();
992 CurrentPackingBits.addBit(HasQualifier);
993 CurrentPackingBits.addBit(HasFoundDecl);
994 CurrentPackingBits.addBit(HasTemplateInfo);
995 Record.push_back(NumTemplateArgs);
996
997 Record.AddStmt(E->getBase());
998 Record.AddDeclRef(E->getMemberDecl());
999 Record.AddDeclarationNameLoc(E->MemberDNLoc,
1000 E->getMemberDecl()->getDeclName());
1001 Record.AddSourceLocation(E->getMemberLoc());
1002 CurrentPackingBits.addBit(E->isArrow());
1003 CurrentPackingBits.addBit(E->hadMultipleCandidates());
1004 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
1005 Record.AddSourceLocation(E->getOperatorLoc());
1006
1007 if (HasQualifier)
1008 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1009
1010 if (HasFoundDecl) {
1011 DeclAccessPair FoundDecl = E->getFoundDecl();
1012 Record.AddDeclRef(FoundDecl.getDecl());
1013 CurrentPackingBits.addBits(FoundDecl.getAccess(), /*BitWidth=*/2);
1014 }
1015
1016 if (HasTemplateInfo)
1017 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1018 E->getTrailingObjects<TemplateArgumentLoc>());
1019
1021}
1022
1023void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1024 VisitExpr(E);
1025 Record.AddStmt(E->getBase());
1026 Record.AddSourceLocation(E->getIsaMemberLoc());
1027 Record.AddSourceLocation(E->getOpLoc());
1028 Record.push_back(E->isArrow());
1030}
1031
1032void ASTStmtWriter::
1033VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1034 VisitExpr(E);
1035 Record.AddStmt(E->getSubExpr());
1036 Record.push_back(E->shouldCopy());
1038}
1039
1040void ASTStmtWriter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1041 VisitExplicitCastExpr(E);
1042 Record.AddSourceLocation(E->getLParenLoc());
1043 Record.AddSourceLocation(E->getBridgeKeywordLoc());
1044 Record.push_back(E->getBridgeKind()); // FIXME: Stable encoding
1046}
1047
1048void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
1049 VisitExpr(E);
1050
1051 Record.push_back(E->path_size());
1052 CurrentPackingBits.updateBits();
1053 // 7 bits should be enough to store the casting kinds.
1054 CurrentPackingBits.addBits(E->getCastKind(), /*Width=*/7);
1055 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
1056 Record.AddStmt(E->getSubExpr());
1057
1059 PI = E->path_begin(), PE = E->path_end(); PI != PE; ++PI)
1060 Record.AddCXXBaseSpecifier(**PI);
1061
1062 if (E->hasStoredFPFeatures())
1063 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
1064}
1065
1066void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
1067 VisitExpr(E);
1068
1069 // Write this first for easy access when deserializing, as they affect the
1070 // size of the UnaryOperator.
1071 CurrentPackingBits.updateBits();
1072 CurrentPackingBits.addBits(E->getOpcode(), /*Width=*/6);
1073 bool HasFPFeatures = E->hasStoredFPFeatures();
1074 CurrentPackingBits.addBit(HasFPFeatures);
1075 CurrentPackingBits.addBit(E->hasExcludedOverflowPattern());
1076 Record.AddStmt(E->getLHS());
1077 Record.AddStmt(E->getRHS());
1078 Record.AddSourceLocation(E->getOperatorLoc());
1079 if (HasFPFeatures)
1080 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1081
1082 if (!HasFPFeatures && E->getValueKind() == VK_PRValue &&
1084 AbbrevToUse = Writer.getBinaryOperatorAbbrev();
1085
1087}
1088
1089void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1090 VisitBinaryOperator(E);
1091 Record.AddTypeRef(E->getComputationLHSType());
1092 Record.AddTypeRef(E->getComputationResultType());
1093
1094 if (!E->hasStoredFPFeatures() && E->getValueKind() == VK_PRValue &&
1096 AbbrevToUse = Writer.getCompoundAssignOperatorAbbrev();
1097
1099}
1100
1101void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
1102 VisitExpr(E);
1103 Record.AddStmt(E->getCond());
1104 Record.AddStmt(E->getLHS());
1105 Record.AddStmt(E->getRHS());
1106 Record.AddSourceLocation(E->getQuestionLoc());
1107 Record.AddSourceLocation(E->getColonLoc());
1109}
1110
1111void
1112ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1113 VisitExpr(E);
1114 Record.AddStmt(E->getOpaqueValue());
1115 Record.AddStmt(E->getCommon());
1116 Record.AddStmt(E->getCond());
1117 Record.AddStmt(E->getTrueExpr());
1118 Record.AddStmt(E->getFalseExpr());
1119 Record.AddSourceLocation(E->getQuestionLoc());
1120 Record.AddSourceLocation(E->getColonLoc());
1122}
1123
1124void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1125 VisitCastExpr(E);
1126 CurrentPackingBits.addBit(E->isPartOfExplicitCast());
1127
1128 if (E->path_size() == 0 && !E->hasStoredFPFeatures())
1129 AbbrevToUse = Writer.getExprImplicitCastAbbrev();
1130
1132}
1133
1134void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1135 VisitCastExpr(E);
1136 Record.AddTypeSourceInfo(E->getTypeInfoAsWritten());
1137}
1138
1139void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
1140 VisitExplicitCastExpr(E);
1141 Record.AddSourceLocation(E->getLParenLoc());
1142 Record.AddSourceLocation(E->getRParenLoc());
1144}
1145
1146void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1147 VisitExpr(E);
1148 Record.AddSourceLocation(E->getLParenLoc());
1149 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1150 Record.AddStmt(E->getInitializer());
1151 Record.push_back(E->isFileScope());
1153}
1154
1155void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1156 VisitExpr(E);
1157 Record.AddStmt(E->getBase());
1158 Record.AddIdentifierRef(&E->getAccessor());
1159 Record.AddSourceLocation(E->getAccessorLoc());
1161}
1162
1163void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
1164 VisitExpr(E);
1165 // NOTE: only add the (possibly null) syntactic form.
1166 // No need to serialize the isSemanticForm flag and the semantic form.
1167 Record.AddStmt(E->getSyntacticForm());
1168 Record.AddSourceLocation(E->getLBraceLoc());
1169 Record.AddSourceLocation(E->getRBraceLoc());
1170 bool isArrayFiller = isa<Expr *>(E->ArrayFillerOrUnionFieldInit);
1171 Record.push_back(isArrayFiller);
1172 if (isArrayFiller)
1173 Record.AddStmt(E->getArrayFiller());
1174 else
1175 Record.AddDeclRef(E->getInitializedFieldInUnion());
1176 Record.push_back(E->hadArrayRangeDesignator());
1177 Record.push_back(E->getNumInits());
1178 if (isArrayFiller) {
1179 // ArrayFiller may have filled "holes" due to designated initializer.
1180 // Replace them by 0 to indicate that the filler goes in that place.
1181 Expr *filler = E->getArrayFiller();
1182 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1183 Record.AddStmt(E->getInit(I) != filler ? E->getInit(I) : nullptr);
1184 } else {
1185 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1186 Record.AddStmt(E->getInit(I));
1187 }
1189}
1190
1191void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1192 VisitExpr(E);
1193 Record.push_back(E->getNumSubExprs());
1194 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1195 Record.AddStmt(E->getSubExpr(I));
1196 Record.AddSourceLocation(E->getEqualOrColonLoc());
1197 Record.push_back(E->usesGNUSyntax());
1198 for (const DesignatedInitExpr::Designator &D : E->designators()) {
1199 if (D.isFieldDesignator()) {
1200 if (FieldDecl *Field = D.getFieldDecl()) {
1202 Record.AddDeclRef(Field);
1203 } else {
1205 Record.AddIdentifierRef(D.getFieldName());
1206 }
1207 Record.AddSourceLocation(D.getDotLoc());
1208 Record.AddSourceLocation(D.getFieldLoc());
1209 } else if (D.isArrayDesignator()) {
1211 Record.push_back(D.getArrayIndex());
1212 Record.AddSourceLocation(D.getLBracketLoc());
1213 Record.AddSourceLocation(D.getRBracketLoc());
1214 } else {
1215 assert(D.isArrayRangeDesignator() && "Unknown designator");
1217 Record.push_back(D.getArrayIndex());
1218 Record.AddSourceLocation(D.getLBracketLoc());
1219 Record.AddSourceLocation(D.getEllipsisLoc());
1220 Record.AddSourceLocation(D.getRBracketLoc());
1221 }
1222 }
1224}
1225
1226void ASTStmtWriter::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1227 VisitExpr(E);
1228 Record.AddStmt(E->getBase());
1229 Record.AddStmt(E->getUpdater());
1231}
1232
1233void ASTStmtWriter::VisitNoInitExpr(NoInitExpr *E) {
1234 VisitExpr(E);
1236}
1237
1238void ASTStmtWriter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1239 VisitExpr(E);
1240 Record.AddStmt(E->SubExprs[0]);
1241 Record.AddStmt(E->SubExprs[1]);
1243}
1244
1245void ASTStmtWriter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1246 VisitExpr(E);
1248}
1249
1250void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1251 VisitExpr(E);
1253}
1254
1255void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
1256 VisitExpr(E);
1257 Record.AddStmt(E->getSubExpr());
1258 Record.AddTypeSourceInfo(E->getWrittenTypeInfo());
1259 Record.AddSourceLocation(E->getBuiltinLoc());
1260 Record.AddSourceLocation(E->getRParenLoc());
1261 Record.push_back(E->isMicrosoftABI());
1263}
1264
1265void ASTStmtWriter::VisitSourceLocExpr(SourceLocExpr *E) {
1266 VisitExpr(E);
1267 Record.AddDeclRef(cast_or_null<Decl>(E->getParentContext()));
1268 Record.AddSourceLocation(E->getBeginLoc());
1269 Record.AddSourceLocation(E->getEndLoc());
1270 Record.push_back(llvm::to_underlying(E->getIdentKind()));
1272}
1273
1274void ASTStmtWriter::VisitEmbedExpr(EmbedExpr *E) {
1275 VisitExpr(E);
1276 Record.AddSourceLocation(E->getBeginLoc());
1277 Record.AddSourceLocation(E->getEndLoc());
1278 Record.AddStmt(E->getDataStringLiteral());
1279 Record.writeUInt32(E->getStartingElementPos());
1280 Record.writeUInt32(E->getDataElementCount());
1282}
1283
1284void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
1285 VisitExpr(E);
1286 Record.AddSourceLocation(E->getAmpAmpLoc());
1287 Record.AddSourceLocation(E->getLabelLoc());
1288 Record.AddDeclRef(E->getLabel());
1290}
1291
1292void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
1293 VisitExpr(E);
1294 Record.AddStmt(E->getSubStmt());
1295 Record.AddSourceLocation(E->getLParenLoc());
1296 Record.AddSourceLocation(E->getRParenLoc());
1297 Record.push_back(E->getTemplateDepth());
1299}
1300
1301void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
1302 VisitExpr(E);
1303 Record.AddStmt(E->getCond());
1304 Record.AddStmt(E->getLHS());
1305 Record.AddStmt(E->getRHS());
1306 Record.AddSourceLocation(E->getBuiltinLoc());
1307 Record.AddSourceLocation(E->getRParenLoc());
1308 Record.push_back(E->isConditionDependent() ? false : E->isConditionTrue());
1310}
1311
1312void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
1313 VisitExpr(E);
1314 Record.AddSourceLocation(E->getTokenLocation());
1316}
1317
1318void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1319 VisitExpr(E);
1320 Record.push_back(E->getNumSubExprs());
1321 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1322 Record.AddStmt(E->getExpr(I));
1323 Record.AddSourceLocation(E->getBuiltinLoc());
1324 Record.AddSourceLocation(E->getRParenLoc());
1326}
1327
1328void ASTStmtWriter::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1329 VisitExpr(E);
1330 Record.AddSourceLocation(E->getBuiltinLoc());
1331 Record.AddSourceLocation(E->getRParenLoc());
1332 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1333 Record.AddStmt(E->getSrcExpr());
1335}
1336
1337void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
1338 VisitExpr(E);
1339 Record.AddDeclRef(E->getBlockDecl());
1341}
1342
1343void ASTStmtWriter::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1344 VisitExpr(E);
1345
1346 Record.push_back(E->getNumAssocs());
1347 Record.push_back(E->isExprPredicate());
1348 Record.push_back(E->ResultIndex);
1349 Record.AddSourceLocation(E->getGenericLoc());
1350 Record.AddSourceLocation(E->getDefaultLoc());
1351 Record.AddSourceLocation(E->getRParenLoc());
1352
1353 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1354 // Add 1 to account for the controlling expression which is the first
1355 // expression in the trailing array of Stmt *. This is not needed for
1356 // the trailing array of TypeSourceInfo *.
1357 for (unsigned I = 0, N = E->getNumAssocs() + 1; I < N; ++I)
1358 Record.AddStmt(Stmts[I]);
1359
1360 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1361 for (unsigned I = 0, N = E->getNumAssocs(); I < N; ++I)
1362 Record.AddTypeSourceInfo(TSIs[I]);
1363
1365}
1366
1367void ASTStmtWriter::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1368 VisitExpr(E);
1369 Record.push_back(E->getNumSemanticExprs());
1370
1371 // Push the result index. Currently, this needs to exactly match
1372 // the encoding used internally for ResultIndex.
1373 unsigned result = E->getResultExprIndex();
1374 result = (result == PseudoObjectExpr::NoResult ? 0 : result + 1);
1375 Record.push_back(result);
1376
1377 Record.AddStmt(E->getSyntacticForm());
1379 i = E->semantics_begin(), e = E->semantics_end(); i != e; ++i) {
1380 Record.AddStmt(*i);
1381 }
1383}
1384
1385void ASTStmtWriter::VisitAtomicExpr(AtomicExpr *E) {
1386 VisitExpr(E);
1387 Record.push_back(E->getOp());
1388 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1389 Record.AddStmt(E->getSubExprs()[I]);
1390 Record.AddSourceLocation(E->getBuiltinLoc());
1391 Record.AddSourceLocation(E->getRParenLoc());
1393}
1394
1395//===----------------------------------------------------------------------===//
1396// Objective-C Expressions and Statements.
1397//===----------------------------------------------------------------------===//
1398
1399void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1400 VisitExpr(E);
1401 Record.AddStmt(E->getString());
1402 Record.AddSourceLocation(E->getAtLoc());
1404}
1405
1406void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1407 VisitExpr(E);
1408 Record.AddStmt(E->getSubExpr());
1409 Record.AddDeclRef(E->getBoxingMethod());
1410 Record.AddSourceRange(E->getSourceRange());
1412}
1413
1414void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1415 VisitExpr(E);
1416 Record.push_back(E->getNumElements());
1417 for (unsigned i = 0; i < E->getNumElements(); i++)
1418 Record.AddStmt(E->getElement(i));
1419 Record.AddDeclRef(E->getArrayWithObjectsMethod());
1420 Record.AddSourceRange(E->getSourceRange());
1422}
1423
1424void ASTStmtWriter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1425 VisitExpr(E);
1426 Record.push_back(E->getNumElements());
1427 Record.push_back(E->HasPackExpansions);
1428 for (unsigned i = 0; i < E->getNumElements(); i++) {
1429 ObjCDictionaryElement Element = E->getKeyValueElement(i);
1430 Record.AddStmt(Element.Key);
1431 Record.AddStmt(Element.Value);
1432 if (E->HasPackExpansions) {
1433 Record.AddSourceLocation(Element.EllipsisLoc);
1434 unsigned NumExpansions = 0;
1435 if (Element.NumExpansions)
1436 NumExpansions = *Element.NumExpansions + 1;
1437 Record.push_back(NumExpansions);
1438 }
1439 }
1440
1441 Record.AddDeclRef(E->getDictWithObjectsMethod());
1442 Record.AddSourceRange(E->getSourceRange());
1444}
1445
1446void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1447 VisitExpr(E);
1448 Record.AddTypeSourceInfo(E->getEncodedTypeSourceInfo());
1449 Record.AddSourceLocation(E->getAtLoc());
1450 Record.AddSourceLocation(E->getRParenLoc());
1452}
1453
1454void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1455 VisitExpr(E);
1456 Record.AddSelectorRef(E->getSelector());
1457 Record.AddSourceLocation(E->getAtLoc());
1458 Record.AddSourceLocation(E->getRParenLoc());
1460}
1461
1462void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1463 VisitExpr(E);
1464 Record.AddDeclRef(E->getProtocol());
1465 Record.AddSourceLocation(E->getAtLoc());
1466 Record.AddSourceLocation(E->ProtoLoc);
1467 Record.AddSourceLocation(E->getRParenLoc());
1469}
1470
1471void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1472 VisitExpr(E);
1473 Record.AddDeclRef(E->getDecl());
1474 Record.AddSourceLocation(E->getLocation());
1475 Record.AddSourceLocation(E->getOpLoc());
1476 Record.AddStmt(E->getBase());
1477 Record.push_back(E->isArrow());
1478 Record.push_back(E->isFreeIvar());
1480}
1481
1482void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1483 VisitExpr(E);
1484 Record.push_back(E->SetterAndMethodRefFlags.getInt());
1485 Record.push_back(E->isImplicitProperty());
1486 if (E->isImplicitProperty()) {
1487 Record.AddDeclRef(E->getImplicitPropertyGetter());
1488 Record.AddDeclRef(E->getImplicitPropertySetter());
1489 } else {
1490 Record.AddDeclRef(E->getExplicitProperty());
1491 }
1492 Record.AddSourceLocation(E->getLocation());
1493 Record.AddSourceLocation(E->getReceiverLocation());
1494 if (E->isObjectReceiver()) {
1495 Record.push_back(0);
1496 Record.AddStmt(E->getBase());
1497 } else if (E->isSuperReceiver()) {
1498 Record.push_back(1);
1499 Record.AddTypeRef(E->getSuperReceiverType());
1500 } else {
1501 Record.push_back(2);
1502 Record.AddDeclRef(E->getClassReceiver());
1503 }
1504
1506}
1507
1508void ASTStmtWriter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1509 VisitExpr(E);
1510 Record.AddSourceLocation(E->getRBracket());
1511 Record.AddStmt(E->getBaseExpr());
1512 Record.AddStmt(E->getKeyExpr());
1513 Record.AddDeclRef(E->getAtIndexMethodDecl());
1514 Record.AddDeclRef(E->setAtIndexMethodDecl());
1515
1517}
1518
1519void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1520 VisitExpr(E);
1521 Record.push_back(E->getNumArgs());
1522 Record.push_back(E->getNumStoredSelLocs());
1523 Record.push_back(E->SelLocsKind);
1524 Record.push_back(E->isDelegateInitCall());
1525 Record.push_back(E->IsImplicit);
1526 Record.push_back((unsigned)E->getReceiverKind()); // FIXME: stable encoding
1527 switch (E->getReceiverKind()) {
1529 Record.AddStmt(E->getInstanceReceiver());
1530 break;
1531
1533 Record.AddTypeSourceInfo(E->getClassReceiverTypeInfo());
1534 break;
1535
1538 Record.AddTypeRef(E->getSuperType());
1539 Record.AddSourceLocation(E->getSuperLoc());
1540 break;
1541 }
1542
1543 if (E->getMethodDecl()) {
1544 Record.push_back(1);
1545 Record.AddDeclRef(E->getMethodDecl());
1546 } else {
1547 Record.push_back(0);
1548 Record.AddSelectorRef(E->getSelector());
1549 }
1550
1551 Record.AddSourceLocation(E->getLeftLoc());
1552 Record.AddSourceLocation(E->getRightLoc());
1553
1554 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
1555 Arg != ArgEnd; ++Arg)
1556 Record.AddStmt(*Arg);
1557
1558 SourceLocation *Locs = E->getStoredSelLocs();
1559 for (unsigned i = 0, e = E->getNumStoredSelLocs(); i != e; ++i)
1560 Record.AddSourceLocation(Locs[i]);
1561
1563}
1564
1565void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1566 VisitStmt(S);
1567 Record.AddStmt(S->getElement());
1568 Record.AddStmt(S->getCollection());
1569 Record.AddStmt(S->getBody());
1570 Record.AddSourceLocation(S->getForLoc());
1571 Record.AddSourceLocation(S->getRParenLoc());
1573}
1574
1575void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1576 VisitStmt(S);
1577 Record.AddStmt(S->getCatchBody());
1578 Record.AddDeclRef(S->getCatchParamDecl());
1579 Record.AddSourceLocation(S->getAtCatchLoc());
1580 Record.AddSourceLocation(S->getRParenLoc());
1582}
1583
1584void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1585 VisitStmt(S);
1586 Record.AddStmt(S->getFinallyBody());
1587 Record.AddSourceLocation(S->getAtFinallyLoc());
1589}
1590
1591void ASTStmtWriter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1592 VisitStmt(S); // FIXME: no test coverage.
1593 Record.AddStmt(S->getSubStmt());
1594 Record.AddSourceLocation(S->getAtLoc());
1596}
1597
1598void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1599 VisitStmt(S);
1600 Record.push_back(S->getNumCatchStmts());
1601 Record.push_back(S->getFinallyStmt() != nullptr);
1602 Record.AddStmt(S->getTryBody());
1603 for (ObjCAtCatchStmt *C : S->catch_stmts())
1604 Record.AddStmt(C);
1605 if (S->getFinallyStmt())
1606 Record.AddStmt(S->getFinallyStmt());
1607 Record.AddSourceLocation(S->getAtTryLoc());
1609}
1610
1611void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1612 VisitStmt(S); // FIXME: no test coverage.
1613 Record.AddStmt(S->getSynchExpr());
1614 Record.AddStmt(S->getSynchBody());
1615 Record.AddSourceLocation(S->getAtSynchronizedLoc());
1617}
1618
1619void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1620 VisitStmt(S); // FIXME: no test coverage.
1621 Record.AddStmt(S->getThrowExpr());
1622 Record.AddSourceLocation(S->getThrowLoc());
1624}
1625
1626void ASTStmtWriter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1627 VisitExpr(E);
1628 Record.push_back(E->getValue());
1629 Record.AddSourceLocation(E->getLocation());
1631}
1632
1633void ASTStmtWriter::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1634 VisitExpr(E);
1635 Record.AddSourceRange(E->getSourceRange());
1636 Record.AddVersionTuple(E->getVersion());
1638}
1639
1640//===----------------------------------------------------------------------===//
1641// C++ Expressions and Statements.
1642//===----------------------------------------------------------------------===//
1643
1644void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
1645 VisitStmt(S);
1646 Record.AddSourceLocation(S->getCatchLoc());
1647 Record.AddDeclRef(S->getExceptionDecl());
1648 Record.AddStmt(S->getHandlerBlock());
1650}
1651
1652void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
1653 VisitStmt(S);
1654 Record.push_back(S->getNumHandlers());
1655 Record.AddSourceLocation(S->getTryLoc());
1656 Record.AddStmt(S->getTryBlock());
1657 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1658 Record.AddStmt(S->getHandler(i));
1660}
1661
1662void ASTStmtWriter::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1663 VisitStmt(S);
1664 Record.AddSourceLocation(S->getForLoc());
1665 Record.AddSourceLocation(S->getCoawaitLoc());
1666 Record.AddSourceLocation(S->getColonLoc());
1667 Record.AddSourceLocation(S->getRParenLoc());
1668 Record.AddStmt(S->getInit());
1669 Record.AddStmt(S->getRangeStmt());
1670 Record.AddStmt(S->getBeginStmt());
1671 Record.AddStmt(S->getEndStmt());
1672 Record.AddStmt(S->getCond());
1673 Record.AddStmt(S->getInc());
1674 Record.AddStmt(S->getLoopVarStmt());
1675 Record.AddStmt(S->getBody());
1677}
1678
1679void ASTStmtWriter::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1680 VisitStmt(S);
1681 Record.AddSourceLocation(S->getKeywordLoc());
1682 Record.push_back(S->isIfExists());
1683 Record.AddNestedNameSpecifierLoc(S->getQualifierLoc());
1684 Record.AddDeclarationNameInfo(S->getNameInfo());
1685 Record.AddStmt(S->getSubStmt());
1687}
1688
1689void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1690 VisitCallExpr(E);
1691 Record.push_back(E->getOperator());
1692 Record.AddSourceRange(E->Range);
1693
1694 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()))
1695 AbbrevToUse = Writer.getCXXOperatorCallExprAbbrev();
1696
1698}
1699
1700void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1701 VisitCallExpr(E);
1702
1703 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()))
1704 AbbrevToUse = Writer.getCXXMemberCallExprAbbrev();
1705
1707}
1708
1709void ASTStmtWriter::VisitCXXRewrittenBinaryOperator(
1711 VisitExpr(E);
1712 Record.push_back(E->isReversed());
1713 Record.AddStmt(E->getSemanticForm());
1715}
1716
1717void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
1718 VisitExpr(E);
1719
1720 Record.push_back(E->getNumArgs());
1721 Record.push_back(E->isElidable());
1722 Record.push_back(E->hadMultipleCandidates());
1723 Record.push_back(E->isListInitialization());
1724 Record.push_back(E->isStdInitListInitialization());
1725 Record.push_back(E->requiresZeroInitialization());
1726 Record.push_back(
1727 llvm::to_underlying(E->getConstructionKind())); // FIXME: stable encoding
1728 Record.push_back(E->isImmediateEscalating());
1729 Record.AddSourceLocation(E->getLocation());
1730 Record.AddDeclRef(E->getConstructor());
1731 Record.AddSourceRange(E->getParenOrBraceRange());
1732
1733 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1734 Record.AddStmt(E->getArg(I));
1735
1737}
1738
1739void ASTStmtWriter::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1740 VisitExpr(E);
1741 Record.AddDeclRef(E->getConstructor());
1742 Record.AddSourceLocation(E->getLocation());
1743 Record.push_back(E->constructsVBase());
1744 Record.push_back(E->inheritedFromVBase());
1746}
1747
1748void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1749 VisitCXXConstructExpr(E);
1750 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1752}
1753
1754void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) {
1755 VisitExpr(E);
1756 Record.push_back(E->LambdaExprBits.NumCaptures);
1757 Record.AddSourceRange(E->IntroducerRange);
1758 Record.push_back(E->LambdaExprBits.CaptureDefault); // FIXME: stable encoding
1759 Record.AddSourceLocation(E->CaptureDefaultLoc);
1760 Record.push_back(E->LambdaExprBits.ExplicitParams);
1761 Record.push_back(E->LambdaExprBits.ExplicitResultType);
1762 Record.AddSourceLocation(E->ClosingBrace);
1763
1764 // Add capture initializers.
1765 for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
1766 CEnd = E->capture_init_end();
1767 C != CEnd; ++C) {
1768 Record.AddStmt(*C);
1769 }
1770
1771 // Don't serialize the body. It belongs to the call operator declaration.
1772 // LambdaExpr only stores a copy of the Stmt *.
1773
1775}
1776
1777void ASTStmtWriter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1778 VisitExpr(E);
1779 Record.AddStmt(E->getSubExpr());
1781}
1782
1783void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1784 VisitExplicitCastExpr(E);
1785 Record.AddSourceRange(SourceRange(E->getOperatorLoc(), E->getRParenLoc()));
1786 CurrentPackingBits.addBit(E->getAngleBrackets().isValid());
1787 if (E->getAngleBrackets().isValid())
1788 Record.AddSourceRange(E->getAngleBrackets());
1789}
1790
1791void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1792 VisitCXXNamedCastExpr(E);
1794}
1795
1796void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1797 VisitCXXNamedCastExpr(E);
1799}
1800
1801void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1802 VisitCXXNamedCastExpr(E);
1804}
1805
1806void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1807 VisitCXXNamedCastExpr(E);
1809}
1810
1811void ASTStmtWriter::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1812 VisitCXXNamedCastExpr(E);
1814}
1815
1816void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1817 VisitExplicitCastExpr(E);
1818 Record.AddSourceLocation(E->getLParenLoc());
1819 Record.AddSourceLocation(E->getRParenLoc());
1821}
1822
1823void ASTStmtWriter::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1824 VisitExplicitCastExpr(E);
1825 Record.AddSourceLocation(E->getBeginLoc());
1826 Record.AddSourceLocation(E->getEndLoc());
1828}
1829
1830void ASTStmtWriter::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1831 VisitCallExpr(E);
1832 Record.AddSourceLocation(E->UDSuffixLoc);
1834}
1835
1836void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1837 VisitExpr(E);
1838 Record.push_back(E->getValue());
1839 Record.AddSourceLocation(E->getLocation());
1841}
1842
1843void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1844 VisitExpr(E);
1845 Record.AddSourceLocation(E->getLocation());
1847}
1848
1849void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1850 VisitExpr(E);
1851 Record.AddSourceRange(E->getSourceRange());
1852 if (E->isTypeOperand()) {
1853 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
1855 } else {
1856 Record.AddStmt(E->getExprOperand());
1858 }
1859}
1860
1861void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
1862 VisitExpr(E);
1863 Record.AddSourceLocation(E->getLocation());
1864 Record.push_back(E->isImplicit());
1865 Record.push_back(E->isCapturedByCopyInLambdaWithExplicitObjectParameter());
1866
1868}
1869
1870void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
1871 VisitExpr(E);
1872 Record.AddSourceLocation(E->getThrowLoc());
1873 Record.AddStmt(E->getSubExpr());
1874 Record.push_back(E->isThrownVariableInScope());
1876}
1877
1878void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1879 VisitExpr(E);
1880 Record.AddDeclRef(E->getParam());
1881 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1882 Record.AddSourceLocation(E->getUsedLocation());
1883 Record.push_back(E->hasRewrittenInit());
1884 if (E->hasRewrittenInit())
1885 Record.AddStmt(E->getRewrittenExpr());
1887}
1888
1889void ASTStmtWriter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1890 VisitExpr(E);
1891 Record.push_back(E->hasRewrittenInit());
1892 Record.AddDeclRef(E->getField());
1893 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1894 Record.AddSourceLocation(E->getExprLoc());
1895 if (E->hasRewrittenInit())
1896 Record.AddStmt(E->getRewrittenExpr());
1898}
1899
1900void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1901 VisitExpr(E);
1902 Record.AddCXXTemporary(E->getTemporary());
1903 Record.AddStmt(E->getSubExpr());
1905}
1906
1907void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1908 VisitExpr(E);
1909 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1910 Record.AddSourceLocation(E->getRParenLoc());
1912}
1913
1914void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
1915 VisitExpr(E);
1916
1917 Record.push_back(E->isArray());
1918 Record.push_back(E->hasInitializer());
1919 Record.push_back(E->getNumPlacementArgs());
1920 Record.push_back(E->isParenTypeId());
1921
1922 Record.push_back(E->isGlobalNew());
1923 Record.push_back(E->passAlignment());
1924 Record.push_back(E->doesUsualArrayDeleteWantSize());
1925 Record.push_back(E->CXXNewExprBits.HasInitializer);
1926 Record.push_back(E->CXXNewExprBits.StoredInitializationStyle);
1927
1928 Record.AddDeclRef(E->getOperatorNew());
1929 Record.AddDeclRef(E->getOperatorDelete());
1930 Record.AddTypeSourceInfo(E->getAllocatedTypeSourceInfo());
1931 if (E->isParenTypeId())
1932 Record.AddSourceRange(E->getTypeIdParens());
1933 Record.AddSourceRange(E->getSourceRange());
1934 Record.AddSourceRange(E->getDirectInitRange());
1935
1936 for (CXXNewExpr::arg_iterator I = E->raw_arg_begin(), N = E->raw_arg_end();
1937 I != N; ++I)
1938 Record.AddStmt(*I);
1939
1941}
1942
1943void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1944 VisitExpr(E);
1945 Record.push_back(E->isGlobalDelete());
1946 Record.push_back(E->isArrayForm());
1947 Record.push_back(E->isArrayFormAsWritten());
1948 Record.push_back(E->doesUsualArrayDeleteWantSize());
1949 Record.AddDeclRef(E->getOperatorDelete());
1950 Record.AddStmt(E->getArgument());
1951 Record.AddSourceLocation(E->getBeginLoc());
1952
1954}
1955
1956void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1957 VisitExpr(E);
1958
1959 Record.AddStmt(E->getBase());
1960 Record.push_back(E->isArrow());
1961 Record.AddSourceLocation(E->getOperatorLoc());
1962 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1963 Record.AddTypeSourceInfo(E->getScopeTypeInfo());
1964 Record.AddSourceLocation(E->getColonColonLoc());
1965 Record.AddSourceLocation(E->getTildeLoc());
1966
1967 // PseudoDestructorTypeStorage.
1968 Record.AddIdentifierRef(E->getDestroyedTypeIdentifier());
1969 if (E->getDestroyedTypeIdentifier())
1970 Record.AddSourceLocation(E->getDestroyedTypeLoc());
1971 else
1972 Record.AddTypeSourceInfo(E->getDestroyedTypeInfo());
1973
1975}
1976
1977void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) {
1978 VisitExpr(E);
1979 Record.push_back(E->getNumObjects());
1980 for (auto &Obj : E->getObjects()) {
1981 if (auto *BD = Obj.dyn_cast<BlockDecl *>()) {
1983 Record.AddDeclRef(BD);
1984 } else if (auto *CLE = Obj.dyn_cast<CompoundLiteralExpr *>()) {
1986 Record.AddStmt(CLE);
1987 }
1988 }
1989
1990 Record.push_back(E->cleanupsHaveSideEffects());
1991 Record.AddStmt(E->getSubExpr());
1993}
1994
1995void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
1997 VisitExpr(E);
1998
1999 // Don't emit anything here (or if you do you will have to update
2000 // the corresponding deserialization function).
2001 Record.push_back(E->getNumTemplateArgs());
2002 CurrentPackingBits.updateBits();
2003 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2004 CurrentPackingBits.addBit(E->hasFirstQualifierFoundInScope());
2005
2006 if (E->hasTemplateKWAndArgsInfo()) {
2007 const ASTTemplateKWAndArgsInfo &ArgInfo =
2008 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2010 E->getTrailingObjects<TemplateArgumentLoc>());
2011 }
2012
2013 CurrentPackingBits.addBit(E->isArrow());
2014
2015 Record.AddTypeRef(E->getBaseType());
2016 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2017 CurrentPackingBits.addBit(!E->isImplicitAccess());
2018 if (!E->isImplicitAccess())
2019 Record.AddStmt(E->getBase());
2020
2021 Record.AddSourceLocation(E->getOperatorLoc());
2022
2023 if (E->hasFirstQualifierFoundInScope())
2024 Record.AddDeclRef(E->getFirstQualifierFoundInScope());
2025
2026 Record.AddDeclarationNameInfo(E->MemberNameInfo);
2028}
2029
2030void
2031ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2032 VisitExpr(E);
2033
2034 // Don't emit anything here, HasTemplateKWAndArgsInfo must be
2035 // emitted first.
2036 CurrentPackingBits.addBit(
2037 E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
2038
2039 if (E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo) {
2040 const ASTTemplateKWAndArgsInfo &ArgInfo =
2041 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2042 // 16 bits should be enought to store the number of args
2043 CurrentPackingBits.addBits(ArgInfo.NumTemplateArgs, /*Width=*/16);
2045 E->getTrailingObjects<TemplateArgumentLoc>());
2046 }
2047
2048 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2049 Record.AddDeclarationNameInfo(E->NameInfo);
2051}
2052
2053void
2054ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2055 VisitExpr(E);
2056 Record.push_back(E->getNumArgs());
2058 ArgI = E->arg_begin(), ArgE = E->arg_end(); ArgI != ArgE; ++ArgI)
2059 Record.AddStmt(*ArgI);
2060 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
2061 Record.AddSourceLocation(E->getLParenLoc());
2062 Record.AddSourceLocation(E->getRParenLoc());
2063 Record.push_back(E->isListInitialization());
2065}
2066
2067void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
2068 VisitExpr(E);
2069
2070 Record.push_back(E->getNumDecls());
2071
2072 CurrentPackingBits.updateBits();
2073 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2074 if (E->hasTemplateKWAndArgsInfo()) {
2075 const ASTTemplateKWAndArgsInfo &ArgInfo =
2076 *E->getTrailingASTTemplateKWAndArgsInfo();
2077 Record.push_back(ArgInfo.NumTemplateArgs);
2078 AddTemplateKWAndArgsInfo(ArgInfo, E->getTrailingTemplateArgumentLoc());
2079 }
2080
2081 for (OverloadExpr::decls_iterator OvI = E->decls_begin(),
2082 OvE = E->decls_end();
2083 OvI != OvE; ++OvI) {
2084 Record.AddDeclRef(OvI.getDecl());
2085 Record.push_back(OvI.getAccess());
2086 }
2087
2088 Record.AddDeclarationNameInfo(E->getNameInfo());
2089 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2090}
2091
2092void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2093 VisitOverloadExpr(E);
2094 CurrentPackingBits.addBit(E->isArrow());
2095 CurrentPackingBits.addBit(E->hasUnresolvedUsing());
2096 CurrentPackingBits.addBit(!E->isImplicitAccess());
2097 if (!E->isImplicitAccess())
2098 Record.AddStmt(E->getBase());
2099
2100 Record.AddSourceLocation(E->getOperatorLoc());
2101
2102 Record.AddTypeRef(E->getBaseType());
2104}
2105
2106void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2107 VisitOverloadExpr(E);
2108 CurrentPackingBits.addBit(E->requiresADL());
2109 Record.AddDeclRef(E->getNamingClass());
2111
2112 if (Writer.isWritingStdCXXNamedModules() && Writer.getChain()) {
2113 // Referencing all the possible declarations to make sure the change get
2114 // propagted.
2115 DeclarationName Name = E->getName();
2116 for (auto *Found :
2117 Record.getASTContext().getTranslationUnitDecl()->lookup(Name))
2118 if (Found->isFromASTFile())
2119 Writer.GetDeclRef(Found);
2120
2122 Writer.getChain()->ReadKnownNamespaces(ExternalNSs);
2123 for (auto *NS : ExternalNSs)
2124 for (auto *Found : NS->lookup(Name))
2125 Writer.GetDeclRef(Found);
2126 }
2127}
2128
2129void ASTStmtWriter::VisitTypeTraitExpr(TypeTraitExpr *E) {
2130 VisitExpr(E);
2131 Record.push_back(E->TypeTraitExprBits.NumArgs);
2132 Record.push_back(E->TypeTraitExprBits.Kind); // FIXME: Stable encoding
2133 Record.push_back(E->TypeTraitExprBits.Value);
2134 Record.AddSourceRange(E->getSourceRange());
2135 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2136 Record.AddTypeSourceInfo(E->getArg(I));
2138}
2139
2140void ASTStmtWriter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2141 VisitExpr(E);
2142 Record.push_back(E->getTrait());
2143 Record.push_back(E->getValue());
2144 Record.AddSourceRange(E->getSourceRange());
2145 Record.AddTypeSourceInfo(E->getQueriedTypeSourceInfo());
2146 Record.AddStmt(E->getDimensionExpression());
2148}
2149
2150void ASTStmtWriter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2151 VisitExpr(E);
2152 Record.push_back(E->getTrait());
2153 Record.push_back(E->getValue());
2154 Record.AddSourceRange(E->getSourceRange());
2155 Record.AddStmt(E->getQueriedExpression());
2157}
2158
2159void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2160 VisitExpr(E);
2161 Record.push_back(E->getValue());
2162 Record.AddSourceRange(E->getSourceRange());
2163 Record.AddStmt(E->getOperand());
2165}
2166
2167void ASTStmtWriter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2168 VisitExpr(E);
2169 Record.AddSourceLocation(E->getEllipsisLoc());
2170 Record.push_back(E->NumExpansions);
2171 Record.AddStmt(E->getPattern());
2173}
2174
2175void ASTStmtWriter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2176 VisitExpr(E);
2177 Record.push_back(E->isPartiallySubstituted() ? E->getPartialArguments().size()
2178 : 0);
2179 Record.AddSourceLocation(E->OperatorLoc);
2180 Record.AddSourceLocation(E->PackLoc);
2181 Record.AddSourceLocation(E->RParenLoc);
2182 Record.AddDeclRef(E->Pack);
2183 if (E->isPartiallySubstituted()) {
2184 for (const auto &TA : E->getPartialArguments())
2185 Record.AddTemplateArgument(TA);
2186 } else if (!E->isValueDependent()) {
2187 Record.push_back(E->getPackLength());
2188 }
2190}
2191
2192void ASTStmtWriter::VisitPackIndexingExpr(PackIndexingExpr *E) {
2193 VisitExpr(E);
2194 Record.push_back(E->TransformedExpressions);
2195 Record.push_back(E->FullySubstituted);
2196 Record.AddSourceLocation(E->getEllipsisLoc());
2197 Record.AddSourceLocation(E->getRSquareLoc());
2198 Record.AddStmt(E->getPackIdExpression());
2199 Record.AddStmt(E->getIndexExpr());
2200 for (Expr *Sub : E->getExpressions())
2201 Record.AddStmt(Sub);
2203}
2204
2205void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
2207 VisitExpr(E);
2208 Record.AddDeclRef(E->getAssociatedDecl());
2209 CurrentPackingBits.addBit(E->isReferenceParameter());
2210 CurrentPackingBits.addBits(E->getIndex(), /*Width=*/12);
2211 CurrentPackingBits.addBit((bool)E->getPackIndex());
2212 if (auto PackIndex = E->getPackIndex())
2213 Record.push_back(*PackIndex + 1);
2214
2215 Record.AddSourceLocation(E->getNameLoc());
2216 Record.AddStmt(E->getReplacement());
2218}
2219
2220void ASTStmtWriter::VisitSubstNonTypeTemplateParmPackExpr(
2222 VisitExpr(E);
2223 Record.AddDeclRef(E->getAssociatedDecl());
2224 Record.push_back(E->getIndex());
2225 Record.AddTemplateArgument(E->getArgumentPack());
2226 Record.AddSourceLocation(E->getParameterPackLocation());
2228}
2229
2230void ASTStmtWriter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2231 VisitExpr(E);
2232 Record.push_back(E->getNumExpansions());
2233 Record.AddDeclRef(E->getParameterPack());
2234 Record.AddSourceLocation(E->getParameterPackLocation());
2235 for (FunctionParmPackExpr::iterator I = E->begin(), End = E->end();
2236 I != End; ++I)
2237 Record.AddDeclRef(*I);
2239}
2240
2241void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2242 VisitExpr(E);
2243 Record.push_back(static_cast<bool>(E->getLifetimeExtendedTemporaryDecl()));
2244 if (E->getLifetimeExtendedTemporaryDecl())
2245 Record.AddDeclRef(E->getLifetimeExtendedTemporaryDecl());
2246 else
2247 Record.AddStmt(E->getSubExpr());
2249}
2250
2251void ASTStmtWriter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2252 VisitExpr(E);
2253 Record.AddSourceLocation(E->LParenLoc);
2254 Record.AddSourceLocation(E->EllipsisLoc);
2255 Record.AddSourceLocation(E->RParenLoc);
2256 Record.push_back(E->NumExpansions);
2257 Record.AddStmt(E->SubExprs[0]);
2258 Record.AddStmt(E->SubExprs[1]);
2259 Record.AddStmt(E->SubExprs[2]);
2260 Record.push_back(E->Opcode);
2262}
2263
2264void ASTStmtWriter::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2265 VisitExpr(E);
2266 ArrayRef<Expr *> InitExprs = E->getInitExprs();
2267 Record.push_back(InitExprs.size());
2268 Record.push_back(E->getUserSpecifiedInitExprs().size());
2269 Record.AddSourceLocation(E->getInitLoc());
2270 Record.AddSourceLocation(E->getBeginLoc());
2271 Record.AddSourceLocation(E->getEndLoc());
2272 for (Expr *InitExpr : E->getInitExprs())
2273 Record.AddStmt(InitExpr);
2274 Expr *ArrayFiller = E->getArrayFiller();
2275 FieldDecl *UnionField = E->getInitializedFieldInUnion();
2276 bool HasArrayFillerOrUnionDecl = ArrayFiller || UnionField;
2277 Record.push_back(HasArrayFillerOrUnionDecl);
2278 if (HasArrayFillerOrUnionDecl) {
2279 Record.push_back(static_cast<bool>(ArrayFiller));
2280 if (ArrayFiller)
2281 Record.AddStmt(ArrayFiller);
2282 else
2283 Record.AddDeclRef(UnionField);
2284 }
2286}
2287
2288void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2289 VisitExpr(E);
2290 Record.AddStmt(E->getSourceExpr());
2291 Record.AddSourceLocation(E->getLocation());
2292 Record.push_back(E->isUnique());
2294}
2295
2296void ASTStmtWriter::VisitTypoExpr(TypoExpr *E) {
2297 VisitExpr(E);
2298 // TODO: Figure out sane writer behavior for a TypoExpr, if necessary
2299 llvm_unreachable("Cannot write TypoExpr nodes");
2300}
2301
2302//===----------------------------------------------------------------------===//
2303// CUDA Expressions and Statements.
2304//===----------------------------------------------------------------------===//
2305
2306void ASTStmtWriter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2307 VisitCallExpr(E);
2308 Record.AddStmt(E->getConfig());
2310}
2311
2312//===----------------------------------------------------------------------===//
2313// OpenCL Expressions and Statements.
2314//===----------------------------------------------------------------------===//
2315void ASTStmtWriter::VisitAsTypeExpr(AsTypeExpr *E) {
2316 VisitExpr(E);
2317 Record.AddSourceLocation(E->getBuiltinLoc());
2318 Record.AddSourceLocation(E->getRParenLoc());
2319 Record.AddStmt(E->getSrcExpr());
2321}
2322
2323//===----------------------------------------------------------------------===//
2324// Microsoft Expressions and Statements.
2325//===----------------------------------------------------------------------===//
2326void ASTStmtWriter::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2327 VisitExpr(E);
2328 Record.push_back(E->isArrow());
2329 Record.AddStmt(E->getBaseExpr());
2330 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2331 Record.AddSourceLocation(E->getMemberLoc());
2332 Record.AddDeclRef(E->getPropertyDecl());
2334}
2335
2336void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2337 VisitExpr(E);
2338 Record.AddStmt(E->getBase());
2339 Record.AddStmt(E->getIdx());
2340 Record.AddSourceLocation(E->getRBracketLoc());
2342}
2343
2344void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2345 VisitExpr(E);
2346 Record.AddSourceRange(E->getSourceRange());
2347 Record.AddDeclRef(E->getGuidDecl());
2348 if (E->isTypeOperand()) {
2349 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
2351 } else {
2352 Record.AddStmt(E->getExprOperand());
2354 }
2355}
2356
2357void ASTStmtWriter::VisitSEHExceptStmt(SEHExceptStmt *S) {
2358 VisitStmt(S);
2359 Record.AddSourceLocation(S->getExceptLoc());
2360 Record.AddStmt(S->getFilterExpr());
2361 Record.AddStmt(S->getBlock());
2363}
2364
2365void ASTStmtWriter::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2366 VisitStmt(S);
2367 Record.AddSourceLocation(S->getFinallyLoc());
2368 Record.AddStmt(S->getBlock());
2370}
2371
2372void ASTStmtWriter::VisitSEHTryStmt(SEHTryStmt *S) {
2373 VisitStmt(S);
2374 Record.push_back(S->getIsCXXTry());
2375 Record.AddSourceLocation(S->getTryLoc());
2376 Record.AddStmt(S->getTryBlock());
2377 Record.AddStmt(S->getHandler());
2379}
2380
2381void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2382 VisitStmt(S);
2383 Record.AddSourceLocation(S->getLeaveLoc());
2385}
2386
2387//===----------------------------------------------------------------------===//
2388// OpenMP Directives.
2389//===----------------------------------------------------------------------===//
2390
2391void ASTStmtWriter::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2392 VisitStmt(S);
2393 for (Stmt *SubStmt : S->SubStmts)
2394 Record.AddStmt(SubStmt);
2396}
2397
2398void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2399 Record.writeOMPChildren(E->Data);
2400 Record.AddSourceLocation(E->getBeginLoc());
2401 Record.AddSourceLocation(E->getEndLoc());
2402}
2403
2404void ASTStmtWriter::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2405 VisitStmt(D);
2406 Record.writeUInt32(D->getLoopsNumber());
2407 VisitOMPExecutableDirective(D);
2408}
2409
2410void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) {
2411 VisitOMPLoopBasedDirective(D);
2412}
2413
2414void ASTStmtWriter::VisitOMPMetaDirective(OMPMetaDirective *D) {
2415 VisitStmt(D);
2416 Record.push_back(D->getNumClauses());
2417 VisitOMPExecutableDirective(D);
2419}
2420
2421void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) {
2422 VisitStmt(D);
2423 VisitOMPExecutableDirective(D);
2424 Record.writeBool(D->hasCancel());
2426}
2427
2428void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) {
2429 VisitOMPLoopDirective(D);
2431}
2432
2433void ASTStmtWriter::VisitOMPLoopTransformationDirective(
2435 VisitOMPLoopBasedDirective(D);
2436 Record.writeUInt32(D->getNumGeneratedLoops());
2437}
2438
2439void ASTStmtWriter::VisitOMPTileDirective(OMPTileDirective *D) {
2440 VisitOMPLoopTransformationDirective(D);
2442}
2443
2444void ASTStmtWriter::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2445 VisitOMPLoopTransformationDirective(D);
2447}
2448
2449void ASTStmtWriter::VisitOMPReverseDirective(OMPReverseDirective *D) {
2450 VisitOMPLoopTransformationDirective(D);
2452}
2453
2454void ASTStmtWriter::VisitOMPInterchangeDirective(OMPInterchangeDirective *D) {
2455 VisitOMPLoopTransformationDirective(D);
2457}
2458
2459void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) {
2460 VisitOMPLoopDirective(D);
2461 Record.writeBool(D->hasCancel());
2463}
2464
2465void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2466 VisitOMPLoopDirective(D);
2468}
2469
2470void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2471 VisitStmt(D);
2472 VisitOMPExecutableDirective(D);
2473 Record.writeBool(D->hasCancel());
2475}
2476
2477void ASTStmtWriter::VisitOMPSectionDirective(OMPSectionDirective *D) {
2478 VisitStmt(D);
2479 VisitOMPExecutableDirective(D);
2480 Record.writeBool(D->hasCancel());
2482}
2483
2484void ASTStmtWriter::VisitOMPScopeDirective(OMPScopeDirective *D) {
2485 VisitStmt(D);
2486 VisitOMPExecutableDirective(D);
2488}
2489
2490void ASTStmtWriter::VisitOMPSingleDirective(OMPSingleDirective *D) {
2491 VisitStmt(D);
2492 VisitOMPExecutableDirective(D);
2494}
2495
2496void ASTStmtWriter::VisitOMPMasterDirective(OMPMasterDirective *D) {
2497 VisitStmt(D);
2498 VisitOMPExecutableDirective(D);
2500}
2501
2502void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2503 VisitStmt(D);
2504 VisitOMPExecutableDirective(D);
2505 Record.AddDeclarationNameInfo(D->getDirectiveName());
2507}
2508
2509void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2510 VisitOMPLoopDirective(D);
2511 Record.writeBool(D->hasCancel());
2513}
2514
2515void ASTStmtWriter::VisitOMPParallelForSimdDirective(
2517 VisitOMPLoopDirective(D);
2519}
2520
2521void ASTStmtWriter::VisitOMPParallelMasterDirective(
2523 VisitStmt(D);
2524 VisitOMPExecutableDirective(D);
2526}
2527
2528void ASTStmtWriter::VisitOMPParallelMaskedDirective(
2530 VisitStmt(D);
2531 VisitOMPExecutableDirective(D);
2533}
2534
2535void ASTStmtWriter::VisitOMPParallelSectionsDirective(
2537 VisitStmt(D);
2538 VisitOMPExecutableDirective(D);
2539 Record.writeBool(D->hasCancel());
2541}
2542
2543void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) {
2544 VisitStmt(D);
2545 VisitOMPExecutableDirective(D);
2546 Record.writeBool(D->hasCancel());
2548}
2549
2550void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2551 VisitStmt(D);
2552 VisitOMPExecutableDirective(D);
2553 Record.writeBool(D->isXLHSInRHSPart());
2554 Record.writeBool(D->isPostfixUpdate());
2555 Record.writeBool(D->isFailOnly());
2557}
2558
2559void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) {
2560 VisitStmt(D);
2561 VisitOMPExecutableDirective(D);
2563}
2564
2565void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2566 VisitStmt(D);
2567 VisitOMPExecutableDirective(D);
2569}
2570
2571void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
2573 VisitStmt(D);
2574 VisitOMPExecutableDirective(D);
2576}
2577
2578void ASTStmtWriter::VisitOMPTargetExitDataDirective(
2580 VisitStmt(D);
2581 VisitOMPExecutableDirective(D);
2583}
2584
2585void ASTStmtWriter::VisitOMPTargetParallelDirective(
2587 VisitStmt(D);
2588 VisitOMPExecutableDirective(D);
2589 Record.writeBool(D->hasCancel());
2591}
2592
2593void ASTStmtWriter::VisitOMPTargetParallelForDirective(
2595 VisitOMPLoopDirective(D);
2596 Record.writeBool(D->hasCancel());
2598}
2599
2600void ASTStmtWriter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2601 VisitStmt(D);
2602 VisitOMPExecutableDirective(D);
2604}
2605
2606void ASTStmtWriter::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2607 VisitStmt(D);
2608 VisitOMPExecutableDirective(D);
2610}
2611
2612void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2613 VisitStmt(D);
2614 Record.push_back(D->getNumClauses());
2615 VisitOMPExecutableDirective(D);
2617}
2618
2619void ASTStmtWriter::VisitOMPAssumeDirective(OMPAssumeDirective *D) {
2620 VisitStmt(D);
2621 VisitOMPExecutableDirective(D);
2623}
2624
2625void ASTStmtWriter::VisitOMPErrorDirective(OMPErrorDirective *D) {
2626 VisitStmt(D);
2627 Record.push_back(D->getNumClauses());
2628 VisitOMPExecutableDirective(D);
2630}
2631
2632void ASTStmtWriter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2633 VisitStmt(D);
2634 VisitOMPExecutableDirective(D);
2636}
2637
2638void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) {
2639 VisitStmt(D);
2640 VisitOMPExecutableDirective(D);
2642}
2643
2644void ASTStmtWriter::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2645 VisitStmt(D);
2646 VisitOMPExecutableDirective(D);
2648}
2649
2650void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
2651 VisitStmt(D);
2652 VisitOMPExecutableDirective(D);
2654}
2655
2656void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2657 VisitStmt(D);
2658 VisitOMPExecutableDirective(D);
2660}
2661
2662void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2663 VisitStmt(D);
2664 VisitOMPExecutableDirective(D);
2666}
2667
2668void ASTStmtWriter::VisitOMPCancellationPointDirective(
2670 VisitStmt(D);
2671 VisitOMPExecutableDirective(D);
2672 Record.writeEnum(D->getCancelRegion());
2674}
2675
2676void ASTStmtWriter::VisitOMPCancelDirective(OMPCancelDirective *D) {
2677 VisitStmt(D);
2678 VisitOMPExecutableDirective(D);
2679 Record.writeEnum(D->getCancelRegion());
2681}
2682
2683void ASTStmtWriter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2684 VisitOMPLoopDirective(D);
2685 Record.writeBool(D->hasCancel());
2687}
2688
2689void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2690 VisitOMPLoopDirective(D);
2692}
2693
2694void ASTStmtWriter::VisitOMPMasterTaskLoopDirective(
2696 VisitOMPLoopDirective(D);
2697 Record.writeBool(D->hasCancel());
2699}
2700
2701void ASTStmtWriter::VisitOMPMaskedTaskLoopDirective(
2703 VisitOMPLoopDirective(D);
2704 Record.writeBool(D->hasCancel());
2706}
2707
2708void ASTStmtWriter::VisitOMPMasterTaskLoopSimdDirective(
2710 VisitOMPLoopDirective(D);
2712}
2713
2714void ASTStmtWriter::VisitOMPMaskedTaskLoopSimdDirective(
2716 VisitOMPLoopDirective(D);
2718}
2719
2720void ASTStmtWriter::VisitOMPParallelMasterTaskLoopDirective(
2722 VisitOMPLoopDirective(D);
2723 Record.writeBool(D->hasCancel());
2725}
2726
2727void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopDirective(
2729 VisitOMPLoopDirective(D);
2730 Record.writeBool(D->hasCancel());
2732}
2733
2734void ASTStmtWriter::VisitOMPParallelMasterTaskLoopSimdDirective(
2736 VisitOMPLoopDirective(D);
2738}
2739
2740void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopSimdDirective(
2742 VisitOMPLoopDirective(D);
2744}
2745
2746void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2747 VisitOMPLoopDirective(D);
2749}
2750
2751void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2752 VisitStmt(D);
2753 VisitOMPExecutableDirective(D);
2755}
2756
2757void ASTStmtWriter::VisitOMPDistributeParallelForDirective(
2759 VisitOMPLoopDirective(D);
2760 Record.writeBool(D->hasCancel());
2762}
2763
2764void ASTStmtWriter::VisitOMPDistributeParallelForSimdDirective(
2766 VisitOMPLoopDirective(D);
2768}
2769
2770void ASTStmtWriter::VisitOMPDistributeSimdDirective(
2772 VisitOMPLoopDirective(D);
2774}
2775
2776void ASTStmtWriter::VisitOMPTargetParallelForSimdDirective(
2778 VisitOMPLoopDirective(D);
2780}
2781
2782void ASTStmtWriter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2783 VisitOMPLoopDirective(D);
2785}
2786
2787void ASTStmtWriter::VisitOMPTeamsDistributeDirective(
2789 VisitOMPLoopDirective(D);
2791}
2792
2793void ASTStmtWriter::VisitOMPTeamsDistributeSimdDirective(
2795 VisitOMPLoopDirective(D);
2797}
2798
2799void ASTStmtWriter::VisitOMPTeamsDistributeParallelForSimdDirective(
2801 VisitOMPLoopDirective(D);
2803}
2804
2805void ASTStmtWriter::VisitOMPTeamsDistributeParallelForDirective(
2807 VisitOMPLoopDirective(D);
2808 Record.writeBool(D->hasCancel());
2810}
2811
2812void ASTStmtWriter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2813 VisitStmt(D);
2814 VisitOMPExecutableDirective(D);
2816}
2817
2818void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective(
2820 VisitOMPLoopDirective(D);
2822}
2823
2824void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective(
2826 VisitOMPLoopDirective(D);
2827 Record.writeBool(D->hasCancel());
2829}
2830
2831void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2833 VisitOMPLoopDirective(D);
2834 Code = serialization::
2836}
2837
2838void ASTStmtWriter::VisitOMPTargetTeamsDistributeSimdDirective(
2840 VisitOMPLoopDirective(D);
2842}
2843
2844void ASTStmtWriter::VisitOMPInteropDirective(OMPInteropDirective *D) {
2845 VisitStmt(D);
2846 VisitOMPExecutableDirective(D);
2848}
2849
2850void ASTStmtWriter::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2851 VisitStmt(D);
2852 VisitOMPExecutableDirective(D);
2853 Record.AddSourceLocation(D->getTargetCallLoc());
2855}
2856
2857void ASTStmtWriter::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2858 VisitStmt(D);
2859 VisitOMPExecutableDirective(D);
2861}
2862
2863void ASTStmtWriter::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2864 VisitOMPLoopDirective(D);
2866}
2867
2868void ASTStmtWriter::VisitOMPTeamsGenericLoopDirective(
2870 VisitOMPLoopDirective(D);
2872}
2873
2874void ASTStmtWriter::VisitOMPTargetTeamsGenericLoopDirective(
2876 VisitOMPLoopDirective(D);
2877 Record.writeBool(D->canBeParallelFor());
2879}
2880
2881void ASTStmtWriter::VisitOMPParallelGenericLoopDirective(
2883 VisitOMPLoopDirective(D);
2885}
2886
2887void ASTStmtWriter::VisitOMPTargetParallelGenericLoopDirective(
2889 VisitOMPLoopDirective(D);
2891}
2892
2893//===----------------------------------------------------------------------===//
2894// OpenACC Constructs/Directives.
2895//===----------------------------------------------------------------------===//
2896void ASTStmtWriter::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2897 Record.push_back(S->clauses().size());
2898 Record.writeEnum(S->Kind);
2899 Record.AddSourceRange(S->Range);
2900 Record.AddSourceLocation(S->DirectiveLoc);
2901 Record.writeOpenACCClauseList(S->clauses());
2902}
2903
2904void ASTStmtWriter::VisitOpenACCAssociatedStmtConstruct(
2906 VisitOpenACCConstructStmt(S);
2907 Record.AddStmt(S->getAssociatedStmt());
2908}
2909
2910void ASTStmtWriter::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2911 VisitStmt(S);
2912 VisitOpenACCAssociatedStmtConstruct(S);
2914}
2915
2916void ASTStmtWriter::VisitOpenACCLoopConstruct(OpenACCLoopConstruct *S) {
2917 VisitStmt(S);
2918 VisitOpenACCAssociatedStmtConstruct(S);
2919 Record.writeEnum(S->getParentComputeConstructKind());
2921}
2922
2923void ASTStmtWriter::VisitOpenACCCombinedConstruct(OpenACCCombinedConstruct *S) {
2924 VisitStmt(S);
2925 VisitOpenACCAssociatedStmtConstruct(S);
2927}
2928
2929void ASTStmtWriter::VisitOpenACCDataConstruct(OpenACCDataConstruct *S) {
2930 VisitStmt(S);
2931 VisitOpenACCAssociatedStmtConstruct(S);
2933}
2934
2935void ASTStmtWriter::VisitOpenACCEnterDataConstruct(
2937 VisitStmt(S);
2938 VisitOpenACCConstructStmt(S);
2940}
2941
2942void ASTStmtWriter::VisitOpenACCExitDataConstruct(OpenACCExitDataConstruct *S) {
2943 VisitStmt(S);
2944 VisitOpenACCConstructStmt(S);
2946}
2947
2948void ASTStmtWriter::VisitOpenACCInitConstruct(OpenACCInitConstruct *S) {
2949 VisitStmt(S);
2950 VisitOpenACCConstructStmt(S);
2952}
2953
2954void ASTStmtWriter::VisitOpenACCShutdownConstruct(OpenACCShutdownConstruct *S) {
2955 VisitStmt(S);
2956 VisitOpenACCConstructStmt(S);
2958}
2959
2960void ASTStmtWriter::VisitOpenACCHostDataConstruct(OpenACCHostDataConstruct *S) {
2961 VisitStmt(S);
2962 VisitOpenACCAssociatedStmtConstruct(S);
2964}
2965
2966void ASTStmtWriter::VisitOpenACCWaitConstruct(OpenACCWaitConstruct *S) {
2967 VisitStmt(S);
2968 Record.push_back(S->getExprs().size());
2969 VisitOpenACCConstructStmt(S);
2970 Record.AddSourceLocation(S->LParenLoc);
2971 Record.AddSourceLocation(S->RParenLoc);
2972 Record.AddSourceLocation(S->QueuesLoc);
2973
2974 for(Expr *E : S->getExprs())
2975 Record.AddStmt(E);
2976
2978}
2979
2980//===----------------------------------------------------------------------===//
2981// HLSL Constructs/Directives.
2982//===----------------------------------------------------------------------===//
2983
2984void ASTStmtWriter::VisitHLSLOutArgExpr(HLSLOutArgExpr *S) {
2985 VisitExpr(S);
2986 Record.AddStmt(S->getOpaqueArgLValue());
2987 Record.AddStmt(S->getCastedTemporary());
2988 Record.AddStmt(S->getWritebackCast());
2989 Record.writeBool(S->isInOut());
2991}
2992
2993//===----------------------------------------------------------------------===//
2994// ASTWriter Implementation
2995//===----------------------------------------------------------------------===//
2996
2998 assert(!SwitchCaseIDs.contains(S) && "SwitchCase recorded twice");
2999 unsigned NextID = SwitchCaseIDs.size();
3000 SwitchCaseIDs[S] = NextID;
3001 return NextID;
3002}
3003
3005 assert(SwitchCaseIDs.contains(S) && "SwitchCase hasn't been seen yet");
3006 return SwitchCaseIDs[S];
3007}
3008
3010 SwitchCaseIDs.clear();
3011}
3012
3013/// Write the given substatement or subexpression to the
3014/// bitstream.
3015void ASTWriter::WriteSubStmt(ASTContext &Context, Stmt *S) {
3017 ASTStmtWriter Writer(Context, *this, Record);
3018 ++NumStatements;
3019
3020 if (!S) {
3021 Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
3022 return;
3023 }
3024
3025 llvm::DenseMap<Stmt *, uint64_t>::iterator I = SubStmtEntries.find(S);
3026 if (I != SubStmtEntries.end()) {
3027 Record.push_back(I->second);
3028 Stream.EmitRecord(serialization::STMT_REF_PTR, Record);
3029 return;
3030 }
3031
3032#ifndef NDEBUG
3033 assert(!ParentStmts.count(S) && "There is a Stmt cycle!");
3034
3035 struct ParentStmtInserterRAII {
3036 Stmt *S;
3037 llvm::DenseSet<Stmt *> &ParentStmts;
3038
3039 ParentStmtInserterRAII(Stmt *S, llvm::DenseSet<Stmt *> &ParentStmts)
3040 : S(S), ParentStmts(ParentStmts) {
3041 ParentStmts.insert(S);
3042 }
3043 ~ParentStmtInserterRAII() {
3044 ParentStmts.erase(S);
3045 }
3046 };
3047
3048 ParentStmtInserterRAII ParentStmtInserter(S, ParentStmts);
3049#endif
3050
3051 Writer.Visit(S);
3052
3053 uint64_t Offset = Writer.Emit();
3054 SubStmtEntries[S] = Offset;
3055}
3056
3057/// Flush all of the statements that have been added to the
3058/// queue via AddStmt().
3059void ASTRecordWriter::FlushStmts() {
3060 // We expect to be the only consumer of the two temporary statement maps,
3061 // assert that they are empty.
3062 assert(Writer->SubStmtEntries.empty() && "unexpected entries in sub-stmt map");
3063 assert(Writer->ParentStmts.empty() && "unexpected entries in parent stmt map");
3064
3065 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3066 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[I]);
3067
3068 assert(N == StmtsToEmit.size() && "record modified while being written!");
3069
3070 // Note that we are at the end of a full expression. Any
3071 // expression records that follow this one are part of a different
3072 // expression.
3073 Writer->Stream.EmitRecord(serialization::STMT_STOP, ArrayRef<uint32_t>());
3074
3075 Writer->SubStmtEntries.clear();
3076 Writer->ParentStmts.clear();
3077 }
3078
3079 StmtsToEmit.clear();
3080}
3081
3082void ASTRecordWriter::FlushSubStmts() {
3083 // For a nested statement, write out the substatements in reverse order (so
3084 // that a simple stack machine can be used when loading), and don't emit a
3085 // STMT_STOP after each one.
3086 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3087 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[N - I - 1]);
3088 assert(N == StmtsToEmit.size() && "record modified while being written!");
3089 }
3090
3091 StmtsToEmit.clear();
3092}
This file provides AST data structures related to concepts.
Defines the clang::ASTContext interface.
static void addConstraintSatisfaction(ASTRecordWriter &Record, const ASTConstraintSatisfaction &Satisfaction)
static void addSubstitutionDiagnostic(ASTRecordWriter &Record, const concepts::Requirement::SubstitutionDiagnostic *D)
const Decl * D
Expr * E
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
llvm::MachO::Record Record
Definition: MachO.h:31
SourceRange Range
Definition: SemaObjC.cpp:758
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:188
void ReadKnownNamespaces(SmallVectorImpl< NamespaceDecl * > &Namespaces) override
Load the set of namespaces that are known to the external source, which will be used during typo corr...
Definition: ASTReader.cpp:9023
An object for streaming information to a record.
void AddTemplateKWAndArgsInfo(const ASTTemplateKWAndArgsInfo &ArgInfo, const TemplateArgumentLoc *Args)
ASTStmtWriter(const ASTStmtWriter &)=delete
ASTStmtWriter & operator=(const ASTStmtWriter &)=delete
ASTStmtWriter(ASTContext &Context, ASTWriter &Writer, ASTWriter::RecordData &Record)
void VisitStmt(Stmt *S)
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:89
unsigned getBinaryOperatorAbbrev() const
Definition: ASTWriter.h:865
bool isWritingStdCXXNamedModules() const
Definition: ASTWriter.h:880
unsigned getExprImplicitCastAbbrev() const
Definition: ASTWriter.h:864
unsigned getSwitchCaseID(SwitchCase *S)
Retrieve the ID for the given switch-case statement.
unsigned getDeclRefExprAbbrev() const
Definition: ASTWriter.h:861
unsigned getCXXOperatorCallExprAbbrev()
Definition: ASTWriter.h:870
LocalDeclID GetDeclRef(const Decl *D)
Force a declaration to be emitted and get its local ID to the module file been writing.
Definition: ASTWriter.cpp:6552
unsigned getCXXMemberCallExprAbbrev()
Definition: ASTWriter.h:871
ASTReader * getChain() const
Definition: ASTWriter.h:876
unsigned getCompoundAssignOperatorAbbrev() const
Definition: ASTWriter.h:866
unsigned RecordSwitchCaseID(SwitchCase *S)
Record an ID for the given switch-case statement.
unsigned getCharacterLiteralAbbrev() const
Definition: ASTWriter.h:862
unsigned getCompoundStmtAbbrev() const
Definition: ASTWriter.h:873
void AddToken(const Token &Tok, RecordDataImpl &Record)
Emit a token.
Definition: ASTWriter.cpp:4937
SmallVector< uint64_t, 64 > RecordData
Definition: ASTWriter.h:94
unsigned getCallExprAbbrev() const
Definition: ASTWriter.h:869
unsigned getIntegerLiteralAbbrev() const
Definition: ASTWriter.h:863
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4421
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5805
Represents a loop initializing the elements of an array.
Definition: Expr.h:5752
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition: Expr.h:6986
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2718
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition: ExprCXX.h:2853
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:6475
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition: Stmt.h:3137
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6678
Represents an attribute applied to a statement.
Definition: Stmt.h:2117
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:4324
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3909
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
Definition: ASTWriter.h:1029
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4474
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:6414
BreakStmt - This represents a break.
Definition: Stmt.h:3017
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:5298
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition: Expr.h:3840
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:231
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Definition: ExprCXX.h:601
Represents a base class of a C++ class.
Definition: DeclCXX.h:146
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1491
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:720
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:28
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:563
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1546
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1268
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1375
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2498
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3683
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:478
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4846
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Definition: StmtCXX.h:135
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Definition: ExprCXX.h:1817
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1737
Represents a call to a member function that may be written either with member call syntax (e....
Definition: ExprCXX.h:176
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:372
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition: ExprCXX.h:2241
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:4126
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:765
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:81
Represents a list-initialization with parenthesis.
Definition: ExprCXX.h:4960
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2617
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:523
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:283
An expression "T()" which creates an rvalue of a non-class type T.
Definition: ExprCXX.h:2182
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:433
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:797
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1885
Represents the this expression in C++.
Definition: ExprCXX.h:1152
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1206
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:69
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:845
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3557
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:1066
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2874
This captures a statement into a function.
Definition: Stmt.h:3794
CaseStmt - Represent a case statement.
Definition: Stmt.h:1838
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3547
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4641
Represents a 'co_await' expression.
Definition: ExprCXX.h:5191
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4171
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3477
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1638
A reference to a concept and its template args, as it appears in the code.
Definition: ASTConcept.h:124
Represents the specialization of a concept - evaluates to a prvalue of type bool.
Definition: ExprConcepts.h:42
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:4262
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:1077
ContinueStmt - This represents a continue.
Definition: Stmt.h:2987
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4582
Represents a 'co_return' statement in the C++ Coroutines TS.
Definition: StmtCXX.h:473
Represents the body of a coroutine.
Definition: StmtCXX.h:320
child_range children()
Definition: StmtCXX.h:435
ArrayRef< Stmt const * > getParamMoves() const
Definition: StmtCXX.h:423
Represents an expression that might suspend coroutine execution; either a co_await or co_yield expres...
Definition: ExprCXX.h:5077
Represents a 'co_yield' expression.
Definition: ExprCXX.h:5272
A POD class for pairing a NamedDecl* with an access specifier.
iterator begin()
Definition: DeclGroup.h:99
iterator end()
Definition: DeclGroup.h:105
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1265
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition: Stmt.h:1529
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
AccessSpecifier getAccess() const
Definition: DeclBase.h:510
The name of a declaration.
NameKind
The kind of the name stored in this DeclarationName.
Represents a 'co_await' expression while the type of the promise is dependent.
Definition: ExprCXX.h:5223
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3323
Represents a single C99 designator.
Definition: Expr.h:5376
Represents a C99 designated initializer expression.
Definition: Expr.h:5333
DoStmt - This represents a 'do/while' stmt.
Definition: Stmt.h:2762
Represents a reference to #emded data.
Definition: Expr.h:4916
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3799
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:3474
This represents one expression.
Definition: Expr.h:110
bool isValueDependent() const
Determines whether the value of this expression depends on.
Definition: Expr.h:175
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Definition: Expr.h:437
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Definition: Expr.h:444
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition: Expr.cpp:277
QualType getType() const
Definition: Expr.h:142
ExprDependence getDependence() const
Definition: Expr.h:162
An expression trait intrinsic.
Definition: ExprCXX.h:2924
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:6354
Represents a member of a struct/union/class.
Definition: Decl.h:3033
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition: Stmt.h:2818
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4654
VarDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition: ExprCXX.h:4688
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:3296
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4716
Represents a C11 generic selection.
Definition: Expr.h:5966
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2899
This class represents temporary values used to represent inout and out arguments in HLSL.
Definition: Expr.h:7152
IfStmt - This represents an if/then/else.
Definition: Stmt.h:2175
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
Definition: Expr.h:1717
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3724
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5841
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2938
Describes an C or C++ initializer list.
Definition: Expr.h:5088
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:2068
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1954
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3519
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
Definition: StmtCXX.h:253
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:933
MS property subscript expression.
Definition: ExprCXX.h:1004
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition: ExprCXX.h:4734
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition: Expr.h:2796
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3236
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:5661
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1601
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
Definition: ExprOpenMP.h:24
This represents '#pragma omp atomic' directive.
Definition: StmtOpenMP.h:2947
This represents '#pragma omp barrier' directive.
Definition: StmtOpenMP.h:2625
This represents '#pragma omp cancel' directive.
Definition: StmtOpenMP.h:3655
This represents '#pragma omp cancellation point' directive.
Definition: StmtOpenMP.h:3597
Representation of an OpenMP canonical loop.
Definition: StmtOpenMP.h:142
This represents '#pragma omp critical' directive.
Definition: StmtOpenMP.h:2076
This represents '#pragma omp depobj' directive.
Definition: StmtOpenMP.h:2841
This represents '#pragma omp dispatch' directive.
Definition: StmtOpenMP.h:5948
This represents '#pragma omp distribute' directive.
Definition: StmtOpenMP.h:4425
This represents '#pragma omp distribute parallel for' composite directive.
Definition: StmtOpenMP.h:4547
This represents '#pragma omp distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:4643
This represents '#pragma omp distribute simd' composite directive.
Definition: StmtOpenMP.h:4708
This represents '#pragma omp error' directive.
Definition: StmtOpenMP.h:6432
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:266
This represents '#pragma omp flush' directive.
Definition: StmtOpenMP.h:2789
This represents '#pragma omp for' directive.
Definition: StmtOpenMP.h:1634
This represents '#pragma omp for simd' directive.
Definition: StmtOpenMP.h:1724
This represents '#pragma omp loop' directive.
Definition: StmtOpenMP.h:6103
Represents the '#pragma omp interchange' loop transformation directive.
Definition: StmtOpenMP.h:5769
This represents '#pragma omp interop' directive.
Definition: StmtOpenMP.h:5895
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition: ExprOpenMP.h:151
The base class for all loop-based directives, including loop transformation directives.
Definition: StmtOpenMP.h:683
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc....
Definition: StmtOpenMP.h:1004
The base class for all loop transformation directives.
Definition: StmtOpenMP.h:960
This represents '#pragma omp masked' directive.
Definition: StmtOpenMP.h:6013
This represents '#pragma omp masked taskloop' directive.
Definition: StmtOpenMP.h:3930
This represents '#pragma omp masked taskloop simd' directive.
Definition: StmtOpenMP.h:4071
This represents '#pragma omp master' directive.
Definition: StmtOpenMP.h:2028
This represents '#pragma omp master taskloop' directive.
Definition: StmtOpenMP.h:3854
This represents '#pragma omp master taskloop simd' directive.
Definition: StmtOpenMP.h:4006
This represents '#pragma omp metadirective' directive.
Definition: StmtOpenMP.h:6064
This represents '#pragma omp ordered' directive.
Definition: StmtOpenMP.h:2893
This represents '#pragma omp parallel' directive.
Definition: StmtOpenMP.h:612
This represents '#pragma omp parallel for' directive.
Definition: StmtOpenMP.h:2147
This represents '#pragma omp parallel for simd' directive.
Definition: StmtOpenMP.h:2244
This represents '#pragma omp parallel loop' directive.
Definition: StmtOpenMP.h:6305
This represents '#pragma omp parallel masked' directive.
Definition: StmtOpenMP.h:2372
This represents '#pragma omp parallel masked taskloop' directive.
Definition: StmtOpenMP.h:4215
This represents '#pragma omp parallel masked taskloop simd' directive.
Definition: StmtOpenMP.h:4360
This represents '#pragma omp parallel master' directive.
Definition: StmtOpenMP.h:2309
This represents '#pragma omp parallel master taskloop' directive.
Definition: StmtOpenMP.h:4137
This represents '#pragma omp parallel master taskloop simd' directive.
Definition: StmtOpenMP.h:4293
This represents '#pragma omp parallel sections' directive.
Definition: StmtOpenMP.h:2436
Represents the '#pragma omp reverse' loop transformation directive.
Definition: StmtOpenMP.h:5704
This represents '#pragma omp scan' directive.
Definition: StmtOpenMP.h:5842
This represents '#pragma omp scope' directive.
Definition: StmtOpenMP.h:1925
This represents '#pragma omp section' directive.
Definition: StmtOpenMP.h:1864
This represents '#pragma omp sections' directive.
Definition: StmtOpenMP.h:1787
This represents '#pragma omp simd' directive.
Definition: StmtOpenMP.h:1571
This represents '#pragma omp single' directive.
Definition: StmtOpenMP.h:1977
This represents '#pragma omp target data' directive.
Definition: StmtOpenMP.h:3206
This represents '#pragma omp target' directive.
Definition: StmtOpenMP.h:3152
This represents '#pragma omp target enter data' directive.
Definition: StmtOpenMP.h:3260
This represents '#pragma omp target exit data' directive.
Definition: StmtOpenMP.h:3315
This represents '#pragma omp target parallel' directive.
Definition: StmtOpenMP.h:3369
This represents '#pragma omp target parallel for' directive.
Definition: StmtOpenMP.h:3449
This represents '#pragma omp target parallel for simd' directive.
Definition: StmtOpenMP.h:4774
This represents '#pragma omp target parallel loop' directive.
Definition: StmtOpenMP.h:6370
This represents '#pragma omp target simd' directive.
Definition: StmtOpenMP.h:4841
This represents '#pragma omp target teams' directive.
Definition: StmtOpenMP.h:5199
This represents '#pragma omp target teams distribute' combined directive.
Definition: StmtOpenMP.h:5255
This represents '#pragma omp target teams distribute parallel for' combined directive.
Definition: StmtOpenMP.h:5322
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
Definition: StmtOpenMP.h:5420
This represents '#pragma omp target teams distribute simd' combined directive.
Definition: StmtOpenMP.h:5490
This represents '#pragma omp target teams loop' directive.
Definition: StmtOpenMP.h:6230
This represents '#pragma omp target update' directive.
Definition: StmtOpenMP.h:4491
This represents '#pragma omp task' directive.
Definition: StmtOpenMP.h:2517
This represents '#pragma omp taskloop' directive.
Definition: StmtOpenMP.h:3715
This represents '#pragma omp taskloop simd' directive.
Definition: StmtOpenMP.h:3788
This represents '#pragma omp taskgroup' directive.
Definition: StmtOpenMP.h:2722
This represents '#pragma omp taskwait' directive.
Definition: StmtOpenMP.h:2671
This represents '#pragma omp taskyield' directive.
Definition: StmtOpenMP.h:2579
This represents '#pragma omp teams' directive.
Definition: StmtOpenMP.h:3544
This represents '#pragma omp teams distribute' directive.
Definition: StmtOpenMP.h:4906
This represents '#pragma omp teams distribute parallel for' composite directive.
Definition: StmtOpenMP.h:5106
This represents '#pragma omp teams distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:5040
This represents '#pragma omp teams distribute simd' combined directive.
Definition: StmtOpenMP.h:4972
This represents '#pragma omp teams loop' directive.
Definition: StmtOpenMP.h:6165
This represents the '#pragma omp tile' loop transformation directive.
Definition: StmtOpenMP.h:5548
This represents the '#pragma omp unroll' loop transformation directive.
Definition: StmtOpenMP.h:5630
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Definition: ExprObjC.h:191
Represents Objective-C's @catch statement.
Definition: StmtObjC.h:77
Represents Objective-C's @finally statement.
Definition: StmtObjC.h:127
Represents Objective-C's @synchronized statement.
Definition: StmtObjC.h:303
Represents Objective-C's @throw statement.
Definition: StmtObjC.h:358
Represents Objective-C's @try ... @catch ... @finally statement.
Definition: StmtObjC.h:167
Represents Objective-C's @autoreleasepool Statement.
Definition: StmtObjC.h:394
A runtime availability query.
Definition: ExprObjC.h:1692
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:87
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:127
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
Definition: ExprObjC.h:1632
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:309
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:410
Represents Objective-C's collection statement.
Definition: StmtObjC.h:23
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1571
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
Definition: ExprObjC.h:1487
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:549
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:941
@ SuperInstance
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:955
@ Instance
The receiver is an object instance.
Definition: ExprObjC.h:949
@ SuperClass
The receiver is a superclass.
Definition: ExprObjC.h:952
@ Class
The receiver is a class.
Definition: ExprObjC.h:946
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:617
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:505
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:455
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:51
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:840
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Definition: Expr.h:2519
Helper class for OffsetOfExpr.
Definition: Expr.h:2413
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
Definition: Expr.h:2471
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition: Expr.h:2477
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition: Expr.cpp:1700
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this offsetof node.
Definition: Expr.h:2498
@ Array
An index into an array.
Definition: Expr.h:2418
@ Identifier
A field in a dependent type, known only by its name.
Definition: Expr.h:2422
@ Field
A field.
Definition: Expr.h:2420
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Definition: Expr.h:2425
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:2467
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
Definition: Expr.h:2487
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition: Expr.h:1173
This is a base class for any OpenACC statement-level constructs that have an associated statement.
Definition: StmtOpenACC.h:80
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
Definition: Expr.h:2078
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
Definition: StmtOpenACC.h:131
This is the base class for an OpenACC statement-level construct, other construct types are expected t...
Definition: StmtOpenACC.h:25
This class represents a 'loop' construct.
Definition: StmtOpenACC.h:194
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Definition: ExprCXX.h:2983
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:4180
ParenExpr - This represents a parenthesized expression, e.g.
Definition: Expr.h:2170
Represents a parameter to a function.
Definition: Decl.h:1725
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1991
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:6546
Expr *const * semantics_iterator
Definition: Expr.h:6610
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition: Expr.h:7258
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:502
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Definition: Stmt.h:3056
Represents a __leave statement.
Definition: Stmt.h:3755
static std::enable_if_t< std::is_base_of_v< Attr, AttrInfo >, SourceLocation > getAttrLoc(const AttrInfo &AL)
A helper function to provide Attribute Location for the Attr types AND the ParsedAttr.
Definition: Sema.h:4405
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:4514
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4258
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Definition: Expr.h:4810
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:4466
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:185
Stmt - This represents one statement.
Definition: Stmt.h:84
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:348
LambdaExprBitfields LambdaExprBits
Definition: Stmt.h:1295
child_range children()
Definition: Stmt.cpp:285
StmtClass getStmtClass() const
Definition: Stmt.h:1390
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:324
TypeTraitExprBitfields TypeTraitExprBits
Definition: Stmt.h:1284
CXXNewExprBitfields CXXNewExprBits
Definition: Stmt.h:1282
ConstantExprBitfields ConstantExprBits
Definition: Stmt.h:1249
RequiresExprBitfields RequiresExprBits
Definition: Stmt.h:1296
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition: Stmt.h:1285
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.cpp:336
void AddString(StringRef V) const
Definition: Diagnostic.h:1153
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1778
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:4490
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:4575
SwitchStmt - This represents a 'switch' stmt.
Definition: Stmt.h:2425
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:524
A container of type source information.
Definition: Type.h:7902
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2768
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:6837
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition: Expr.h:2622
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition: Expr.h:2232
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3203
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition: ExprCXX.h:3943
The iterator over UnresolvedSets.
Definition: UnresolvedSet.h:35
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Definition: ExprCXX.h:637
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:4750
WhileStmt - This represents a 'while' stmt.
Definition: Stmt.h:2621
A static requirement that can be used in a requires-expression to check properties of types and expre...
Definition: ExprConcepts.h:168
StmtCode
Record codes for each kind of statement or expression.
Definition: ASTBitCodes.h:1526
@ EXPR_DESIGNATED_INIT
A DesignatedInitExpr record.
Definition: ASTBitCodes.h:1673
@ EXPR_COMPOUND_LITERAL
A CompoundLiteralExpr record.
Definition: ASTBitCodes.h:1664
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1971
@ EXPR_OBJC_IVAR_REF_EXPR
An ObjCIvarRefExpr record.
Definition: ASTBitCodes.h:1751
@ EXPR_MEMBER
A MemberExpr record.
Definition: ASTBitCodes.h:1646
@ EXPR_CXX_TEMPORARY_OBJECT
A CXXTemporaryObjectExpr record.
Definition: ASTBitCodes.h:1825
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1982
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
Definition: ASTBitCodes.h:1652
@ EXPR_CXX_STATIC_CAST
A CXXStaticCastExpr record.
Definition: ASTBitCodes.h:1828
@ EXPR_OBJC_STRING_LITERAL
An ObjCStringLiteral record.
Definition: ASTBitCodes.h:1735
@ EXPR_VA_ARG
A VAArgExpr record.
Definition: ASTBitCodes.h:1691
@ STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1976
@ EXPR_OBJC_ISA
An ObjCIsa Expr record.
Definition: ASTBitCodes.h:1766
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
Definition: ASTBitCodes.h:1810
@ STMT_OBJC_AT_TRY
An ObjCAtTryStmt record.
Definition: ASTBitCodes.h:1781
@ STMT_DO
A DoStmt record.
Definition: ASTBitCodes.h:1565
@ STMT_OBJC_CATCH
An ObjCAtCatchStmt record.
Definition: ASTBitCodes.h:1775
@ STMT_IF
An IfStmt record.
Definition: ASTBitCodes.h:1556
@ EXPR_STRING_LITERAL
A StringLiteral record.
Definition: ASTBitCodes.h:1616
@ EXPR_OBJC_AVAILABILITY_CHECK
An ObjCAvailabilityCheckExpr record.
Definition: ASTBitCodes.h:1796
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_DIRECTIVE
Definition: ASTBitCodes.h:1966
@ EXPR_PSEUDO_OBJECT
A PseudoObjectExpr record.
Definition: ASTBitCodes.h:1724
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1981
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1658
@ STMT_CAPTURED
A CapturedStmt record.
Definition: ASTBitCodes.h:1589
@ STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1973
@ STMT_GCCASM
A GCC-style AsmStmt record.
Definition: ASTBitCodes.h:1592
@ EXPR_IMAGINARY_LITERAL
An ImaginaryLiteral record.
Definition: ASTBitCodes.h:1613
@ STMT_WHILE
A WhileStmt record.
Definition: ASTBitCodes.h:1562
@ EXPR_CONVERT_VECTOR
A ConvertVectorExpr record.
Definition: ASTBitCodes.h:1715
@ EXPR_OBJC_SUBSCRIPT_REF_EXPR
An ObjCSubscriptRefExpr record.
Definition: ASTBitCodes.h:1757
@ EXPR_STMT
A StmtExpr record.
Definition: ASTBitCodes.h:1697
@ STMT_OMP_PARALLEL_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:1991
@ EXPR_CXX_REINTERPRET_CAST
A CXXReinterpretCastExpr record.
Definition: ASTBitCodes.h:1834
@ EXPR_DESIGNATED_INIT_UPDATE
A DesignatedInitUpdateExpr record.
Definition: ASTBitCodes.h:1676
@ STMT_OBJC_AT_SYNCHRONIZED
An ObjCAtSynchronizedStmt record.
Definition: ASTBitCodes.h:1784
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1970
@ EXPR_BUILTIN_BIT_CAST
A BuiltinBitCastExpr record.
Definition: ASTBitCodes.h:1846
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1983
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
Definition: ASTBitCodes.h:1619
@ EXPR_OBJC_ENCODE
An ObjCEncodeExpr record.
Definition: ASTBitCodes.h:1742
@ EXPR_CSTYLE_CAST
A CStyleCastExpr record.
Definition: ASTBitCodes.h:1661
@ EXPR_OBJC_BOOL_LITERAL
An ObjCBoolLiteralExpr record.
Definition: ASTBitCodes.h:1793
@ EXPR_EXT_VECTOR_ELEMENT
An ExtVectorElementExpr record.
Definition: ASTBitCodes.h:1667
@ EXPR_ATOMIC
An AtomicExpr record.
Definition: ASTBitCodes.h:1727
@ EXPR_OFFSETOF
An OffsetOfExpr record.
Definition: ASTBitCodes.h:1631
@ STMT_RETURN
A ReturnStmt record.
Definition: ASTBitCodes.h:1583
@ STMT_OBJC_FOR_COLLECTION
An ObjCForCollectionStmt record.
Definition: ASTBitCodes.h:1772
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE
Definition: ASTBitCodes.h:1980
@ EXPR_ARRAY_INIT_LOOP
An ArrayInitLoopExpr record.
Definition: ASTBitCodes.h:1682
@ STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE
Definition: ASTBitCodes.h:1962
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1967
@ STMT_CONTINUE
A ContinueStmt record.
Definition: ASTBitCodes.h:1577
@ EXPR_PREDEFINED
A PredefinedExpr record.
Definition: ASTBitCodes.h:1601
@ EXPR_CXX_BOOL_LITERAL
A CXXBoolLiteralExpr record.
Definition: ASTBitCodes.h:1855
@ EXPR_PAREN_LIST
A ParenListExpr record.
Definition: ASTBitCodes.h:1625
@ EXPR_CXX_PAREN_LIST_INIT
A CXXParenListInitExpr record.
Definition: ASTBitCodes.h:1858
@ STMT_OMP_MASTER_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1961
@ STMT_COMPOUND
A CompoundStmt record.
Definition: ASTBitCodes.h:1541
@ STMT_FOR
A ForStmt record.
Definition: ASTBitCodes.h:1568
@ STMT_ATTRIBUTED
An AttributedStmt record.
Definition: ASTBitCodes.h:1553
@ STMT_OMP_TARGET_TEAMS_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:1990
@ EXPR_CXX_REWRITTEN_BINARY_OPERATOR
A CXXRewrittenBinaryOperator record.
Definition: ASTBitCodes.h:1816
@ STMT_GOTO
A GotoStmt record.
Definition: ASTBitCodes.h:1571
@ EXPR_NO_INIT
An NoInitExpr record.
Definition: ASTBitCodes.h:1679
@ EXPR_OBJC_PROTOCOL_EXPR
An ObjCProtocolExpr record.
Definition: ASTBitCodes.h:1748
@ EXPR_ARRAY_INIT_INDEX
An ArrayInitIndexExpr record.
Definition: ASTBitCodes.h:1685
@ EXPR_CXX_CONSTRUCT
A CXXConstructExpr record.
Definition: ASTBitCodes.h:1819
@ STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1978
@ STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1963
@ STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1977
@ EXPR_CXX_DYNAMIC_CAST
A CXXDynamicCastExpr record.
Definition: ASTBitCodes.h:1831
@ STMT_CXX_TRY
A CXXTryStmt record.
Definition: ASTBitCodes.h:1804
@ EXPR_GENERIC_SELECTION
A GenericSelectionExpr record.
Definition: ASTBitCodes.h:1721
@ EXPR_OBJC_INDIRECT_COPY_RESTORE
An ObjCIndirectCopyRestoreExpr record.
Definition: ASTBitCodes.h:1769
@ EXPR_CXX_INHERITED_CTOR_INIT
A CXXInheritedCtorInitExpr record.
Definition: ASTBitCodes.h:1822
@ EXPR_CALL
A CallExpr record.
Definition: ASTBitCodes.h:1643
@ EXPR_GNU_NULL
A GNUNullExpr record.
Definition: ASTBitCodes.h:1703
@ EXPR_OBJC_PROPERTY_REF_EXPR
An ObjCPropertyRefExpr record.
Definition: ASTBitCodes.h:1754
@ STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1953
@ EXPR_CXX_CONST_CAST
A CXXConstCastExpr record.
Definition: ASTBitCodes.h:1837
@ STMT_REF_PTR
A reference to a previously [de]serialized Stmt record.
Definition: ASTBitCodes.h:1535
@ EXPR_OBJC_MESSAGE_EXPR
An ObjCMessageExpr record.
Definition: ASTBitCodes.h:1763
@ STMT_CASE
A CaseStmt record.
Definition: ASTBitCodes.h:1544
@ EXPR_CONSTANT
A constant expression context.
Definition: ASTBitCodes.h:1598
@ STMT_STOP
A marker record that indicates that we are at the end of an expression.
Definition: ASTBitCodes.h:1529
@ STMT_MSASM
A MS-style AsmStmt record.
Definition: ASTBitCodes.h:1595
@ EXPR_CONDITIONAL_OPERATOR
A ConditionOperator record.
Definition: ASTBitCodes.h:1655
@ EXPR_BINARY_OPERATOR
A BinaryOperator record.
Definition: ASTBitCodes.h:1649
@ EXPR_CXX_STD_INITIALIZER_LIST
A CXXStdInitializerListExpr record.
Definition: ASTBitCodes.h:1852
@ EXPR_SHUFFLE_VECTOR
A ShuffleVectorExpr record.
Definition: ASTBitCodes.h:1712
@ STMT_OBJC_FINALLY
An ObjCAtFinallyStmt record.
Definition: ASTBitCodes.h:1778
@ EXPR_OBJC_SELECTOR_EXPR
An ObjCSelectorExpr record.
Definition: ASTBitCodes.h:1745
@ EXPR_FLOATING_LITERAL
A FloatingLiteral record.
Definition: ASTBitCodes.h:1610
@ STMT_NULL_PTR
A NULL expression.
Definition: ASTBitCodes.h:1532
@ STMT_DEFAULT
A DefaultStmt record.
Definition: ASTBitCodes.h:1547
@ EXPR_CHOOSE
A ChooseExpr record.
Definition: ASTBitCodes.h:1700
@ STMT_NULL
A NullStmt record.
Definition: ASTBitCodes.h:1538
@ EXPR_BLOCK
BlockExpr.
Definition: ASTBitCodes.h:1718
@ EXPR_DECL_REF
A DeclRefExpr record.
Definition: ASTBitCodes.h:1604
@ EXPR_INIT_LIST
An InitListExpr record.
Definition: ASTBitCodes.h:1670
@ EXPR_IMPLICIT_VALUE_INIT
An ImplicitValueInitExpr record.
Definition: ASTBitCodes.h:1688
@ STMT_OBJC_AUTORELEASE_POOL
An ObjCAutoreleasePoolStmt record.
Definition: ASTBitCodes.h:1790
@ EXPR_RECOVERY
A RecoveryExpr record.
Definition: ASTBitCodes.h:1730
@ EXPR_PAREN
A ParenExpr record.
Definition: ASTBitCodes.h:1622
@ STMT_OMP_TARGET_PARALLEL_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:1992
@ STMT_LABEL
A LabelStmt record.
Definition: ASTBitCodes.h:1550
@ EXPR_CXX_FUNCTIONAL_CAST
A CXXFunctionalCastExpr record.
Definition: ASTBitCodes.h:1843
@ EXPR_USER_DEFINED_LITERAL
A UserDefinedLiteral record.
Definition: ASTBitCodes.h:1849
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
Definition: ASTBitCodes.h:1607
@ EXPR_SOURCE_LOC
A SourceLocExpr record.
Definition: ASTBitCodes.h:1706
@ EXPR_CXX_MEMBER_CALL
A CXXMemberCallExpr record.
Definition: ASTBitCodes.h:1813
@ STMT_SWITCH
A SwitchStmt record.
Definition: ASTBitCodes.h:1559
@ STMT_DECL
A DeclStmt record.
Definition: ASTBitCodes.h:1586
@ EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK
Definition: ASTBitCodes.h:1894
@ STMT_OMP_MASKED_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1965
@ EXPR_SIZEOF_ALIGN_OF
A SizefAlignOfExpr record.
Definition: ASTBitCodes.h:1634
@ STMT_BREAK
A BreakStmt record.
Definition: ASTBitCodes.h:1580
@ STMT_OBJC_AT_THROW
An ObjCAtThrowStmt record.
Definition: ASTBitCodes.h:1787
@ EXPR_ADDR_LABEL
An AddrLabelExpr record.
Definition: ASTBitCodes.h:1694
@ STMT_CXX_FOR_RANGE
A CXXForRangeStmt record.
Definition: ASTBitCodes.h:1807
@ EXPR_CXX_ADDRSPACE_CAST
A CXXAddrspaceCastExpr record.
Definition: ASTBitCodes.h:1840
@ EXPR_ARRAY_SUBSCRIPT
An ArraySubscriptExpr record.
Definition: ASTBitCodes.h:1637
@ EXPR_UNARY_OPERATOR
A UnaryOperator record.
Definition: ASTBitCodes.h:1628
@ STMT_CXX_CATCH
A CXXCatchStmt record.
Definition: ASTBitCodes.h:1801
@ EXPR_BUILTIN_PP_EMBED
A EmbedExpr record.
Definition: ASTBitCodes.h:1709
@ STMT_INDIRECT_GOTO
An IndirectGotoStmt record.
Definition: ASTBitCodes.h:1574
@ DESIG_ARRAY_RANGE
GNU array range designator.
Definition: ASTBitCodes.h:2047
@ DESIG_FIELD_NAME
Field designator where only the field name is known.
Definition: ASTBitCodes.h:2037
@ DESIG_FIELD_DECL
Field designator where the field has been resolved to a declaration.
Definition: ASTBitCodes.h:2041
@ DESIG_ARRAY
Array designator.
Definition: ASTBitCodes.h:2044
The JSON file list parser is used to communicate input to InstallAPI.
@ OK_Ordinary
An ordinary object is located at an address in memory.
Definition: Specifiers.h:151
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:135
unsigned long uint64_t
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition: ASTConcept.h:89
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Definition: TemplateBase.h:728
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
Definition: TemplateBase.h:730
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: TemplateBase.h:742
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
Definition: TemplateBase.h:733
SourceLocation TemplateKWLoc
The source location of the template keyword; this is used as part of the representation of qualified ...
Definition: TemplateBase.h:739
Iterator range representation begin:end[:step].
Definition: ExprOpenMP.h:154
Helper expressions and declaration for OMPIteratorExpr class for each iteration space.
Definition: ExprOpenMP.h:111
Expr * CounterUpdate
Updater for the internal counter: ++CounterVD;.
Definition: ExprOpenMP.h:121
Expr * Upper
Normalized upper bound.
Definition: ExprOpenMP.h:116
Expr * Update
Update expression for the originally specified iteration variable, calculated as VD = Begin + Counter...
Definition: ExprOpenMP.h:119
VarDecl * CounterVD
Internal normalized counter.
Definition: ExprOpenMP.h:113
An element in an Objective-C dictionary literal.
Definition: ExprObjC.h:262
Iterator for iterating over Stmt * arrays that contain only T *.
Definition: Stmt.h:1348