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:
95 : Writer(Writer), Record(Writer, Record),
96 Code(serialization::STMT_NULL_PTR), AbbrevToUse(0),
97 CurrentPackingBits(this->Record) {}
98
99 ASTStmtWriter(const ASTStmtWriter&) = delete;
101
102 uint64_t Emit() {
103 CurrentPackingBits.writeBits();
104 assert(Code != serialization::STMT_NULL_PTR &&
105 "unhandled sub-statement writing AST file");
106 return Record.EmitStmt(Code, AbbrevToUse);
107 }
108
110 const TemplateArgumentLoc *Args);
111
112 void VisitStmt(Stmt *S);
113#define STMT(Type, Base) \
114 void Visit##Type(Type *);
115#include "clang/AST/StmtNodes.inc"
116 };
117}
118
120 const ASTTemplateKWAndArgsInfo &ArgInfo, const TemplateArgumentLoc *Args) {
121 Record.AddSourceLocation(ArgInfo.TemplateKWLoc);
122 Record.AddSourceLocation(ArgInfo.LAngleLoc);
123 Record.AddSourceLocation(ArgInfo.RAngleLoc);
124 for (unsigned i = 0; i != ArgInfo.NumTemplateArgs; ++i)
125 Record.AddTemplateArgumentLoc(Args[i]);
126}
127
129}
130
131void ASTStmtWriter::VisitNullStmt(NullStmt *S) {
132 VisitStmt(S);
133 Record.AddSourceLocation(S->getSemiLoc());
134 Record.push_back(S->NullStmtBits.HasLeadingEmptyMacro);
136}
137
138void ASTStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
139 VisitStmt(S);
140
141 Record.push_back(S->size());
142 Record.push_back(S->hasStoredFPFeatures());
143
144 for (auto *CS : S->body())
145 Record.AddStmt(CS);
146 if (S->hasStoredFPFeatures())
147 Record.push_back(S->getStoredFPFeatures().getAsOpaqueInt());
148 Record.AddSourceLocation(S->getLBracLoc());
149 Record.AddSourceLocation(S->getRBracLoc());
150
151 if (!S->hasStoredFPFeatures())
152 AbbrevToUse = Writer.getCompoundStmtAbbrev();
153
155}
156
157void ASTStmtWriter::VisitSwitchCase(SwitchCase *S) {
158 VisitStmt(S);
159 Record.push_back(Writer.getSwitchCaseID(S));
160 Record.AddSourceLocation(S->getKeywordLoc());
161 Record.AddSourceLocation(S->getColonLoc());
162}
163
164void ASTStmtWriter::VisitCaseStmt(CaseStmt *S) {
165 VisitSwitchCase(S);
166 Record.push_back(S->caseStmtIsGNURange());
167 Record.AddStmt(S->getLHS());
168 Record.AddStmt(S->getSubStmt());
169 if (S->caseStmtIsGNURange()) {
170 Record.AddStmt(S->getRHS());
171 Record.AddSourceLocation(S->getEllipsisLoc());
172 }
174}
175
176void ASTStmtWriter::VisitDefaultStmt(DefaultStmt *S) {
177 VisitSwitchCase(S);
178 Record.AddStmt(S->getSubStmt());
180}
181
182void ASTStmtWriter::VisitLabelStmt(LabelStmt *S) {
183 VisitStmt(S);
184 Record.push_back(S->isSideEntry());
185 Record.AddDeclRef(S->getDecl());
186 Record.AddStmt(S->getSubStmt());
187 Record.AddSourceLocation(S->getIdentLoc());
189}
190
191void ASTStmtWriter::VisitAttributedStmt(AttributedStmt *S) {
192 VisitStmt(S);
193 Record.push_back(S->getAttrs().size());
194 Record.AddAttributes(S->getAttrs());
195 Record.AddStmt(S->getSubStmt());
196 Record.AddSourceLocation(S->getAttrLoc());
198}
199
200void ASTStmtWriter::VisitIfStmt(IfStmt *S) {
201 VisitStmt(S);
202
203 bool HasElse = S->getElse() != nullptr;
204 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
205 bool HasInit = S->getInit() != nullptr;
206
207 CurrentPackingBits.updateBits();
208
209 CurrentPackingBits.addBit(HasElse);
210 CurrentPackingBits.addBit(HasVar);
211 CurrentPackingBits.addBit(HasInit);
212 Record.push_back(static_cast<uint64_t>(S->getStatementKind()));
213 Record.AddStmt(S->getCond());
214 Record.AddStmt(S->getThen());
215 if (HasElse)
216 Record.AddStmt(S->getElse());
217 if (HasVar)
218 Record.AddStmt(S->getConditionVariableDeclStmt());
219 if (HasInit)
220 Record.AddStmt(S->getInit());
221
222 Record.AddSourceLocation(S->getIfLoc());
223 Record.AddSourceLocation(S->getLParenLoc());
224 Record.AddSourceLocation(S->getRParenLoc());
225 if (HasElse)
226 Record.AddSourceLocation(S->getElseLoc());
227
229}
230
231void ASTStmtWriter::VisitSwitchStmt(SwitchStmt *S) {
232 VisitStmt(S);
233
234 bool HasInit = S->getInit() != nullptr;
235 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
236 Record.push_back(HasInit);
237 Record.push_back(HasVar);
238 Record.push_back(S->isAllEnumCasesCovered());
239
240 Record.AddStmt(S->getCond());
241 Record.AddStmt(S->getBody());
242 if (HasInit)
243 Record.AddStmt(S->getInit());
244 if (HasVar)
245 Record.AddStmt(S->getConditionVariableDeclStmt());
246
247 Record.AddSourceLocation(S->getSwitchLoc());
248 Record.AddSourceLocation(S->getLParenLoc());
249 Record.AddSourceLocation(S->getRParenLoc());
250
251 for (SwitchCase *SC = S->getSwitchCaseList(); SC;
252 SC = SC->getNextSwitchCase())
253 Record.push_back(Writer.RecordSwitchCaseID(SC));
255}
256
257void ASTStmtWriter::VisitWhileStmt(WhileStmt *S) {
258 VisitStmt(S);
259
260 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
261 Record.push_back(HasVar);
262
263 Record.AddStmt(S->getCond());
264 Record.AddStmt(S->getBody());
265 if (HasVar)
266 Record.AddStmt(S->getConditionVariableDeclStmt());
267
268 Record.AddSourceLocation(S->getWhileLoc());
269 Record.AddSourceLocation(S->getLParenLoc());
270 Record.AddSourceLocation(S->getRParenLoc());
272}
273
274void ASTStmtWriter::VisitDoStmt(DoStmt *S) {
275 VisitStmt(S);
276 Record.AddStmt(S->getCond());
277 Record.AddStmt(S->getBody());
278 Record.AddSourceLocation(S->getDoLoc());
279 Record.AddSourceLocation(S->getWhileLoc());
280 Record.AddSourceLocation(S->getRParenLoc());
282}
283
284void ASTStmtWriter::VisitForStmt(ForStmt *S) {
285 VisitStmt(S);
286 Record.AddStmt(S->getInit());
287 Record.AddStmt(S->getCond());
288 Record.AddStmt(S->getConditionVariableDeclStmt());
289 Record.AddStmt(S->getInc());
290 Record.AddStmt(S->getBody());
291 Record.AddSourceLocation(S->getForLoc());
292 Record.AddSourceLocation(S->getLParenLoc());
293 Record.AddSourceLocation(S->getRParenLoc());
295}
296
297void ASTStmtWriter::VisitGotoStmt(GotoStmt *S) {
298 VisitStmt(S);
299 Record.AddDeclRef(S->getLabel());
300 Record.AddSourceLocation(S->getGotoLoc());
301 Record.AddSourceLocation(S->getLabelLoc());
303}
304
305void ASTStmtWriter::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
306 VisitStmt(S);
307 Record.AddSourceLocation(S->getGotoLoc());
308 Record.AddSourceLocation(S->getStarLoc());
309 Record.AddStmt(S->getTarget());
311}
312
313void ASTStmtWriter::VisitContinueStmt(ContinueStmt *S) {
314 VisitStmt(S);
315 Record.AddSourceLocation(S->getContinueLoc());
317}
318
319void ASTStmtWriter::VisitBreakStmt(BreakStmt *S) {
320 VisitStmt(S);
321 Record.AddSourceLocation(S->getBreakLoc());
323}
324
325void ASTStmtWriter::VisitReturnStmt(ReturnStmt *S) {
326 VisitStmt(S);
327
328 bool HasNRVOCandidate = S->getNRVOCandidate() != nullptr;
329 Record.push_back(HasNRVOCandidate);
330
331 Record.AddStmt(S->getRetValue());
332 if (HasNRVOCandidate)
333 Record.AddDeclRef(S->getNRVOCandidate());
334
335 Record.AddSourceLocation(S->getReturnLoc());
337}
338
339void ASTStmtWriter::VisitDeclStmt(DeclStmt *S) {
340 VisitStmt(S);
341 Record.AddSourceLocation(S->getBeginLoc());
342 Record.AddSourceLocation(S->getEndLoc());
343 DeclGroupRef DG = S->getDeclGroup();
344 for (DeclGroupRef::iterator D = DG.begin(), DEnd = DG.end(); D != DEnd; ++D)
345 Record.AddDeclRef(*D);
347}
348
349void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) {
350 VisitStmt(S);
351 Record.push_back(S->getNumOutputs());
352 Record.push_back(S->getNumInputs());
353 Record.push_back(S->getNumClobbers());
354 Record.AddSourceLocation(S->getAsmLoc());
355 Record.push_back(S->isVolatile());
356 Record.push_back(S->isSimple());
357}
358
359void ASTStmtWriter::VisitGCCAsmStmt(GCCAsmStmt *S) {
360 VisitAsmStmt(S);
361 Record.push_back(S->getNumLabels());
362 Record.AddSourceLocation(S->getRParenLoc());
363 Record.AddStmt(S->getAsmString());
364
365 // Outputs
366 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
367 Record.AddIdentifierRef(S->getOutputIdentifier(I));
368 Record.AddStmt(S->getOutputConstraintLiteral(I));
369 Record.AddStmt(S->getOutputExpr(I));
370 }
371
372 // Inputs
373 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
374 Record.AddIdentifierRef(S->getInputIdentifier(I));
375 Record.AddStmt(S->getInputConstraintLiteral(I));
376 Record.AddStmt(S->getInputExpr(I));
377 }
378
379 // Clobbers
380 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
381 Record.AddStmt(S->getClobberStringLiteral(I));
382
383 // Labels
384 for (unsigned I = 0, N = S->getNumLabels(); I != N; ++I) {
385 Record.AddIdentifierRef(S->getLabelIdentifier(I));
386 Record.AddStmt(S->getLabelExpr(I));
387 }
388
390}
391
392void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) {
393 VisitAsmStmt(S);
394 Record.AddSourceLocation(S->getLBraceLoc());
395 Record.AddSourceLocation(S->getEndLoc());
396 Record.push_back(S->getNumAsmToks());
397 Record.AddString(S->getAsmString());
398
399 // Tokens
400 for (unsigned I = 0, N = S->getNumAsmToks(); I != N; ++I) {
401 // FIXME: Move this to ASTRecordWriter?
402 Writer.AddToken(S->getAsmToks()[I], Record.getRecordData());
403 }
404
405 // Clobbers
406 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) {
407 Record.AddString(S->getClobber(I));
408 }
409
410 // Outputs
411 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
412 Record.AddStmt(S->getOutputExpr(I));
413 Record.AddString(S->getOutputConstraint(I));
414 }
415
416 // Inputs
417 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
418 Record.AddStmt(S->getInputExpr(I));
419 Record.AddString(S->getInputConstraint(I));
420 }
421
423}
424
425void ASTStmtWriter::VisitCoroutineBodyStmt(CoroutineBodyStmt *CoroStmt) {
426 VisitStmt(CoroStmt);
427 Record.push_back(CoroStmt->getParamMoves().size());
428 for (Stmt *S : CoroStmt->children())
429 Record.AddStmt(S);
431}
432
433void ASTStmtWriter::VisitCoreturnStmt(CoreturnStmt *S) {
434 VisitStmt(S);
435 Record.AddSourceLocation(S->getKeywordLoc());
436 Record.AddStmt(S->getOperand());
437 Record.AddStmt(S->getPromiseCall());
438 Record.push_back(S->isImplicit());
440}
441
442void ASTStmtWriter::VisitCoroutineSuspendExpr(CoroutineSuspendExpr *E) {
443 VisitExpr(E);
444 Record.AddSourceLocation(E->getKeywordLoc());
445 for (Stmt *S : E->children())
446 Record.AddStmt(S);
447 Record.AddStmt(E->getOpaqueValue());
448}
449
450void ASTStmtWriter::VisitCoawaitExpr(CoawaitExpr *E) {
451 VisitCoroutineSuspendExpr(E);
452 Record.push_back(E->isImplicit());
454}
455
456void ASTStmtWriter::VisitCoyieldExpr(CoyieldExpr *E) {
457 VisitCoroutineSuspendExpr(E);
459}
460
461void ASTStmtWriter::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
462 VisitExpr(E);
463 Record.AddSourceLocation(E->getKeywordLoc());
464 for (Stmt *S : E->children())
465 Record.AddStmt(S);
467}
468
469static void
471 const ASTConstraintSatisfaction &Satisfaction) {
472 Record.push_back(Satisfaction.IsSatisfied);
473 Record.push_back(Satisfaction.ContainsErrors);
474 if (!Satisfaction.IsSatisfied) {
475 Record.push_back(Satisfaction.NumRecords);
476 for (const auto &DetailRecord : Satisfaction) {
477 auto *E = DetailRecord.dyn_cast<Expr *>();
478 Record.push_back(/* IsDiagnostic */ E == nullptr);
479 if (E)
480 Record.AddStmt(E);
481 else {
482 auto *Diag = DetailRecord.get<std::pair<SourceLocation, StringRef> *>();
483 Record.AddSourceLocation(Diag->first);
484 Record.AddString(Diag->second);
485 }
486 }
487 }
488}
489
490static void
494 Record.AddString(D->SubstitutedEntity);
495 Record.AddSourceLocation(D->DiagLoc);
496 Record.AddString(D->DiagMessage);
497}
498
499void ASTStmtWriter::VisitConceptSpecializationExpr(
501 VisitExpr(E);
502 Record.AddDeclRef(E->getSpecializationDecl());
503 const ConceptReference *CR = E->getConceptReference();
504 Record.push_back(CR != nullptr);
505 if (CR)
506 Record.AddConceptReference(CR);
507 if (!E->isValueDependent())
508 addConstraintSatisfaction(Record, E->getSatisfaction());
509
511}
512
513void ASTStmtWriter::VisitRequiresExpr(RequiresExpr *E) {
514 VisitExpr(E);
515 Record.push_back(E->getLocalParameters().size());
516 Record.push_back(E->getRequirements().size());
517 Record.AddSourceLocation(E->RequiresExprBits.RequiresKWLoc);
518 Record.push_back(E->RequiresExprBits.IsSatisfied);
519 Record.AddDeclRef(E->getBody());
520 for (ParmVarDecl *P : E->getLocalParameters())
521 Record.AddDeclRef(P);
522 for (concepts::Requirement *R : E->getRequirements()) {
523 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(R)) {
525 Record.push_back(TypeReq->Status);
527 addSubstitutionDiagnostic(Record, TypeReq->getSubstitutionDiagnostic());
528 else
529 Record.AddTypeSourceInfo(TypeReq->getType());
530 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(R)) {
531 Record.push_back(ExprReq->getKind());
532 Record.push_back(ExprReq->Status);
533 if (ExprReq->isExprSubstitutionFailure()) {
535 ExprReq->Value.get<concepts::Requirement::SubstitutionDiagnostic *>());
536 } else
537 Record.AddStmt(ExprReq->Value.get<Expr *>());
538 if (ExprReq->getKind() == concepts::Requirement::RK_Compound) {
539 Record.AddSourceLocation(ExprReq->NoexceptLoc);
540 const auto &RetReq = ExprReq->getReturnTypeRequirement();
541 if (RetReq.isSubstitutionFailure()) {
542 Record.push_back(2);
543 addSubstitutionDiagnostic(Record, RetReq.getSubstitutionDiagnostic());
544 } else if (RetReq.isTypeConstraint()) {
545 Record.push_back(1);
546 Record.AddTemplateParameterList(
547 RetReq.getTypeConstraintTemplateParameterList());
548 if (ExprReq->Status >=
550 Record.AddStmt(
551 ExprReq->getReturnTypeRequirementSubstitutedConstraintExpr());
552 } else {
553 assert(RetReq.isEmpty());
554 Record.push_back(0);
555 }
556 }
557 } else {
558 auto *NestedReq = cast<concepts::NestedRequirement>(R);
560 Record.push_back(NestedReq->hasInvalidConstraint());
561 if (NestedReq->hasInvalidConstraint()) {
562 Record.AddString(NestedReq->getInvalidConstraintEntity());
563 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
564 } else {
565 Record.AddStmt(NestedReq->getConstraintExpr());
566 if (!NestedReq->isDependent())
567 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
568 }
569 }
570 }
571 Record.AddSourceLocation(E->getLParenLoc());
572 Record.AddSourceLocation(E->getRParenLoc());
573 Record.AddSourceLocation(E->getEndLoc());
574
576}
577
578
579void ASTStmtWriter::VisitCapturedStmt(CapturedStmt *S) {
580 VisitStmt(S);
581 // NumCaptures
582 Record.push_back(std::distance(S->capture_begin(), S->capture_end()));
583
584 // CapturedDecl and captured region kind
585 Record.AddDeclRef(S->getCapturedDecl());
586 Record.push_back(S->getCapturedRegionKind());
587
588 Record.AddDeclRef(S->getCapturedRecordDecl());
589
590 // Capture inits
591 for (auto *I : S->capture_inits())
592 Record.AddStmt(I);
593
594 // Body
595 Record.AddStmt(S->getCapturedStmt());
596
597 // Captures
598 for (const auto &I : S->captures()) {
599 if (I.capturesThis() || I.capturesVariableArrayType())
600 Record.AddDeclRef(nullptr);
601 else
602 Record.AddDeclRef(I.getCapturedVar());
603 Record.push_back(I.getCaptureKind());
604 Record.AddSourceLocation(I.getLocation());
605 }
606
608}
609
610void ASTStmtWriter::VisitExpr(Expr *E) {
611 VisitStmt(E);
612
613 CurrentPackingBits.updateBits();
614 CurrentPackingBits.addBits(E->getDependence(), /*BitsWidth=*/5);
615 CurrentPackingBits.addBits(E->getValueKind(), /*BitsWidth=*/2);
616 CurrentPackingBits.addBits(E->getObjectKind(), /*BitsWidth=*/3);
617
618 Record.AddTypeRef(E->getType());
619}
620
621void ASTStmtWriter::VisitConstantExpr(ConstantExpr *E) {
622 VisitExpr(E);
623 Record.push_back(E->ConstantExprBits.ResultKind);
624
625 Record.push_back(E->ConstantExprBits.APValueKind);
626 Record.push_back(E->ConstantExprBits.IsUnsigned);
627 Record.push_back(E->ConstantExprBits.BitWidth);
628 // HasCleanup not serialized since we can just query the APValue.
629 Record.push_back(E->ConstantExprBits.IsImmediateInvocation);
630
631 switch (E->getResultStorageKind()) {
633 break;
635 Record.push_back(E->Int64Result());
636 break;
638 Record.AddAPValue(E->APValueResult());
639 break;
640 }
641
642 Record.AddStmt(E->getSubExpr());
644}
645
646void ASTStmtWriter::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *E) {
647 VisitExpr(E);
648
649 Record.AddSourceLocation(E->getLocation());
650 Record.AddSourceLocation(E->getLParenLocation());
651 Record.AddSourceLocation(E->getRParenLocation());
652 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
653
655}
656
657void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
658 VisitExpr(E);
659
660 bool HasFunctionName = E->getFunctionName() != nullptr;
661 Record.push_back(HasFunctionName);
662 Record.push_back(
663 llvm::to_underlying(E->getIdentKind())); // FIXME: stable encoding
664 Record.push_back(E->isTransparent());
665 Record.AddSourceLocation(E->getLocation());
666 if (HasFunctionName)
667 Record.AddStmt(E->getFunctionName());
669}
670
671void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
672 VisitExpr(E);
673
674 CurrentPackingBits.updateBits();
675
676 CurrentPackingBits.addBit(E->hadMultipleCandidates());
677 CurrentPackingBits.addBit(E->refersToEnclosingVariableOrCapture());
678 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
679 CurrentPackingBits.addBit(E->isImmediateEscalating());
680 CurrentPackingBits.addBit(E->getDecl() != E->getFoundDecl());
681 CurrentPackingBits.addBit(E->hasQualifier());
682 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
683
684 if (E->hasTemplateKWAndArgsInfo()) {
685 unsigned NumTemplateArgs = E->getNumTemplateArgs();
686 Record.push_back(NumTemplateArgs);
687 }
688
689 DeclarationName::NameKind nk = (E->getDecl()->getDeclName().getNameKind());
690
691 if ((!E->hasTemplateKWAndArgsInfo()) && (!E->hasQualifier()) &&
692 (E->getDecl() == E->getFoundDecl()) &&
694 AbbrevToUse = Writer.getDeclRefExprAbbrev();
695 }
696
697 if (E->hasQualifier())
698 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
699
700 if (E->getDecl() != E->getFoundDecl())
701 Record.AddDeclRef(E->getFoundDecl());
702
703 if (E->hasTemplateKWAndArgsInfo())
705 E->getTrailingObjects<TemplateArgumentLoc>());
706
707 Record.AddDeclRef(E->getDecl());
708 Record.AddSourceLocation(E->getLocation());
709 Record.AddDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
711}
712
713void ASTStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
714 VisitExpr(E);
715 Record.AddSourceLocation(E->getLocation());
716 Record.AddAPInt(E->getValue());
717
718 if (E->getValue().getBitWidth() == 32) {
719 AbbrevToUse = Writer.getIntegerLiteralAbbrev();
720 }
721
723}
724
725void ASTStmtWriter::VisitFixedPointLiteral(FixedPointLiteral *E) {
726 VisitExpr(E);
727 Record.AddSourceLocation(E->getLocation());
728 Record.push_back(E->getScale());
729 Record.AddAPInt(E->getValue());
731}
732
733void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
734 VisitExpr(E);
735 Record.push_back(E->getRawSemantics());
736 Record.push_back(E->isExact());
737 Record.AddAPFloat(E->getValue());
738 Record.AddSourceLocation(E->getLocation());
740}
741
742void ASTStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
743 VisitExpr(E);
744 Record.AddStmt(E->getSubExpr());
746}
747
748void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
749 VisitExpr(E);
750
751 // Store the various bits of data of StringLiteral.
752 Record.push_back(E->getNumConcatenated());
753 Record.push_back(E->getLength());
754 Record.push_back(E->getCharByteWidth());
755 Record.push_back(llvm::to_underlying(E->getKind()));
756 Record.push_back(E->isPascal());
757
758 // Store the trailing array of SourceLocation.
759 for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
760 Record.AddSourceLocation(E->getStrTokenLoc(I));
761
762 // Store the trailing array of char holding the string data.
763 StringRef StrData = E->getBytes();
764 for (unsigned I = 0, N = E->getByteLength(); I != N; ++I)
765 Record.push_back(StrData[I]);
766
768}
769
770void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
771 VisitExpr(E);
772 Record.push_back(E->getValue());
773 Record.AddSourceLocation(E->getLocation());
774 Record.push_back(llvm::to_underlying(E->getKind()));
775
776 AbbrevToUse = Writer.getCharacterLiteralAbbrev();
777
779}
780
781void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
782 VisitExpr(E);
783 Record.AddSourceLocation(E->getLParen());
784 Record.AddSourceLocation(E->getRParen());
785 Record.AddStmt(E->getSubExpr());
787}
788
789void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
790 VisitExpr(E);
791 Record.push_back(E->getNumExprs());
792 for (auto *SubStmt : E->exprs())
793 Record.AddStmt(SubStmt);
794 Record.AddSourceLocation(E->getLParenLoc());
795 Record.AddSourceLocation(E->getRParenLoc());
797}
798
799void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
800 VisitExpr(E);
801 bool HasFPFeatures = E->hasStoredFPFeatures();
802 // Write this first for easy access when deserializing, as they affect the
803 // size of the UnaryOperator.
804 CurrentPackingBits.addBit(HasFPFeatures);
805 Record.AddStmt(E->getSubExpr());
806 CurrentPackingBits.addBits(E->getOpcode(),
807 /*Width=*/5); // FIXME: stable encoding
808 Record.AddSourceLocation(E->getOperatorLoc());
809 CurrentPackingBits.addBit(E->canOverflow());
810
811 if (HasFPFeatures)
812 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
814}
815
816void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
817 VisitExpr(E);
818 Record.push_back(E->getNumComponents());
819 Record.push_back(E->getNumExpressions());
820 Record.AddSourceLocation(E->getOperatorLoc());
821 Record.AddSourceLocation(E->getRParenLoc());
822 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
823 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
824 const OffsetOfNode &ON = E->getComponent(I);
825 Record.push_back(ON.getKind()); // FIXME: Stable encoding
826 Record.AddSourceLocation(ON.getSourceRange().getBegin());
827 Record.AddSourceLocation(ON.getSourceRange().getEnd());
828 switch (ON.getKind()) {
830 Record.push_back(ON.getArrayExprIndex());
831 break;
832
834 Record.AddDeclRef(ON.getField());
835 break;
836
838 Record.AddIdentifierRef(ON.getFieldName());
839 break;
840
842 Record.AddCXXBaseSpecifier(*ON.getBase());
843 break;
844 }
845 }
846 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
847 Record.AddStmt(E->getIndexExpr(I));
849}
850
851void ASTStmtWriter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
852 VisitExpr(E);
853 Record.push_back(E->getKind());
854 if (E->isArgumentType())
855 Record.AddTypeSourceInfo(E->getArgumentTypeInfo());
856 else {
857 Record.push_back(0);
858 Record.AddStmt(E->getArgumentExpr());
859 }
860 Record.AddSourceLocation(E->getOperatorLoc());
861 Record.AddSourceLocation(E->getRParenLoc());
863}
864
865void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
866 VisitExpr(E);
867 Record.AddStmt(E->getLHS());
868 Record.AddStmt(E->getRHS());
869 Record.AddSourceLocation(E->getRBracketLoc());
871}
872
873void ASTStmtWriter::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
874 VisitExpr(E);
875 Record.AddStmt(E->getBase());
876 Record.AddStmt(E->getRowIdx());
877 Record.AddStmt(E->getColumnIdx());
878 Record.AddSourceLocation(E->getRBracketLoc());
880}
881
882void ASTStmtWriter::VisitArraySectionExpr(ArraySectionExpr *E) {
883 VisitExpr(E);
884 Record.writeEnum(E->ASType);
885 Record.AddStmt(E->getBase());
886 Record.AddStmt(E->getLowerBound());
887 Record.AddStmt(E->getLength());
888 if (E->isOMPArraySection())
889 Record.AddStmt(E->getStride());
890 Record.AddSourceLocation(E->getColonLocFirst());
891
892 if (E->isOMPArraySection())
893 Record.AddSourceLocation(E->getColonLocSecond());
894
895 Record.AddSourceLocation(E->getRBracketLoc());
897}
898
899void ASTStmtWriter::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
900 VisitExpr(E);
901 Record.push_back(E->getDimensions().size());
902 Record.AddStmt(E->getBase());
903 for (Expr *Dim : E->getDimensions())
904 Record.AddStmt(Dim);
905 for (SourceRange SR : E->getBracketsRanges())
906 Record.AddSourceRange(SR);
907 Record.AddSourceLocation(E->getLParenLoc());
908 Record.AddSourceLocation(E->getRParenLoc());
910}
911
912void ASTStmtWriter::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
913 VisitExpr(E);
914 Record.push_back(E->numOfIterators());
915 Record.AddSourceLocation(E->getIteratorKwLoc());
916 Record.AddSourceLocation(E->getLParenLoc());
917 Record.AddSourceLocation(E->getRParenLoc());
918 for (unsigned I = 0, End = E->numOfIterators(); I < End; ++I) {
919 Record.AddDeclRef(E->getIteratorDecl(I));
920 Record.AddSourceLocation(E->getAssignLoc(I));
921 OMPIteratorExpr::IteratorRange Range = E->getIteratorRange(I);
922 Record.AddStmt(Range.Begin);
923 Record.AddStmt(Range.End);
924 Record.AddStmt(Range.Step);
925 Record.AddSourceLocation(E->getColonLoc(I));
926 if (Range.Step)
927 Record.AddSourceLocation(E->getSecondColonLoc(I));
928 // Serialize helpers
929 OMPIteratorHelperData &HD = E->getHelper(I);
930 Record.AddDeclRef(HD.CounterVD);
931 Record.AddStmt(HD.Upper);
932 Record.AddStmt(HD.Update);
933 Record.AddStmt(HD.CounterUpdate);
934 }
936}
937
938void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
939 VisitExpr(E);
940
941 Record.push_back(E->getNumArgs());
942 CurrentPackingBits.updateBits();
943 CurrentPackingBits.addBit(static_cast<bool>(E->getADLCallKind()));
944 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
945
946 Record.AddSourceLocation(E->getRParenLoc());
947 Record.AddStmt(E->getCallee());
948 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
949 Arg != ArgEnd; ++Arg)
950 Record.AddStmt(*Arg);
951
952 if (E->hasStoredFPFeatures())
953 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
954
955 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
956 E->getStmtClass() == Stmt::CallExprClass)
957 AbbrevToUse = Writer.getCallExprAbbrev();
958
960}
961
962void ASTStmtWriter::VisitRecoveryExpr(RecoveryExpr *E) {
963 VisitExpr(E);
964 Record.push_back(std::distance(E->children().begin(), E->children().end()));
965 Record.AddSourceLocation(E->getBeginLoc());
966 Record.AddSourceLocation(E->getEndLoc());
967 for (Stmt *Child : E->children())
968 Record.AddStmt(Child);
970}
971
972void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
973 VisitExpr(E);
974
975 bool HasQualifier = E->hasQualifier();
976 bool HasFoundDecl = E->hasFoundDecl();
977 bool HasTemplateInfo = E->hasTemplateKWAndArgsInfo();
978 unsigned NumTemplateArgs = E->getNumTemplateArgs();
979
980 // Write these first for easy access when deserializing, as they affect the
981 // size of the MemberExpr.
982 CurrentPackingBits.updateBits();
983 CurrentPackingBits.addBit(HasQualifier);
984 CurrentPackingBits.addBit(HasFoundDecl);
985 CurrentPackingBits.addBit(HasTemplateInfo);
986 Record.push_back(NumTemplateArgs);
987
988 Record.AddStmt(E->getBase());
989 Record.AddDeclRef(E->getMemberDecl());
990 Record.AddDeclarationNameLoc(E->MemberDNLoc,
991 E->getMemberDecl()->getDeclName());
992 Record.AddSourceLocation(E->getMemberLoc());
993 CurrentPackingBits.addBit(E->isArrow());
994 CurrentPackingBits.addBit(E->hadMultipleCandidates());
995 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
996 Record.AddSourceLocation(E->getOperatorLoc());
997
998 if (HasQualifier)
999 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1000
1001 if (HasFoundDecl) {
1002 DeclAccessPair FoundDecl = E->getFoundDecl();
1003 Record.AddDeclRef(FoundDecl.getDecl());
1004 CurrentPackingBits.addBits(FoundDecl.getAccess(), /*BitWidth=*/2);
1005 }
1006
1007 if (HasTemplateInfo)
1008 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1009 E->getTrailingObjects<TemplateArgumentLoc>());
1010
1012}
1013
1014void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1015 VisitExpr(E);
1016 Record.AddStmt(E->getBase());
1017 Record.AddSourceLocation(E->getIsaMemberLoc());
1018 Record.AddSourceLocation(E->getOpLoc());
1019 Record.push_back(E->isArrow());
1021}
1022
1023void ASTStmtWriter::
1024VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1025 VisitExpr(E);
1026 Record.AddStmt(E->getSubExpr());
1027 Record.push_back(E->shouldCopy());
1029}
1030
1031void ASTStmtWriter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1032 VisitExplicitCastExpr(E);
1033 Record.AddSourceLocation(E->getLParenLoc());
1034 Record.AddSourceLocation(E->getBridgeKeywordLoc());
1035 Record.push_back(E->getBridgeKind()); // FIXME: Stable encoding
1037}
1038
1039void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
1040 VisitExpr(E);
1041
1042 Record.push_back(E->path_size());
1043 CurrentPackingBits.updateBits();
1044 // 7 bits should be enough to store the casting kinds.
1045 CurrentPackingBits.addBits(E->getCastKind(), /*Width=*/7);
1046 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
1047 Record.AddStmt(E->getSubExpr());
1048
1050 PI = E->path_begin(), PE = E->path_end(); PI != PE; ++PI)
1051 Record.AddCXXBaseSpecifier(**PI);
1052
1053 if (E->hasStoredFPFeatures())
1054 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
1055}
1056
1057void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
1058 VisitExpr(E);
1059
1060 // Write this first for easy access when deserializing, as they affect the
1061 // size of the UnaryOperator.
1062 CurrentPackingBits.updateBits();
1063 CurrentPackingBits.addBits(E->getOpcode(), /*Width=*/6);
1064 bool HasFPFeatures = E->hasStoredFPFeatures();
1065 CurrentPackingBits.addBit(HasFPFeatures);
1066 CurrentPackingBits.addBit(E->hasExcludedOverflowPattern());
1067 Record.AddStmt(E->getLHS());
1068 Record.AddStmt(E->getRHS());
1069 Record.AddSourceLocation(E->getOperatorLoc());
1070 if (HasFPFeatures)
1071 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1072
1073 if (!HasFPFeatures && E->getValueKind() == VK_PRValue &&
1075 AbbrevToUse = Writer.getBinaryOperatorAbbrev();
1076
1078}
1079
1080void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1081 VisitBinaryOperator(E);
1082 Record.AddTypeRef(E->getComputationLHSType());
1083 Record.AddTypeRef(E->getComputationResultType());
1084
1085 if (!E->hasStoredFPFeatures() && E->getValueKind() == VK_PRValue &&
1087 AbbrevToUse = Writer.getCompoundAssignOperatorAbbrev();
1088
1090}
1091
1092void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
1093 VisitExpr(E);
1094 Record.AddStmt(E->getCond());
1095 Record.AddStmt(E->getLHS());
1096 Record.AddStmt(E->getRHS());
1097 Record.AddSourceLocation(E->getQuestionLoc());
1098 Record.AddSourceLocation(E->getColonLoc());
1100}
1101
1102void
1103ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1104 VisitExpr(E);
1105 Record.AddStmt(E->getOpaqueValue());
1106 Record.AddStmt(E->getCommon());
1107 Record.AddStmt(E->getCond());
1108 Record.AddStmt(E->getTrueExpr());
1109 Record.AddStmt(E->getFalseExpr());
1110 Record.AddSourceLocation(E->getQuestionLoc());
1111 Record.AddSourceLocation(E->getColonLoc());
1113}
1114
1115void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1116 VisitCastExpr(E);
1117 CurrentPackingBits.addBit(E->isPartOfExplicitCast());
1118
1119 if (E->path_size() == 0 && !E->hasStoredFPFeatures())
1120 AbbrevToUse = Writer.getExprImplicitCastAbbrev();
1121
1123}
1124
1125void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1126 VisitCastExpr(E);
1127 Record.AddTypeSourceInfo(E->getTypeInfoAsWritten());
1128}
1129
1130void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
1131 VisitExplicitCastExpr(E);
1132 Record.AddSourceLocation(E->getLParenLoc());
1133 Record.AddSourceLocation(E->getRParenLoc());
1135}
1136
1137void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1138 VisitExpr(E);
1139 Record.AddSourceLocation(E->getLParenLoc());
1140 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1141 Record.AddStmt(E->getInitializer());
1142 Record.push_back(E->isFileScope());
1144}
1145
1146void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1147 VisitExpr(E);
1148 Record.AddStmt(E->getBase());
1149 Record.AddIdentifierRef(&E->getAccessor());
1150 Record.AddSourceLocation(E->getAccessorLoc());
1152}
1153
1154void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
1155 VisitExpr(E);
1156 // NOTE: only add the (possibly null) syntactic form.
1157 // No need to serialize the isSemanticForm flag and the semantic form.
1158 Record.AddStmt(E->getSyntacticForm());
1159 Record.AddSourceLocation(E->getLBraceLoc());
1160 Record.AddSourceLocation(E->getRBraceLoc());
1161 bool isArrayFiller = E->ArrayFillerOrUnionFieldInit.is<Expr*>();
1162 Record.push_back(isArrayFiller);
1163 if (isArrayFiller)
1164 Record.AddStmt(E->getArrayFiller());
1165 else
1166 Record.AddDeclRef(E->getInitializedFieldInUnion());
1167 Record.push_back(E->hadArrayRangeDesignator());
1168 Record.push_back(E->getNumInits());
1169 if (isArrayFiller) {
1170 // ArrayFiller may have filled "holes" due to designated initializer.
1171 // Replace them by 0 to indicate that the filler goes in that place.
1172 Expr *filler = E->getArrayFiller();
1173 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1174 Record.AddStmt(E->getInit(I) != filler ? E->getInit(I) : nullptr);
1175 } else {
1176 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1177 Record.AddStmt(E->getInit(I));
1178 }
1180}
1181
1182void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1183 VisitExpr(E);
1184 Record.push_back(E->getNumSubExprs());
1185 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1186 Record.AddStmt(E->getSubExpr(I));
1187 Record.AddSourceLocation(E->getEqualOrColonLoc());
1188 Record.push_back(E->usesGNUSyntax());
1189 for (const DesignatedInitExpr::Designator &D : E->designators()) {
1190 if (D.isFieldDesignator()) {
1191 if (FieldDecl *Field = D.getFieldDecl()) {
1193 Record.AddDeclRef(Field);
1194 } else {
1196 Record.AddIdentifierRef(D.getFieldName());
1197 }
1198 Record.AddSourceLocation(D.getDotLoc());
1199 Record.AddSourceLocation(D.getFieldLoc());
1200 } else if (D.isArrayDesignator()) {
1202 Record.push_back(D.getArrayIndex());
1203 Record.AddSourceLocation(D.getLBracketLoc());
1204 Record.AddSourceLocation(D.getRBracketLoc());
1205 } else {
1206 assert(D.isArrayRangeDesignator() && "Unknown designator");
1208 Record.push_back(D.getArrayIndex());
1209 Record.AddSourceLocation(D.getLBracketLoc());
1210 Record.AddSourceLocation(D.getEllipsisLoc());
1211 Record.AddSourceLocation(D.getRBracketLoc());
1212 }
1213 }
1215}
1216
1217void ASTStmtWriter::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1218 VisitExpr(E);
1219 Record.AddStmt(E->getBase());
1220 Record.AddStmt(E->getUpdater());
1222}
1223
1224void ASTStmtWriter::VisitNoInitExpr(NoInitExpr *E) {
1225 VisitExpr(E);
1227}
1228
1229void ASTStmtWriter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1230 VisitExpr(E);
1231 Record.AddStmt(E->SubExprs[0]);
1232 Record.AddStmt(E->SubExprs[1]);
1234}
1235
1236void ASTStmtWriter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1237 VisitExpr(E);
1239}
1240
1241void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1242 VisitExpr(E);
1244}
1245
1246void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
1247 VisitExpr(E);
1248 Record.AddStmt(E->getSubExpr());
1249 Record.AddTypeSourceInfo(E->getWrittenTypeInfo());
1250 Record.AddSourceLocation(E->getBuiltinLoc());
1251 Record.AddSourceLocation(E->getRParenLoc());
1252 Record.push_back(E->isMicrosoftABI());
1254}
1255
1256void ASTStmtWriter::VisitSourceLocExpr(SourceLocExpr *E) {
1257 VisitExpr(E);
1258 Record.AddDeclRef(cast_or_null<Decl>(E->getParentContext()));
1259 Record.AddSourceLocation(E->getBeginLoc());
1260 Record.AddSourceLocation(E->getEndLoc());
1261 Record.push_back(llvm::to_underlying(E->getIdentKind()));
1263}
1264
1265void ASTStmtWriter::VisitEmbedExpr(EmbedExpr *E) {
1266 VisitExpr(E);
1267 Record.AddSourceLocation(E->getBeginLoc());
1268 Record.AddSourceLocation(E->getEndLoc());
1269 Record.AddStmt(E->getDataStringLiteral());
1270 Record.writeUInt32(E->getStartingElementPos());
1271 Record.writeUInt32(E->getDataElementCount());
1273}
1274
1275void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
1276 VisitExpr(E);
1277 Record.AddSourceLocation(E->getAmpAmpLoc());
1278 Record.AddSourceLocation(E->getLabelLoc());
1279 Record.AddDeclRef(E->getLabel());
1281}
1282
1283void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
1284 VisitExpr(E);
1285 Record.AddStmt(E->getSubStmt());
1286 Record.AddSourceLocation(E->getLParenLoc());
1287 Record.AddSourceLocation(E->getRParenLoc());
1288 Record.push_back(E->getTemplateDepth());
1290}
1291
1292void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
1293 VisitExpr(E);
1294 Record.AddStmt(E->getCond());
1295 Record.AddStmt(E->getLHS());
1296 Record.AddStmt(E->getRHS());
1297 Record.AddSourceLocation(E->getBuiltinLoc());
1298 Record.AddSourceLocation(E->getRParenLoc());
1299 Record.push_back(E->isConditionDependent() ? false : E->isConditionTrue());
1301}
1302
1303void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
1304 VisitExpr(E);
1305 Record.AddSourceLocation(E->getTokenLocation());
1307}
1308
1309void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1310 VisitExpr(E);
1311 Record.push_back(E->getNumSubExprs());
1312 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1313 Record.AddStmt(E->getExpr(I));
1314 Record.AddSourceLocation(E->getBuiltinLoc());
1315 Record.AddSourceLocation(E->getRParenLoc());
1317}
1318
1319void ASTStmtWriter::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1320 VisitExpr(E);
1321 Record.AddSourceLocation(E->getBuiltinLoc());
1322 Record.AddSourceLocation(E->getRParenLoc());
1323 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1324 Record.AddStmt(E->getSrcExpr());
1326}
1327
1328void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
1329 VisitExpr(E);
1330 Record.AddDeclRef(E->getBlockDecl());
1332}
1333
1334void ASTStmtWriter::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1335 VisitExpr(E);
1336
1337 Record.push_back(E->getNumAssocs());
1338 Record.push_back(E->isExprPredicate());
1339 Record.push_back(E->ResultIndex);
1340 Record.AddSourceLocation(E->getGenericLoc());
1341 Record.AddSourceLocation(E->getDefaultLoc());
1342 Record.AddSourceLocation(E->getRParenLoc());
1343
1344 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1345 // Add 1 to account for the controlling expression which is the first
1346 // expression in the trailing array of Stmt *. This is not needed for
1347 // the trailing array of TypeSourceInfo *.
1348 for (unsigned I = 0, N = E->getNumAssocs() + 1; I < N; ++I)
1349 Record.AddStmt(Stmts[I]);
1350
1351 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1352 for (unsigned I = 0, N = E->getNumAssocs(); I < N; ++I)
1353 Record.AddTypeSourceInfo(TSIs[I]);
1354
1356}
1357
1358void ASTStmtWriter::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1359 VisitExpr(E);
1360 Record.push_back(E->getNumSemanticExprs());
1361
1362 // Push the result index. Currently, this needs to exactly match
1363 // the encoding used internally for ResultIndex.
1364 unsigned result = E->getResultExprIndex();
1365 result = (result == PseudoObjectExpr::NoResult ? 0 : result + 1);
1366 Record.push_back(result);
1367
1368 Record.AddStmt(E->getSyntacticForm());
1370 i = E->semantics_begin(), e = E->semantics_end(); i != e; ++i) {
1371 Record.AddStmt(*i);
1372 }
1374}
1375
1376void ASTStmtWriter::VisitAtomicExpr(AtomicExpr *E) {
1377 VisitExpr(E);
1378 Record.push_back(E->getOp());
1379 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1380 Record.AddStmt(E->getSubExprs()[I]);
1381 Record.AddSourceLocation(E->getBuiltinLoc());
1382 Record.AddSourceLocation(E->getRParenLoc());
1384}
1385
1386//===----------------------------------------------------------------------===//
1387// Objective-C Expressions and Statements.
1388//===----------------------------------------------------------------------===//
1389
1390void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1391 VisitExpr(E);
1392 Record.AddStmt(E->getString());
1393 Record.AddSourceLocation(E->getAtLoc());
1395}
1396
1397void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1398 VisitExpr(E);
1399 Record.AddStmt(E->getSubExpr());
1400 Record.AddDeclRef(E->getBoxingMethod());
1401 Record.AddSourceRange(E->getSourceRange());
1403}
1404
1405void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1406 VisitExpr(E);
1407 Record.push_back(E->getNumElements());
1408 for (unsigned i = 0; i < E->getNumElements(); i++)
1409 Record.AddStmt(E->getElement(i));
1410 Record.AddDeclRef(E->getArrayWithObjectsMethod());
1411 Record.AddSourceRange(E->getSourceRange());
1413}
1414
1415void ASTStmtWriter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1416 VisitExpr(E);
1417 Record.push_back(E->getNumElements());
1418 Record.push_back(E->HasPackExpansions);
1419 for (unsigned i = 0; i < E->getNumElements(); i++) {
1420 ObjCDictionaryElement Element = E->getKeyValueElement(i);
1421 Record.AddStmt(Element.Key);
1422 Record.AddStmt(Element.Value);
1423 if (E->HasPackExpansions) {
1424 Record.AddSourceLocation(Element.EllipsisLoc);
1425 unsigned NumExpansions = 0;
1426 if (Element.NumExpansions)
1427 NumExpansions = *Element.NumExpansions + 1;
1428 Record.push_back(NumExpansions);
1429 }
1430 }
1431
1432 Record.AddDeclRef(E->getDictWithObjectsMethod());
1433 Record.AddSourceRange(E->getSourceRange());
1435}
1436
1437void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1438 VisitExpr(E);
1439 Record.AddTypeSourceInfo(E->getEncodedTypeSourceInfo());
1440 Record.AddSourceLocation(E->getAtLoc());
1441 Record.AddSourceLocation(E->getRParenLoc());
1443}
1444
1445void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1446 VisitExpr(E);
1447 Record.AddSelectorRef(E->getSelector());
1448 Record.AddSourceLocation(E->getAtLoc());
1449 Record.AddSourceLocation(E->getRParenLoc());
1451}
1452
1453void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1454 VisitExpr(E);
1455 Record.AddDeclRef(E->getProtocol());
1456 Record.AddSourceLocation(E->getAtLoc());
1457 Record.AddSourceLocation(E->ProtoLoc);
1458 Record.AddSourceLocation(E->getRParenLoc());
1460}
1461
1462void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1463 VisitExpr(E);
1464 Record.AddDeclRef(E->getDecl());
1465 Record.AddSourceLocation(E->getLocation());
1466 Record.AddSourceLocation(E->getOpLoc());
1467 Record.AddStmt(E->getBase());
1468 Record.push_back(E->isArrow());
1469 Record.push_back(E->isFreeIvar());
1471}
1472
1473void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1474 VisitExpr(E);
1475 Record.push_back(E->SetterAndMethodRefFlags.getInt());
1476 Record.push_back(E->isImplicitProperty());
1477 if (E->isImplicitProperty()) {
1478 Record.AddDeclRef(E->getImplicitPropertyGetter());
1479 Record.AddDeclRef(E->getImplicitPropertySetter());
1480 } else {
1481 Record.AddDeclRef(E->getExplicitProperty());
1482 }
1483 Record.AddSourceLocation(E->getLocation());
1484 Record.AddSourceLocation(E->getReceiverLocation());
1485 if (E->isObjectReceiver()) {
1486 Record.push_back(0);
1487 Record.AddStmt(E->getBase());
1488 } else if (E->isSuperReceiver()) {
1489 Record.push_back(1);
1490 Record.AddTypeRef(E->getSuperReceiverType());
1491 } else {
1492 Record.push_back(2);
1493 Record.AddDeclRef(E->getClassReceiver());
1494 }
1495
1497}
1498
1499void ASTStmtWriter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1500 VisitExpr(E);
1501 Record.AddSourceLocation(E->getRBracket());
1502 Record.AddStmt(E->getBaseExpr());
1503 Record.AddStmt(E->getKeyExpr());
1504 Record.AddDeclRef(E->getAtIndexMethodDecl());
1505 Record.AddDeclRef(E->setAtIndexMethodDecl());
1506
1508}
1509
1510void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1511 VisitExpr(E);
1512 Record.push_back(E->getNumArgs());
1513 Record.push_back(E->getNumStoredSelLocs());
1514 Record.push_back(E->SelLocsKind);
1515 Record.push_back(E->isDelegateInitCall());
1516 Record.push_back(E->IsImplicit);
1517 Record.push_back((unsigned)E->getReceiverKind()); // FIXME: stable encoding
1518 switch (E->getReceiverKind()) {
1520 Record.AddStmt(E->getInstanceReceiver());
1521 break;
1522
1524 Record.AddTypeSourceInfo(E->getClassReceiverTypeInfo());
1525 break;
1526
1529 Record.AddTypeRef(E->getSuperType());
1530 Record.AddSourceLocation(E->getSuperLoc());
1531 break;
1532 }
1533
1534 if (E->getMethodDecl()) {
1535 Record.push_back(1);
1536 Record.AddDeclRef(E->getMethodDecl());
1537 } else {
1538 Record.push_back(0);
1539 Record.AddSelectorRef(E->getSelector());
1540 }
1541
1542 Record.AddSourceLocation(E->getLeftLoc());
1543 Record.AddSourceLocation(E->getRightLoc());
1544
1545 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
1546 Arg != ArgEnd; ++Arg)
1547 Record.AddStmt(*Arg);
1548
1549 SourceLocation *Locs = E->getStoredSelLocs();
1550 for (unsigned i = 0, e = E->getNumStoredSelLocs(); i != e; ++i)
1551 Record.AddSourceLocation(Locs[i]);
1552
1554}
1555
1556void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1557 VisitStmt(S);
1558 Record.AddStmt(S->getElement());
1559 Record.AddStmt(S->getCollection());
1560 Record.AddStmt(S->getBody());
1561 Record.AddSourceLocation(S->getForLoc());
1562 Record.AddSourceLocation(S->getRParenLoc());
1564}
1565
1566void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1567 VisitStmt(S);
1568 Record.AddStmt(S->getCatchBody());
1569 Record.AddDeclRef(S->getCatchParamDecl());
1570 Record.AddSourceLocation(S->getAtCatchLoc());
1571 Record.AddSourceLocation(S->getRParenLoc());
1573}
1574
1575void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1576 VisitStmt(S);
1577 Record.AddStmt(S->getFinallyBody());
1578 Record.AddSourceLocation(S->getAtFinallyLoc());
1580}
1581
1582void ASTStmtWriter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1583 VisitStmt(S); // FIXME: no test coverage.
1584 Record.AddStmt(S->getSubStmt());
1585 Record.AddSourceLocation(S->getAtLoc());
1587}
1588
1589void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1590 VisitStmt(S);
1591 Record.push_back(S->getNumCatchStmts());
1592 Record.push_back(S->getFinallyStmt() != nullptr);
1593 Record.AddStmt(S->getTryBody());
1594 for (ObjCAtCatchStmt *C : S->catch_stmts())
1595 Record.AddStmt(C);
1596 if (S->getFinallyStmt())
1597 Record.AddStmt(S->getFinallyStmt());
1598 Record.AddSourceLocation(S->getAtTryLoc());
1600}
1601
1602void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1603 VisitStmt(S); // FIXME: no test coverage.
1604 Record.AddStmt(S->getSynchExpr());
1605 Record.AddStmt(S->getSynchBody());
1606 Record.AddSourceLocation(S->getAtSynchronizedLoc());
1608}
1609
1610void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1611 VisitStmt(S); // FIXME: no test coverage.
1612 Record.AddStmt(S->getThrowExpr());
1613 Record.AddSourceLocation(S->getThrowLoc());
1615}
1616
1617void ASTStmtWriter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1618 VisitExpr(E);
1619 Record.push_back(E->getValue());
1620 Record.AddSourceLocation(E->getLocation());
1622}
1623
1624void ASTStmtWriter::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1625 VisitExpr(E);
1626 Record.AddSourceRange(E->getSourceRange());
1627 Record.AddVersionTuple(E->getVersion());
1629}
1630
1631//===----------------------------------------------------------------------===//
1632// C++ Expressions and Statements.
1633//===----------------------------------------------------------------------===//
1634
1635void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
1636 VisitStmt(S);
1637 Record.AddSourceLocation(S->getCatchLoc());
1638 Record.AddDeclRef(S->getExceptionDecl());
1639 Record.AddStmt(S->getHandlerBlock());
1641}
1642
1643void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
1644 VisitStmt(S);
1645 Record.push_back(S->getNumHandlers());
1646 Record.AddSourceLocation(S->getTryLoc());
1647 Record.AddStmt(S->getTryBlock());
1648 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1649 Record.AddStmt(S->getHandler(i));
1651}
1652
1653void ASTStmtWriter::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1654 VisitStmt(S);
1655 Record.AddSourceLocation(S->getForLoc());
1656 Record.AddSourceLocation(S->getCoawaitLoc());
1657 Record.AddSourceLocation(S->getColonLoc());
1658 Record.AddSourceLocation(S->getRParenLoc());
1659 Record.AddStmt(S->getInit());
1660 Record.AddStmt(S->getRangeStmt());
1661 Record.AddStmt(S->getBeginStmt());
1662 Record.AddStmt(S->getEndStmt());
1663 Record.AddStmt(S->getCond());
1664 Record.AddStmt(S->getInc());
1665 Record.AddStmt(S->getLoopVarStmt());
1666 Record.AddStmt(S->getBody());
1668}
1669
1670void ASTStmtWriter::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1671 VisitStmt(S);
1672 Record.AddSourceLocation(S->getKeywordLoc());
1673 Record.push_back(S->isIfExists());
1674 Record.AddNestedNameSpecifierLoc(S->getQualifierLoc());
1675 Record.AddDeclarationNameInfo(S->getNameInfo());
1676 Record.AddStmt(S->getSubStmt());
1678}
1679
1680void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1681 VisitCallExpr(E);
1682 Record.push_back(E->getOperator());
1683 Record.AddSourceRange(E->Range);
1684
1685 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()))
1686 AbbrevToUse = Writer.getCXXOperatorCallExprAbbrev();
1687
1689}
1690
1691void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1692 VisitCallExpr(E);
1693
1694 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()))
1695 AbbrevToUse = Writer.getCXXMemberCallExprAbbrev();
1696
1698}
1699
1700void ASTStmtWriter::VisitCXXRewrittenBinaryOperator(
1702 VisitExpr(E);
1703 Record.push_back(E->isReversed());
1704 Record.AddStmt(E->getSemanticForm());
1706}
1707
1708void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
1709 VisitExpr(E);
1710
1711 Record.push_back(E->getNumArgs());
1712 Record.push_back(E->isElidable());
1713 Record.push_back(E->hadMultipleCandidates());
1714 Record.push_back(E->isListInitialization());
1715 Record.push_back(E->isStdInitListInitialization());
1716 Record.push_back(E->requiresZeroInitialization());
1717 Record.push_back(
1718 llvm::to_underlying(E->getConstructionKind())); // FIXME: stable encoding
1719 Record.push_back(E->isImmediateEscalating());
1720 Record.AddSourceLocation(E->getLocation());
1721 Record.AddDeclRef(E->getConstructor());
1722 Record.AddSourceRange(E->getParenOrBraceRange());
1723
1724 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1725 Record.AddStmt(E->getArg(I));
1726
1728}
1729
1730void ASTStmtWriter::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1731 VisitExpr(E);
1732 Record.AddDeclRef(E->getConstructor());
1733 Record.AddSourceLocation(E->getLocation());
1734 Record.push_back(E->constructsVBase());
1735 Record.push_back(E->inheritedFromVBase());
1737}
1738
1739void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1740 VisitCXXConstructExpr(E);
1741 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1743}
1744
1745void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) {
1746 VisitExpr(E);
1747 Record.push_back(E->LambdaExprBits.NumCaptures);
1748 Record.AddSourceRange(E->IntroducerRange);
1749 Record.push_back(E->LambdaExprBits.CaptureDefault); // FIXME: stable encoding
1750 Record.AddSourceLocation(E->CaptureDefaultLoc);
1751 Record.push_back(E->LambdaExprBits.ExplicitParams);
1752 Record.push_back(E->LambdaExprBits.ExplicitResultType);
1753 Record.AddSourceLocation(E->ClosingBrace);
1754
1755 // Add capture initializers.
1756 for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
1757 CEnd = E->capture_init_end();
1758 C != CEnd; ++C) {
1759 Record.AddStmt(*C);
1760 }
1761
1762 // Don't serialize the body. It belongs to the call operator declaration.
1763 // LambdaExpr only stores a copy of the Stmt *.
1764
1766}
1767
1768void ASTStmtWriter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1769 VisitExpr(E);
1770 Record.AddStmt(E->getSubExpr());
1772}
1773
1774void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1775 VisitExplicitCastExpr(E);
1776 Record.AddSourceRange(SourceRange(E->getOperatorLoc(), E->getRParenLoc()));
1777 CurrentPackingBits.addBit(E->getAngleBrackets().isValid());
1778 if (E->getAngleBrackets().isValid())
1779 Record.AddSourceRange(E->getAngleBrackets());
1780}
1781
1782void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1783 VisitCXXNamedCastExpr(E);
1785}
1786
1787void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1788 VisitCXXNamedCastExpr(E);
1790}
1791
1792void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1793 VisitCXXNamedCastExpr(E);
1795}
1796
1797void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1798 VisitCXXNamedCastExpr(E);
1800}
1801
1802void ASTStmtWriter::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1803 VisitCXXNamedCastExpr(E);
1805}
1806
1807void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1808 VisitExplicitCastExpr(E);
1809 Record.AddSourceLocation(E->getLParenLoc());
1810 Record.AddSourceLocation(E->getRParenLoc());
1812}
1813
1814void ASTStmtWriter::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1815 VisitExplicitCastExpr(E);
1816 Record.AddSourceLocation(E->getBeginLoc());
1817 Record.AddSourceLocation(E->getEndLoc());
1819}
1820
1821void ASTStmtWriter::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1822 VisitCallExpr(E);
1823 Record.AddSourceLocation(E->UDSuffixLoc);
1825}
1826
1827void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1828 VisitExpr(E);
1829 Record.push_back(E->getValue());
1830 Record.AddSourceLocation(E->getLocation());
1832}
1833
1834void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1835 VisitExpr(E);
1836 Record.AddSourceLocation(E->getLocation());
1838}
1839
1840void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1841 VisitExpr(E);
1842 Record.AddSourceRange(E->getSourceRange());
1843 if (E->isTypeOperand()) {
1844 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
1846 } else {
1847 Record.AddStmt(E->getExprOperand());
1849 }
1850}
1851
1852void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
1853 VisitExpr(E);
1854 Record.AddSourceLocation(E->getLocation());
1855 Record.push_back(E->isImplicit());
1856 Record.push_back(E->isCapturedByCopyInLambdaWithExplicitObjectParameter());
1857
1859}
1860
1861void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
1862 VisitExpr(E);
1863 Record.AddSourceLocation(E->getThrowLoc());
1864 Record.AddStmt(E->getSubExpr());
1865 Record.push_back(E->isThrownVariableInScope());
1867}
1868
1869void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1870 VisitExpr(E);
1871 Record.AddDeclRef(E->getParam());
1872 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1873 Record.AddSourceLocation(E->getUsedLocation());
1874 Record.push_back(E->hasRewrittenInit());
1875 if (E->hasRewrittenInit())
1876 Record.AddStmt(E->getRewrittenExpr());
1878}
1879
1880void ASTStmtWriter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1881 VisitExpr(E);
1882 Record.push_back(E->hasRewrittenInit());
1883 Record.AddDeclRef(E->getField());
1884 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1885 Record.AddSourceLocation(E->getExprLoc());
1886 if (E->hasRewrittenInit())
1887 Record.AddStmt(E->getRewrittenExpr());
1889}
1890
1891void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1892 VisitExpr(E);
1893 Record.AddCXXTemporary(E->getTemporary());
1894 Record.AddStmt(E->getSubExpr());
1896}
1897
1898void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1899 VisitExpr(E);
1900 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1901 Record.AddSourceLocation(E->getRParenLoc());
1903}
1904
1905void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
1906 VisitExpr(E);
1907
1908 Record.push_back(E->isArray());
1909 Record.push_back(E->hasInitializer());
1910 Record.push_back(E->getNumPlacementArgs());
1911 Record.push_back(E->isParenTypeId());
1912
1913 Record.push_back(E->isGlobalNew());
1914 Record.push_back(E->passAlignment());
1915 Record.push_back(E->doesUsualArrayDeleteWantSize());
1916 Record.push_back(E->CXXNewExprBits.HasInitializer);
1917 Record.push_back(E->CXXNewExprBits.StoredInitializationStyle);
1918
1919 Record.AddDeclRef(E->getOperatorNew());
1920 Record.AddDeclRef(E->getOperatorDelete());
1921 Record.AddTypeSourceInfo(E->getAllocatedTypeSourceInfo());
1922 if (E->isParenTypeId())
1923 Record.AddSourceRange(E->getTypeIdParens());
1924 Record.AddSourceRange(E->getSourceRange());
1925 Record.AddSourceRange(E->getDirectInitRange());
1926
1927 for (CXXNewExpr::arg_iterator I = E->raw_arg_begin(), N = E->raw_arg_end();
1928 I != N; ++I)
1929 Record.AddStmt(*I);
1930
1932}
1933
1934void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1935 VisitExpr(E);
1936 Record.push_back(E->isGlobalDelete());
1937 Record.push_back(E->isArrayForm());
1938 Record.push_back(E->isArrayFormAsWritten());
1939 Record.push_back(E->doesUsualArrayDeleteWantSize());
1940 Record.AddDeclRef(E->getOperatorDelete());
1941 Record.AddStmt(E->getArgument());
1942 Record.AddSourceLocation(E->getBeginLoc());
1943
1945}
1946
1947void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1948 VisitExpr(E);
1949
1950 Record.AddStmt(E->getBase());
1951 Record.push_back(E->isArrow());
1952 Record.AddSourceLocation(E->getOperatorLoc());
1953 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1954 Record.AddTypeSourceInfo(E->getScopeTypeInfo());
1955 Record.AddSourceLocation(E->getColonColonLoc());
1956 Record.AddSourceLocation(E->getTildeLoc());
1957
1958 // PseudoDestructorTypeStorage.
1959 Record.AddIdentifierRef(E->getDestroyedTypeIdentifier());
1960 if (E->getDestroyedTypeIdentifier())
1961 Record.AddSourceLocation(E->getDestroyedTypeLoc());
1962 else
1963 Record.AddTypeSourceInfo(E->getDestroyedTypeInfo());
1964
1966}
1967
1968void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) {
1969 VisitExpr(E);
1970 Record.push_back(E->getNumObjects());
1971 for (auto &Obj : E->getObjects()) {
1972 if (auto *BD = Obj.dyn_cast<BlockDecl *>()) {
1974 Record.AddDeclRef(BD);
1975 } else if (auto *CLE = Obj.dyn_cast<CompoundLiteralExpr *>()) {
1977 Record.AddStmt(CLE);
1978 }
1979 }
1980
1981 Record.push_back(E->cleanupsHaveSideEffects());
1982 Record.AddStmt(E->getSubExpr());
1984}
1985
1986void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
1988 VisitExpr(E);
1989
1990 // Don't emit anything here (or if you do you will have to update
1991 // the corresponding deserialization function).
1992 Record.push_back(E->getNumTemplateArgs());
1993 CurrentPackingBits.updateBits();
1994 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
1995 CurrentPackingBits.addBit(E->hasFirstQualifierFoundInScope());
1996
1997 if (E->hasTemplateKWAndArgsInfo()) {
1998 const ASTTemplateKWAndArgsInfo &ArgInfo =
1999 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2001 E->getTrailingObjects<TemplateArgumentLoc>());
2002 }
2003
2004 CurrentPackingBits.addBit(E->isArrow());
2005
2006 Record.AddTypeRef(E->getBaseType());
2007 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2008 CurrentPackingBits.addBit(!E->isImplicitAccess());
2009 if (!E->isImplicitAccess())
2010 Record.AddStmt(E->getBase());
2011
2012 Record.AddSourceLocation(E->getOperatorLoc());
2013
2014 if (E->hasFirstQualifierFoundInScope())
2015 Record.AddDeclRef(E->getFirstQualifierFoundInScope());
2016
2017 Record.AddDeclarationNameInfo(E->MemberNameInfo);
2019}
2020
2021void
2022ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2023 VisitExpr(E);
2024
2025 // Don't emit anything here, HasTemplateKWAndArgsInfo must be
2026 // emitted first.
2027 CurrentPackingBits.addBit(
2028 E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
2029
2030 if (E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo) {
2031 const ASTTemplateKWAndArgsInfo &ArgInfo =
2032 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2033 // 16 bits should be enought to store the number of args
2034 CurrentPackingBits.addBits(ArgInfo.NumTemplateArgs, /*Width=*/16);
2036 E->getTrailingObjects<TemplateArgumentLoc>());
2037 }
2038
2039 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2040 Record.AddDeclarationNameInfo(E->NameInfo);
2042}
2043
2044void
2045ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2046 VisitExpr(E);
2047 Record.push_back(E->getNumArgs());
2049 ArgI = E->arg_begin(), ArgE = E->arg_end(); ArgI != ArgE; ++ArgI)
2050 Record.AddStmt(*ArgI);
2051 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
2052 Record.AddSourceLocation(E->getLParenLoc());
2053 Record.AddSourceLocation(E->getRParenLoc());
2054 Record.push_back(E->isListInitialization());
2056}
2057
2058void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
2059 VisitExpr(E);
2060
2061 Record.push_back(E->getNumDecls());
2062
2063 CurrentPackingBits.updateBits();
2064 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2065 if (E->hasTemplateKWAndArgsInfo()) {
2066 const ASTTemplateKWAndArgsInfo &ArgInfo =
2067 *E->getTrailingASTTemplateKWAndArgsInfo();
2068 Record.push_back(ArgInfo.NumTemplateArgs);
2069 AddTemplateKWAndArgsInfo(ArgInfo, E->getTrailingTemplateArgumentLoc());
2070 }
2071
2072 for (OverloadExpr::decls_iterator OvI = E->decls_begin(),
2073 OvE = E->decls_end();
2074 OvI != OvE; ++OvI) {
2075 Record.AddDeclRef(OvI.getDecl());
2076 Record.push_back(OvI.getAccess());
2077 }
2078
2079 Record.AddDeclarationNameInfo(E->getNameInfo());
2080 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2081}
2082
2083void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2084 VisitOverloadExpr(E);
2085 CurrentPackingBits.addBit(E->isArrow());
2086 CurrentPackingBits.addBit(E->hasUnresolvedUsing());
2087 CurrentPackingBits.addBit(!E->isImplicitAccess());
2088 if (!E->isImplicitAccess())
2089 Record.AddStmt(E->getBase());
2090
2091 Record.AddSourceLocation(E->getOperatorLoc());
2092
2093 Record.AddTypeRef(E->getBaseType());
2095}
2096
2097void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2098 VisitOverloadExpr(E);
2099 CurrentPackingBits.addBit(E->requiresADL());
2100 Record.AddDeclRef(E->getNamingClass());
2102
2103 if (Writer.isWritingStdCXXNamedModules() && Writer.getChain()) {
2104 // Referencing all the possible declarations to make sure the change get
2105 // propagted.
2106 DeclarationName Name = E->getName();
2107 for (auto *Found :
2109 if (Found->isFromASTFile())
2110 Writer.GetDeclRef(Found);
2111
2113 Writer.getChain()->ReadKnownNamespaces(ExternalNSs);
2114 for (auto *NS : ExternalNSs)
2115 for (auto *Found : NS->lookup(Name))
2116 Writer.GetDeclRef(Found);
2117 }
2118}
2119
2120void ASTStmtWriter::VisitTypeTraitExpr(TypeTraitExpr *E) {
2121 VisitExpr(E);
2122 Record.push_back(E->TypeTraitExprBits.NumArgs);
2123 Record.push_back(E->TypeTraitExprBits.Kind); // FIXME: Stable encoding
2124 Record.push_back(E->TypeTraitExprBits.Value);
2125 Record.AddSourceRange(E->getSourceRange());
2126 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2127 Record.AddTypeSourceInfo(E->getArg(I));
2129}
2130
2131void ASTStmtWriter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2132 VisitExpr(E);
2133 Record.push_back(E->getTrait());
2134 Record.push_back(E->getValue());
2135 Record.AddSourceRange(E->getSourceRange());
2136 Record.AddTypeSourceInfo(E->getQueriedTypeSourceInfo());
2137 Record.AddStmt(E->getDimensionExpression());
2139}
2140
2141void ASTStmtWriter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2142 VisitExpr(E);
2143 Record.push_back(E->getTrait());
2144 Record.push_back(E->getValue());
2145 Record.AddSourceRange(E->getSourceRange());
2146 Record.AddStmt(E->getQueriedExpression());
2148}
2149
2150void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2151 VisitExpr(E);
2152 Record.push_back(E->getValue());
2153 Record.AddSourceRange(E->getSourceRange());
2154 Record.AddStmt(E->getOperand());
2156}
2157
2158void ASTStmtWriter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2159 VisitExpr(E);
2160 Record.AddSourceLocation(E->getEllipsisLoc());
2161 Record.push_back(E->NumExpansions);
2162 Record.AddStmt(E->getPattern());
2164}
2165
2166void ASTStmtWriter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2167 VisitExpr(E);
2168 Record.push_back(E->isPartiallySubstituted() ? E->getPartialArguments().size()
2169 : 0);
2170 Record.AddSourceLocation(E->OperatorLoc);
2171 Record.AddSourceLocation(E->PackLoc);
2172 Record.AddSourceLocation(E->RParenLoc);
2173 Record.AddDeclRef(E->Pack);
2174 if (E->isPartiallySubstituted()) {
2175 for (const auto &TA : E->getPartialArguments())
2176 Record.AddTemplateArgument(TA);
2177 } else if (!E->isValueDependent()) {
2178 Record.push_back(E->getPackLength());
2179 }
2181}
2182
2183void ASTStmtWriter::VisitPackIndexingExpr(PackIndexingExpr *E) {
2184 VisitExpr(E);
2185 Record.push_back(E->TransformedExpressions);
2186 Record.push_back(E->ExpandedToEmptyPack);
2187 Record.AddSourceLocation(E->getEllipsisLoc());
2188 Record.AddSourceLocation(E->getRSquareLoc());
2189 Record.AddStmt(E->getPackIdExpression());
2190 Record.AddStmt(E->getIndexExpr());
2191 for (Expr *Sub : E->getExpressions())
2192 Record.AddStmt(Sub);
2194}
2195
2196void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
2198 VisitExpr(E);
2199 Record.AddDeclRef(E->getAssociatedDecl());
2200 CurrentPackingBits.addBit(E->isReferenceParameter());
2201 CurrentPackingBits.addBits(E->getIndex(), /*Width=*/12);
2202 CurrentPackingBits.addBit((bool)E->getPackIndex());
2203 if (auto PackIndex = E->getPackIndex())
2204 Record.push_back(*PackIndex + 1);
2205
2206 Record.AddSourceLocation(E->getNameLoc());
2207 Record.AddStmt(E->getReplacement());
2209}
2210
2211void ASTStmtWriter::VisitSubstNonTypeTemplateParmPackExpr(
2213 VisitExpr(E);
2214 Record.AddDeclRef(E->getAssociatedDecl());
2215 Record.push_back(E->getIndex());
2216 Record.AddTemplateArgument(E->getArgumentPack());
2217 Record.AddSourceLocation(E->getParameterPackLocation());
2219}
2220
2221void ASTStmtWriter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2222 VisitExpr(E);
2223 Record.push_back(E->getNumExpansions());
2224 Record.AddDeclRef(E->getParameterPack());
2225 Record.AddSourceLocation(E->getParameterPackLocation());
2226 for (FunctionParmPackExpr::iterator I = E->begin(), End = E->end();
2227 I != End; ++I)
2228 Record.AddDeclRef(*I);
2230}
2231
2232void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2233 VisitExpr(E);
2234 Record.push_back(static_cast<bool>(E->getLifetimeExtendedTemporaryDecl()));
2235 if (E->getLifetimeExtendedTemporaryDecl())
2236 Record.AddDeclRef(E->getLifetimeExtendedTemporaryDecl());
2237 else
2238 Record.AddStmt(E->getSubExpr());
2240}
2241
2242void ASTStmtWriter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2243 VisitExpr(E);
2244 Record.AddSourceLocation(E->LParenLoc);
2245 Record.AddSourceLocation(E->EllipsisLoc);
2246 Record.AddSourceLocation(E->RParenLoc);
2247 Record.push_back(E->NumExpansions);
2248 Record.AddStmt(E->SubExprs[0]);
2249 Record.AddStmt(E->SubExprs[1]);
2250 Record.AddStmt(E->SubExprs[2]);
2251 Record.push_back(E->Opcode);
2253}
2254
2255void ASTStmtWriter::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2256 VisitExpr(E);
2257 ArrayRef<Expr *> InitExprs = E->getInitExprs();
2258 Record.push_back(InitExprs.size());
2259 Record.push_back(E->getUserSpecifiedInitExprs().size());
2260 Record.AddSourceLocation(E->getInitLoc());
2261 Record.AddSourceLocation(E->getBeginLoc());
2262 Record.AddSourceLocation(E->getEndLoc());
2263 for (Expr *InitExpr : E->getInitExprs())
2264 Record.AddStmt(InitExpr);
2265 Expr *ArrayFiller = E->getArrayFiller();
2266 FieldDecl *UnionField = E->getInitializedFieldInUnion();
2267 bool HasArrayFillerOrUnionDecl = ArrayFiller || UnionField;
2268 Record.push_back(HasArrayFillerOrUnionDecl);
2269 if (HasArrayFillerOrUnionDecl) {
2270 Record.push_back(static_cast<bool>(ArrayFiller));
2271 if (ArrayFiller)
2272 Record.AddStmt(ArrayFiller);
2273 else
2274 Record.AddDeclRef(UnionField);
2275 }
2277}
2278
2279void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2280 VisitExpr(E);
2281 Record.AddStmt(E->getSourceExpr());
2282 Record.AddSourceLocation(E->getLocation());
2283 Record.push_back(E->isUnique());
2285}
2286
2287void ASTStmtWriter::VisitTypoExpr(TypoExpr *E) {
2288 VisitExpr(E);
2289 // TODO: Figure out sane writer behavior for a TypoExpr, if necessary
2290 llvm_unreachable("Cannot write TypoExpr nodes");
2291}
2292
2293//===----------------------------------------------------------------------===//
2294// CUDA Expressions and Statements.
2295//===----------------------------------------------------------------------===//
2296
2297void ASTStmtWriter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2298 VisitCallExpr(E);
2299 Record.AddStmt(E->getConfig());
2301}
2302
2303//===----------------------------------------------------------------------===//
2304// OpenCL Expressions and Statements.
2305//===----------------------------------------------------------------------===//
2306void ASTStmtWriter::VisitAsTypeExpr(AsTypeExpr *E) {
2307 VisitExpr(E);
2308 Record.AddSourceLocation(E->getBuiltinLoc());
2309 Record.AddSourceLocation(E->getRParenLoc());
2310 Record.AddStmt(E->getSrcExpr());
2312}
2313
2314//===----------------------------------------------------------------------===//
2315// Microsoft Expressions and Statements.
2316//===----------------------------------------------------------------------===//
2317void ASTStmtWriter::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2318 VisitExpr(E);
2319 Record.push_back(E->isArrow());
2320 Record.AddStmt(E->getBaseExpr());
2321 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2322 Record.AddSourceLocation(E->getMemberLoc());
2323 Record.AddDeclRef(E->getPropertyDecl());
2325}
2326
2327void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2328 VisitExpr(E);
2329 Record.AddStmt(E->getBase());
2330 Record.AddStmt(E->getIdx());
2331 Record.AddSourceLocation(E->getRBracketLoc());
2333}
2334
2335void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2336 VisitExpr(E);
2337 Record.AddSourceRange(E->getSourceRange());
2338 Record.AddDeclRef(E->getGuidDecl());
2339 if (E->isTypeOperand()) {
2340 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
2342 } else {
2343 Record.AddStmt(E->getExprOperand());
2345 }
2346}
2347
2348void ASTStmtWriter::VisitSEHExceptStmt(SEHExceptStmt *S) {
2349 VisitStmt(S);
2350 Record.AddSourceLocation(S->getExceptLoc());
2351 Record.AddStmt(S->getFilterExpr());
2352 Record.AddStmt(S->getBlock());
2354}
2355
2356void ASTStmtWriter::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2357 VisitStmt(S);
2358 Record.AddSourceLocation(S->getFinallyLoc());
2359 Record.AddStmt(S->getBlock());
2361}
2362
2363void ASTStmtWriter::VisitSEHTryStmt(SEHTryStmt *S) {
2364 VisitStmt(S);
2365 Record.push_back(S->getIsCXXTry());
2366 Record.AddSourceLocation(S->getTryLoc());
2367 Record.AddStmt(S->getTryBlock());
2368 Record.AddStmt(S->getHandler());
2370}
2371
2372void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2373 VisitStmt(S);
2374 Record.AddSourceLocation(S->getLeaveLoc());
2376}
2377
2378//===----------------------------------------------------------------------===//
2379// OpenMP Directives.
2380//===----------------------------------------------------------------------===//
2381
2382void ASTStmtWriter::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2383 VisitStmt(S);
2384 for (Stmt *SubStmt : S->SubStmts)
2385 Record.AddStmt(SubStmt);
2387}
2388
2389void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2390 Record.writeOMPChildren(E->Data);
2391 Record.AddSourceLocation(E->getBeginLoc());
2392 Record.AddSourceLocation(E->getEndLoc());
2393}
2394
2395void ASTStmtWriter::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2396 VisitStmt(D);
2397 Record.writeUInt32(D->getLoopsNumber());
2398 VisitOMPExecutableDirective(D);
2399}
2400
2401void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) {
2402 VisitOMPLoopBasedDirective(D);
2403}
2404
2405void ASTStmtWriter::VisitOMPMetaDirective(OMPMetaDirective *D) {
2406 VisitStmt(D);
2407 Record.push_back(D->getNumClauses());
2408 VisitOMPExecutableDirective(D);
2410}
2411
2412void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) {
2413 VisitStmt(D);
2414 VisitOMPExecutableDirective(D);
2415 Record.writeBool(D->hasCancel());
2417}
2418
2419void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) {
2420 VisitOMPLoopDirective(D);
2422}
2423
2424void ASTStmtWriter::VisitOMPLoopTransformationDirective(
2426 VisitOMPLoopBasedDirective(D);
2427 Record.writeUInt32(D->getNumGeneratedLoops());
2428}
2429
2430void ASTStmtWriter::VisitOMPTileDirective(OMPTileDirective *D) {
2431 VisitOMPLoopTransformationDirective(D);
2433}
2434
2435void ASTStmtWriter::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2436 VisitOMPLoopTransformationDirective(D);
2438}
2439
2440void ASTStmtWriter::VisitOMPReverseDirective(OMPReverseDirective *D) {
2441 VisitOMPLoopTransformationDirective(D);
2443}
2444
2445void ASTStmtWriter::VisitOMPInterchangeDirective(OMPInterchangeDirective *D) {
2446 VisitOMPLoopTransformationDirective(D);
2448}
2449
2450void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) {
2451 VisitOMPLoopDirective(D);
2452 Record.writeBool(D->hasCancel());
2454}
2455
2456void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2457 VisitOMPLoopDirective(D);
2459}
2460
2461void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2462 VisitStmt(D);
2463 VisitOMPExecutableDirective(D);
2464 Record.writeBool(D->hasCancel());
2466}
2467
2468void ASTStmtWriter::VisitOMPSectionDirective(OMPSectionDirective *D) {
2469 VisitStmt(D);
2470 VisitOMPExecutableDirective(D);
2471 Record.writeBool(D->hasCancel());
2473}
2474
2475void ASTStmtWriter::VisitOMPScopeDirective(OMPScopeDirective *D) {
2476 VisitStmt(D);
2477 VisitOMPExecutableDirective(D);
2479}
2480
2481void ASTStmtWriter::VisitOMPSingleDirective(OMPSingleDirective *D) {
2482 VisitStmt(D);
2483 VisitOMPExecutableDirective(D);
2485}
2486
2487void ASTStmtWriter::VisitOMPMasterDirective(OMPMasterDirective *D) {
2488 VisitStmt(D);
2489 VisitOMPExecutableDirective(D);
2491}
2492
2493void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2494 VisitStmt(D);
2495 VisitOMPExecutableDirective(D);
2496 Record.AddDeclarationNameInfo(D->getDirectiveName());
2498}
2499
2500void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2501 VisitOMPLoopDirective(D);
2502 Record.writeBool(D->hasCancel());
2504}
2505
2506void ASTStmtWriter::VisitOMPParallelForSimdDirective(
2508 VisitOMPLoopDirective(D);
2510}
2511
2512void ASTStmtWriter::VisitOMPParallelMasterDirective(
2514 VisitStmt(D);
2515 VisitOMPExecutableDirective(D);
2517}
2518
2519void ASTStmtWriter::VisitOMPParallelMaskedDirective(
2521 VisitStmt(D);
2522 VisitOMPExecutableDirective(D);
2524}
2525
2526void ASTStmtWriter::VisitOMPParallelSectionsDirective(
2528 VisitStmt(D);
2529 VisitOMPExecutableDirective(D);
2530 Record.writeBool(D->hasCancel());
2532}
2533
2534void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) {
2535 VisitStmt(D);
2536 VisitOMPExecutableDirective(D);
2537 Record.writeBool(D->hasCancel());
2539}
2540
2541void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2542 VisitStmt(D);
2543 VisitOMPExecutableDirective(D);
2544 Record.writeBool(D->isXLHSInRHSPart());
2545 Record.writeBool(D->isPostfixUpdate());
2546 Record.writeBool(D->isFailOnly());
2548}
2549
2550void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) {
2551 VisitStmt(D);
2552 VisitOMPExecutableDirective(D);
2554}
2555
2556void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2557 VisitStmt(D);
2558 VisitOMPExecutableDirective(D);
2560}
2561
2562void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
2564 VisitStmt(D);
2565 VisitOMPExecutableDirective(D);
2567}
2568
2569void ASTStmtWriter::VisitOMPTargetExitDataDirective(
2571 VisitStmt(D);
2572 VisitOMPExecutableDirective(D);
2574}
2575
2576void ASTStmtWriter::VisitOMPTargetParallelDirective(
2578 VisitStmt(D);
2579 VisitOMPExecutableDirective(D);
2580 Record.writeBool(D->hasCancel());
2582}
2583
2584void ASTStmtWriter::VisitOMPTargetParallelForDirective(
2586 VisitOMPLoopDirective(D);
2587 Record.writeBool(D->hasCancel());
2589}
2590
2591void ASTStmtWriter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2592 VisitStmt(D);
2593 VisitOMPExecutableDirective(D);
2595}
2596
2597void ASTStmtWriter::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2598 VisitStmt(D);
2599 VisitOMPExecutableDirective(D);
2601}
2602
2603void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2604 VisitStmt(D);
2605 Record.push_back(D->getNumClauses());
2606 VisitOMPExecutableDirective(D);
2608}
2609
2610void ASTStmtWriter::VisitOMPAssumeDirective(OMPAssumeDirective *D) {
2611 VisitStmt(D);
2612 VisitOMPExecutableDirective(D);
2614}
2615
2616void ASTStmtWriter::VisitOMPErrorDirective(OMPErrorDirective *D) {
2617 VisitStmt(D);
2618 Record.push_back(D->getNumClauses());
2619 VisitOMPExecutableDirective(D);
2621}
2622
2623void ASTStmtWriter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2624 VisitStmt(D);
2625 VisitOMPExecutableDirective(D);
2627}
2628
2629void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) {
2630 VisitStmt(D);
2631 VisitOMPExecutableDirective(D);
2633}
2634
2635void ASTStmtWriter::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2636 VisitStmt(D);
2637 VisitOMPExecutableDirective(D);
2639}
2640
2641void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
2642 VisitStmt(D);
2643 VisitOMPExecutableDirective(D);
2645}
2646
2647void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2648 VisitStmt(D);
2649 VisitOMPExecutableDirective(D);
2651}
2652
2653void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2654 VisitStmt(D);
2655 VisitOMPExecutableDirective(D);
2657}
2658
2659void ASTStmtWriter::VisitOMPCancellationPointDirective(
2661 VisitStmt(D);
2662 VisitOMPExecutableDirective(D);
2663 Record.writeEnum(D->getCancelRegion());
2665}
2666
2667void ASTStmtWriter::VisitOMPCancelDirective(OMPCancelDirective *D) {
2668 VisitStmt(D);
2669 VisitOMPExecutableDirective(D);
2670 Record.writeEnum(D->getCancelRegion());
2672}
2673
2674void ASTStmtWriter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2675 VisitOMPLoopDirective(D);
2676 Record.writeBool(D->hasCancel());
2678}
2679
2680void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2681 VisitOMPLoopDirective(D);
2683}
2684
2685void ASTStmtWriter::VisitOMPMasterTaskLoopDirective(
2687 VisitOMPLoopDirective(D);
2688 Record.writeBool(D->hasCancel());
2690}
2691
2692void ASTStmtWriter::VisitOMPMaskedTaskLoopDirective(
2694 VisitOMPLoopDirective(D);
2695 Record.writeBool(D->hasCancel());
2697}
2698
2699void ASTStmtWriter::VisitOMPMasterTaskLoopSimdDirective(
2701 VisitOMPLoopDirective(D);
2703}
2704
2705void ASTStmtWriter::VisitOMPMaskedTaskLoopSimdDirective(
2707 VisitOMPLoopDirective(D);
2709}
2710
2711void ASTStmtWriter::VisitOMPParallelMasterTaskLoopDirective(
2713 VisitOMPLoopDirective(D);
2714 Record.writeBool(D->hasCancel());
2716}
2717
2718void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopDirective(
2720 VisitOMPLoopDirective(D);
2721 Record.writeBool(D->hasCancel());
2723}
2724
2725void ASTStmtWriter::VisitOMPParallelMasterTaskLoopSimdDirective(
2727 VisitOMPLoopDirective(D);
2729}
2730
2731void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopSimdDirective(
2733 VisitOMPLoopDirective(D);
2735}
2736
2737void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2738 VisitOMPLoopDirective(D);
2740}
2741
2742void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2743 VisitStmt(D);
2744 VisitOMPExecutableDirective(D);
2746}
2747
2748void ASTStmtWriter::VisitOMPDistributeParallelForDirective(
2750 VisitOMPLoopDirective(D);
2751 Record.writeBool(D->hasCancel());
2753}
2754
2755void ASTStmtWriter::VisitOMPDistributeParallelForSimdDirective(
2757 VisitOMPLoopDirective(D);
2759}
2760
2761void ASTStmtWriter::VisitOMPDistributeSimdDirective(
2763 VisitOMPLoopDirective(D);
2765}
2766
2767void ASTStmtWriter::VisitOMPTargetParallelForSimdDirective(
2769 VisitOMPLoopDirective(D);
2771}
2772
2773void ASTStmtWriter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2774 VisitOMPLoopDirective(D);
2776}
2777
2778void ASTStmtWriter::VisitOMPTeamsDistributeDirective(
2780 VisitOMPLoopDirective(D);
2782}
2783
2784void ASTStmtWriter::VisitOMPTeamsDistributeSimdDirective(
2786 VisitOMPLoopDirective(D);
2788}
2789
2790void ASTStmtWriter::VisitOMPTeamsDistributeParallelForSimdDirective(
2792 VisitOMPLoopDirective(D);
2794}
2795
2796void ASTStmtWriter::VisitOMPTeamsDistributeParallelForDirective(
2798 VisitOMPLoopDirective(D);
2799 Record.writeBool(D->hasCancel());
2801}
2802
2803void ASTStmtWriter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2804 VisitStmt(D);
2805 VisitOMPExecutableDirective(D);
2807}
2808
2809void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective(
2811 VisitOMPLoopDirective(D);
2813}
2814
2815void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective(
2817 VisitOMPLoopDirective(D);
2818 Record.writeBool(D->hasCancel());
2820}
2821
2822void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2824 VisitOMPLoopDirective(D);
2825 Code = serialization::
2827}
2828
2829void ASTStmtWriter::VisitOMPTargetTeamsDistributeSimdDirective(
2831 VisitOMPLoopDirective(D);
2833}
2834
2835void ASTStmtWriter::VisitOMPInteropDirective(OMPInteropDirective *D) {
2836 VisitStmt(D);
2837 VisitOMPExecutableDirective(D);
2839}
2840
2841void ASTStmtWriter::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2842 VisitStmt(D);
2843 VisitOMPExecutableDirective(D);
2844 Record.AddSourceLocation(D->getTargetCallLoc());
2846}
2847
2848void ASTStmtWriter::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2849 VisitStmt(D);
2850 VisitOMPExecutableDirective(D);
2852}
2853
2854void ASTStmtWriter::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2855 VisitOMPLoopDirective(D);
2857}
2858
2859void ASTStmtWriter::VisitOMPTeamsGenericLoopDirective(
2861 VisitOMPLoopDirective(D);
2863}
2864
2865void ASTStmtWriter::VisitOMPTargetTeamsGenericLoopDirective(
2867 VisitOMPLoopDirective(D);
2868 Record.writeBool(D->canBeParallelFor());
2870}
2871
2872void ASTStmtWriter::VisitOMPParallelGenericLoopDirective(
2874 VisitOMPLoopDirective(D);
2876}
2877
2878void ASTStmtWriter::VisitOMPTargetParallelGenericLoopDirective(
2880 VisitOMPLoopDirective(D);
2882}
2883
2884//===----------------------------------------------------------------------===//
2885// OpenACC Constructs/Directives.
2886//===----------------------------------------------------------------------===//
2887void ASTStmtWriter::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2888 Record.push_back(S->clauses().size());
2889 Record.writeEnum(S->Kind);
2890 Record.AddSourceRange(S->Range);
2891 Record.AddSourceLocation(S->DirectiveLoc);
2892 Record.writeOpenACCClauseList(S->clauses());
2893}
2894
2895void ASTStmtWriter::VisitOpenACCAssociatedStmtConstruct(
2897 VisitOpenACCConstructStmt(S);
2898 Record.AddStmt(S->getAssociatedStmt());
2899}
2900
2901void ASTStmtWriter::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2902 VisitStmt(S);
2903 VisitOpenACCAssociatedStmtConstruct(S);
2905}
2906
2907void ASTStmtWriter::VisitOpenACCLoopConstruct(OpenACCLoopConstruct *S) {
2908 VisitStmt(S);
2909 VisitOpenACCAssociatedStmtConstruct(S);
2911}
2912
2913//===----------------------------------------------------------------------===//
2914// ASTWriter Implementation
2915//===----------------------------------------------------------------------===//
2916
2918 assert(!SwitchCaseIDs.contains(S) && "SwitchCase recorded twice");
2919 unsigned NextID = SwitchCaseIDs.size();
2920 SwitchCaseIDs[S] = NextID;
2921 return NextID;
2922}
2923
2925 assert(SwitchCaseIDs.contains(S) && "SwitchCase hasn't been seen yet");
2926 return SwitchCaseIDs[S];
2927}
2928
2930 SwitchCaseIDs.clear();
2931}
2932
2933/// Write the given substatement or subexpression to the
2934/// bitstream.
2935void ASTWriter::WriteSubStmt(Stmt *S) {
2937 ASTStmtWriter Writer(*this, Record);
2938 ++NumStatements;
2939
2940 if (!S) {
2941 Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
2942 return;
2943 }
2944
2945 llvm::DenseMap<Stmt *, uint64_t>::iterator I = SubStmtEntries.find(S);
2946 if (I != SubStmtEntries.end()) {
2947 Record.push_back(I->second);
2948 Stream.EmitRecord(serialization::STMT_REF_PTR, Record);
2949 return;
2950 }
2951
2952#ifndef NDEBUG
2953 assert(!ParentStmts.count(S) && "There is a Stmt cycle!");
2954
2955 struct ParentStmtInserterRAII {
2956 Stmt *S;
2957 llvm::DenseSet<Stmt *> &ParentStmts;
2958
2959 ParentStmtInserterRAII(Stmt *S, llvm::DenseSet<Stmt *> &ParentStmts)
2960 : S(S), ParentStmts(ParentStmts) {
2961 ParentStmts.insert(S);
2962 }
2963 ~ParentStmtInserterRAII() {
2964 ParentStmts.erase(S);
2965 }
2966 };
2967
2968 ParentStmtInserterRAII ParentStmtInserter(S, ParentStmts);
2969#endif
2970
2971 Writer.Visit(S);
2972
2973 uint64_t Offset = Writer.Emit();
2974 SubStmtEntries[S] = Offset;
2975}
2976
2977/// Flush all of the statements that have been added to the
2978/// queue via AddStmt().
2979void ASTRecordWriter::FlushStmts() {
2980 // We expect to be the only consumer of the two temporary statement maps,
2981 // assert that they are empty.
2982 assert(Writer->SubStmtEntries.empty() && "unexpected entries in sub-stmt map");
2983 assert(Writer->ParentStmts.empty() && "unexpected entries in parent stmt map");
2984
2985 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
2986 Writer->WriteSubStmt(StmtsToEmit[I]);
2987
2988 assert(N == StmtsToEmit.size() && "record modified while being written!");
2989
2990 // Note that we are at the end of a full expression. Any
2991 // expression records that follow this one are part of a different
2992 // expression.
2993 Writer->Stream.EmitRecord(serialization::STMT_STOP, ArrayRef<uint32_t>());
2994
2995 Writer->SubStmtEntries.clear();
2996 Writer->ParentStmts.clear();
2997 }
2998
2999 StmtsToEmit.clear();
3000}
3001
3002void ASTRecordWriter::FlushSubStmts() {
3003 // For a nested statement, write out the substatements in reverse order (so
3004 // that a simple stack machine can be used when loading), and don't emit a
3005 // STMT_STOP after each one.
3006 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3007 Writer->WriteSubStmt(StmtsToEmit[N - I - 1]);
3008 assert(N == StmtsToEmit.size() && "record modified while being written!");
3009 }
3010
3011 StmtsToEmit.clear();
3012}
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
TranslationUnitDecl * getTranslationUnitDecl() const
Definition: ASTContext.h:1101
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:8774
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(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:837
bool isWritingStdCXXNamedModules() const
Definition: ASTWriter.h:852
unsigned getExprImplicitCastAbbrev() const
Definition: ASTWriter.h:836
unsigned getSwitchCaseID(SwitchCase *S)
Retrieve the ID for the given switch-case statement.
unsigned getDeclRefExprAbbrev() const
Definition: ASTWriter.h:833
unsigned getCXXOperatorCallExprAbbrev()
Definition: ASTWriter.h:842
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:6222
ASTContext & getASTContext() const
Definition: ASTWriter.h:649
unsigned getCXXMemberCallExprAbbrev()
Definition: ASTWriter.h:843
ASTReader * getChain() const
Definition: ASTWriter.h:848
unsigned getCompoundAssignOperatorAbbrev() const
Definition: ASTWriter.h:838
unsigned RecordSwitchCaseID(SwitchCase *S)
Record an ID for the given switch-case statement.
unsigned getCharacterLiteralAbbrev() const
Definition: ASTWriter.h:834
unsigned getCompoundStmtAbbrev() const
Definition: ASTWriter.h:845
void AddToken(const Token &Tok, RecordDataImpl &Record)
Emit a token.
Definition: ASTWriter.cpp:4704
SmallVector< uint64_t, 64 > RecordData
Definition: ASTWriter.h:94
unsigned getCallExprAbbrev() const
Definition: ASTWriter.h:841
unsigned getIntegerLiteralAbbrev() const
Definition: ASTWriter.h:835
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4372
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5756
Represents a loop initializing the elements of an array.
Definition: Expr.h:5703
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition: Expr.h:6926
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2674
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:6426
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition: Stmt.h:3110
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6629
Represents an attribute applied to a statement.
Definition: Stmt.h:2090
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:4275
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3860
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
Definition: ASTWriter.h:1003
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4471
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:6365
BreakStmt - This represents a break.
Definition: Stmt.h:2990
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:5292
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition: Expr.h:3791
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:4840
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:4954
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:2830
This captures a statement into a function.
Definition: Stmt.h:3767
CaseStmt - Represent a case statement.
Definition: Stmt.h:1811
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3498
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4592
Represents a 'co_await' expression.
Definition: ExprCXX.h:5185
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4122
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3428
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1611
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:4213
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:2960
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4533
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:5071
Represents a 'co_yield' expression.
Definition: ExprCXX.h:5266
A POD class for pairing a NamedDecl* with an access specifier.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
Definition: DeclBase.cpp:1852
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:1502
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
AccessSpecifier getAccess() const
Definition: DeclBase.h:514
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:5217
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3323
Represents a single C99 designator.
Definition: Expr.h:5327
Represents a C99 designated initializer expression.
Definition: Expr.h:5284
DoStmt - This represents a 'do/while' stmt.
Definition: Stmt.h:2735
Represents a reference to #emded data.
Definition: Expr.h:4867
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3750
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:3474
This represents one expression.
Definition: Expr.h:110
bool isValueDependent() const
Determines whether the value of this expression depends on.
Definition: Expr.h:175
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Definition: Expr.h:437
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Definition: Expr.h:444
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition: Expr.cpp:277
QualType getType() const
Definition: Expr.h:142
ExprDependence getDependence() const
Definition: Expr.h:162
An expression trait intrinsic.
Definition: ExprCXX.h:2924
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:6305
Represents a member of a struct/union/class.
Definition: Decl.h:3030
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition: Stmt.h:2791
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4648
VarDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition: ExprCXX.h:4682
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:3269
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4667
Represents a C11 generic selection.
Definition: Expr.h:5917
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2872
IfStmt - This represents an if/then/else.
Definition: Stmt.h:2148
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:3675
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5792
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2911
Describes an C or C++ initializer list.
Definition: Expr.h:5039
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:2041
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:3492
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:4728
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition: Expr.h:2752
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3187
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:5612
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1574
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:1696
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:1636
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:1575
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
Definition: ExprObjC.h:1491
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:945
@ SuperInstance
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:959
@ Instance
The receiver is an object instance.
Definition: ExprObjC.h:953
@ SuperClass
The receiver is a superclass.
Definition: ExprObjC.h:956
@ Class
The receiver is a class.
Definition: ExprObjC.h:950
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:844
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Definition: Expr.h:2475
Helper class for OffsetOfExpr.
Definition: Expr.h:2369
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
Definition: Expr.h:2427
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition: Expr.h:2433
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition: Expr.cpp:1692
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this offsetof node.
Definition: Expr.h:2454
@ Array
An index into an array.
Definition: Expr.h:2374
@ Identifier
A field in a dependent type, known only by its name.
Definition: Expr.h:2378
@ Field
A field.
Definition: Expr.h:2376
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Definition: Expr.h:2381
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:2423
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
Definition: Expr.h:2443
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 class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
Definition: StmtOpenACC.h:132
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:200
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:2135
Represents a parameter to a function.
Definition: Decl.h:1722
[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:6497
Expr *const * semantics_iterator
Definition: Expr.h:6561
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition: Expr.h:7101
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:510
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Definition: Stmt.h:3029
Represents a __leave statement.
Definition: Stmt.h:3728
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:4423
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:4465
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:4761
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:4417
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:185
Stmt - This represents one statement.
Definition: Stmt.h:84
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:350
LambdaExprBitfields LambdaExprBits
Definition: Stmt.h:1268
child_range children()
Definition: Stmt.cpp:287
StmtClass getStmtClass() const
Definition: Stmt.h:1363
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:326
TypeTraitExprBitfields TypeTraitExprBits
Definition: Stmt.h:1257
CXXNewExprBitfields CXXNewExprBits
Definition: Stmt.h:1255
ConstantExprBitfields ConstantExprBits
Definition: Stmt.h:1223
RequiresExprBitfields RequiresExprBits
Definition: Stmt.h:1269
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition: Stmt.h:1258
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.cpp:338
void AddString(StringRef V) const
Definition: Diagnostic.h:1199
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:4484
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:4569
SwitchStmt - This represents a 'switch' stmt.
Definition: Stmt.h:2398
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:524
A container of type source information.
Definition: Type.h:7721
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:6777
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition: Expr.h:2578
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition: Expr.h:2188
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:4701
WhileStmt - This represents a 'while' stmt.
Definition: Stmt.h:2594
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:1506
@ EXPR_DESIGNATED_INIT
A DesignatedInitExpr record.
Definition: ASTBitCodes.h:1653
@ EXPR_COMPOUND_LITERAL
A CompoundLiteralExpr record.
Definition: ASTBitCodes.h:1644
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1951
@ EXPR_OBJC_IVAR_REF_EXPR
An ObjCIvarRefExpr record.
Definition: ASTBitCodes.h:1731
@ EXPR_MEMBER
A MemberExpr record.
Definition: ASTBitCodes.h:1626
@ EXPR_CXX_TEMPORARY_OBJECT
A CXXTemporaryObjectExpr record.
Definition: ASTBitCodes.h:1805
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1962
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
Definition: ASTBitCodes.h:1632
@ EXPR_CXX_STATIC_CAST
A CXXStaticCastExpr record.
Definition: ASTBitCodes.h:1808
@ EXPR_OBJC_STRING_LITERAL
An ObjCStringLiteral record.
Definition: ASTBitCodes.h:1715
@ EXPR_VA_ARG
A VAArgExpr record.
Definition: ASTBitCodes.h:1671
@ STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1956
@ EXPR_OBJC_ISA
An ObjCIsa Expr record.
Definition: ASTBitCodes.h:1746
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
Definition: ASTBitCodes.h:1790
@ STMT_OBJC_AT_TRY
An ObjCAtTryStmt record.
Definition: ASTBitCodes.h:1761
@ STMT_DO
A DoStmt record.
Definition: ASTBitCodes.h:1545
@ STMT_OBJC_CATCH
An ObjCAtCatchStmt record.
Definition: ASTBitCodes.h:1755
@ STMT_IF
An IfStmt record.
Definition: ASTBitCodes.h:1536
@ EXPR_STRING_LITERAL
A StringLiteral record.
Definition: ASTBitCodes.h:1596
@ EXPR_OBJC_AVAILABILITY_CHECK
An ObjCAvailabilityCheckExpr record.
Definition: ASTBitCodes.h:1776
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_DIRECTIVE
Definition: ASTBitCodes.h:1946
@ EXPR_PSEUDO_OBJECT
A PseudoObjectExpr record.
Definition: ASTBitCodes.h:1704
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1961
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1638
@ STMT_CAPTURED
A CapturedStmt record.
Definition: ASTBitCodes.h:1569
@ STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1953
@ STMT_GCCASM
A GCC-style AsmStmt record.
Definition: ASTBitCodes.h:1572
@ EXPR_IMAGINARY_LITERAL
An ImaginaryLiteral record.
Definition: ASTBitCodes.h:1593
@ STMT_WHILE
A WhileStmt record.
Definition: ASTBitCodes.h:1542
@ EXPR_CONVERT_VECTOR
A ConvertVectorExpr record.
Definition: ASTBitCodes.h:1695
@ EXPR_OBJC_SUBSCRIPT_REF_EXPR
An ObjCSubscriptRefExpr record.
Definition: ASTBitCodes.h:1737
@ EXPR_STMT
A StmtExpr record.
Definition: ASTBitCodes.h:1677
@ STMT_OMP_PARALLEL_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:1971
@ EXPR_CXX_REINTERPRET_CAST
A CXXReinterpretCastExpr record.
Definition: ASTBitCodes.h:1814
@ EXPR_DESIGNATED_INIT_UPDATE
A DesignatedInitUpdateExpr record.
Definition: ASTBitCodes.h:1656
@ STMT_OBJC_AT_SYNCHRONIZED
An ObjCAtSynchronizedStmt record.
Definition: ASTBitCodes.h:1764
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1950
@ EXPR_BUILTIN_BIT_CAST
A BuiltinBitCastExpr record.
Definition: ASTBitCodes.h:1826
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1963
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
Definition: ASTBitCodes.h:1599
@ EXPR_OBJC_ENCODE
An ObjCEncodeExpr record.
Definition: ASTBitCodes.h:1722
@ EXPR_CSTYLE_CAST
A CStyleCastExpr record.
Definition: ASTBitCodes.h:1641
@ EXPR_OBJC_BOOL_LITERAL
An ObjCBoolLiteralExpr record.
Definition: ASTBitCodes.h:1773
@ EXPR_EXT_VECTOR_ELEMENT
An ExtVectorElementExpr record.
Definition: ASTBitCodes.h:1647
@ EXPR_ATOMIC
An AtomicExpr record.
Definition: ASTBitCodes.h:1707
@ EXPR_OFFSETOF
An OffsetOfExpr record.
Definition: ASTBitCodes.h:1611
@ STMT_RETURN
A ReturnStmt record.
Definition: ASTBitCodes.h:1563
@ STMT_OBJC_FOR_COLLECTION
An ObjCForCollectionStmt record.
Definition: ASTBitCodes.h:1752
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE
Definition: ASTBitCodes.h:1960
@ EXPR_ARRAY_INIT_LOOP
An ArrayInitLoopExpr record.
Definition: ASTBitCodes.h:1662
@ STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE
Definition: ASTBitCodes.h:1942
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1947
@ STMT_CONTINUE
A ContinueStmt record.
Definition: ASTBitCodes.h:1557
@ EXPR_PREDEFINED
A PredefinedExpr record.
Definition: ASTBitCodes.h:1581
@ EXPR_CXX_BOOL_LITERAL
A CXXBoolLiteralExpr record.
Definition: ASTBitCodes.h:1835
@ EXPR_PAREN_LIST
A ParenListExpr record.
Definition: ASTBitCodes.h:1605
@ EXPR_CXX_PAREN_LIST_INIT
A CXXParenListInitExpr record.
Definition: ASTBitCodes.h:1838
@ STMT_OMP_MASTER_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1941
@ STMT_COMPOUND
A CompoundStmt record.
Definition: ASTBitCodes.h:1521
@ STMT_FOR
A ForStmt record.
Definition: ASTBitCodes.h:1548
@ STMT_ATTRIBUTED
An AttributedStmt record.
Definition: ASTBitCodes.h:1533
@ STMT_OMP_TARGET_TEAMS_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:1970
@ EXPR_CXX_REWRITTEN_BINARY_OPERATOR
A CXXRewrittenBinaryOperator record.
Definition: ASTBitCodes.h:1796
@ STMT_GOTO
A GotoStmt record.
Definition: ASTBitCodes.h:1551
@ EXPR_NO_INIT
An NoInitExpr record.
Definition: ASTBitCodes.h:1659
@ EXPR_OBJC_PROTOCOL_EXPR
An ObjCProtocolExpr record.
Definition: ASTBitCodes.h:1728
@ EXPR_ARRAY_INIT_INDEX
An ArrayInitIndexExpr record.
Definition: ASTBitCodes.h:1665
@ EXPR_CXX_CONSTRUCT
A CXXConstructExpr record.
Definition: ASTBitCodes.h:1799
@ STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1958
@ STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1943
@ STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1957
@ EXPR_CXX_DYNAMIC_CAST
A CXXDynamicCastExpr record.
Definition: ASTBitCodes.h:1811
@ STMT_CXX_TRY
A CXXTryStmt record.
Definition: ASTBitCodes.h:1784
@ EXPR_GENERIC_SELECTION
A GenericSelectionExpr record.
Definition: ASTBitCodes.h:1701
@ EXPR_OBJC_INDIRECT_COPY_RESTORE
An ObjCIndirectCopyRestoreExpr record.
Definition: ASTBitCodes.h:1749
@ EXPR_CXX_INHERITED_CTOR_INIT
A CXXInheritedCtorInitExpr record.
Definition: ASTBitCodes.h:1802
@ EXPR_CALL
A CallExpr record.
Definition: ASTBitCodes.h:1623
@ EXPR_GNU_NULL
A GNUNullExpr record.
Definition: ASTBitCodes.h:1683
@ EXPR_OBJC_PROPERTY_REF_EXPR
An ObjCPropertyRefExpr record.
Definition: ASTBitCodes.h:1734
@ STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1933
@ EXPR_CXX_CONST_CAST
A CXXConstCastExpr record.
Definition: ASTBitCodes.h:1817
@ STMT_REF_PTR
A reference to a previously [de]serialized Stmt record.
Definition: ASTBitCodes.h:1515
@ EXPR_OBJC_MESSAGE_EXPR
An ObjCMessageExpr record.
Definition: ASTBitCodes.h:1743
@ STMT_CASE
A CaseStmt record.
Definition: ASTBitCodes.h:1524
@ EXPR_CONSTANT
A constant expression context.
Definition: ASTBitCodes.h:1578
@ STMT_STOP
A marker record that indicates that we are at the end of an expression.
Definition: ASTBitCodes.h:1509
@ STMT_MSASM
A MS-style AsmStmt record.
Definition: ASTBitCodes.h:1575
@ EXPR_CONDITIONAL_OPERATOR
A ConditionOperator record.
Definition: ASTBitCodes.h:1635
@ EXPR_BINARY_OPERATOR
A BinaryOperator record.
Definition: ASTBitCodes.h:1629
@ EXPR_CXX_STD_INITIALIZER_LIST
A CXXStdInitializerListExpr record.
Definition: ASTBitCodes.h:1832
@ EXPR_SHUFFLE_VECTOR
A ShuffleVectorExpr record.
Definition: ASTBitCodes.h:1692
@ STMT_OBJC_FINALLY
An ObjCAtFinallyStmt record.
Definition: ASTBitCodes.h:1758
@ EXPR_OBJC_SELECTOR_EXPR
An ObjCSelectorExpr record.
Definition: ASTBitCodes.h:1725
@ EXPR_FLOATING_LITERAL
A FloatingLiteral record.
Definition: ASTBitCodes.h:1590
@ STMT_NULL_PTR
A NULL expression.
Definition: ASTBitCodes.h:1512
@ STMT_DEFAULT
A DefaultStmt record.
Definition: ASTBitCodes.h:1527
@ EXPR_CHOOSE
A ChooseExpr record.
Definition: ASTBitCodes.h:1680
@ STMT_NULL
A NullStmt record.
Definition: ASTBitCodes.h:1518
@ EXPR_BLOCK
BlockExpr.
Definition: ASTBitCodes.h:1698
@ EXPR_DECL_REF
A DeclRefExpr record.
Definition: ASTBitCodes.h:1584
@ EXPR_INIT_LIST
An InitListExpr record.
Definition: ASTBitCodes.h:1650
@ EXPR_IMPLICIT_VALUE_INIT
An ImplicitValueInitExpr record.
Definition: ASTBitCodes.h:1668
@ STMT_OBJC_AUTORELEASE_POOL
An ObjCAutoreleasePoolStmt record.
Definition: ASTBitCodes.h:1770
@ EXPR_RECOVERY
A RecoveryExpr record.
Definition: ASTBitCodes.h:1710
@ EXPR_PAREN
A ParenExpr record.
Definition: ASTBitCodes.h:1602
@ STMT_OMP_TARGET_PARALLEL_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:1972
@ STMT_LABEL
A LabelStmt record.
Definition: ASTBitCodes.h:1530
@ EXPR_CXX_FUNCTIONAL_CAST
A CXXFunctionalCastExpr record.
Definition: ASTBitCodes.h:1823
@ EXPR_USER_DEFINED_LITERAL
A UserDefinedLiteral record.
Definition: ASTBitCodes.h:1829
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
Definition: ASTBitCodes.h:1587
@ EXPR_SOURCE_LOC
A SourceLocExpr record.
Definition: ASTBitCodes.h:1686
@ EXPR_CXX_MEMBER_CALL
A CXXMemberCallExpr record.
Definition: ASTBitCodes.h:1793
@ STMT_SWITCH
A SwitchStmt record.
Definition: ASTBitCodes.h:1539
@ STMT_DECL
A DeclStmt record.
Definition: ASTBitCodes.h:1566
@ EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK
Definition: ASTBitCodes.h:1874
@ STMT_OMP_MASKED_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1945
@ EXPR_SIZEOF_ALIGN_OF
A SizefAlignOfExpr record.
Definition: ASTBitCodes.h:1614
@ STMT_BREAK
A BreakStmt record.
Definition: ASTBitCodes.h:1560
@ STMT_OBJC_AT_THROW
An ObjCAtThrowStmt record.
Definition: ASTBitCodes.h:1767
@ EXPR_ADDR_LABEL
An AddrLabelExpr record.
Definition: ASTBitCodes.h:1674
@ STMT_CXX_FOR_RANGE
A CXXForRangeStmt record.
Definition: ASTBitCodes.h:1787
@ EXPR_CXX_ADDRSPACE_CAST
A CXXAddrspaceCastExpr record.
Definition: ASTBitCodes.h:1820
@ EXPR_ARRAY_SUBSCRIPT
An ArraySubscriptExpr record.
Definition: ASTBitCodes.h:1617
@ EXPR_UNARY_OPERATOR
A UnaryOperator record.
Definition: ASTBitCodes.h:1608
@ STMT_CXX_CATCH
A CXXCatchStmt record.
Definition: ASTBitCodes.h:1781
@ EXPR_BUILTIN_PP_EMBED
A EmbedExpr record.
Definition: ASTBitCodes.h:1689
@ STMT_INDIRECT_GOTO
An IndirectGotoStmt record.
Definition: ASTBitCodes.h:1554
@ DESIG_ARRAY_RANGE
GNU array range designator.
Definition: ASTBitCodes.h:2014
@ DESIG_FIELD_NAME
Field designator where only the field name is known.
Definition: ASTBitCodes.h:2004
@ DESIG_FIELD_DECL
Field designator where the field has been resolved to a declaration.
Definition: ASTBitCodes.h:2008
@ DESIG_ARRAY
Array designator.
Definition: ASTBitCodes.h:2011
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:1321