Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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::VisitSYCLKernelCallStmt(SYCLKernelCallStmt *S) {
613 VisitStmt(S);
614 Record.AddStmt(S->getOriginalStmt());
615 Record.AddDeclRef(S->getOutlinedFunctionDecl());
616
618}
619
620void ASTStmtWriter::VisitExpr(Expr *E) {
621 VisitStmt(E);
622
623 CurrentPackingBits.updateBits();
624 CurrentPackingBits.addBits(E->getDependence(), /*BitsWidth=*/5);
625 CurrentPackingBits.addBits(E->getValueKind(), /*BitsWidth=*/2);
626 CurrentPackingBits.addBits(E->getObjectKind(), /*BitsWidth=*/3);
627
628 Record.AddTypeRef(E->getType());
629}
630
631void ASTStmtWriter::VisitConstantExpr(ConstantExpr *E) {
632 VisitExpr(E);
633 Record.push_back(E->ConstantExprBits.ResultKind);
634
635 Record.push_back(E->ConstantExprBits.APValueKind);
636 Record.push_back(E->ConstantExprBits.IsUnsigned);
637 Record.push_back(E->ConstantExprBits.BitWidth);
638 // HasCleanup not serialized since we can just query the APValue.
639 Record.push_back(E->ConstantExprBits.IsImmediateInvocation);
640
641 switch (E->getResultStorageKind()) {
643 break;
645 Record.push_back(E->Int64Result());
646 break;
648 Record.AddAPValue(E->APValueResult());
649 break;
650 }
651
652 Record.AddStmt(E->getSubExpr());
654}
655
656void ASTStmtWriter::VisitOpenACCAsteriskSizeExpr(OpenACCAsteriskSizeExpr *E) {
657 VisitExpr(E);
658 Record.AddSourceLocation(E->getLocation());
660}
661
662void ASTStmtWriter::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *E) {
663 VisitExpr(E);
664
665 Record.AddSourceLocation(E->getLocation());
666 Record.AddSourceLocation(E->getLParenLocation());
667 Record.AddSourceLocation(E->getRParenLocation());
668 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
669
671}
672
673void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
674 VisitExpr(E);
675
676 bool HasFunctionName = E->getFunctionName() != nullptr;
677 Record.push_back(HasFunctionName);
678 Record.push_back(
679 llvm::to_underlying(E->getIdentKind())); // FIXME: stable encoding
680 Record.push_back(E->isTransparent());
681 Record.AddSourceLocation(E->getLocation());
682 if (HasFunctionName)
683 Record.AddStmt(E->getFunctionName());
685}
686
687void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
688 VisitExpr(E);
689
690 CurrentPackingBits.updateBits();
691
692 CurrentPackingBits.addBit(E->hadMultipleCandidates());
693 CurrentPackingBits.addBit(E->refersToEnclosingVariableOrCapture());
694 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
695 CurrentPackingBits.addBit(E->isImmediateEscalating());
696 CurrentPackingBits.addBit(E->getDecl() != E->getFoundDecl());
697 CurrentPackingBits.addBit(E->hasQualifier());
698 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
699
700 if (E->hasTemplateKWAndArgsInfo()) {
701 unsigned NumTemplateArgs = E->getNumTemplateArgs();
702 Record.push_back(NumTemplateArgs);
703 }
704
705 DeclarationName::NameKind nk = (E->getDecl()->getDeclName().getNameKind());
706
707 if ((!E->hasTemplateKWAndArgsInfo()) && (!E->hasQualifier()) &&
708 (E->getDecl() == E->getFoundDecl()) &&
710 AbbrevToUse = Writer.getDeclRefExprAbbrev();
711 }
712
713 if (E->hasQualifier())
714 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
715
716 if (E->getDecl() != E->getFoundDecl())
717 Record.AddDeclRef(E->getFoundDecl());
718
719 if (E->hasTemplateKWAndArgsInfo())
721 E->getTrailingObjects<TemplateArgumentLoc>());
722
723 Record.AddDeclRef(E->getDecl());
724 Record.AddSourceLocation(E->getLocation());
725 Record.AddDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
727}
728
729void ASTStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
730 VisitExpr(E);
731 Record.AddSourceLocation(E->getLocation());
732 Record.AddAPInt(E->getValue());
733
734 if (E->getValue().getBitWidth() == 32) {
735 AbbrevToUse = Writer.getIntegerLiteralAbbrev();
736 }
737
739}
740
741void ASTStmtWriter::VisitFixedPointLiteral(FixedPointLiteral *E) {
742 VisitExpr(E);
743 Record.AddSourceLocation(E->getLocation());
744 Record.push_back(E->getScale());
745 Record.AddAPInt(E->getValue());
747}
748
749void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
750 VisitExpr(E);
751 Record.push_back(E->getRawSemantics());
752 Record.push_back(E->isExact());
753 Record.AddAPFloat(E->getValue());
754 Record.AddSourceLocation(E->getLocation());
756}
757
758void ASTStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
759 VisitExpr(E);
760 Record.AddStmt(E->getSubExpr());
762}
763
764void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
765 VisitExpr(E);
766
767 // Store the various bits of data of StringLiteral.
768 Record.push_back(E->getNumConcatenated());
769 Record.push_back(E->getLength());
770 Record.push_back(E->getCharByteWidth());
771 Record.push_back(llvm::to_underlying(E->getKind()));
772 Record.push_back(E->isPascal());
773
774 // Store the trailing array of SourceLocation.
775 for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
776 Record.AddSourceLocation(E->getStrTokenLoc(I));
777
778 // Store the trailing array of char holding the string data.
779 StringRef StrData = E->getBytes();
780 for (unsigned I = 0, N = E->getByteLength(); I != N; ++I)
781 Record.push_back(StrData[I]);
782
784}
785
786void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
787 VisitExpr(E);
788 Record.push_back(E->getValue());
789 Record.AddSourceLocation(E->getLocation());
790 Record.push_back(llvm::to_underlying(E->getKind()));
791
792 AbbrevToUse = Writer.getCharacterLiteralAbbrev();
793
795}
796
797void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
798 VisitExpr(E);
799 Record.push_back(E->isProducedByFoldExpansion());
800 Record.AddSourceLocation(E->getLParen());
801 Record.AddSourceLocation(E->getRParen());
802 Record.AddStmt(E->getSubExpr());
804}
805
806void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
807 VisitExpr(E);
808 Record.push_back(E->getNumExprs());
809 for (auto *SubStmt : E->exprs())
810 Record.AddStmt(SubStmt);
811 Record.AddSourceLocation(E->getLParenLoc());
812 Record.AddSourceLocation(E->getRParenLoc());
814}
815
816void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
817 VisitExpr(E);
818 bool HasFPFeatures = E->hasStoredFPFeatures();
819 // Write this first for easy access when deserializing, as they affect the
820 // size of the UnaryOperator.
821 CurrentPackingBits.addBit(HasFPFeatures);
822 Record.AddStmt(E->getSubExpr());
823 CurrentPackingBits.addBits(E->getOpcode(),
824 /*Width=*/5); // FIXME: stable encoding
825 Record.AddSourceLocation(E->getOperatorLoc());
826 CurrentPackingBits.addBit(E->canOverflow());
827
828 if (HasFPFeatures)
829 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
831}
832
833void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
834 VisitExpr(E);
835 Record.push_back(E->getNumComponents());
836 Record.push_back(E->getNumExpressions());
837 Record.AddSourceLocation(E->getOperatorLoc());
838 Record.AddSourceLocation(E->getRParenLoc());
839 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
840 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
841 const OffsetOfNode &ON = E->getComponent(I);
842 Record.push_back(ON.getKind()); // FIXME: Stable encoding
843 Record.AddSourceLocation(ON.getSourceRange().getBegin());
844 Record.AddSourceLocation(ON.getSourceRange().getEnd());
845 switch (ON.getKind()) {
847 Record.push_back(ON.getArrayExprIndex());
848 break;
849
851 Record.AddDeclRef(ON.getField());
852 break;
853
855 Record.AddIdentifierRef(ON.getFieldName());
856 break;
857
859 Record.AddCXXBaseSpecifier(*ON.getBase());
860 break;
861 }
862 }
863 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
864 Record.AddStmt(E->getIndexExpr(I));
866}
867
868void ASTStmtWriter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
869 VisitExpr(E);
870 Record.push_back(E->getKind());
871 if (E->isArgumentType())
872 Record.AddTypeSourceInfo(E->getArgumentTypeInfo());
873 else {
874 Record.push_back(0);
875 Record.AddStmt(E->getArgumentExpr());
876 }
877 Record.AddSourceLocation(E->getOperatorLoc());
878 Record.AddSourceLocation(E->getRParenLoc());
880}
881
882void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
883 VisitExpr(E);
884 Record.AddStmt(E->getLHS());
885 Record.AddStmt(E->getRHS());
886 Record.AddSourceLocation(E->getRBracketLoc());
888}
889
890void ASTStmtWriter::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
891 VisitExpr(E);
892 Record.AddStmt(E->getBase());
893 Record.AddStmt(E->getRowIdx());
894 Record.AddStmt(E->getColumnIdx());
895 Record.AddSourceLocation(E->getRBracketLoc());
897}
898
899void ASTStmtWriter::VisitArraySectionExpr(ArraySectionExpr *E) {
900 VisitExpr(E);
901 Record.writeEnum(E->ASType);
902 Record.AddStmt(E->getBase());
903 Record.AddStmt(E->getLowerBound());
904 Record.AddStmt(E->getLength());
905 if (E->isOMPArraySection())
906 Record.AddStmt(E->getStride());
907 Record.AddSourceLocation(E->getColonLocFirst());
908
909 if (E->isOMPArraySection())
910 Record.AddSourceLocation(E->getColonLocSecond());
911
912 Record.AddSourceLocation(E->getRBracketLoc());
914}
915
916void ASTStmtWriter::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
917 VisitExpr(E);
918 Record.push_back(E->getDimensions().size());
919 Record.AddStmt(E->getBase());
920 for (Expr *Dim : E->getDimensions())
921 Record.AddStmt(Dim);
922 for (SourceRange SR : E->getBracketsRanges())
923 Record.AddSourceRange(SR);
924 Record.AddSourceLocation(E->getLParenLoc());
925 Record.AddSourceLocation(E->getRParenLoc());
927}
928
929void ASTStmtWriter::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
930 VisitExpr(E);
931 Record.push_back(E->numOfIterators());
932 Record.AddSourceLocation(E->getIteratorKwLoc());
933 Record.AddSourceLocation(E->getLParenLoc());
934 Record.AddSourceLocation(E->getRParenLoc());
935 for (unsigned I = 0, End = E->numOfIterators(); I < End; ++I) {
936 Record.AddDeclRef(E->getIteratorDecl(I));
937 Record.AddSourceLocation(E->getAssignLoc(I));
938 OMPIteratorExpr::IteratorRange Range = E->getIteratorRange(I);
939 Record.AddStmt(Range.Begin);
940 Record.AddStmt(Range.End);
941 Record.AddStmt(Range.Step);
942 Record.AddSourceLocation(E->getColonLoc(I));
943 if (Range.Step)
944 Record.AddSourceLocation(E->getSecondColonLoc(I));
945 // Serialize helpers
946 OMPIteratorHelperData &HD = E->getHelper(I);
947 Record.AddDeclRef(HD.CounterVD);
948 Record.AddStmt(HD.Upper);
949 Record.AddStmt(HD.Update);
950 Record.AddStmt(HD.CounterUpdate);
951 }
953}
954
955void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
956 VisitExpr(E);
957
958 Record.push_back(E->getNumArgs());
959 CurrentPackingBits.updateBits();
960 CurrentPackingBits.addBit(static_cast<bool>(E->getADLCallKind()));
961 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
962
963 Record.AddSourceLocation(E->getRParenLoc());
964 Record.AddStmt(E->getCallee());
965 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
966 Arg != ArgEnd; ++Arg)
967 Record.AddStmt(*Arg);
968
969 if (E->hasStoredFPFeatures())
970 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
971
972 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
973 E->getStmtClass() == Stmt::CallExprClass)
974 AbbrevToUse = Writer.getCallExprAbbrev();
975
977}
978
979void ASTStmtWriter::VisitRecoveryExpr(RecoveryExpr *E) {
980 VisitExpr(E);
981 Record.push_back(std::distance(E->children().begin(), E->children().end()));
982 Record.AddSourceLocation(E->getBeginLoc());
983 Record.AddSourceLocation(E->getEndLoc());
984 for (Stmt *Child : E->children())
985 Record.AddStmt(Child);
987}
988
989void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
990 VisitExpr(E);
991
992 bool HasQualifier = E->hasQualifier();
993 bool HasFoundDecl = E->hasFoundDecl();
994 bool HasTemplateInfo = E->hasTemplateKWAndArgsInfo();
995 unsigned NumTemplateArgs = E->getNumTemplateArgs();
996
997 // Write these first for easy access when deserializing, as they affect the
998 // size of the MemberExpr.
999 CurrentPackingBits.updateBits();
1000 CurrentPackingBits.addBit(HasQualifier);
1001 CurrentPackingBits.addBit(HasFoundDecl);
1002 CurrentPackingBits.addBit(HasTemplateInfo);
1003 Record.push_back(NumTemplateArgs);
1004
1005 Record.AddStmt(E->getBase());
1006 Record.AddDeclRef(E->getMemberDecl());
1007 Record.AddDeclarationNameLoc(E->MemberDNLoc,
1008 E->getMemberDecl()->getDeclName());
1009 Record.AddSourceLocation(E->getMemberLoc());
1010 CurrentPackingBits.addBit(E->isArrow());
1011 CurrentPackingBits.addBit(E->hadMultipleCandidates());
1012 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
1013 Record.AddSourceLocation(E->getOperatorLoc());
1014
1015 if (HasQualifier)
1016 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1017
1018 if (HasFoundDecl) {
1019 DeclAccessPair FoundDecl = E->getFoundDecl();
1020 Record.AddDeclRef(FoundDecl.getDecl());
1021 CurrentPackingBits.addBits(FoundDecl.getAccess(), /*BitWidth=*/2);
1022 }
1023
1024 if (HasTemplateInfo)
1025 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1026 E->getTrailingObjects<TemplateArgumentLoc>());
1027
1029}
1030
1031void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1032 VisitExpr(E);
1033 Record.AddStmt(E->getBase());
1034 Record.AddSourceLocation(E->getIsaMemberLoc());
1035 Record.AddSourceLocation(E->getOpLoc());
1036 Record.push_back(E->isArrow());
1038}
1039
1040void ASTStmtWriter::
1041VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1042 VisitExpr(E);
1043 Record.AddStmt(E->getSubExpr());
1044 Record.push_back(E->shouldCopy());
1046}
1047
1048void ASTStmtWriter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1049 VisitExplicitCastExpr(E);
1050 Record.AddSourceLocation(E->getLParenLoc());
1051 Record.AddSourceLocation(E->getBridgeKeywordLoc());
1052 Record.push_back(E->getBridgeKind()); // FIXME: Stable encoding
1054}
1055
1056void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
1057 VisitExpr(E);
1058
1059 Record.push_back(E->path_size());
1060 CurrentPackingBits.updateBits();
1061 // 7 bits should be enough to store the casting kinds.
1062 CurrentPackingBits.addBits(E->getCastKind(), /*Width=*/7);
1063 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
1064 Record.AddStmt(E->getSubExpr());
1065
1067 PI = E->path_begin(), PE = E->path_end(); PI != PE; ++PI)
1068 Record.AddCXXBaseSpecifier(**PI);
1069
1070 if (E->hasStoredFPFeatures())
1071 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
1072}
1073
1074void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
1075 VisitExpr(E);
1076
1077 // Write this first for easy access when deserializing, as they affect the
1078 // size of the UnaryOperator.
1079 CurrentPackingBits.updateBits();
1080 CurrentPackingBits.addBits(E->getOpcode(), /*Width=*/6);
1081 bool HasFPFeatures = E->hasStoredFPFeatures();
1082 CurrentPackingBits.addBit(HasFPFeatures);
1083 CurrentPackingBits.addBit(E->hasExcludedOverflowPattern());
1084 Record.AddStmt(E->getLHS());
1085 Record.AddStmt(E->getRHS());
1086 Record.AddSourceLocation(E->getOperatorLoc());
1087 if (HasFPFeatures)
1088 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1089
1090 if (!HasFPFeatures && E->getValueKind() == VK_PRValue &&
1092 AbbrevToUse = Writer.getBinaryOperatorAbbrev();
1093
1095}
1096
1097void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1098 VisitBinaryOperator(E);
1099 Record.AddTypeRef(E->getComputationLHSType());
1100 Record.AddTypeRef(E->getComputationResultType());
1101
1102 if (!E->hasStoredFPFeatures() && E->getValueKind() == VK_PRValue &&
1104 AbbrevToUse = Writer.getCompoundAssignOperatorAbbrev();
1105
1107}
1108
1109void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
1110 VisitExpr(E);
1111 Record.AddStmt(E->getCond());
1112 Record.AddStmt(E->getLHS());
1113 Record.AddStmt(E->getRHS());
1114 Record.AddSourceLocation(E->getQuestionLoc());
1115 Record.AddSourceLocation(E->getColonLoc());
1117}
1118
1119void
1120ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1121 VisitExpr(E);
1122 Record.AddStmt(E->getOpaqueValue());
1123 Record.AddStmt(E->getCommon());
1124 Record.AddStmt(E->getCond());
1125 Record.AddStmt(E->getTrueExpr());
1126 Record.AddStmt(E->getFalseExpr());
1127 Record.AddSourceLocation(E->getQuestionLoc());
1128 Record.AddSourceLocation(E->getColonLoc());
1130}
1131
1132void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1133 VisitCastExpr(E);
1134 CurrentPackingBits.addBit(E->isPartOfExplicitCast());
1135
1136 if (E->path_size() == 0 && !E->hasStoredFPFeatures())
1137 AbbrevToUse = Writer.getExprImplicitCastAbbrev();
1138
1140}
1141
1142void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1143 VisitCastExpr(E);
1144 Record.AddTypeSourceInfo(E->getTypeInfoAsWritten());
1145}
1146
1147void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
1148 VisitExplicitCastExpr(E);
1149 Record.AddSourceLocation(E->getLParenLoc());
1150 Record.AddSourceLocation(E->getRParenLoc());
1152}
1153
1154void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1155 VisitExpr(E);
1156 Record.AddSourceLocation(E->getLParenLoc());
1157 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1158 Record.AddStmt(E->getInitializer());
1159 Record.push_back(E->isFileScope());
1161}
1162
1163void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1164 VisitExpr(E);
1165 Record.AddStmt(E->getBase());
1166 Record.AddIdentifierRef(&E->getAccessor());
1167 Record.AddSourceLocation(E->getAccessorLoc());
1169}
1170
1171void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
1172 VisitExpr(E);
1173 // NOTE: only add the (possibly null) syntactic form.
1174 // No need to serialize the isSemanticForm flag and the semantic form.
1175 Record.AddStmt(E->getSyntacticForm());
1176 Record.AddSourceLocation(E->getLBraceLoc());
1177 Record.AddSourceLocation(E->getRBraceLoc());
1178 bool isArrayFiller = isa<Expr *>(E->ArrayFillerOrUnionFieldInit);
1179 Record.push_back(isArrayFiller);
1180 if (isArrayFiller)
1181 Record.AddStmt(E->getArrayFiller());
1182 else
1183 Record.AddDeclRef(E->getInitializedFieldInUnion());
1184 Record.push_back(E->hadArrayRangeDesignator());
1185 Record.push_back(E->getNumInits());
1186 if (isArrayFiller) {
1187 // ArrayFiller may have filled "holes" due to designated initializer.
1188 // Replace them by 0 to indicate that the filler goes in that place.
1189 Expr *filler = E->getArrayFiller();
1190 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1191 Record.AddStmt(E->getInit(I) != filler ? E->getInit(I) : nullptr);
1192 } else {
1193 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1194 Record.AddStmt(E->getInit(I));
1195 }
1197}
1198
1199void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1200 VisitExpr(E);
1201 Record.push_back(E->getNumSubExprs());
1202 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1203 Record.AddStmt(E->getSubExpr(I));
1204 Record.AddSourceLocation(E->getEqualOrColonLoc());
1205 Record.push_back(E->usesGNUSyntax());
1206 for (const DesignatedInitExpr::Designator &D : E->designators()) {
1207 if (D.isFieldDesignator()) {
1208 if (FieldDecl *Field = D.getFieldDecl()) {
1210 Record.AddDeclRef(Field);
1211 } else {
1213 Record.AddIdentifierRef(D.getFieldName());
1214 }
1215 Record.AddSourceLocation(D.getDotLoc());
1216 Record.AddSourceLocation(D.getFieldLoc());
1217 } else if (D.isArrayDesignator()) {
1219 Record.push_back(D.getArrayIndex());
1220 Record.AddSourceLocation(D.getLBracketLoc());
1221 Record.AddSourceLocation(D.getRBracketLoc());
1222 } else {
1223 assert(D.isArrayRangeDesignator() && "Unknown designator");
1225 Record.push_back(D.getArrayIndex());
1226 Record.AddSourceLocation(D.getLBracketLoc());
1227 Record.AddSourceLocation(D.getEllipsisLoc());
1228 Record.AddSourceLocation(D.getRBracketLoc());
1229 }
1230 }
1232}
1233
1234void ASTStmtWriter::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1235 VisitExpr(E);
1236 Record.AddStmt(E->getBase());
1237 Record.AddStmt(E->getUpdater());
1239}
1240
1241void ASTStmtWriter::VisitNoInitExpr(NoInitExpr *E) {
1242 VisitExpr(E);
1244}
1245
1246void ASTStmtWriter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1247 VisitExpr(E);
1248 Record.AddStmt(E->SubExprs[0]);
1249 Record.AddStmt(E->SubExprs[1]);
1251}
1252
1253void ASTStmtWriter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1254 VisitExpr(E);
1256}
1257
1258void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1259 VisitExpr(E);
1261}
1262
1263void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
1264 VisitExpr(E);
1265 Record.AddStmt(E->getSubExpr());
1266 Record.AddTypeSourceInfo(E->getWrittenTypeInfo());
1267 Record.AddSourceLocation(E->getBuiltinLoc());
1268 Record.AddSourceLocation(E->getRParenLoc());
1269 Record.push_back(E->isMicrosoftABI());
1271}
1272
1273void ASTStmtWriter::VisitSourceLocExpr(SourceLocExpr *E) {
1274 VisitExpr(E);
1275 Record.AddDeclRef(cast_or_null<Decl>(E->getParentContext()));
1276 Record.AddSourceLocation(E->getBeginLoc());
1277 Record.AddSourceLocation(E->getEndLoc());
1278 Record.push_back(llvm::to_underlying(E->getIdentKind()));
1280}
1281
1282void ASTStmtWriter::VisitEmbedExpr(EmbedExpr *E) {
1283 VisitExpr(E);
1284 Record.AddSourceLocation(E->getBeginLoc());
1285 Record.AddSourceLocation(E->getEndLoc());
1286 Record.AddStmt(E->getDataStringLiteral());
1287 Record.writeUInt32(E->getStartingElementPos());
1288 Record.writeUInt32(E->getDataElementCount());
1290}
1291
1292void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
1293 VisitExpr(E);
1294 Record.AddSourceLocation(E->getAmpAmpLoc());
1295 Record.AddSourceLocation(E->getLabelLoc());
1296 Record.AddDeclRef(E->getLabel());
1298}
1299
1300void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
1301 VisitExpr(E);
1302 Record.AddStmt(E->getSubStmt());
1303 Record.AddSourceLocation(E->getLParenLoc());
1304 Record.AddSourceLocation(E->getRParenLoc());
1305 Record.push_back(E->getTemplateDepth());
1307}
1308
1309void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
1310 VisitExpr(E);
1311 Record.AddStmt(E->getCond());
1312 Record.AddStmt(E->getLHS());
1313 Record.AddStmt(E->getRHS());
1314 Record.AddSourceLocation(E->getBuiltinLoc());
1315 Record.AddSourceLocation(E->getRParenLoc());
1316 Record.push_back(E->isConditionDependent() ? false : E->isConditionTrue());
1318}
1319
1320void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
1321 VisitExpr(E);
1322 Record.AddSourceLocation(E->getTokenLocation());
1324}
1325
1326void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1327 VisitExpr(E);
1328 Record.push_back(E->getNumSubExprs());
1329 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1330 Record.AddStmt(E->getExpr(I));
1331 Record.AddSourceLocation(E->getBuiltinLoc());
1332 Record.AddSourceLocation(E->getRParenLoc());
1334}
1335
1336void ASTStmtWriter::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1337 VisitExpr(E);
1338 Record.AddSourceLocation(E->getBuiltinLoc());
1339 Record.AddSourceLocation(E->getRParenLoc());
1340 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1341 Record.AddStmt(E->getSrcExpr());
1343}
1344
1345void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
1346 VisitExpr(E);
1347 Record.AddDeclRef(E->getBlockDecl());
1349}
1350
1351void ASTStmtWriter::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1352 VisitExpr(E);
1353
1354 Record.push_back(E->getNumAssocs());
1355 Record.push_back(E->isExprPredicate());
1356 Record.push_back(E->ResultIndex);
1357 Record.AddSourceLocation(E->getGenericLoc());
1358 Record.AddSourceLocation(E->getDefaultLoc());
1359 Record.AddSourceLocation(E->getRParenLoc());
1360
1361 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1362 // Add 1 to account for the controlling expression which is the first
1363 // expression in the trailing array of Stmt *. This is not needed for
1364 // the trailing array of TypeSourceInfo *.
1365 for (unsigned I = 0, N = E->getNumAssocs() + 1; I < N; ++I)
1366 Record.AddStmt(Stmts[I]);
1367
1368 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1369 for (unsigned I = 0, N = E->getNumAssocs(); I < N; ++I)
1370 Record.AddTypeSourceInfo(TSIs[I]);
1371
1373}
1374
1375void ASTStmtWriter::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1376 VisitExpr(E);
1377 Record.push_back(E->getNumSemanticExprs());
1378
1379 // Push the result index. Currently, this needs to exactly match
1380 // the encoding used internally for ResultIndex.
1381 unsigned result = E->getResultExprIndex();
1382 result = (result == PseudoObjectExpr::NoResult ? 0 : result + 1);
1383 Record.push_back(result);
1384
1385 Record.AddStmt(E->getSyntacticForm());
1387 i = E->semantics_begin(), e = E->semantics_end(); i != e; ++i) {
1388 Record.AddStmt(*i);
1389 }
1391}
1392
1393void ASTStmtWriter::VisitAtomicExpr(AtomicExpr *E) {
1394 VisitExpr(E);
1395 Record.push_back(E->getOp());
1396 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1397 Record.AddStmt(E->getSubExprs()[I]);
1398 Record.AddSourceLocation(E->getBuiltinLoc());
1399 Record.AddSourceLocation(E->getRParenLoc());
1401}
1402
1403//===----------------------------------------------------------------------===//
1404// Objective-C Expressions and Statements.
1405//===----------------------------------------------------------------------===//
1406
1407void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1408 VisitExpr(E);
1409 Record.AddStmt(E->getString());
1410 Record.AddSourceLocation(E->getAtLoc());
1412}
1413
1414void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1415 VisitExpr(E);
1416 Record.AddStmt(E->getSubExpr());
1417 Record.AddDeclRef(E->getBoxingMethod());
1418 Record.AddSourceRange(E->getSourceRange());
1420}
1421
1422void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1423 VisitExpr(E);
1424 Record.push_back(E->getNumElements());
1425 for (unsigned i = 0; i < E->getNumElements(); i++)
1426 Record.AddStmt(E->getElement(i));
1427 Record.AddDeclRef(E->getArrayWithObjectsMethod());
1428 Record.AddSourceRange(E->getSourceRange());
1430}
1431
1432void ASTStmtWriter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1433 VisitExpr(E);
1434 Record.push_back(E->getNumElements());
1435 Record.push_back(E->HasPackExpansions);
1436 for (unsigned i = 0; i < E->getNumElements(); i++) {
1437 ObjCDictionaryElement Element = E->getKeyValueElement(i);
1438 Record.AddStmt(Element.Key);
1439 Record.AddStmt(Element.Value);
1440 if (E->HasPackExpansions) {
1441 Record.AddSourceLocation(Element.EllipsisLoc);
1442 unsigned NumExpansions = 0;
1443 if (Element.NumExpansions)
1444 NumExpansions = *Element.NumExpansions + 1;
1445 Record.push_back(NumExpansions);
1446 }
1447 }
1448
1449 Record.AddDeclRef(E->getDictWithObjectsMethod());
1450 Record.AddSourceRange(E->getSourceRange());
1452}
1453
1454void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1455 VisitExpr(E);
1456 Record.AddTypeSourceInfo(E->getEncodedTypeSourceInfo());
1457 Record.AddSourceLocation(E->getAtLoc());
1458 Record.AddSourceLocation(E->getRParenLoc());
1460}
1461
1462void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1463 VisitExpr(E);
1464 Record.AddSelectorRef(E->getSelector());
1465 Record.AddSourceLocation(E->getAtLoc());
1466 Record.AddSourceLocation(E->getRParenLoc());
1468}
1469
1470void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1471 VisitExpr(E);
1472 Record.AddDeclRef(E->getProtocol());
1473 Record.AddSourceLocation(E->getAtLoc());
1474 Record.AddSourceLocation(E->ProtoLoc);
1475 Record.AddSourceLocation(E->getRParenLoc());
1477}
1478
1479void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1480 VisitExpr(E);
1481 Record.AddDeclRef(E->getDecl());
1482 Record.AddSourceLocation(E->getLocation());
1483 Record.AddSourceLocation(E->getOpLoc());
1484 Record.AddStmt(E->getBase());
1485 Record.push_back(E->isArrow());
1486 Record.push_back(E->isFreeIvar());
1488}
1489
1490void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1491 VisitExpr(E);
1492 Record.push_back(E->SetterAndMethodRefFlags.getInt());
1493 Record.push_back(E->isImplicitProperty());
1494 if (E->isImplicitProperty()) {
1495 Record.AddDeclRef(E->getImplicitPropertyGetter());
1496 Record.AddDeclRef(E->getImplicitPropertySetter());
1497 } else {
1498 Record.AddDeclRef(E->getExplicitProperty());
1499 }
1500 Record.AddSourceLocation(E->getLocation());
1501 Record.AddSourceLocation(E->getReceiverLocation());
1502 if (E->isObjectReceiver()) {
1503 Record.push_back(0);
1504 Record.AddStmt(E->getBase());
1505 } else if (E->isSuperReceiver()) {
1506 Record.push_back(1);
1507 Record.AddTypeRef(E->getSuperReceiverType());
1508 } else {
1509 Record.push_back(2);
1510 Record.AddDeclRef(E->getClassReceiver());
1511 }
1512
1514}
1515
1516void ASTStmtWriter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1517 VisitExpr(E);
1518 Record.AddSourceLocation(E->getRBracket());
1519 Record.AddStmt(E->getBaseExpr());
1520 Record.AddStmt(E->getKeyExpr());
1521 Record.AddDeclRef(E->getAtIndexMethodDecl());
1522 Record.AddDeclRef(E->setAtIndexMethodDecl());
1523
1525}
1526
1527void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1528 VisitExpr(E);
1529 Record.push_back(E->getNumArgs());
1530 Record.push_back(E->getNumStoredSelLocs());
1531 Record.push_back(E->SelLocsKind);
1532 Record.push_back(E->isDelegateInitCall());
1533 Record.push_back(E->IsImplicit);
1534 Record.push_back((unsigned)E->getReceiverKind()); // FIXME: stable encoding
1535 switch (E->getReceiverKind()) {
1537 Record.AddStmt(E->getInstanceReceiver());
1538 break;
1539
1541 Record.AddTypeSourceInfo(E->getClassReceiverTypeInfo());
1542 break;
1543
1546 Record.AddTypeRef(E->getSuperType());
1547 Record.AddSourceLocation(E->getSuperLoc());
1548 break;
1549 }
1550
1551 if (E->getMethodDecl()) {
1552 Record.push_back(1);
1553 Record.AddDeclRef(E->getMethodDecl());
1554 } else {
1555 Record.push_back(0);
1556 Record.AddSelectorRef(E->getSelector());
1557 }
1558
1559 Record.AddSourceLocation(E->getLeftLoc());
1560 Record.AddSourceLocation(E->getRightLoc());
1561
1562 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
1563 Arg != ArgEnd; ++Arg)
1564 Record.AddStmt(*Arg);
1565
1566 SourceLocation *Locs = E->getStoredSelLocs();
1567 for (unsigned i = 0, e = E->getNumStoredSelLocs(); i != e; ++i)
1568 Record.AddSourceLocation(Locs[i]);
1569
1571}
1572
1573void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1574 VisitStmt(S);
1575 Record.AddStmt(S->getElement());
1576 Record.AddStmt(S->getCollection());
1577 Record.AddStmt(S->getBody());
1578 Record.AddSourceLocation(S->getForLoc());
1579 Record.AddSourceLocation(S->getRParenLoc());
1581}
1582
1583void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1584 VisitStmt(S);
1585 Record.AddStmt(S->getCatchBody());
1586 Record.AddDeclRef(S->getCatchParamDecl());
1587 Record.AddSourceLocation(S->getAtCatchLoc());
1588 Record.AddSourceLocation(S->getRParenLoc());
1590}
1591
1592void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1593 VisitStmt(S);
1594 Record.AddStmt(S->getFinallyBody());
1595 Record.AddSourceLocation(S->getAtFinallyLoc());
1597}
1598
1599void ASTStmtWriter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1600 VisitStmt(S); // FIXME: no test coverage.
1601 Record.AddStmt(S->getSubStmt());
1602 Record.AddSourceLocation(S->getAtLoc());
1604}
1605
1606void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1607 VisitStmt(S);
1608 Record.push_back(S->getNumCatchStmts());
1609 Record.push_back(S->getFinallyStmt() != nullptr);
1610 Record.AddStmt(S->getTryBody());
1611 for (ObjCAtCatchStmt *C : S->catch_stmts())
1612 Record.AddStmt(C);
1613 if (S->getFinallyStmt())
1614 Record.AddStmt(S->getFinallyStmt());
1615 Record.AddSourceLocation(S->getAtTryLoc());
1617}
1618
1619void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1620 VisitStmt(S); // FIXME: no test coverage.
1621 Record.AddStmt(S->getSynchExpr());
1622 Record.AddStmt(S->getSynchBody());
1623 Record.AddSourceLocation(S->getAtSynchronizedLoc());
1625}
1626
1627void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1628 VisitStmt(S); // FIXME: no test coverage.
1629 Record.AddStmt(S->getThrowExpr());
1630 Record.AddSourceLocation(S->getThrowLoc());
1632}
1633
1634void ASTStmtWriter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1635 VisitExpr(E);
1636 Record.push_back(E->getValue());
1637 Record.AddSourceLocation(E->getLocation());
1639}
1640
1641void ASTStmtWriter::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1642 VisitExpr(E);
1643 Record.AddSourceRange(E->getSourceRange());
1644 Record.AddVersionTuple(E->getVersion());
1646}
1647
1648//===----------------------------------------------------------------------===//
1649// C++ Expressions and Statements.
1650//===----------------------------------------------------------------------===//
1651
1652void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
1653 VisitStmt(S);
1654 Record.AddSourceLocation(S->getCatchLoc());
1655 Record.AddDeclRef(S->getExceptionDecl());
1656 Record.AddStmt(S->getHandlerBlock());
1658}
1659
1660void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
1661 VisitStmt(S);
1662 Record.push_back(S->getNumHandlers());
1663 Record.AddSourceLocation(S->getTryLoc());
1664 Record.AddStmt(S->getTryBlock());
1665 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1666 Record.AddStmt(S->getHandler(i));
1668}
1669
1670void ASTStmtWriter::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1671 VisitStmt(S);
1672 Record.AddSourceLocation(S->getForLoc());
1673 Record.AddSourceLocation(S->getCoawaitLoc());
1674 Record.AddSourceLocation(S->getColonLoc());
1675 Record.AddSourceLocation(S->getRParenLoc());
1676 Record.AddStmt(S->getInit());
1677 Record.AddStmt(S->getRangeStmt());
1678 Record.AddStmt(S->getBeginStmt());
1679 Record.AddStmt(S->getEndStmt());
1680 Record.AddStmt(S->getCond());
1681 Record.AddStmt(S->getInc());
1682 Record.AddStmt(S->getLoopVarStmt());
1683 Record.AddStmt(S->getBody());
1685}
1686
1687void ASTStmtWriter::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1688 VisitStmt(S);
1689 Record.AddSourceLocation(S->getKeywordLoc());
1690 Record.push_back(S->isIfExists());
1691 Record.AddNestedNameSpecifierLoc(S->getQualifierLoc());
1692 Record.AddDeclarationNameInfo(S->getNameInfo());
1693 Record.AddStmt(S->getSubStmt());
1695}
1696
1697void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1698 VisitCallExpr(E);
1699 Record.push_back(E->getOperator());
1700 Record.AddSourceRange(E->Range);
1701
1702 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()))
1703 AbbrevToUse = Writer.getCXXOperatorCallExprAbbrev();
1704
1706}
1707
1708void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1709 VisitCallExpr(E);
1710
1711 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()))
1712 AbbrevToUse = Writer.getCXXMemberCallExprAbbrev();
1713
1715}
1716
1717void ASTStmtWriter::VisitCXXRewrittenBinaryOperator(
1719 VisitExpr(E);
1720 Record.push_back(E->isReversed());
1721 Record.AddStmt(E->getSemanticForm());
1723}
1724
1725void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
1726 VisitExpr(E);
1727
1728 Record.push_back(E->getNumArgs());
1729 Record.push_back(E->isElidable());
1730 Record.push_back(E->hadMultipleCandidates());
1731 Record.push_back(E->isListInitialization());
1732 Record.push_back(E->isStdInitListInitialization());
1733 Record.push_back(E->requiresZeroInitialization());
1734 Record.push_back(
1735 llvm::to_underlying(E->getConstructionKind())); // FIXME: stable encoding
1736 Record.push_back(E->isImmediateEscalating());
1737 Record.AddSourceLocation(E->getLocation());
1738 Record.AddDeclRef(E->getConstructor());
1739 Record.AddSourceRange(E->getParenOrBraceRange());
1740
1741 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1742 Record.AddStmt(E->getArg(I));
1743
1745}
1746
1747void ASTStmtWriter::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1748 VisitExpr(E);
1749 Record.AddDeclRef(E->getConstructor());
1750 Record.AddSourceLocation(E->getLocation());
1751 Record.push_back(E->constructsVBase());
1752 Record.push_back(E->inheritedFromVBase());
1754}
1755
1756void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1757 VisitCXXConstructExpr(E);
1758 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1760}
1761
1762void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) {
1763 VisitExpr(E);
1764 Record.push_back(E->LambdaExprBits.NumCaptures);
1765 Record.AddSourceRange(E->IntroducerRange);
1766 Record.push_back(E->LambdaExprBits.CaptureDefault); // FIXME: stable encoding
1767 Record.AddSourceLocation(E->CaptureDefaultLoc);
1768 Record.push_back(E->LambdaExprBits.ExplicitParams);
1769 Record.push_back(E->LambdaExprBits.ExplicitResultType);
1770 Record.AddSourceLocation(E->ClosingBrace);
1771
1772 // Add capture initializers.
1773 for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
1774 CEnd = E->capture_init_end();
1775 C != CEnd; ++C) {
1776 Record.AddStmt(*C);
1777 }
1778
1779 // Don't serialize the body. It belongs to the call operator declaration.
1780 // LambdaExpr only stores a copy of the Stmt *.
1781
1783}
1784
1785void ASTStmtWriter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1786 VisitExpr(E);
1787 Record.AddStmt(E->getSubExpr());
1789}
1790
1791void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1792 VisitExplicitCastExpr(E);
1793 Record.AddSourceRange(SourceRange(E->getOperatorLoc(), E->getRParenLoc()));
1794 CurrentPackingBits.addBit(E->getAngleBrackets().isValid());
1795 if (E->getAngleBrackets().isValid())
1796 Record.AddSourceRange(E->getAngleBrackets());
1797}
1798
1799void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1800 VisitCXXNamedCastExpr(E);
1802}
1803
1804void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1805 VisitCXXNamedCastExpr(E);
1807}
1808
1809void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1810 VisitCXXNamedCastExpr(E);
1812}
1813
1814void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1815 VisitCXXNamedCastExpr(E);
1817}
1818
1819void ASTStmtWriter::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1820 VisitCXXNamedCastExpr(E);
1822}
1823
1824void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1825 VisitExplicitCastExpr(E);
1826 Record.AddSourceLocation(E->getLParenLoc());
1827 Record.AddSourceLocation(E->getRParenLoc());
1829}
1830
1831void ASTStmtWriter::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1832 VisitExplicitCastExpr(E);
1833 Record.AddSourceLocation(E->getBeginLoc());
1834 Record.AddSourceLocation(E->getEndLoc());
1836}
1837
1838void ASTStmtWriter::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1839 VisitCallExpr(E);
1840 Record.AddSourceLocation(E->UDSuffixLoc);
1842}
1843
1844void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1845 VisitExpr(E);
1846 Record.push_back(E->getValue());
1847 Record.AddSourceLocation(E->getLocation());
1849}
1850
1851void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1852 VisitExpr(E);
1853 Record.AddSourceLocation(E->getLocation());
1855}
1856
1857void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1858 VisitExpr(E);
1859 Record.AddSourceRange(E->getSourceRange());
1860 if (E->isTypeOperand()) {
1861 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
1863 } else {
1864 Record.AddStmt(E->getExprOperand());
1866 }
1867}
1868
1869void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
1870 VisitExpr(E);
1871 Record.AddSourceLocation(E->getLocation());
1872 Record.push_back(E->isImplicit());
1873 Record.push_back(E->isCapturedByCopyInLambdaWithExplicitObjectParameter());
1874
1876}
1877
1878void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
1879 VisitExpr(E);
1880 Record.AddSourceLocation(E->getThrowLoc());
1881 Record.AddStmt(E->getSubExpr());
1882 Record.push_back(E->isThrownVariableInScope());
1884}
1885
1886void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1887 VisitExpr(E);
1888 Record.AddDeclRef(E->getParam());
1889 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1890 Record.AddSourceLocation(E->getUsedLocation());
1891 Record.push_back(E->hasRewrittenInit());
1892 if (E->hasRewrittenInit())
1893 Record.AddStmt(E->getRewrittenExpr());
1895}
1896
1897void ASTStmtWriter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1898 VisitExpr(E);
1899 Record.push_back(E->hasRewrittenInit());
1900 Record.AddDeclRef(E->getField());
1901 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1902 Record.AddSourceLocation(E->getExprLoc());
1903 if (E->hasRewrittenInit())
1904 Record.AddStmt(E->getRewrittenExpr());
1906}
1907
1908void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1909 VisitExpr(E);
1910 Record.AddCXXTemporary(E->getTemporary());
1911 Record.AddStmt(E->getSubExpr());
1913}
1914
1915void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1916 VisitExpr(E);
1917 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1918 Record.AddSourceLocation(E->getRParenLoc());
1920}
1921
1922void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
1923 VisitExpr(E);
1924
1925 Record.push_back(E->isArray());
1926 Record.push_back(E->hasInitializer());
1927 Record.push_back(E->getNumPlacementArgs());
1928 Record.push_back(E->isParenTypeId());
1929
1930 Record.push_back(E->isGlobalNew());
1931 Record.push_back(E->passAlignment());
1932 Record.push_back(E->doesUsualArrayDeleteWantSize());
1933 Record.push_back(E->CXXNewExprBits.HasInitializer);
1934 Record.push_back(E->CXXNewExprBits.StoredInitializationStyle);
1935
1936 Record.AddDeclRef(E->getOperatorNew());
1937 Record.AddDeclRef(E->getOperatorDelete());
1938 Record.AddTypeSourceInfo(E->getAllocatedTypeSourceInfo());
1939 if (E->isParenTypeId())
1940 Record.AddSourceRange(E->getTypeIdParens());
1941 Record.AddSourceRange(E->getSourceRange());
1942 Record.AddSourceRange(E->getDirectInitRange());
1943
1944 for (CXXNewExpr::arg_iterator I = E->raw_arg_begin(), N = E->raw_arg_end();
1945 I != N; ++I)
1946 Record.AddStmt(*I);
1947
1949}
1950
1951void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1952 VisitExpr(E);
1953 Record.push_back(E->isGlobalDelete());
1954 Record.push_back(E->isArrayForm());
1955 Record.push_back(E->isArrayFormAsWritten());
1956 Record.push_back(E->doesUsualArrayDeleteWantSize());
1957 Record.AddDeclRef(E->getOperatorDelete());
1958 Record.AddStmt(E->getArgument());
1959 Record.AddSourceLocation(E->getBeginLoc());
1960
1962}
1963
1964void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1965 VisitExpr(E);
1966
1967 Record.AddStmt(E->getBase());
1968 Record.push_back(E->isArrow());
1969 Record.AddSourceLocation(E->getOperatorLoc());
1970 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1971 Record.AddTypeSourceInfo(E->getScopeTypeInfo());
1972 Record.AddSourceLocation(E->getColonColonLoc());
1973 Record.AddSourceLocation(E->getTildeLoc());
1974
1975 // PseudoDestructorTypeStorage.
1976 Record.AddIdentifierRef(E->getDestroyedTypeIdentifier());
1977 if (E->getDestroyedTypeIdentifier())
1978 Record.AddSourceLocation(E->getDestroyedTypeLoc());
1979 else
1980 Record.AddTypeSourceInfo(E->getDestroyedTypeInfo());
1981
1983}
1984
1985void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) {
1986 VisitExpr(E);
1987 Record.push_back(E->getNumObjects());
1988 for (auto &Obj : E->getObjects()) {
1989 if (auto *BD = Obj.dyn_cast<BlockDecl *>()) {
1991 Record.AddDeclRef(BD);
1992 } else if (auto *CLE = Obj.dyn_cast<CompoundLiteralExpr *>()) {
1994 Record.AddStmt(CLE);
1995 }
1996 }
1997
1998 Record.push_back(E->cleanupsHaveSideEffects());
1999 Record.AddStmt(E->getSubExpr());
2001}
2002
2003void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
2005 VisitExpr(E);
2006
2007 // Don't emit anything here (or if you do you will have to update
2008 // the corresponding deserialization function).
2009 Record.push_back(E->getNumTemplateArgs());
2010 CurrentPackingBits.updateBits();
2011 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2012 CurrentPackingBits.addBit(E->hasFirstQualifierFoundInScope());
2013
2014 if (E->hasTemplateKWAndArgsInfo()) {
2015 const ASTTemplateKWAndArgsInfo &ArgInfo =
2016 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2018 E->getTrailingObjects<TemplateArgumentLoc>());
2019 }
2020
2021 CurrentPackingBits.addBit(E->isArrow());
2022
2023 Record.AddTypeRef(E->getBaseType());
2024 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2025 CurrentPackingBits.addBit(!E->isImplicitAccess());
2026 if (!E->isImplicitAccess())
2027 Record.AddStmt(E->getBase());
2028
2029 Record.AddSourceLocation(E->getOperatorLoc());
2030
2031 if (E->hasFirstQualifierFoundInScope())
2032 Record.AddDeclRef(E->getFirstQualifierFoundInScope());
2033
2034 Record.AddDeclarationNameInfo(E->MemberNameInfo);
2036}
2037
2038void
2039ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2040 VisitExpr(E);
2041
2042 // Don't emit anything here, HasTemplateKWAndArgsInfo must be
2043 // emitted first.
2044 CurrentPackingBits.addBit(
2045 E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
2046
2047 if (E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo) {
2048 const ASTTemplateKWAndArgsInfo &ArgInfo =
2049 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2050 // 16 bits should be enought to store the number of args
2051 CurrentPackingBits.addBits(ArgInfo.NumTemplateArgs, /*Width=*/16);
2053 E->getTrailingObjects<TemplateArgumentLoc>());
2054 }
2055
2056 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2057 Record.AddDeclarationNameInfo(E->NameInfo);
2059}
2060
2061void
2062ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2063 VisitExpr(E);
2064 Record.push_back(E->getNumArgs());
2066 ArgI = E->arg_begin(), ArgE = E->arg_end(); ArgI != ArgE; ++ArgI)
2067 Record.AddStmt(*ArgI);
2068 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
2069 Record.AddSourceLocation(E->getLParenLoc());
2070 Record.AddSourceLocation(E->getRParenLoc());
2071 Record.push_back(E->isListInitialization());
2073}
2074
2075void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
2076 VisitExpr(E);
2077
2078 Record.push_back(E->getNumDecls());
2079
2080 CurrentPackingBits.updateBits();
2081 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2082 if (E->hasTemplateKWAndArgsInfo()) {
2083 const ASTTemplateKWAndArgsInfo &ArgInfo =
2084 *E->getTrailingASTTemplateKWAndArgsInfo();
2085 Record.push_back(ArgInfo.NumTemplateArgs);
2086 AddTemplateKWAndArgsInfo(ArgInfo, E->getTrailingTemplateArgumentLoc());
2087 }
2088
2089 for (OverloadExpr::decls_iterator OvI = E->decls_begin(),
2090 OvE = E->decls_end();
2091 OvI != OvE; ++OvI) {
2092 Record.AddDeclRef(OvI.getDecl());
2093 Record.push_back(OvI.getAccess());
2094 }
2095
2096 Record.AddDeclarationNameInfo(E->getNameInfo());
2097 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2098}
2099
2100void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2101 VisitOverloadExpr(E);
2102 CurrentPackingBits.addBit(E->isArrow());
2103 CurrentPackingBits.addBit(E->hasUnresolvedUsing());
2104 CurrentPackingBits.addBit(!E->isImplicitAccess());
2105 if (!E->isImplicitAccess())
2106 Record.AddStmt(E->getBase());
2107
2108 Record.AddSourceLocation(E->getOperatorLoc());
2109
2110 Record.AddTypeRef(E->getBaseType());
2112}
2113
2114void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2115 VisitOverloadExpr(E);
2116 CurrentPackingBits.addBit(E->requiresADL());
2117 Record.AddDeclRef(E->getNamingClass());
2119
2120 if (Writer.isWritingStdCXXNamedModules() && Writer.getChain()) {
2121 // Referencing all the possible declarations to make sure the change get
2122 // propagted.
2123 DeclarationName Name = E->getName();
2124 for (auto *Found :
2125 Record.getASTContext().getTranslationUnitDecl()->lookup(Name))
2126 if (Found->isFromASTFile())
2127 Writer.GetDeclRef(Found);
2128
2130 Writer.getChain()->ReadKnownNamespaces(ExternalNSs);
2131 for (auto *NS : ExternalNSs)
2132 for (auto *Found : NS->lookup(Name))
2133 Writer.GetDeclRef(Found);
2134 }
2135}
2136
2137void ASTStmtWriter::VisitTypeTraitExpr(TypeTraitExpr *E) {
2138 VisitExpr(E);
2139 Record.push_back(E->TypeTraitExprBits.NumArgs);
2140 Record.push_back(E->TypeTraitExprBits.Kind); // FIXME: Stable encoding
2141 Record.push_back(E->TypeTraitExprBits.Value);
2142 Record.AddSourceRange(E->getSourceRange());
2143 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2144 Record.AddTypeSourceInfo(E->getArg(I));
2146}
2147
2148void ASTStmtWriter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2149 VisitExpr(E);
2150 Record.push_back(E->getTrait());
2151 Record.push_back(E->getValue());
2152 Record.AddSourceRange(E->getSourceRange());
2153 Record.AddTypeSourceInfo(E->getQueriedTypeSourceInfo());
2154 Record.AddStmt(E->getDimensionExpression());
2156}
2157
2158void ASTStmtWriter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2159 VisitExpr(E);
2160 Record.push_back(E->getTrait());
2161 Record.push_back(E->getValue());
2162 Record.AddSourceRange(E->getSourceRange());
2163 Record.AddStmt(E->getQueriedExpression());
2165}
2166
2167void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2168 VisitExpr(E);
2169 Record.push_back(E->getValue());
2170 Record.AddSourceRange(E->getSourceRange());
2171 Record.AddStmt(E->getOperand());
2173}
2174
2175void ASTStmtWriter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2176 VisitExpr(E);
2177 Record.AddSourceLocation(E->getEllipsisLoc());
2178 Record.push_back(E->NumExpansions);
2179 Record.AddStmt(E->getPattern());
2181}
2182
2183void ASTStmtWriter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2184 VisitExpr(E);
2185 Record.push_back(E->isPartiallySubstituted() ? E->getPartialArguments().size()
2186 : 0);
2187 Record.AddSourceLocation(E->OperatorLoc);
2188 Record.AddSourceLocation(E->PackLoc);
2189 Record.AddSourceLocation(E->RParenLoc);
2190 Record.AddDeclRef(E->Pack);
2191 if (E->isPartiallySubstituted()) {
2192 for (const auto &TA : E->getPartialArguments())
2193 Record.AddTemplateArgument(TA);
2194 } else if (!E->isValueDependent()) {
2195 Record.push_back(E->getPackLength());
2196 }
2198}
2199
2200void ASTStmtWriter::VisitPackIndexingExpr(PackIndexingExpr *E) {
2201 VisitExpr(E);
2202 Record.push_back(E->TransformedExpressions);
2203 Record.push_back(E->FullySubstituted);
2204 Record.AddSourceLocation(E->getEllipsisLoc());
2205 Record.AddSourceLocation(E->getRSquareLoc());
2206 Record.AddStmt(E->getPackIdExpression());
2207 Record.AddStmt(E->getIndexExpr());
2208 for (Expr *Sub : E->getExpressions())
2209 Record.AddStmt(Sub);
2211}
2212
2213void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
2215 VisitExpr(E);
2216 Record.AddDeclRef(E->getAssociatedDecl());
2217 CurrentPackingBits.addBit(E->isReferenceParameter());
2218 CurrentPackingBits.addBits(E->getIndex(), /*Width=*/12);
2219 CurrentPackingBits.addBit((bool)E->getPackIndex());
2220 if (auto PackIndex = E->getPackIndex())
2221 Record.push_back(*PackIndex + 1);
2222
2223 Record.AddSourceLocation(E->getNameLoc());
2224 Record.AddStmt(E->getReplacement());
2226}
2227
2228void ASTStmtWriter::VisitSubstNonTypeTemplateParmPackExpr(
2230 VisitExpr(E);
2231 Record.AddDeclRef(E->getAssociatedDecl());
2232 Record.push_back(E->getIndex());
2233 Record.AddTemplateArgument(E->getArgumentPack());
2234 Record.AddSourceLocation(E->getParameterPackLocation());
2236}
2237
2238void ASTStmtWriter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2239 VisitExpr(E);
2240 Record.push_back(E->getNumExpansions());
2241 Record.AddDeclRef(E->getParameterPack());
2242 Record.AddSourceLocation(E->getParameterPackLocation());
2243 for (FunctionParmPackExpr::iterator I = E->begin(), End = E->end();
2244 I != End; ++I)
2245 Record.AddDeclRef(*I);
2247}
2248
2249void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2250 VisitExpr(E);
2251 Record.push_back(static_cast<bool>(E->getLifetimeExtendedTemporaryDecl()));
2252 if (E->getLifetimeExtendedTemporaryDecl())
2253 Record.AddDeclRef(E->getLifetimeExtendedTemporaryDecl());
2254 else
2255 Record.AddStmt(E->getSubExpr());
2257}
2258
2259void ASTStmtWriter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2260 VisitExpr(E);
2261 Record.AddSourceLocation(E->LParenLoc);
2262 Record.AddSourceLocation(E->EllipsisLoc);
2263 Record.AddSourceLocation(E->RParenLoc);
2264 Record.push_back(E->NumExpansions);
2265 Record.AddStmt(E->SubExprs[0]);
2266 Record.AddStmt(E->SubExprs[1]);
2267 Record.AddStmt(E->SubExprs[2]);
2268 Record.push_back(E->Opcode);
2270}
2271
2272void ASTStmtWriter::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2273 VisitExpr(E);
2274 ArrayRef<Expr *> InitExprs = E->getInitExprs();
2275 Record.push_back(InitExprs.size());
2276 Record.push_back(E->getUserSpecifiedInitExprs().size());
2277 Record.AddSourceLocation(E->getInitLoc());
2278 Record.AddSourceLocation(E->getBeginLoc());
2279 Record.AddSourceLocation(E->getEndLoc());
2280 for (Expr *InitExpr : E->getInitExprs())
2281 Record.AddStmt(InitExpr);
2282 Expr *ArrayFiller = E->getArrayFiller();
2283 FieldDecl *UnionField = E->getInitializedFieldInUnion();
2284 bool HasArrayFillerOrUnionDecl = ArrayFiller || UnionField;
2285 Record.push_back(HasArrayFillerOrUnionDecl);
2286 if (HasArrayFillerOrUnionDecl) {
2287 Record.push_back(static_cast<bool>(ArrayFiller));
2288 if (ArrayFiller)
2289 Record.AddStmt(ArrayFiller);
2290 else
2291 Record.AddDeclRef(UnionField);
2292 }
2294}
2295
2296void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2297 VisitExpr(E);
2298 Record.AddStmt(E->getSourceExpr());
2299 Record.AddSourceLocation(E->getLocation());
2300 Record.push_back(E->isUnique());
2302}
2303
2304void ASTStmtWriter::VisitTypoExpr(TypoExpr *E) {
2305 VisitExpr(E);
2306 // TODO: Figure out sane writer behavior for a TypoExpr, if necessary
2307 llvm_unreachable("Cannot write TypoExpr nodes");
2308}
2309
2310//===----------------------------------------------------------------------===//
2311// CUDA Expressions and Statements.
2312//===----------------------------------------------------------------------===//
2313
2314void ASTStmtWriter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2315 VisitCallExpr(E);
2316 Record.AddStmt(E->getConfig());
2318}
2319
2320//===----------------------------------------------------------------------===//
2321// OpenCL Expressions and Statements.
2322//===----------------------------------------------------------------------===//
2323void ASTStmtWriter::VisitAsTypeExpr(AsTypeExpr *E) {
2324 VisitExpr(E);
2325 Record.AddSourceLocation(E->getBuiltinLoc());
2326 Record.AddSourceLocation(E->getRParenLoc());
2327 Record.AddStmt(E->getSrcExpr());
2329}
2330
2331//===----------------------------------------------------------------------===//
2332// Microsoft Expressions and Statements.
2333//===----------------------------------------------------------------------===//
2334void ASTStmtWriter::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2335 VisitExpr(E);
2336 Record.push_back(E->isArrow());
2337 Record.AddStmt(E->getBaseExpr());
2338 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2339 Record.AddSourceLocation(E->getMemberLoc());
2340 Record.AddDeclRef(E->getPropertyDecl());
2342}
2343
2344void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2345 VisitExpr(E);
2346 Record.AddStmt(E->getBase());
2347 Record.AddStmt(E->getIdx());
2348 Record.AddSourceLocation(E->getRBracketLoc());
2350}
2351
2352void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2353 VisitExpr(E);
2354 Record.AddSourceRange(E->getSourceRange());
2355 Record.AddDeclRef(E->getGuidDecl());
2356 if (E->isTypeOperand()) {
2357 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
2359 } else {
2360 Record.AddStmt(E->getExprOperand());
2362 }
2363}
2364
2365void ASTStmtWriter::VisitSEHExceptStmt(SEHExceptStmt *S) {
2366 VisitStmt(S);
2367 Record.AddSourceLocation(S->getExceptLoc());
2368 Record.AddStmt(S->getFilterExpr());
2369 Record.AddStmt(S->getBlock());
2371}
2372
2373void ASTStmtWriter::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2374 VisitStmt(S);
2375 Record.AddSourceLocation(S->getFinallyLoc());
2376 Record.AddStmt(S->getBlock());
2378}
2379
2380void ASTStmtWriter::VisitSEHTryStmt(SEHTryStmt *S) {
2381 VisitStmt(S);
2382 Record.push_back(S->getIsCXXTry());
2383 Record.AddSourceLocation(S->getTryLoc());
2384 Record.AddStmt(S->getTryBlock());
2385 Record.AddStmt(S->getHandler());
2387}
2388
2389void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2390 VisitStmt(S);
2391 Record.AddSourceLocation(S->getLeaveLoc());
2393}
2394
2395//===----------------------------------------------------------------------===//
2396// OpenMP Directives.
2397//===----------------------------------------------------------------------===//
2398
2399void ASTStmtWriter::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2400 VisitStmt(S);
2401 for (Stmt *SubStmt : S->SubStmts)
2402 Record.AddStmt(SubStmt);
2404}
2405
2406void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2407 Record.writeOMPChildren(E->Data);
2408 Record.AddSourceLocation(E->getBeginLoc());
2409 Record.AddSourceLocation(E->getEndLoc());
2410}
2411
2412void ASTStmtWriter::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2413 VisitStmt(D);
2414 Record.writeUInt32(D->getLoopsNumber());
2415 VisitOMPExecutableDirective(D);
2416}
2417
2418void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) {
2419 VisitOMPLoopBasedDirective(D);
2420}
2421
2422void ASTStmtWriter::VisitOMPMetaDirective(OMPMetaDirective *D) {
2423 VisitStmt(D);
2424 Record.push_back(D->getNumClauses());
2425 VisitOMPExecutableDirective(D);
2427}
2428
2429void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) {
2430 VisitStmt(D);
2431 VisitOMPExecutableDirective(D);
2432 Record.writeBool(D->hasCancel());
2434}
2435
2436void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) {
2437 VisitOMPLoopDirective(D);
2439}
2440
2441void ASTStmtWriter::VisitOMPLoopTransformationDirective(
2443 VisitOMPLoopBasedDirective(D);
2444 Record.writeUInt32(D->getNumGeneratedLoops());
2445}
2446
2447void ASTStmtWriter::VisitOMPTileDirective(OMPTileDirective *D) {
2448 VisitOMPLoopTransformationDirective(D);
2450}
2451
2452void ASTStmtWriter::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2453 VisitOMPLoopTransformationDirective(D);
2455}
2456
2457void ASTStmtWriter::VisitOMPReverseDirective(OMPReverseDirective *D) {
2458 VisitOMPLoopTransformationDirective(D);
2460}
2461
2462void ASTStmtWriter::VisitOMPInterchangeDirective(OMPInterchangeDirective *D) {
2463 VisitOMPLoopTransformationDirective(D);
2465}
2466
2467void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) {
2468 VisitOMPLoopDirective(D);
2469 Record.writeBool(D->hasCancel());
2471}
2472
2473void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2474 VisitOMPLoopDirective(D);
2476}
2477
2478void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2479 VisitStmt(D);
2480 VisitOMPExecutableDirective(D);
2481 Record.writeBool(D->hasCancel());
2483}
2484
2485void ASTStmtWriter::VisitOMPSectionDirective(OMPSectionDirective *D) {
2486 VisitStmt(D);
2487 VisitOMPExecutableDirective(D);
2488 Record.writeBool(D->hasCancel());
2490}
2491
2492void ASTStmtWriter::VisitOMPScopeDirective(OMPScopeDirective *D) {
2493 VisitStmt(D);
2494 VisitOMPExecutableDirective(D);
2496}
2497
2498void ASTStmtWriter::VisitOMPSingleDirective(OMPSingleDirective *D) {
2499 VisitStmt(D);
2500 VisitOMPExecutableDirective(D);
2502}
2503
2504void ASTStmtWriter::VisitOMPMasterDirective(OMPMasterDirective *D) {
2505 VisitStmt(D);
2506 VisitOMPExecutableDirective(D);
2508}
2509
2510void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2511 VisitStmt(D);
2512 VisitOMPExecutableDirective(D);
2513 Record.AddDeclarationNameInfo(D->getDirectiveName());
2515}
2516
2517void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2518 VisitOMPLoopDirective(D);
2519 Record.writeBool(D->hasCancel());
2521}
2522
2523void ASTStmtWriter::VisitOMPParallelForSimdDirective(
2525 VisitOMPLoopDirective(D);
2527}
2528
2529void ASTStmtWriter::VisitOMPParallelMasterDirective(
2531 VisitStmt(D);
2532 VisitOMPExecutableDirective(D);
2534}
2535
2536void ASTStmtWriter::VisitOMPParallelMaskedDirective(
2538 VisitStmt(D);
2539 VisitOMPExecutableDirective(D);
2541}
2542
2543void ASTStmtWriter::VisitOMPParallelSectionsDirective(
2545 VisitStmt(D);
2546 VisitOMPExecutableDirective(D);
2547 Record.writeBool(D->hasCancel());
2549}
2550
2551void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) {
2552 VisitStmt(D);
2553 VisitOMPExecutableDirective(D);
2554 Record.writeBool(D->hasCancel());
2556}
2557
2558void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2559 VisitStmt(D);
2560 VisitOMPExecutableDirective(D);
2561 Record.writeBool(D->isXLHSInRHSPart());
2562 Record.writeBool(D->isPostfixUpdate());
2563 Record.writeBool(D->isFailOnly());
2565}
2566
2567void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) {
2568 VisitStmt(D);
2569 VisitOMPExecutableDirective(D);
2571}
2572
2573void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2574 VisitStmt(D);
2575 VisitOMPExecutableDirective(D);
2577}
2578
2579void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
2581 VisitStmt(D);
2582 VisitOMPExecutableDirective(D);
2584}
2585
2586void ASTStmtWriter::VisitOMPTargetExitDataDirective(
2588 VisitStmt(D);
2589 VisitOMPExecutableDirective(D);
2591}
2592
2593void ASTStmtWriter::VisitOMPTargetParallelDirective(
2595 VisitStmt(D);
2596 VisitOMPExecutableDirective(D);
2597 Record.writeBool(D->hasCancel());
2599}
2600
2601void ASTStmtWriter::VisitOMPTargetParallelForDirective(
2603 VisitOMPLoopDirective(D);
2604 Record.writeBool(D->hasCancel());
2606}
2607
2608void ASTStmtWriter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2609 VisitStmt(D);
2610 VisitOMPExecutableDirective(D);
2612}
2613
2614void ASTStmtWriter::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2615 VisitStmt(D);
2616 VisitOMPExecutableDirective(D);
2618}
2619
2620void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2621 VisitStmt(D);
2622 Record.push_back(D->getNumClauses());
2623 VisitOMPExecutableDirective(D);
2625}
2626
2627void ASTStmtWriter::VisitOMPAssumeDirective(OMPAssumeDirective *D) {
2628 VisitStmt(D);
2629 VisitOMPExecutableDirective(D);
2631}
2632
2633void ASTStmtWriter::VisitOMPErrorDirective(OMPErrorDirective *D) {
2634 VisitStmt(D);
2635 Record.push_back(D->getNumClauses());
2636 VisitOMPExecutableDirective(D);
2638}
2639
2640void ASTStmtWriter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2641 VisitStmt(D);
2642 VisitOMPExecutableDirective(D);
2644}
2645
2646void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) {
2647 VisitStmt(D);
2648 VisitOMPExecutableDirective(D);
2650}
2651
2652void ASTStmtWriter::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2653 VisitStmt(D);
2654 VisitOMPExecutableDirective(D);
2656}
2657
2658void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
2659 VisitStmt(D);
2660 VisitOMPExecutableDirective(D);
2662}
2663
2664void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2665 VisitStmt(D);
2666 VisitOMPExecutableDirective(D);
2668}
2669
2670void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2671 VisitStmt(D);
2672 VisitOMPExecutableDirective(D);
2674}
2675
2676void ASTStmtWriter::VisitOMPCancellationPointDirective(
2678 VisitStmt(D);
2679 VisitOMPExecutableDirective(D);
2680 Record.writeEnum(D->getCancelRegion());
2682}
2683
2684void ASTStmtWriter::VisitOMPCancelDirective(OMPCancelDirective *D) {
2685 VisitStmt(D);
2686 VisitOMPExecutableDirective(D);
2687 Record.writeEnum(D->getCancelRegion());
2689}
2690
2691void ASTStmtWriter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2692 VisitOMPLoopDirective(D);
2693 Record.writeBool(D->hasCancel());
2695}
2696
2697void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2698 VisitOMPLoopDirective(D);
2700}
2701
2702void ASTStmtWriter::VisitOMPMasterTaskLoopDirective(
2704 VisitOMPLoopDirective(D);
2705 Record.writeBool(D->hasCancel());
2707}
2708
2709void ASTStmtWriter::VisitOMPMaskedTaskLoopDirective(
2711 VisitOMPLoopDirective(D);
2712 Record.writeBool(D->hasCancel());
2714}
2715
2716void ASTStmtWriter::VisitOMPMasterTaskLoopSimdDirective(
2718 VisitOMPLoopDirective(D);
2720}
2721
2722void ASTStmtWriter::VisitOMPMaskedTaskLoopSimdDirective(
2724 VisitOMPLoopDirective(D);
2726}
2727
2728void ASTStmtWriter::VisitOMPParallelMasterTaskLoopDirective(
2730 VisitOMPLoopDirective(D);
2731 Record.writeBool(D->hasCancel());
2733}
2734
2735void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopDirective(
2737 VisitOMPLoopDirective(D);
2738 Record.writeBool(D->hasCancel());
2740}
2741
2742void ASTStmtWriter::VisitOMPParallelMasterTaskLoopSimdDirective(
2744 VisitOMPLoopDirective(D);
2746}
2747
2748void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopSimdDirective(
2750 VisitOMPLoopDirective(D);
2752}
2753
2754void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2755 VisitOMPLoopDirective(D);
2757}
2758
2759void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2760 VisitStmt(D);
2761 VisitOMPExecutableDirective(D);
2763}
2764
2765void ASTStmtWriter::VisitOMPDistributeParallelForDirective(
2767 VisitOMPLoopDirective(D);
2768 Record.writeBool(D->hasCancel());
2770}
2771
2772void ASTStmtWriter::VisitOMPDistributeParallelForSimdDirective(
2774 VisitOMPLoopDirective(D);
2776}
2777
2778void ASTStmtWriter::VisitOMPDistributeSimdDirective(
2780 VisitOMPLoopDirective(D);
2782}
2783
2784void ASTStmtWriter::VisitOMPTargetParallelForSimdDirective(
2786 VisitOMPLoopDirective(D);
2788}
2789
2790void ASTStmtWriter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2791 VisitOMPLoopDirective(D);
2793}
2794
2795void ASTStmtWriter::VisitOMPTeamsDistributeDirective(
2797 VisitOMPLoopDirective(D);
2799}
2800
2801void ASTStmtWriter::VisitOMPTeamsDistributeSimdDirective(
2803 VisitOMPLoopDirective(D);
2805}
2806
2807void ASTStmtWriter::VisitOMPTeamsDistributeParallelForSimdDirective(
2809 VisitOMPLoopDirective(D);
2811}
2812
2813void ASTStmtWriter::VisitOMPTeamsDistributeParallelForDirective(
2815 VisitOMPLoopDirective(D);
2816 Record.writeBool(D->hasCancel());
2818}
2819
2820void ASTStmtWriter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2821 VisitStmt(D);
2822 VisitOMPExecutableDirective(D);
2824}
2825
2826void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective(
2828 VisitOMPLoopDirective(D);
2830}
2831
2832void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective(
2834 VisitOMPLoopDirective(D);
2835 Record.writeBool(D->hasCancel());
2837}
2838
2839void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2841 VisitOMPLoopDirective(D);
2842 Code = serialization::
2844}
2845
2846void ASTStmtWriter::VisitOMPTargetTeamsDistributeSimdDirective(
2848 VisitOMPLoopDirective(D);
2850}
2851
2852void ASTStmtWriter::VisitOMPInteropDirective(OMPInteropDirective *D) {
2853 VisitStmt(D);
2854 VisitOMPExecutableDirective(D);
2856}
2857
2858void ASTStmtWriter::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2859 VisitStmt(D);
2860 VisitOMPExecutableDirective(D);
2861 Record.AddSourceLocation(D->getTargetCallLoc());
2863}
2864
2865void ASTStmtWriter::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2866 VisitStmt(D);
2867 VisitOMPExecutableDirective(D);
2869}
2870
2871void ASTStmtWriter::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2872 VisitOMPLoopDirective(D);
2874}
2875
2876void ASTStmtWriter::VisitOMPTeamsGenericLoopDirective(
2878 VisitOMPLoopDirective(D);
2880}
2881
2882void ASTStmtWriter::VisitOMPTargetTeamsGenericLoopDirective(
2884 VisitOMPLoopDirective(D);
2885 Record.writeBool(D->canBeParallelFor());
2887}
2888
2889void ASTStmtWriter::VisitOMPParallelGenericLoopDirective(
2891 VisitOMPLoopDirective(D);
2893}
2894
2895void ASTStmtWriter::VisitOMPTargetParallelGenericLoopDirective(
2897 VisitOMPLoopDirective(D);
2899}
2900
2901//===----------------------------------------------------------------------===//
2902// OpenACC Constructs/Directives.
2903//===----------------------------------------------------------------------===//
2904void ASTStmtWriter::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2905 Record.push_back(S->clauses().size());
2906 Record.writeEnum(S->Kind);
2907 Record.AddSourceRange(S->Range);
2908 Record.AddSourceLocation(S->DirectiveLoc);
2909 Record.writeOpenACCClauseList(S->clauses());
2910}
2911
2912void ASTStmtWriter::VisitOpenACCAssociatedStmtConstruct(
2914 VisitOpenACCConstructStmt(S);
2915 Record.AddStmt(S->getAssociatedStmt());
2916}
2917
2918void ASTStmtWriter::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2919 VisitStmt(S);
2920 VisitOpenACCAssociatedStmtConstruct(S);
2922}
2923
2924void ASTStmtWriter::VisitOpenACCLoopConstruct(OpenACCLoopConstruct *S) {
2925 VisitStmt(S);
2926 VisitOpenACCAssociatedStmtConstruct(S);
2927 Record.writeEnum(S->getParentComputeConstructKind());
2929}
2930
2931void ASTStmtWriter::VisitOpenACCCombinedConstruct(OpenACCCombinedConstruct *S) {
2932 VisitStmt(S);
2933 VisitOpenACCAssociatedStmtConstruct(S);
2935}
2936
2937void ASTStmtWriter::VisitOpenACCDataConstruct(OpenACCDataConstruct *S) {
2938 VisitStmt(S);
2939 VisitOpenACCAssociatedStmtConstruct(S);
2941}
2942
2943void ASTStmtWriter::VisitOpenACCEnterDataConstruct(
2945 VisitStmt(S);
2946 VisitOpenACCConstructStmt(S);
2948}
2949
2950void ASTStmtWriter::VisitOpenACCExitDataConstruct(OpenACCExitDataConstruct *S) {
2951 VisitStmt(S);
2952 VisitOpenACCConstructStmt(S);
2954}
2955
2956void ASTStmtWriter::VisitOpenACCInitConstruct(OpenACCInitConstruct *S) {
2957 VisitStmt(S);
2958 VisitOpenACCConstructStmt(S);
2960}
2961
2962void ASTStmtWriter::VisitOpenACCShutdownConstruct(OpenACCShutdownConstruct *S) {
2963 VisitStmt(S);
2964 VisitOpenACCConstructStmt(S);
2966}
2967
2968void ASTStmtWriter::VisitOpenACCSetConstruct(OpenACCSetConstruct *S) {
2969 VisitStmt(S);
2970 VisitOpenACCConstructStmt(S);
2972}
2973
2974void ASTStmtWriter::VisitOpenACCUpdateConstruct(OpenACCUpdateConstruct *S) {
2975 VisitStmt(S);
2976 VisitOpenACCConstructStmt(S);
2978}
2979
2980void ASTStmtWriter::VisitOpenACCHostDataConstruct(OpenACCHostDataConstruct *S) {
2981 VisitStmt(S);
2982 VisitOpenACCAssociatedStmtConstruct(S);
2984}
2985
2986void ASTStmtWriter::VisitOpenACCWaitConstruct(OpenACCWaitConstruct *S) {
2987 VisitStmt(S);
2988 Record.push_back(S->getExprs().size());
2989 VisitOpenACCConstructStmt(S);
2990 Record.AddSourceLocation(S->LParenLoc);
2991 Record.AddSourceLocation(S->RParenLoc);
2992 Record.AddSourceLocation(S->QueuesLoc);
2993
2994 for(Expr *E : S->getExprs())
2995 Record.AddStmt(E);
2996
2998}
2999
3000//===----------------------------------------------------------------------===//
3001// HLSL Constructs/Directives.
3002//===----------------------------------------------------------------------===//
3003
3004void ASTStmtWriter::VisitHLSLOutArgExpr(HLSLOutArgExpr *S) {
3005 VisitExpr(S);
3006 Record.AddStmt(S->getOpaqueArgLValue());
3007 Record.AddStmt(S->getCastedTemporary());
3008 Record.AddStmt(S->getWritebackCast());
3009 Record.writeBool(S->isInOut());
3011}
3012
3013//===----------------------------------------------------------------------===//
3014// ASTWriter Implementation
3015//===----------------------------------------------------------------------===//
3016
3018 assert(!SwitchCaseIDs.contains(S) && "SwitchCase recorded twice");
3019 unsigned NextID = SwitchCaseIDs.size();
3020 SwitchCaseIDs[S] = NextID;
3021 return NextID;
3022}
3023
3025 assert(SwitchCaseIDs.contains(S) && "SwitchCase hasn't been seen yet");
3026 return SwitchCaseIDs[S];
3027}
3028
3030 SwitchCaseIDs.clear();
3031}
3032
3033/// Write the given substatement or subexpression to the
3034/// bitstream.
3035void ASTWriter::WriteSubStmt(ASTContext &Context, Stmt *S) {
3037 ASTStmtWriter Writer(Context, *this, Record);
3038 ++NumStatements;
3039
3040 if (!S) {
3041 Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
3042 return;
3043 }
3044
3045 llvm::DenseMap<Stmt *, uint64_t>::iterator I = SubStmtEntries.find(S);
3046 if (I != SubStmtEntries.end()) {
3047 Record.push_back(I->second);
3048 Stream.EmitRecord(serialization::STMT_REF_PTR, Record);
3049 return;
3050 }
3051
3052#ifndef NDEBUG
3053 assert(!ParentStmts.count(S) && "There is a Stmt cycle!");
3054
3055 struct ParentStmtInserterRAII {
3056 Stmt *S;
3057 llvm::DenseSet<Stmt *> &ParentStmts;
3058
3059 ParentStmtInserterRAII(Stmt *S, llvm::DenseSet<Stmt *> &ParentStmts)
3060 : S(S), ParentStmts(ParentStmts) {
3061 ParentStmts.insert(S);
3062 }
3063 ~ParentStmtInserterRAII() {
3064 ParentStmts.erase(S);
3065 }
3066 };
3067
3068 ParentStmtInserterRAII ParentStmtInserter(S, ParentStmts);
3069#endif
3070
3071 Writer.Visit(S);
3072
3073 uint64_t Offset = Writer.Emit();
3074 SubStmtEntries[S] = Offset;
3075}
3076
3077/// Flush all of the statements that have been added to the
3078/// queue via AddStmt().
3079void ASTRecordWriter::FlushStmts() {
3080 // We expect to be the only consumer of the two temporary statement maps,
3081 // assert that they are empty.
3082 assert(Writer->SubStmtEntries.empty() && "unexpected entries in sub-stmt map");
3083 assert(Writer->ParentStmts.empty() && "unexpected entries in parent stmt map");
3084
3085 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3086 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[I]);
3087
3088 assert(N == StmtsToEmit.size() && "record modified while being written!");
3089
3090 // Note that we are at the end of a full expression. Any
3091 // expression records that follow this one are part of a different
3092 // expression.
3093 Writer->Stream.EmitRecord(serialization::STMT_STOP, ArrayRef<uint32_t>());
3094
3095 Writer->SubStmtEntries.clear();
3096 Writer->ParentStmts.clear();
3097 }
3098
3099 StmtsToEmit.clear();
3100}
3101
3102void ASTRecordWriter::FlushSubStmts() {
3103 // For a nested statement, write out the substatements in reverse order (so
3104 // that a simple stack machine can be used when loading), and don't emit a
3105 // STMT_STOP after each one.
3106 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3107 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[N - I - 1]);
3108 assert(N == StmtsToEmit.size() && "record modified while being written!");
3109 }
3110
3111 StmtsToEmit.clear();
3112}
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:9183
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:882
bool isWritingStdCXXNamedModules() const
Definition: ASTWriter.h:897
unsigned getExprImplicitCastAbbrev() const
Definition: ASTWriter.h:881
unsigned getSwitchCaseID(SwitchCase *S)
Retrieve the ID for the given switch-case statement.
unsigned getDeclRefExprAbbrev() const
Definition: ASTWriter.h:878
unsigned getCXXOperatorCallExprAbbrev()
Definition: ASTWriter.h:887
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:6829
unsigned getCXXMemberCallExprAbbrev()
Definition: ASTWriter.h:888
ASTReader * getChain() const
Definition: ASTWriter.h:893
unsigned getCompoundAssignOperatorAbbrev() const
Definition: ASTWriter.h:883
unsigned RecordSwitchCaseID(SwitchCase *S)
Record an ID for the given switch-case statement.
unsigned getCharacterLiteralAbbrev() const
Definition: ASTWriter.h:879
unsigned getCompoundStmtAbbrev() const
Definition: ASTWriter.h:890
void AddToken(const Token &Tok, RecordDataImpl &Record)
Emit a token.
Definition: ASTWriter.cpp:5186
SmallVector< uint64_t, 64 > RecordData
Definition: ASTWriter.h:94
unsigned getCallExprAbbrev() const
Definition: ASTWriter.h:886
unsigned getIntegerLiteralAbbrev() const
Definition: ASTWriter.h:880
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:3127
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6678
Represents an attribute applied to a statement.
Definition: Stmt.h:2107
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:1049
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4496
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:6414
BreakStmt - This represents a break.
Definition: Stmt.h:3007
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:3784
CaseStmt - Represent a case statement.
Definition: Stmt.h:1828
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:1628
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:2977
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:1519
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:2752
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:276
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:2808
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:3286
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:2889
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:2165
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:2928
Describes an C or C++ initializer list.
Definition: Expr.h:5088
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:2058
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:3509
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:1591
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:1707
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:3046
Represents a __leave statement.
Definition: Stmt.h:3745
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Definition: StmtSYCL.h:37
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:4412
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:186
Stmt - This represents one statement.
Definition: Stmt.h:84
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:358
LambdaExprBitfields LambdaExprBits
Definition: Stmt.h:1285
child_range children()
Definition: Stmt.cpp:295
StmtClass getStmtClass() const
Definition: Stmt.h:1380
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:334
TypeTraitExprBitfields TypeTraitExprBits
Definition: Stmt.h:1274
CXXNewExprBitfields CXXNewExprBits
Definition: Stmt.h:1272
ConstantExprBitfields ConstantExprBits
Definition: Stmt.h:1239
RequiresExprBitfields RequiresExprBits
Definition: Stmt.h:1286
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition: Stmt.h:1275
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.cpp:346
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:2415
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:524
A container of type source information.
Definition: Type.h:7907
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:2611
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:1541
@ EXPR_DESIGNATED_INIT
A DesignatedInitExpr record.
Definition: ASTBitCodes.h:1691
@ EXPR_COMPOUND_LITERAL
A CompoundLiteralExpr record.
Definition: ASTBitCodes.h:1682
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1989
@ EXPR_OBJC_IVAR_REF_EXPR
An ObjCIvarRefExpr record.
Definition: ASTBitCodes.h:1769
@ EXPR_MEMBER
A MemberExpr record.
Definition: ASTBitCodes.h:1664
@ EXPR_CXX_TEMPORARY_OBJECT
A CXXTemporaryObjectExpr record.
Definition: ASTBitCodes.h:1843
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:2000
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
Definition: ASTBitCodes.h:1670
@ EXPR_CXX_STATIC_CAST
A CXXStaticCastExpr record.
Definition: ASTBitCodes.h:1846
@ EXPR_OBJC_STRING_LITERAL
An ObjCStringLiteral record.
Definition: ASTBitCodes.h:1753
@ EXPR_VA_ARG
A VAArgExpr record.
Definition: ASTBitCodes.h:1709
@ STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1994
@ EXPR_OBJC_ISA
An ObjCIsa Expr record.
Definition: ASTBitCodes.h:1784
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
Definition: ASTBitCodes.h:1828
@ STMT_OBJC_AT_TRY
An ObjCAtTryStmt record.
Definition: ASTBitCodes.h:1799
@ STMT_DO
A DoStmt record.
Definition: ASTBitCodes.h:1580
@ STMT_OBJC_CATCH
An ObjCAtCatchStmt record.
Definition: ASTBitCodes.h:1793
@ STMT_IF
An IfStmt record.
Definition: ASTBitCodes.h:1571
@ EXPR_STRING_LITERAL
A StringLiteral record.
Definition: ASTBitCodes.h:1634
@ EXPR_OBJC_AVAILABILITY_CHECK
An ObjCAvailabilityCheckExpr record.
Definition: ASTBitCodes.h:1814
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_DIRECTIVE
Definition: ASTBitCodes.h:1984
@ EXPR_PSEUDO_OBJECT
A PseudoObjectExpr record.
Definition: ASTBitCodes.h:1742
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1999
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1676
@ STMT_CAPTURED
A CapturedStmt record.
Definition: ASTBitCodes.h:1604
@ STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1991
@ STMT_GCCASM
A GCC-style AsmStmt record.
Definition: ASTBitCodes.h:1610
@ EXPR_IMAGINARY_LITERAL
An ImaginaryLiteral record.
Definition: ASTBitCodes.h:1631
@ STMT_WHILE
A WhileStmt record.
Definition: ASTBitCodes.h:1577
@ EXPR_CONVERT_VECTOR
A ConvertVectorExpr record.
Definition: ASTBitCodes.h:1733
@ EXPR_OBJC_SUBSCRIPT_REF_EXPR
An ObjCSubscriptRefExpr record.
Definition: ASTBitCodes.h:1775
@ EXPR_STMT
A StmtExpr record.
Definition: ASTBitCodes.h:1715
@ STMT_OMP_PARALLEL_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:2009
@ EXPR_CXX_REINTERPRET_CAST
A CXXReinterpretCastExpr record.
Definition: ASTBitCodes.h:1852
@ EXPR_DESIGNATED_INIT_UPDATE
A DesignatedInitUpdateExpr record.
Definition: ASTBitCodes.h:1694
@ STMT_OBJC_AT_SYNCHRONIZED
An ObjCAtSynchronizedStmt record.
Definition: ASTBitCodes.h:1802
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1988
@ EXPR_BUILTIN_BIT_CAST
A BuiltinBitCastExpr record.
Definition: ASTBitCodes.h:1864
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:2001
@ STMT_SYCLKERNELCALL
A SYCLKernelCallStmt record.
Definition: ASTBitCodes.h:1607
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
Definition: ASTBitCodes.h:1637
@ EXPR_OBJC_ENCODE
An ObjCEncodeExpr record.
Definition: ASTBitCodes.h:1760
@ EXPR_CSTYLE_CAST
A CStyleCastExpr record.
Definition: ASTBitCodes.h:1679
@ EXPR_OBJC_BOOL_LITERAL
An ObjCBoolLiteralExpr record.
Definition: ASTBitCodes.h:1811
@ EXPR_EXT_VECTOR_ELEMENT
An ExtVectorElementExpr record.
Definition: ASTBitCodes.h:1685
@ EXPR_ATOMIC
An AtomicExpr record.
Definition: ASTBitCodes.h:1745
@ EXPR_OFFSETOF
An OffsetOfExpr record.
Definition: ASTBitCodes.h:1649
@ STMT_RETURN
A ReturnStmt record.
Definition: ASTBitCodes.h:1598
@ STMT_OBJC_FOR_COLLECTION
An ObjCForCollectionStmt record.
Definition: ASTBitCodes.h:1790
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE
Definition: ASTBitCodes.h:1998
@ EXPR_ARRAY_INIT_LOOP
An ArrayInitLoopExpr record.
Definition: ASTBitCodes.h:1700
@ STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE
Definition: ASTBitCodes.h:1980
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1985
@ STMT_CONTINUE
A ContinueStmt record.
Definition: ASTBitCodes.h:1592
@ EXPR_PREDEFINED
A PredefinedExpr record.
Definition: ASTBitCodes.h:1619
@ EXPR_CXX_BOOL_LITERAL
A CXXBoolLiteralExpr record.
Definition: ASTBitCodes.h:1873
@ EXPR_PAREN_LIST
A ParenListExpr record.
Definition: ASTBitCodes.h:1643
@ EXPR_CXX_PAREN_LIST_INIT
A CXXParenListInitExpr record.
Definition: ASTBitCodes.h:1876
@ STMT_OMP_MASTER_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1979
@ STMT_COMPOUND
A CompoundStmt record.
Definition: ASTBitCodes.h:1556
@ STMT_FOR
A ForStmt record.
Definition: ASTBitCodes.h:1583
@ STMT_ATTRIBUTED
An AttributedStmt record.
Definition: ASTBitCodes.h:1568
@ STMT_OMP_TARGET_TEAMS_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:2008
@ EXPR_CXX_REWRITTEN_BINARY_OPERATOR
A CXXRewrittenBinaryOperator record.
Definition: ASTBitCodes.h:1834
@ STMT_GOTO
A GotoStmt record.
Definition: ASTBitCodes.h:1586
@ EXPR_NO_INIT
An NoInitExpr record.
Definition: ASTBitCodes.h:1697
@ EXPR_OBJC_PROTOCOL_EXPR
An ObjCProtocolExpr record.
Definition: ASTBitCodes.h:1766
@ EXPR_ARRAY_INIT_INDEX
An ArrayInitIndexExpr record.
Definition: ASTBitCodes.h:1703
@ EXPR_CXX_CONSTRUCT
A CXXConstructExpr record.
Definition: ASTBitCodes.h:1837
@ STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1996
@ STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1981
@ STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1995
@ EXPR_CXX_DYNAMIC_CAST
A CXXDynamicCastExpr record.
Definition: ASTBitCodes.h:1849
@ STMT_CXX_TRY
A CXXTryStmt record.
Definition: ASTBitCodes.h:1822
@ EXPR_GENERIC_SELECTION
A GenericSelectionExpr record.
Definition: ASTBitCodes.h:1739
@ EXPR_OBJC_INDIRECT_COPY_RESTORE
An ObjCIndirectCopyRestoreExpr record.
Definition: ASTBitCodes.h:1787
@ EXPR_CXX_INHERITED_CTOR_INIT
A CXXInheritedCtorInitExpr record.
Definition: ASTBitCodes.h:1840
@ EXPR_CALL
A CallExpr record.
Definition: ASTBitCodes.h:1661
@ EXPR_GNU_NULL
A GNUNullExpr record.
Definition: ASTBitCodes.h:1721
@ EXPR_OBJC_PROPERTY_REF_EXPR
An ObjCPropertyRefExpr record.
Definition: ASTBitCodes.h:1772
@ STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1971
@ EXPR_CXX_CONST_CAST
A CXXConstCastExpr record.
Definition: ASTBitCodes.h:1855
@ STMT_REF_PTR
A reference to a previously [de]serialized Stmt record.
Definition: ASTBitCodes.h:1550
@ EXPR_OBJC_MESSAGE_EXPR
An ObjCMessageExpr record.
Definition: ASTBitCodes.h:1781
@ STMT_CASE
A CaseStmt record.
Definition: ASTBitCodes.h:1559
@ EXPR_CONSTANT
A constant expression context.
Definition: ASTBitCodes.h:1616
@ STMT_STOP
A marker record that indicates that we are at the end of an expression.
Definition: ASTBitCodes.h:1544
@ STMT_MSASM
A MS-style AsmStmt record.
Definition: ASTBitCodes.h:1613
@ EXPR_CONDITIONAL_OPERATOR
A ConditionOperator record.
Definition: ASTBitCodes.h:1673
@ EXPR_BINARY_OPERATOR
A BinaryOperator record.
Definition: ASTBitCodes.h:1667
@ EXPR_CXX_STD_INITIALIZER_LIST
A CXXStdInitializerListExpr record.
Definition: ASTBitCodes.h:1870
@ EXPR_SHUFFLE_VECTOR
A ShuffleVectorExpr record.
Definition: ASTBitCodes.h:1730
@ STMT_OBJC_FINALLY
An ObjCAtFinallyStmt record.
Definition: ASTBitCodes.h:1796
@ EXPR_OBJC_SELECTOR_EXPR
An ObjCSelectorExpr record.
Definition: ASTBitCodes.h:1763
@ EXPR_FLOATING_LITERAL
A FloatingLiteral record.
Definition: ASTBitCodes.h:1628
@ STMT_NULL_PTR
A NULL expression.
Definition: ASTBitCodes.h:1547
@ STMT_DEFAULT
A DefaultStmt record.
Definition: ASTBitCodes.h:1562
@ EXPR_CHOOSE
A ChooseExpr record.
Definition: ASTBitCodes.h:1718
@ STMT_NULL
A NullStmt record.
Definition: ASTBitCodes.h:1553
@ EXPR_BLOCK
BlockExpr.
Definition: ASTBitCodes.h:1736
@ EXPR_DECL_REF
A DeclRefExpr record.
Definition: ASTBitCodes.h:1622
@ EXPR_INIT_LIST
An InitListExpr record.
Definition: ASTBitCodes.h:1688
@ EXPR_IMPLICIT_VALUE_INIT
An ImplicitValueInitExpr record.
Definition: ASTBitCodes.h:1706
@ STMT_OBJC_AUTORELEASE_POOL
An ObjCAutoreleasePoolStmt record.
Definition: ASTBitCodes.h:1808
@ EXPR_RECOVERY
A RecoveryExpr record.
Definition: ASTBitCodes.h:1748
@ EXPR_PAREN
A ParenExpr record.
Definition: ASTBitCodes.h:1640
@ STMT_OMP_TARGET_PARALLEL_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:2010
@ STMT_LABEL
A LabelStmt record.
Definition: ASTBitCodes.h:1565
@ EXPR_CXX_FUNCTIONAL_CAST
A CXXFunctionalCastExpr record.
Definition: ASTBitCodes.h:1861
@ EXPR_USER_DEFINED_LITERAL
A UserDefinedLiteral record.
Definition: ASTBitCodes.h:1867
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
Definition: ASTBitCodes.h:1625
@ EXPR_SOURCE_LOC
A SourceLocExpr record.
Definition: ASTBitCodes.h:1724
@ EXPR_CXX_MEMBER_CALL
A CXXMemberCallExpr record.
Definition: ASTBitCodes.h:1831
@ STMT_SWITCH
A SwitchStmt record.
Definition: ASTBitCodes.h:1574
@ STMT_DECL
A DeclStmt record.
Definition: ASTBitCodes.h:1601
@ EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK
Definition: ASTBitCodes.h:1912
@ STMT_OMP_MASKED_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1983
@ EXPR_SIZEOF_ALIGN_OF
A SizefAlignOfExpr record.
Definition: ASTBitCodes.h:1652
@ STMT_BREAK
A BreakStmt record.
Definition: ASTBitCodes.h:1595
@ STMT_OBJC_AT_THROW
An ObjCAtThrowStmt record.
Definition: ASTBitCodes.h:1805
@ EXPR_ADDR_LABEL
An AddrLabelExpr record.
Definition: ASTBitCodes.h:1712
@ STMT_CXX_FOR_RANGE
A CXXForRangeStmt record.
Definition: ASTBitCodes.h:1825
@ EXPR_CXX_ADDRSPACE_CAST
A CXXAddrspaceCastExpr record.
Definition: ASTBitCodes.h:1858
@ EXPR_ARRAY_SUBSCRIPT
An ArraySubscriptExpr record.
Definition: ASTBitCodes.h:1655
@ EXPR_UNARY_OPERATOR
A UnaryOperator record.
Definition: ASTBitCodes.h:1646
@ STMT_CXX_CATCH
A CXXCatchStmt record.
Definition: ASTBitCodes.h:1819
@ EXPR_BUILTIN_PP_EMBED
A EmbedExpr record.
Definition: ASTBitCodes.h:1727
@ STMT_INDIRECT_GOTO
An IndirectGotoStmt record.
Definition: ASTBitCodes.h:1589
@ DESIG_ARRAY_RANGE
GNU array range designator.
Definition: ASTBitCodes.h:2067
@ DESIG_FIELD_NAME
Field designator where only the field name is known.
Definition: ASTBitCodes.h:2057
@ DESIG_FIELD_DECL
Field designator where the field has been resolved to a declaration.
Definition: ASTBitCodes.h:2061
@ DESIG_ARRAY
Array designator.
Definition: ASTBitCodes.h:2064
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:1338