clang 22.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"
23#include "llvm/Bitstream/BitstreamWriter.h"
24using namespace clang;
25
26//===----------------------------------------------------------------------===//
27// Statement/expression serialization
28//===----------------------------------------------------------------------===//
29
30namespace clang {
31
32 class ASTStmtWriter : public StmtVisitor<ASTStmtWriter, void> {
33 ASTWriter &Writer;
34 ASTRecordWriter Record;
35
37 unsigned AbbrevToUse;
38
39 /// A helper that can help us to write a packed bit across function
40 /// calls. For example, we may write separate bits in separate functions:
41 ///
42 /// void VisitA(A* a) {
43 /// Record.push_back(a->isSomething());
44 /// }
45 ///
46 /// void Visitb(B *b) {
47 /// VisitA(b);
48 /// Record.push_back(b->isAnother());
49 /// }
50 ///
51 /// In such cases, it'll be better if we can pack these 2 bits. We achieve
52 /// this by writing a zero value in `VisitA` and recorded that first and add
53 /// the new bit to the recorded value.
54 class PakedBitsWriter {
55 public:
56 PakedBitsWriter(ASTRecordWriter &Record) : RecordRef(Record) {}
57 ~PakedBitsWriter() { assert(!CurrentIndex); }
58
59 void addBit(bool Value) {
60 assert(CurrentIndex && "Writing Bits without recording first!");
61 PackingBits.addBit(Value);
62 }
63 void addBits(uint32_t Value, uint32_t BitsWidth) {
64 assert(CurrentIndex && "Writing Bits without recording first!");
65 PackingBits.addBits(Value, BitsWidth);
66 }
67
68 void writeBits() {
69 if (!CurrentIndex)
70 return;
71
72 RecordRef[*CurrentIndex] = (uint32_t)PackingBits;
73 CurrentIndex = std::nullopt;
74 PackingBits.reset(0);
75 }
76
77 void updateBits() {
78 writeBits();
79
80 CurrentIndex = RecordRef.size();
81 RecordRef.push_back(0);
82 }
83
84 private:
85 BitsPacker PackingBits;
86 ASTRecordWriter &RecordRef;
87 std::optional<unsigned> CurrentIndex;
88 };
89
90 PakedBitsWriter CurrentPackingBits;
91
92 public:
95 : Writer(Writer), Record(Context, 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
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::VisitLoopControlStmt(LoopControlStmt *S) {
314 VisitStmt(S);
315 Record.AddSourceLocation(S->getKwLoc());
316 Record.push_back(S->hasLabelTarget());
317 if (S->hasLabelTarget()) {
318 Record.AddDeclRef(S->getLabelDecl());
319 Record.AddSourceLocation(S->getLabelLoc());
320 }
321}
322
323void ASTStmtWriter::VisitContinueStmt(ContinueStmt *S) {
324 VisitLoopControlStmt(S);
326}
327
328void ASTStmtWriter::VisitBreakStmt(BreakStmt *S) {
329 VisitLoopControlStmt(S);
331}
332
333void ASTStmtWriter::VisitDeferStmt(DeferStmt *S) {
334 VisitStmt(S);
335 Record.AddSourceLocation(S->getDeferLoc());
336 Record.AddStmt(S->getBody());
338}
339
340void ASTStmtWriter::VisitReturnStmt(ReturnStmt *S) {
341 VisitStmt(S);
342
343 bool HasNRVOCandidate = S->getNRVOCandidate() != nullptr;
344 Record.push_back(HasNRVOCandidate);
345
346 Record.AddStmt(S->getRetValue());
347 if (HasNRVOCandidate)
348 Record.AddDeclRef(S->getNRVOCandidate());
349
350 Record.AddSourceLocation(S->getReturnLoc());
352}
353
354void ASTStmtWriter::VisitDeclStmt(DeclStmt *S) {
355 VisitStmt(S);
356 Record.AddSourceLocation(S->getBeginLoc());
357 Record.AddSourceLocation(S->getEndLoc());
358 DeclGroupRef DG = S->getDeclGroup();
359 for (DeclGroupRef::iterator D = DG.begin(), DEnd = DG.end(); D != DEnd; ++D)
360 Record.AddDeclRef(*D);
362}
363
364void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) {
365 VisitStmt(S);
366 Record.push_back(S->getNumOutputs());
367 Record.push_back(S->getNumInputs());
368 Record.push_back(S->getNumClobbers());
369 Record.AddSourceLocation(S->getAsmLoc());
370 Record.push_back(S->isVolatile());
371 Record.push_back(S->isSimple());
372}
373
374void ASTStmtWriter::VisitGCCAsmStmt(GCCAsmStmt *S) {
375 VisitAsmStmt(S);
376 Record.push_back(S->getNumLabels());
377 Record.AddSourceLocation(S->getRParenLoc());
378 Record.AddStmt(S->getAsmStringExpr());
379
380 // Outputs
381 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
382 Record.AddIdentifierRef(S->getOutputIdentifier(I));
383 Record.AddStmt(S->getOutputConstraintExpr(I));
384 Record.AddStmt(S->getOutputExpr(I));
385 }
386
387 // Inputs
388 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
389 Record.AddIdentifierRef(S->getInputIdentifier(I));
390 Record.AddStmt(S->getInputConstraintExpr(I));
391 Record.AddStmt(S->getInputExpr(I));
392 }
393
394 // Clobbers
395 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
396 Record.AddStmt(S->getClobberExpr(I));
397
398 // Labels
399 for (unsigned I = 0, N = S->getNumLabels(); I != N; ++I) {
400 Record.AddIdentifierRef(S->getLabelIdentifier(I));
401 Record.AddStmt(S->getLabelExpr(I));
402 }
403
405}
406
407void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) {
408 VisitAsmStmt(S);
409 Record.AddSourceLocation(S->getLBraceLoc());
410 Record.AddSourceLocation(S->getEndLoc());
411 Record.push_back(S->getNumAsmToks());
412 Record.AddString(S->getAsmString());
413
414 // Tokens
415 for (unsigned I = 0, N = S->getNumAsmToks(); I != N; ++I) {
416 // FIXME: Move this to ASTRecordWriter?
417 Writer.AddToken(S->getAsmToks()[I], Record.getRecordData());
418 }
419
420 // Clobbers
421 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) {
422 Record.AddString(S->getClobber(I));
423 }
424
425 // Outputs
426 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
427 Record.AddStmt(S->getOutputExpr(I));
428 Record.AddString(S->getOutputConstraint(I));
429 }
430
431 // Inputs
432 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
433 Record.AddStmt(S->getInputExpr(I));
434 Record.AddString(S->getInputConstraint(I));
435 }
436
438}
439
440void ASTStmtWriter::VisitCoroutineBodyStmt(CoroutineBodyStmt *CoroStmt) {
441 VisitStmt(CoroStmt);
442 Record.push_back(CoroStmt->getParamMoves().size());
443 for (Stmt *S : CoroStmt->children())
444 Record.AddStmt(S);
446}
447
448void ASTStmtWriter::VisitCoreturnStmt(CoreturnStmt *S) {
449 VisitStmt(S);
450 Record.AddSourceLocation(S->getKeywordLoc());
451 Record.AddStmt(S->getOperand());
452 Record.AddStmt(S->getPromiseCall());
453 Record.push_back(S->isImplicit());
455}
456
457void ASTStmtWriter::VisitCoroutineSuspendExpr(CoroutineSuspendExpr *E) {
458 VisitExpr(E);
459 Record.AddSourceLocation(E->getKeywordLoc());
460 for (Stmt *S : E->children())
461 Record.AddStmt(S);
462 Record.AddStmt(E->getOpaqueValue());
463}
464
465void ASTStmtWriter::VisitCoawaitExpr(CoawaitExpr *E) {
466 VisitCoroutineSuspendExpr(E);
467 Record.push_back(E->isImplicit());
469}
470
471void ASTStmtWriter::VisitCoyieldExpr(CoyieldExpr *E) {
472 VisitCoroutineSuspendExpr(E);
474}
475
476void ASTStmtWriter::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
477 VisitExpr(E);
478 Record.AddSourceLocation(E->getKeywordLoc());
479 for (Stmt *S : E->children())
480 Record.AddStmt(S);
482}
483
484static void
486 const ASTConstraintSatisfaction &Satisfaction) {
487 Record.push_back(Satisfaction.IsSatisfied);
488 Record.push_back(Satisfaction.ContainsErrors);
489 if (!Satisfaction.IsSatisfied) {
490 Record.push_back(Satisfaction.NumRecords);
491 for (const auto &DetailRecord : Satisfaction) {
492 if (auto *Diag = dyn_cast<const ConstraintSubstitutionDiagnostic *>(
493 DetailRecord)) {
494 Record.push_back(/*Kind=*/0);
495 Record.AddSourceLocation(Diag->first);
496 Record.AddString(Diag->second);
497 continue;
498 }
499 if (auto *E = dyn_cast<const Expr *>(DetailRecord)) {
500 Record.push_back(/*Kind=*/1);
501 Record.AddStmt(const_cast<Expr *>(E));
502 } else {
503 Record.push_back(/*Kind=*/2);
504 auto *CR = cast<const ConceptReference *>(DetailRecord);
505 Record.AddConceptReference(CR);
506 }
507 }
508 }
509}
510
511static void
515 Record.AddString(D->SubstitutedEntity);
516 Record.AddSourceLocation(D->DiagLoc);
517 Record.AddString(D->DiagMessage);
518}
519
520void ASTStmtWriter::VisitConceptSpecializationExpr(
522 VisitExpr(E);
523 Record.AddDeclRef(E->getSpecializationDecl());
524 const ConceptReference *CR = E->getConceptReference();
525 Record.push_back(CR != nullptr);
526 if (CR)
527 Record.AddConceptReference(CR);
528 if (!E->isValueDependent())
530
532}
533
534void ASTStmtWriter::VisitRequiresExpr(RequiresExpr *E) {
535 VisitExpr(E);
536 Record.push_back(E->getLocalParameters().size());
537 Record.push_back(E->getRequirements().size());
538 Record.AddSourceLocation(E->RequiresExprBits.RequiresKWLoc);
539 Record.push_back(E->RequiresExprBits.IsSatisfied);
540 Record.AddDeclRef(E->getBody());
541 for (ParmVarDecl *P : E->getLocalParameters())
542 Record.AddDeclRef(P);
543 for (concepts::Requirement *R : E->getRequirements()) {
544 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(R)) {
545 Record.push_back(concepts::Requirement::RK_Type);
546 Record.push_back(TypeReq->Status);
548 addSubstitutionDiagnostic(Record, TypeReq->getSubstitutionDiagnostic());
549 else
550 Record.AddTypeSourceInfo(TypeReq->getType());
551 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(R)) {
552 Record.push_back(ExprReq->getKind());
553 Record.push_back(ExprReq->Status);
554 if (ExprReq->isExprSubstitutionFailure()) {
557 ExprReq->Value));
558 } else
559 Record.AddStmt(cast<Expr *>(ExprReq->Value));
560 if (ExprReq->getKind() == concepts::Requirement::RK_Compound) {
561 Record.AddSourceLocation(ExprReq->NoexceptLoc);
562 const auto &RetReq = ExprReq->getReturnTypeRequirement();
563 if (RetReq.isSubstitutionFailure()) {
564 Record.push_back(2);
565 addSubstitutionDiagnostic(Record, RetReq.getSubstitutionDiagnostic());
566 } else if (RetReq.isTypeConstraint()) {
567 Record.push_back(1);
568 Record.AddTemplateParameterList(
569 RetReq.getTypeConstraintTemplateParameterList());
570 if (ExprReq->Status >=
572 Record.AddStmt(
573 ExprReq->getReturnTypeRequirementSubstitutedConstraintExpr());
574 } else {
575 assert(RetReq.isEmpty());
576 Record.push_back(0);
577 }
578 }
579 } else {
580 auto *NestedReq = cast<concepts::NestedRequirement>(R);
581 Record.push_back(concepts::Requirement::RK_Nested);
582 Record.push_back(NestedReq->hasInvalidConstraint());
583 if (NestedReq->hasInvalidConstraint()) {
584 Record.AddString(NestedReq->getInvalidConstraintEntity());
585 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
586 } else {
587 Record.AddStmt(NestedReq->getConstraintExpr());
588 if (!NestedReq->isDependent())
589 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
590 }
591 }
592 }
593 Record.AddSourceLocation(E->getLParenLoc());
594 Record.AddSourceLocation(E->getRParenLoc());
595 Record.AddSourceLocation(E->getEndLoc());
596
598}
599
600
601void ASTStmtWriter::VisitCapturedStmt(CapturedStmt *S) {
602 VisitStmt(S);
603 // NumCaptures
604 Record.push_back(std::distance(S->capture_begin(), S->capture_end()));
605
606 // CapturedDecl and captured region kind
607 Record.AddDeclRef(S->getCapturedDecl());
608 Record.push_back(S->getCapturedRegionKind());
609
610 Record.AddDeclRef(S->getCapturedRecordDecl());
611
612 // Capture inits
613 for (auto *I : S->capture_inits())
614 Record.AddStmt(I);
615
616 // Body
617 Record.AddStmt(S->getCapturedStmt());
618
619 // Captures
620 for (const auto &I : S->captures()) {
621 if (I.capturesThis() || I.capturesVariableArrayType())
622 Record.AddDeclRef(nullptr);
623 else
624 Record.AddDeclRef(I.getCapturedVar());
625 Record.push_back(I.getCaptureKind());
626 Record.AddSourceLocation(I.getLocation());
627 }
628
630}
631
632void ASTStmtWriter::VisitSYCLKernelCallStmt(SYCLKernelCallStmt *S) {
633 VisitStmt(S);
634 Record.AddStmt(S->getOriginalStmt());
635 Record.AddDeclRef(S->getOutlinedFunctionDecl());
636
638}
639
640void ASTStmtWriter::VisitExpr(Expr *E) {
641 VisitStmt(E);
642
643 CurrentPackingBits.updateBits();
644 CurrentPackingBits.addBits(E->getDependence(), /*BitsWidth=*/5);
645 CurrentPackingBits.addBits(E->getValueKind(), /*BitsWidth=*/2);
646 CurrentPackingBits.addBits(E->getObjectKind(), /*BitsWidth=*/3);
647
648 Record.AddTypeRef(E->getType());
649}
650
651void ASTStmtWriter::VisitConstantExpr(ConstantExpr *E) {
652 VisitExpr(E);
653 Record.push_back(E->ConstantExprBits.ResultKind);
654
655 Record.push_back(E->ConstantExprBits.APValueKind);
656 Record.push_back(E->ConstantExprBits.IsUnsigned);
657 Record.push_back(E->ConstantExprBits.BitWidth);
658 // HasCleanup not serialized since we can just query the APValue.
659 Record.push_back(E->ConstantExprBits.IsImmediateInvocation);
660
661 switch (E->getResultStorageKind()) {
663 break;
665 Record.push_back(E->Int64Result());
666 break;
668 Record.AddAPValue(E->APValueResult());
669 break;
670 }
671
672 Record.AddStmt(E->getSubExpr());
674}
675
676void ASTStmtWriter::VisitOpenACCAsteriskSizeExpr(OpenACCAsteriskSizeExpr *E) {
677 VisitExpr(E);
678 Record.AddSourceLocation(E->getLocation());
680}
681
682void ASTStmtWriter::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *E) {
683 VisitExpr(E);
684
685 Record.AddSourceLocation(E->getLocation());
686 Record.AddSourceLocation(E->getLParenLocation());
687 Record.AddSourceLocation(E->getRParenLocation());
688 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
689
691}
692
693void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
694 VisitExpr(E);
695
696 bool HasFunctionName = E->getFunctionName() != nullptr;
697 Record.push_back(HasFunctionName);
698 Record.push_back(
699 llvm::to_underlying(E->getIdentKind())); // FIXME: stable encoding
700 Record.push_back(E->isTransparent());
701 Record.AddSourceLocation(E->getLocation());
702 if (HasFunctionName)
703 Record.AddStmt(E->getFunctionName());
705}
706
707void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
708 VisitExpr(E);
709
710 CurrentPackingBits.updateBits();
711
712 CurrentPackingBits.addBit(E->hadMultipleCandidates());
713 CurrentPackingBits.addBit(E->refersToEnclosingVariableOrCapture());
714 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
715 CurrentPackingBits.addBit(E->isImmediateEscalating());
716 CurrentPackingBits.addBit(E->getDecl() != E->getFoundDecl());
717 CurrentPackingBits.addBit(E->hasQualifier());
718 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
719
720 if (E->hasTemplateKWAndArgsInfo()) {
721 unsigned NumTemplateArgs = E->getNumTemplateArgs();
722 Record.push_back(NumTemplateArgs);
723 }
724
725 DeclarationName::NameKind nk = (E->getDecl()->getDeclName().getNameKind());
726
727 if ((!E->hasTemplateKWAndArgsInfo()) && (!E->hasQualifier()) &&
728 (E->getDecl() == E->getFoundDecl()) &&
730 AbbrevToUse = Writer.getDeclRefExprAbbrev();
731 }
732
733 if (E->hasQualifier())
734 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
735
736 if (E->getDecl() != E->getFoundDecl())
737 Record.AddDeclRef(E->getFoundDecl());
738
740 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
741 E->getTrailingObjects<TemplateArgumentLoc>());
742
743 Record.AddDeclRef(E->getDecl());
744 Record.AddSourceLocation(E->getLocation());
745 Record.AddDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
747}
748
749void ASTStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
750 VisitExpr(E);
751 Record.AddSourceLocation(E->getLocation());
752 Record.AddAPInt(E->getValue());
753
754 if (E->getBitWidth() == 32) {
755 AbbrevToUse = Writer.getIntegerLiteralAbbrev();
756 }
757
759}
760
761void ASTStmtWriter::VisitFixedPointLiteral(FixedPointLiteral *E) {
762 VisitExpr(E);
763 Record.AddSourceLocation(E->getLocation());
764 Record.push_back(E->getScale());
765 Record.AddAPInt(E->getValue());
767}
768
769void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
770 VisitExpr(E);
771 Record.push_back(E->getRawSemantics());
772 Record.push_back(E->isExact());
773 Record.AddAPFloat(E->getValue());
774 Record.AddSourceLocation(E->getLocation());
776}
777
778void ASTStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
779 VisitExpr(E);
780 Record.AddStmt(E->getSubExpr());
782}
783
784void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
785 VisitExpr(E);
786
787 // Store the various bits of data of StringLiteral.
788 Record.push_back(E->getNumConcatenated());
789 Record.push_back(E->getLength());
790 Record.push_back(E->getCharByteWidth());
791 Record.push_back(llvm::to_underlying(E->getKind()));
792 Record.push_back(E->isPascal());
793
794 // Store the trailing array of SourceLocation.
795 for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
796 Record.AddSourceLocation(E->getStrTokenLoc(I));
797
798 // Store the trailing array of char holding the string data.
799 StringRef StrData = E->getBytes();
800 for (unsigned I = 0, N = E->getByteLength(); I != N; ++I)
801 Record.push_back(StrData[I]);
802
804}
805
806void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
807 VisitExpr(E);
808 Record.push_back(E->getValue());
809 Record.AddSourceLocation(E->getLocation());
810 Record.push_back(llvm::to_underlying(E->getKind()));
811
812 AbbrevToUse = Writer.getCharacterLiteralAbbrev();
813
815}
816
817void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
818 VisitExpr(E);
819 Record.push_back(E->isProducedByFoldExpansion());
820 Record.AddSourceLocation(E->getLParen());
821 Record.AddSourceLocation(E->getRParen());
822 Record.AddStmt(E->getSubExpr());
824}
825
826void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
827 VisitExpr(E);
828 Record.push_back(E->getNumExprs());
829 for (auto *SubStmt : E->exprs())
830 Record.AddStmt(SubStmt);
831 Record.AddSourceLocation(E->getLParenLoc());
832 Record.AddSourceLocation(E->getRParenLoc());
834}
835
836void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
837 VisitExpr(E);
838 bool HasFPFeatures = E->hasStoredFPFeatures();
839 // Write this first for easy access when deserializing, as they affect the
840 // size of the UnaryOperator.
841 CurrentPackingBits.addBit(HasFPFeatures);
842 Record.AddStmt(E->getSubExpr());
843 CurrentPackingBits.addBits(E->getOpcode(),
844 /*Width=*/5); // FIXME: stable encoding
845 Record.AddSourceLocation(E->getOperatorLoc());
846 CurrentPackingBits.addBit(E->canOverflow());
847
848 if (HasFPFeatures)
849 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
851}
852
853void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
854 VisitExpr(E);
855 Record.push_back(E->getNumComponents());
856 Record.push_back(E->getNumExpressions());
857 Record.AddSourceLocation(E->getOperatorLoc());
858 Record.AddSourceLocation(E->getRParenLoc());
859 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
860 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
861 const OffsetOfNode &ON = E->getComponent(I);
862 Record.push_back(ON.getKind()); // FIXME: Stable encoding
863 Record.AddSourceLocation(ON.getSourceRange().getBegin());
864 Record.AddSourceLocation(ON.getSourceRange().getEnd());
865 switch (ON.getKind()) {
867 Record.push_back(ON.getArrayExprIndex());
868 break;
869
871 Record.AddDeclRef(ON.getField());
872 break;
873
875 Record.AddIdentifierRef(ON.getFieldName());
876 break;
877
879 Record.AddCXXBaseSpecifier(*ON.getBase());
880 break;
881 }
882 }
883 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
884 Record.AddStmt(E->getIndexExpr(I));
886}
887
888void ASTStmtWriter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
889 VisitExpr(E);
890 Record.push_back(E->getKind());
891 if (E->isArgumentType())
892 Record.AddTypeSourceInfo(E->getArgumentTypeInfo());
893 else {
894 Record.push_back(0);
895 Record.AddStmt(E->getArgumentExpr());
896 }
897 Record.AddSourceLocation(E->getOperatorLoc());
898 Record.AddSourceLocation(E->getRParenLoc());
900}
901
902void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
903 VisitExpr(E);
904 Record.AddStmt(E->getLHS());
905 Record.AddStmt(E->getRHS());
906 Record.AddSourceLocation(E->getRBracketLoc());
908}
909
910void ASTStmtWriter::VisitMatrixSingleSubscriptExpr(
912 VisitExpr(E);
913 Record.AddStmt(E->getBase());
914 Record.AddStmt(E->getRowIdx());
915 Record.AddSourceLocation(E->getRBracketLoc());
917}
918
919void ASTStmtWriter::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
920 VisitExpr(E);
921 Record.AddStmt(E->getBase());
922 Record.AddStmt(E->getRowIdx());
923 Record.AddStmt(E->getColumnIdx());
924 Record.AddSourceLocation(E->getRBracketLoc());
926}
927
928void ASTStmtWriter::VisitArraySectionExpr(ArraySectionExpr *E) {
929 VisitExpr(E);
930 Record.writeEnum(E->ASType);
931 Record.AddStmt(E->getBase());
932 Record.AddStmt(E->getLowerBound());
933 Record.AddStmt(E->getLength());
934 if (E->isOMPArraySection())
935 Record.AddStmt(E->getStride());
936 Record.AddSourceLocation(E->getColonLocFirst());
937
938 if (E->isOMPArraySection())
939 Record.AddSourceLocation(E->getColonLocSecond());
940
941 Record.AddSourceLocation(E->getRBracketLoc());
943}
944
945void ASTStmtWriter::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
946 VisitExpr(E);
947 Record.push_back(E->getDimensions().size());
948 Record.AddStmt(E->getBase());
949 for (Expr *Dim : E->getDimensions())
950 Record.AddStmt(Dim);
951 for (SourceRange SR : E->getBracketsRanges())
952 Record.AddSourceRange(SR);
953 Record.AddSourceLocation(E->getLParenLoc());
954 Record.AddSourceLocation(E->getRParenLoc());
956}
957
958void ASTStmtWriter::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
959 VisitExpr(E);
960 Record.push_back(E->numOfIterators());
961 Record.AddSourceLocation(E->getIteratorKwLoc());
962 Record.AddSourceLocation(E->getLParenLoc());
963 Record.AddSourceLocation(E->getRParenLoc());
964 for (unsigned I = 0, End = E->numOfIterators(); I < End; ++I) {
965 Record.AddDeclRef(E->getIteratorDecl(I));
966 Record.AddSourceLocation(E->getAssignLoc(I));
967 OMPIteratorExpr::IteratorRange Range = E->getIteratorRange(I);
968 Record.AddStmt(Range.Begin);
969 Record.AddStmt(Range.End);
970 Record.AddStmt(Range.Step);
971 Record.AddSourceLocation(E->getColonLoc(I));
972 if (Range.Step)
973 Record.AddSourceLocation(E->getSecondColonLoc(I));
974 // Serialize helpers
975 OMPIteratorHelperData &HD = E->getHelper(I);
976 Record.AddDeclRef(HD.CounterVD);
977 Record.AddStmt(HD.Upper);
978 Record.AddStmt(HD.Update);
979 Record.AddStmt(HD.CounterUpdate);
980 }
982}
983
984void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
985 VisitExpr(E);
986
987 Record.push_back(E->getNumArgs());
988 CurrentPackingBits.updateBits();
989 CurrentPackingBits.addBit(static_cast<bool>(E->getADLCallKind()));
990 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
991 CurrentPackingBits.addBit(E->isCoroElideSafe());
992 CurrentPackingBits.addBit(E->usesMemberSyntax());
993
994 Record.AddSourceLocation(E->getRParenLoc());
995 Record.AddStmt(E->getCallee());
996 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
997 Arg != ArgEnd; ++Arg)
998 Record.AddStmt(*Arg);
999
1000 if (E->hasStoredFPFeatures())
1001 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
1002
1003 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1004 !E->isCoroElideSafe() && !E->usesMemberSyntax() &&
1005 E->getStmtClass() == Stmt::CallExprClass)
1006 AbbrevToUse = Writer.getCallExprAbbrev();
1007
1009}
1010
1011void ASTStmtWriter::VisitRecoveryExpr(RecoveryExpr *E) {
1012 VisitExpr(E);
1013 Record.push_back(std::distance(E->children().begin(), E->children().end()));
1014 Record.AddSourceLocation(E->getBeginLoc());
1015 Record.AddSourceLocation(E->getEndLoc());
1016 for (Stmt *Child : E->children())
1017 Record.AddStmt(Child);
1019}
1020
1021void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
1022 VisitExpr(E);
1023
1024 bool HasQualifier = E->hasQualifier();
1025 bool HasFoundDecl = E->hasFoundDecl();
1026 bool HasTemplateInfo = E->hasTemplateKWAndArgsInfo();
1027 unsigned NumTemplateArgs = E->getNumTemplateArgs();
1028
1029 // Write these first for easy access when deserializing, as they affect the
1030 // size of the MemberExpr.
1031 CurrentPackingBits.updateBits();
1032 CurrentPackingBits.addBit(HasQualifier);
1033 CurrentPackingBits.addBit(HasFoundDecl);
1034 CurrentPackingBits.addBit(HasTemplateInfo);
1035 Record.push_back(NumTemplateArgs);
1036
1037 Record.AddStmt(E->getBase());
1038 Record.AddDeclRef(E->getMemberDecl());
1039 Record.AddDeclarationNameLoc(E->MemberDNLoc,
1040 E->getMemberDecl()->getDeclName());
1041 Record.AddSourceLocation(E->getMemberLoc());
1042 CurrentPackingBits.addBit(E->isArrow());
1043 CurrentPackingBits.addBit(E->hadMultipleCandidates());
1044 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
1045 Record.AddSourceLocation(E->getOperatorLoc());
1046
1047 if (HasQualifier)
1048 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1049
1050 if (HasFoundDecl) {
1051 DeclAccessPair FoundDecl = E->getFoundDecl();
1052 Record.AddDeclRef(FoundDecl.getDecl());
1053 CurrentPackingBits.addBits(FoundDecl.getAccess(), /*BitWidth=*/2);
1054 }
1055
1056 if (HasTemplateInfo)
1057 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1058 E->getTrailingObjects<TemplateArgumentLoc>());
1059
1061}
1062
1063void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1064 VisitExpr(E);
1065 Record.AddStmt(E->getBase());
1066 Record.AddSourceLocation(E->getIsaMemberLoc());
1067 Record.AddSourceLocation(E->getOpLoc());
1068 Record.push_back(E->isArrow());
1070}
1071
1072void ASTStmtWriter::
1073VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1074 VisitExpr(E);
1075 Record.AddStmt(E->getSubExpr());
1076 Record.push_back(E->shouldCopy());
1078}
1079
1080void ASTStmtWriter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1081 VisitExplicitCastExpr(E);
1082 Record.AddSourceLocation(E->getLParenLoc());
1083 Record.AddSourceLocation(E->getBridgeKeywordLoc());
1084 Record.push_back(E->getBridgeKind()); // FIXME: Stable encoding
1086}
1087
1088void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
1089 VisitExpr(E);
1090
1091 Record.push_back(E->path_size());
1092 CurrentPackingBits.updateBits();
1093 // 7 bits should be enough to store the casting kinds.
1094 CurrentPackingBits.addBits(E->getCastKind(), /*Width=*/7);
1095 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
1096 Record.AddStmt(E->getSubExpr());
1097
1099 PI = E->path_begin(), PE = E->path_end(); PI != PE; ++PI)
1100 Record.AddCXXBaseSpecifier(**PI);
1101
1102 if (E->hasStoredFPFeatures())
1103 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
1104}
1105
1106void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
1107 VisitExpr(E);
1108
1109 // Write this first for easy access when deserializing, as they affect the
1110 // size of the UnaryOperator.
1111 CurrentPackingBits.updateBits();
1112 CurrentPackingBits.addBits(E->getOpcode(), /*Width=*/6);
1113 bool HasFPFeatures = E->hasStoredFPFeatures();
1114 CurrentPackingBits.addBit(HasFPFeatures);
1115 CurrentPackingBits.addBit(E->hasExcludedOverflowPattern());
1116 Record.AddStmt(E->getLHS());
1117 Record.AddStmt(E->getRHS());
1118 Record.AddSourceLocation(E->getOperatorLoc());
1119 if (HasFPFeatures)
1120 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1121
1122 if (!HasFPFeatures && E->getValueKind() == VK_PRValue &&
1123 E->getObjectKind() == OK_Ordinary)
1124 AbbrevToUse = Writer.getBinaryOperatorAbbrev();
1125
1127}
1128
1129void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1130 VisitBinaryOperator(E);
1131 Record.AddTypeRef(E->getComputationLHSType());
1132 Record.AddTypeRef(E->getComputationResultType());
1133
1134 if (!E->hasStoredFPFeatures() && E->getValueKind() == VK_PRValue &&
1135 E->getObjectKind() == OK_Ordinary)
1136 AbbrevToUse = Writer.getCompoundAssignOperatorAbbrev();
1137
1139}
1140
1141void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
1142 VisitExpr(E);
1143 Record.AddStmt(E->getCond());
1144 Record.AddStmt(E->getLHS());
1145 Record.AddStmt(E->getRHS());
1146 Record.AddSourceLocation(E->getQuestionLoc());
1147 Record.AddSourceLocation(E->getColonLoc());
1149}
1150
1151void
1152ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1153 VisitExpr(E);
1154 Record.AddStmt(E->getOpaqueValue());
1155 Record.AddStmt(E->getCommon());
1156 Record.AddStmt(E->getCond());
1157 Record.AddStmt(E->getTrueExpr());
1158 Record.AddStmt(E->getFalseExpr());
1159 Record.AddSourceLocation(E->getQuestionLoc());
1160 Record.AddSourceLocation(E->getColonLoc());
1162}
1163
1164void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1165 VisitCastExpr(E);
1166 CurrentPackingBits.addBit(E->isPartOfExplicitCast());
1167
1168 if (E->path_size() == 0 && !E->hasStoredFPFeatures())
1169 AbbrevToUse = Writer.getExprImplicitCastAbbrev();
1170
1172}
1173
1174void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1175 VisitCastExpr(E);
1176 Record.AddTypeSourceInfo(E->getTypeInfoAsWritten());
1177}
1178
1179void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
1180 VisitExplicitCastExpr(E);
1181 Record.AddSourceLocation(E->getLParenLoc());
1182 Record.AddSourceLocation(E->getRParenLoc());
1184}
1185
1186void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1187 VisitExpr(E);
1188 Record.AddSourceLocation(E->getLParenLoc());
1189 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1190 Record.AddStmt(E->getInitializer());
1191 Record.push_back(E->isFileScope());
1193}
1194
1195void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1196 VisitExpr(E);
1197 Record.AddStmt(E->getBase());
1198 Record.AddIdentifierRef(&E->getAccessor());
1199 Record.AddSourceLocation(E->getAccessorLoc());
1201}
1202
1203void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
1204 VisitExpr(E);
1205 // NOTE: only add the (possibly null) syntactic form.
1206 // No need to serialize the isSemanticForm flag and the semantic form.
1207 Record.AddStmt(E->getSyntacticForm());
1208 Record.AddSourceLocation(E->getLBraceLoc());
1209 Record.AddSourceLocation(E->getRBraceLoc());
1210 bool isArrayFiller = isa<Expr *>(E->ArrayFillerOrUnionFieldInit);
1211 Record.push_back(isArrayFiller);
1212 if (isArrayFiller)
1213 Record.AddStmt(E->getArrayFiller());
1214 else
1215 Record.AddDeclRef(E->getInitializedFieldInUnion());
1216 Record.push_back(E->hadArrayRangeDesignator());
1217 Record.push_back(E->getNumInits());
1218 if (isArrayFiller) {
1219 // ArrayFiller may have filled "holes" due to designated initializer.
1220 // Replace them by 0 to indicate that the filler goes in that place.
1221 Expr *filler = E->getArrayFiller();
1222 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1223 Record.AddStmt(E->getInit(I) != filler ? E->getInit(I) : nullptr);
1224 } else {
1225 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1226 Record.AddStmt(E->getInit(I));
1227 }
1229}
1230
1231void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1232 VisitExpr(E);
1233 Record.push_back(E->getNumSubExprs());
1234 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1235 Record.AddStmt(E->getSubExpr(I));
1236 Record.AddSourceLocation(E->getEqualOrColonLoc());
1237 Record.push_back(E->usesGNUSyntax());
1238 for (const DesignatedInitExpr::Designator &D : E->designators()) {
1239 if (D.isFieldDesignator()) {
1240 if (FieldDecl *Field = D.getFieldDecl()) {
1241 Record.push_back(serialization::DESIG_FIELD_DECL);
1242 Record.AddDeclRef(Field);
1243 } else {
1244 Record.push_back(serialization::DESIG_FIELD_NAME);
1245 Record.AddIdentifierRef(D.getFieldName());
1246 }
1247 Record.AddSourceLocation(D.getDotLoc());
1248 Record.AddSourceLocation(D.getFieldLoc());
1249 } else if (D.isArrayDesignator()) {
1250 Record.push_back(serialization::DESIG_ARRAY);
1251 Record.push_back(D.getArrayIndex());
1252 Record.AddSourceLocation(D.getLBracketLoc());
1253 Record.AddSourceLocation(D.getRBracketLoc());
1254 } else {
1255 assert(D.isArrayRangeDesignator() && "Unknown designator");
1256 Record.push_back(serialization::DESIG_ARRAY_RANGE);
1257 Record.push_back(D.getArrayIndex());
1258 Record.AddSourceLocation(D.getLBracketLoc());
1259 Record.AddSourceLocation(D.getEllipsisLoc());
1260 Record.AddSourceLocation(D.getRBracketLoc());
1261 }
1262 }
1264}
1265
1266void ASTStmtWriter::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1267 VisitExpr(E);
1268 Record.AddStmt(E->getBase());
1269 Record.AddStmt(E->getUpdater());
1271}
1272
1273void ASTStmtWriter::VisitNoInitExpr(NoInitExpr *E) {
1274 VisitExpr(E);
1276}
1277
1278void ASTStmtWriter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1279 VisitExpr(E);
1280 Record.AddStmt(E->SubExprs[0]);
1281 Record.AddStmt(E->SubExprs[1]);
1283}
1284
1285void ASTStmtWriter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1286 VisitExpr(E);
1288}
1289
1290void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1291 VisitExpr(E);
1293}
1294
1295void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
1296 VisitExpr(E);
1297 Record.AddStmt(E->getSubExpr());
1298 Record.AddTypeSourceInfo(E->getWrittenTypeInfo());
1299 Record.AddSourceLocation(E->getBuiltinLoc());
1300 Record.AddSourceLocation(E->getRParenLoc());
1301 Record.push_back(E->isMicrosoftABI());
1303}
1304
1305void ASTStmtWriter::VisitSourceLocExpr(SourceLocExpr *E) {
1306 VisitExpr(E);
1307 Record.AddDeclRef(cast_or_null<Decl>(E->getParentContext()));
1308 Record.AddSourceLocation(E->getBeginLoc());
1309 Record.AddSourceLocation(E->getEndLoc());
1310 Record.push_back(llvm::to_underlying(E->getIdentKind()));
1312}
1313
1314void ASTStmtWriter::VisitEmbedExpr(EmbedExpr *E) {
1315 VisitExpr(E);
1316 Record.AddSourceLocation(E->getBeginLoc());
1317 Record.AddSourceLocation(E->getEndLoc());
1318 Record.AddStmt(E->getDataStringLiteral());
1319 Record.writeUInt32(E->getStartingElementPos());
1320 Record.writeUInt32(E->getDataElementCount());
1322}
1323
1324void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
1325 VisitExpr(E);
1326 Record.AddSourceLocation(E->getAmpAmpLoc());
1327 Record.AddSourceLocation(E->getLabelLoc());
1328 Record.AddDeclRef(E->getLabel());
1330}
1331
1332void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
1333 VisitExpr(E);
1334 Record.AddStmt(E->getSubStmt());
1335 Record.AddSourceLocation(E->getLParenLoc());
1336 Record.AddSourceLocation(E->getRParenLoc());
1337 Record.push_back(E->getTemplateDepth());
1339}
1340
1341void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
1342 VisitExpr(E);
1343 Record.AddStmt(E->getCond());
1344 Record.AddStmt(E->getLHS());
1345 Record.AddStmt(E->getRHS());
1346 Record.AddSourceLocation(E->getBuiltinLoc());
1347 Record.AddSourceLocation(E->getRParenLoc());
1348 Record.push_back(E->isConditionDependent() ? false : E->isConditionTrue());
1350}
1351
1352void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
1353 VisitExpr(E);
1354 Record.AddSourceLocation(E->getTokenLocation());
1356}
1357
1358void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1359 VisitExpr(E);
1360 Record.push_back(E->getNumSubExprs());
1361 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1362 Record.AddStmt(E->getExpr(I));
1363 Record.AddSourceLocation(E->getBuiltinLoc());
1364 Record.AddSourceLocation(E->getRParenLoc());
1366}
1367
1368void ASTStmtWriter::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1369 VisitExpr(E);
1370 bool HasFPFeatures = E->hasStoredFPFeatures();
1371 CurrentPackingBits.addBit(HasFPFeatures);
1372 Record.AddSourceLocation(E->getBuiltinLoc());
1373 Record.AddSourceLocation(E->getRParenLoc());
1374 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1375 Record.AddStmt(E->getSrcExpr());
1377 if (HasFPFeatures)
1378 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1379}
1380
1381void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
1382 VisitExpr(E);
1383 Record.AddDeclRef(E->getBlockDecl());
1385}
1386
1387void ASTStmtWriter::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1388 VisitExpr(E);
1389
1390 Record.push_back(E->getNumAssocs());
1391 Record.push_back(E->isExprPredicate());
1392 Record.push_back(E->ResultIndex);
1393 Record.AddSourceLocation(E->getGenericLoc());
1394 Record.AddSourceLocation(E->getDefaultLoc());
1395 Record.AddSourceLocation(E->getRParenLoc());
1396
1397 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1398 // Add 1 to account for the controlling expression which is the first
1399 // expression in the trailing array of Stmt *. This is not needed for
1400 // the trailing array of TypeSourceInfo *.
1401 for (unsigned I = 0, N = E->getNumAssocs() + 1; I < N; ++I)
1402 Record.AddStmt(Stmts[I]);
1403
1404 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1405 for (unsigned I = 0, N = E->getNumAssocs(); I < N; ++I)
1406 Record.AddTypeSourceInfo(TSIs[I]);
1407
1409}
1410
1411void ASTStmtWriter::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1412 VisitExpr(E);
1413 Record.push_back(E->getNumSemanticExprs());
1414
1415 // Push the result index. Currently, this needs to exactly match
1416 // the encoding used internally for ResultIndex.
1417 unsigned result = E->getResultExprIndex();
1418 result = (result == PseudoObjectExpr::NoResult ? 0 : result + 1);
1419 Record.push_back(result);
1420
1421 Record.AddStmt(E->getSyntacticForm());
1423 i = E->semantics_begin(), e = E->semantics_end(); i != e; ++i) {
1424 Record.AddStmt(*i);
1425 }
1427}
1428
1429void ASTStmtWriter::VisitAtomicExpr(AtomicExpr *E) {
1430 VisitExpr(E);
1431 Record.push_back(E->getOp());
1432 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1433 Record.AddStmt(E->getSubExprs()[I]);
1434 Record.AddSourceLocation(E->getBuiltinLoc());
1435 Record.AddSourceLocation(E->getRParenLoc());
1437}
1438
1439//===----------------------------------------------------------------------===//
1440// Objective-C Expressions and Statements.
1441//===----------------------------------------------------------------------===//
1442
1443void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1444 VisitExpr(E);
1445 Record.AddStmt(E->getString());
1446 Record.AddSourceLocation(E->getAtLoc());
1448}
1449
1450void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1451 VisitExpr(E);
1452 Record.AddStmt(E->getSubExpr());
1453 Record.AddDeclRef(E->getBoxingMethod());
1454 Record.AddSourceRange(E->getSourceRange());
1456}
1457
1458void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1459 VisitExpr(E);
1460 Record.push_back(E->getNumElements());
1461 for (unsigned i = 0; i < E->getNumElements(); i++)
1462 Record.AddStmt(E->getElement(i));
1463 Record.AddDeclRef(E->getArrayWithObjectsMethod());
1464 Record.AddSourceRange(E->getSourceRange());
1466}
1467
1468void ASTStmtWriter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1469 VisitExpr(E);
1470 Record.push_back(E->getNumElements());
1471 Record.push_back(E->HasPackExpansions);
1472 for (unsigned i = 0; i < E->getNumElements(); i++) {
1473 ObjCDictionaryElement Element = E->getKeyValueElement(i);
1474 Record.AddStmt(Element.Key);
1475 Record.AddStmt(Element.Value);
1476 if (E->HasPackExpansions) {
1477 Record.AddSourceLocation(Element.EllipsisLoc);
1478 unsigned NumExpansions = 0;
1479 if (Element.NumExpansions)
1480 NumExpansions = *Element.NumExpansions + 1;
1481 Record.push_back(NumExpansions);
1482 }
1483 }
1484
1485 Record.AddDeclRef(E->getDictWithObjectsMethod());
1486 Record.AddSourceRange(E->getSourceRange());
1488}
1489
1490void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1491 VisitExpr(E);
1492 Record.AddTypeSourceInfo(E->getEncodedTypeSourceInfo());
1493 Record.AddSourceLocation(E->getAtLoc());
1494 Record.AddSourceLocation(E->getRParenLoc());
1496}
1497
1498void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1499 VisitExpr(E);
1500 Record.AddSelectorRef(E->getSelector());
1501 Record.AddSourceLocation(E->getAtLoc());
1502 Record.AddSourceLocation(E->getRParenLoc());
1504}
1505
1506void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1507 VisitExpr(E);
1508 Record.AddDeclRef(E->getProtocol());
1509 Record.AddSourceLocation(E->getAtLoc());
1510 Record.AddSourceLocation(E->ProtoLoc);
1511 Record.AddSourceLocation(E->getRParenLoc());
1513}
1514
1515void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1516 VisitExpr(E);
1517 Record.AddDeclRef(E->getDecl());
1518 Record.AddSourceLocation(E->getLocation());
1519 Record.AddSourceLocation(E->getOpLoc());
1520 Record.AddStmt(E->getBase());
1521 Record.push_back(E->isArrow());
1522 Record.push_back(E->isFreeIvar());
1524}
1525
1526void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1527 VisitExpr(E);
1528 Record.push_back(E->SetterAndMethodRefFlags.getInt());
1529 Record.push_back(E->isImplicitProperty());
1530 if (E->isImplicitProperty()) {
1531 Record.AddDeclRef(E->getImplicitPropertyGetter());
1532 Record.AddDeclRef(E->getImplicitPropertySetter());
1533 } else {
1534 Record.AddDeclRef(E->getExplicitProperty());
1535 }
1536 Record.AddSourceLocation(E->getLocation());
1537 Record.AddSourceLocation(E->getReceiverLocation());
1538 if (E->isObjectReceiver()) {
1539 Record.push_back(0);
1540 Record.AddStmt(E->getBase());
1541 } else if (E->isSuperReceiver()) {
1542 Record.push_back(1);
1543 Record.AddTypeRef(E->getSuperReceiverType());
1544 } else {
1545 Record.push_back(2);
1546 Record.AddDeclRef(E->getClassReceiver());
1547 }
1548
1550}
1551
1552void ASTStmtWriter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1553 VisitExpr(E);
1554 Record.AddSourceLocation(E->getRBracket());
1555 Record.AddStmt(E->getBaseExpr());
1556 Record.AddStmt(E->getKeyExpr());
1557 Record.AddDeclRef(E->getAtIndexMethodDecl());
1558 Record.AddDeclRef(E->setAtIndexMethodDecl());
1559
1561}
1562
1563void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1564 VisitExpr(E);
1565 Record.push_back(E->getNumArgs());
1566 Record.push_back(E->getNumStoredSelLocs());
1567 Record.push_back(E->SelLocsKind);
1568 Record.push_back(E->isDelegateInitCall());
1569 Record.push_back(E->IsImplicit);
1570 Record.push_back((unsigned)E->getReceiverKind()); // FIXME: stable encoding
1571 switch (E->getReceiverKind()) {
1573 Record.AddStmt(E->getInstanceReceiver());
1574 break;
1575
1577 Record.AddTypeSourceInfo(E->getClassReceiverTypeInfo());
1578 break;
1579
1582 Record.AddTypeRef(E->getSuperType());
1583 Record.AddSourceLocation(E->getSuperLoc());
1584 break;
1585 }
1586
1587 if (E->getMethodDecl()) {
1588 Record.push_back(1);
1589 Record.AddDeclRef(E->getMethodDecl());
1590 } else {
1591 Record.push_back(0);
1592 Record.AddSelectorRef(E->getSelector());
1593 }
1594
1595 Record.AddSourceLocation(E->getLeftLoc());
1596 Record.AddSourceLocation(E->getRightLoc());
1597
1598 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
1599 Arg != ArgEnd; ++Arg)
1600 Record.AddStmt(*Arg);
1601
1602 SourceLocation *Locs = E->getStoredSelLocs();
1603 for (unsigned i = 0, e = E->getNumStoredSelLocs(); i != e; ++i)
1604 Record.AddSourceLocation(Locs[i]);
1605
1607}
1608
1609void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1610 VisitStmt(S);
1611 Record.AddStmt(S->getElement());
1612 Record.AddStmt(S->getCollection());
1613 Record.AddStmt(S->getBody());
1614 Record.AddSourceLocation(S->getForLoc());
1615 Record.AddSourceLocation(S->getRParenLoc());
1617}
1618
1619void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1620 VisitStmt(S);
1621 Record.AddStmt(S->getCatchBody());
1622 Record.AddDeclRef(S->getCatchParamDecl());
1623 Record.AddSourceLocation(S->getAtCatchLoc());
1624 Record.AddSourceLocation(S->getRParenLoc());
1626}
1627
1628void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1629 VisitStmt(S);
1630 Record.AddStmt(S->getFinallyBody());
1631 Record.AddSourceLocation(S->getAtFinallyLoc());
1633}
1634
1635void ASTStmtWriter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1636 VisitStmt(S); // FIXME: no test coverage.
1637 Record.AddStmt(S->getSubStmt());
1638 Record.AddSourceLocation(S->getAtLoc());
1640}
1641
1642void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1643 VisitStmt(S);
1644 Record.push_back(S->getNumCatchStmts());
1645 Record.push_back(S->getFinallyStmt() != nullptr);
1646 Record.AddStmt(S->getTryBody());
1647 for (ObjCAtCatchStmt *C : S->catch_stmts())
1648 Record.AddStmt(C);
1649 if (S->getFinallyStmt())
1650 Record.AddStmt(S->getFinallyStmt());
1651 Record.AddSourceLocation(S->getAtTryLoc());
1653}
1654
1655void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1656 VisitStmt(S); // FIXME: no test coverage.
1657 Record.AddStmt(S->getSynchExpr());
1658 Record.AddStmt(S->getSynchBody());
1659 Record.AddSourceLocation(S->getAtSynchronizedLoc());
1661}
1662
1663void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1664 VisitStmt(S); // FIXME: no test coverage.
1665 Record.AddStmt(S->getThrowExpr());
1666 Record.AddSourceLocation(S->getThrowLoc());
1668}
1669
1670void ASTStmtWriter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1671 VisitExpr(E);
1672 Record.push_back(E->getValue());
1673 Record.AddSourceLocation(E->getLocation());
1675}
1676
1677void ASTStmtWriter::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1678 VisitExpr(E);
1679 Record.AddSourceRange(E->getSourceRange());
1680 Record.AddVersionTuple(E->getVersion());
1682}
1683
1684//===----------------------------------------------------------------------===//
1685// C++ Expressions and Statements.
1686//===----------------------------------------------------------------------===//
1687
1688void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
1689 VisitStmt(S);
1690 Record.AddSourceLocation(S->getCatchLoc());
1691 Record.AddDeclRef(S->getExceptionDecl());
1692 Record.AddStmt(S->getHandlerBlock());
1694}
1695
1696void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
1697 VisitStmt(S);
1698 Record.push_back(S->getNumHandlers());
1699 Record.AddSourceLocation(S->getTryLoc());
1700 Record.AddStmt(S->getTryBlock());
1701 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1702 Record.AddStmt(S->getHandler(i));
1704}
1705
1706void ASTStmtWriter::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1707 VisitStmt(S);
1708 Record.AddSourceLocation(S->getForLoc());
1709 Record.AddSourceLocation(S->getCoawaitLoc());
1710 Record.AddSourceLocation(S->getColonLoc());
1711 Record.AddSourceLocation(S->getRParenLoc());
1712 Record.AddStmt(S->getInit());
1713 Record.AddStmt(S->getRangeStmt());
1714 Record.AddStmt(S->getBeginStmt());
1715 Record.AddStmt(S->getEndStmt());
1716 Record.AddStmt(S->getCond());
1717 Record.AddStmt(S->getInc());
1718 Record.AddStmt(S->getLoopVarStmt());
1719 Record.AddStmt(S->getBody());
1721}
1722
1723void ASTStmtWriter::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1724 VisitStmt(S);
1725 Record.AddSourceLocation(S->getKeywordLoc());
1726 Record.push_back(S->isIfExists());
1727 Record.AddNestedNameSpecifierLoc(S->getQualifierLoc());
1728 Record.AddDeclarationNameInfo(S->getNameInfo());
1729 Record.AddStmt(S->getSubStmt());
1731}
1732
1733void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1734 VisitCallExpr(E);
1735 Record.push_back(E->getOperator());
1736 Record.AddSourceLocation(E->BeginLoc);
1737
1738 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1739 !E->isCoroElideSafe() && !E->usesMemberSyntax())
1740 AbbrevToUse = Writer.getCXXOperatorCallExprAbbrev();
1741
1743}
1744
1745void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1746 VisitCallExpr(E);
1747
1748 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1749 !E->isCoroElideSafe() && !E->usesMemberSyntax())
1750 AbbrevToUse = Writer.getCXXMemberCallExprAbbrev();
1751
1753}
1754
1755void ASTStmtWriter::VisitCXXRewrittenBinaryOperator(
1757 VisitExpr(E);
1758 Record.push_back(E->isReversed());
1759 Record.AddStmt(E->getSemanticForm());
1761}
1762
1763void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
1764 VisitExpr(E);
1765
1766 Record.push_back(E->getNumArgs());
1767 Record.push_back(E->isElidable());
1768 Record.push_back(E->hadMultipleCandidates());
1769 Record.push_back(E->isListInitialization());
1770 Record.push_back(E->isStdInitListInitialization());
1771 Record.push_back(E->requiresZeroInitialization());
1772 Record.push_back(
1773 llvm::to_underlying(E->getConstructionKind())); // FIXME: stable encoding
1774 Record.push_back(E->isImmediateEscalating());
1775 Record.AddSourceLocation(E->getLocation());
1776 Record.AddDeclRef(E->getConstructor());
1777 Record.AddSourceRange(E->getParenOrBraceRange());
1778
1779 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1780 Record.AddStmt(E->getArg(I));
1781
1783}
1784
1785void ASTStmtWriter::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1786 VisitExpr(E);
1787 Record.AddDeclRef(E->getConstructor());
1788 Record.AddSourceLocation(E->getLocation());
1789 Record.push_back(E->constructsVBase());
1790 Record.push_back(E->inheritedFromVBase());
1792}
1793
1794void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1795 VisitCXXConstructExpr(E);
1796 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1798}
1799
1800void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) {
1801 VisitExpr(E);
1802 Record.push_back(E->LambdaExprBits.NumCaptures);
1803 Record.AddSourceRange(E->IntroducerRange);
1804 Record.push_back(E->LambdaExprBits.CaptureDefault); // FIXME: stable encoding
1805 Record.AddSourceLocation(E->CaptureDefaultLoc);
1806 Record.push_back(E->LambdaExprBits.ExplicitParams);
1807 Record.push_back(E->LambdaExprBits.ExplicitResultType);
1808 Record.AddSourceLocation(E->ClosingBrace);
1809
1810 // Add capture initializers.
1812 CEnd = E->capture_init_end();
1813 C != CEnd; ++C) {
1814 Record.AddStmt(*C);
1815 }
1816
1817 // Don't serialize the body. It belongs to the call operator declaration.
1818 // LambdaExpr only stores a copy of the Stmt *.
1819
1821}
1822
1823void ASTStmtWriter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1824 VisitExpr(E);
1825 Record.AddStmt(E->getSubExpr());
1827}
1828
1829void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1830 VisitExplicitCastExpr(E);
1831 Record.AddSourceRange(SourceRange(E->getOperatorLoc(), E->getRParenLoc()));
1832 CurrentPackingBits.addBit(E->getAngleBrackets().isValid());
1833 if (E->getAngleBrackets().isValid())
1834 Record.AddSourceRange(E->getAngleBrackets());
1835}
1836
1837void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1838 VisitCXXNamedCastExpr(E);
1840}
1841
1842void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1843 VisitCXXNamedCastExpr(E);
1845}
1846
1847void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1848 VisitCXXNamedCastExpr(E);
1850}
1851
1852void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1853 VisitCXXNamedCastExpr(E);
1855}
1856
1857void ASTStmtWriter::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1858 VisitCXXNamedCastExpr(E);
1860}
1861
1862void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1863 VisitExplicitCastExpr(E);
1864 Record.AddSourceLocation(E->getLParenLoc());
1865 Record.AddSourceLocation(E->getRParenLoc());
1867}
1868
1869void ASTStmtWriter::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1870 VisitExplicitCastExpr(E);
1871 Record.AddSourceLocation(E->getBeginLoc());
1872 Record.AddSourceLocation(E->getEndLoc());
1874}
1875
1876void ASTStmtWriter::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1877 VisitCallExpr(E);
1878 Record.AddSourceLocation(E->UDSuffixLoc);
1880}
1881
1882void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1883 VisitExpr(E);
1884 Record.push_back(E->getValue());
1885 Record.AddSourceLocation(E->getLocation());
1887}
1888
1889void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1890 VisitExpr(E);
1891 Record.AddSourceLocation(E->getLocation());
1893}
1894
1895void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1896 VisitExpr(E);
1897 Record.AddSourceRange(E->getSourceRange());
1898 if (E->isTypeOperand()) {
1899 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
1901 } else {
1902 Record.AddStmt(E->getExprOperand());
1904 }
1905}
1906
1907void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
1908 VisitExpr(E);
1909 Record.AddSourceLocation(E->getLocation());
1910 Record.push_back(E->isImplicit());
1912
1914}
1915
1916void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
1917 VisitExpr(E);
1918 Record.AddSourceLocation(E->getThrowLoc());
1919 Record.AddStmt(E->getSubExpr());
1920 Record.push_back(E->isThrownVariableInScope());
1922}
1923
1924void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1925 VisitExpr(E);
1926 Record.AddDeclRef(E->getParam());
1927 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1928 Record.AddSourceLocation(E->getUsedLocation());
1929 Record.push_back(E->hasRewrittenInit());
1930 if (E->hasRewrittenInit())
1931 Record.AddStmt(E->getRewrittenExpr());
1933}
1934
1935void ASTStmtWriter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1936 VisitExpr(E);
1937 Record.push_back(E->hasRewrittenInit());
1938 Record.AddDeclRef(E->getField());
1939 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1940 Record.AddSourceLocation(E->getExprLoc());
1941 if (E->hasRewrittenInit())
1942 Record.AddStmt(E->getRewrittenExpr());
1944}
1945
1946void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1947 VisitExpr(E);
1948 Record.AddCXXTemporary(E->getTemporary());
1949 Record.AddStmt(E->getSubExpr());
1951}
1952
1953void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1954 VisitExpr(E);
1955 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1956 Record.AddSourceLocation(E->getRParenLoc());
1958}
1959
1960void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
1961 VisitExpr(E);
1962
1963 Record.push_back(E->isArray());
1964 Record.push_back(E->hasInitializer());
1965 Record.push_back(E->getNumPlacementArgs());
1966 Record.push_back(E->isParenTypeId());
1967
1968 Record.push_back(E->isGlobalNew());
1969 ImplicitAllocationParameters IAP = E->implicitAllocationParameters();
1970 Record.push_back(isAlignedAllocation(IAP.PassAlignment));
1971 Record.push_back(isTypeAwareAllocation(IAP.PassTypeIdentity));
1972 Record.push_back(E->doesUsualArrayDeleteWantSize());
1973 Record.push_back(E->CXXNewExprBits.HasInitializer);
1974 Record.push_back(E->CXXNewExprBits.StoredInitializationStyle);
1975
1976 Record.AddDeclRef(E->getOperatorNew());
1977 Record.AddDeclRef(E->getOperatorDelete());
1978 Record.AddTypeSourceInfo(E->getAllocatedTypeSourceInfo());
1979 if (E->isParenTypeId())
1980 Record.AddSourceRange(E->getTypeIdParens());
1981 Record.AddSourceRange(E->getSourceRange());
1982 Record.AddSourceRange(E->getDirectInitRange());
1983
1984 for (CXXNewExpr::arg_iterator I = E->raw_arg_begin(), N = E->raw_arg_end();
1985 I != N; ++I)
1986 Record.AddStmt(*I);
1987
1989}
1990
1991void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1992 VisitExpr(E);
1993 Record.push_back(E->isGlobalDelete());
1994 Record.push_back(E->isArrayForm());
1995 Record.push_back(E->isArrayFormAsWritten());
1996 Record.push_back(E->doesUsualArrayDeleteWantSize());
1997 Record.AddDeclRef(E->getOperatorDelete());
1998 Record.AddStmt(E->getArgument());
1999 Record.AddSourceLocation(E->getBeginLoc());
2000
2002}
2003
2004void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
2005 VisitExpr(E);
2006
2007 Record.AddStmt(E->getBase());
2008 Record.push_back(E->isArrow());
2009 Record.AddSourceLocation(E->getOperatorLoc());
2010 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2011 Record.AddTypeSourceInfo(E->getScopeTypeInfo());
2012 Record.AddSourceLocation(E->getColonColonLoc());
2013 Record.AddSourceLocation(E->getTildeLoc());
2014
2015 // PseudoDestructorTypeStorage.
2016 Record.AddIdentifierRef(E->getDestroyedTypeIdentifier());
2018 Record.AddSourceLocation(E->getDestroyedTypeLoc());
2019 else
2020 Record.AddTypeSourceInfo(E->getDestroyedTypeInfo());
2021
2023}
2024
2025void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) {
2026 VisitExpr(E);
2027 Record.push_back(E->getNumObjects());
2028 for (auto &Obj : E->getObjects()) {
2029 if (auto *BD = Obj.dyn_cast<BlockDecl *>()) {
2030 Record.push_back(serialization::COK_Block);
2031 Record.AddDeclRef(BD);
2032 } else if (auto *CLE = Obj.dyn_cast<CompoundLiteralExpr *>()) {
2033 Record.push_back(serialization::COK_CompoundLiteral);
2034 Record.AddStmt(CLE);
2035 }
2036 }
2037
2038 Record.push_back(E->cleanupsHaveSideEffects());
2039 Record.AddStmt(E->getSubExpr());
2041}
2042
2043void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
2045 VisitExpr(E);
2046
2047 // Don't emit anything here (or if you do you will have to update
2048 // the corresponding deserialization function).
2049 Record.push_back(E->getNumTemplateArgs());
2050 CurrentPackingBits.updateBits();
2051 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2052 CurrentPackingBits.addBit(E->hasFirstQualifierFoundInScope());
2053
2054 if (E->hasTemplateKWAndArgsInfo()) {
2055 const ASTTemplateKWAndArgsInfo &ArgInfo =
2056 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2058 E->getTrailingObjects<TemplateArgumentLoc>());
2059 }
2060
2061 CurrentPackingBits.addBit(E->isArrow());
2062
2063 Record.AddTypeRef(E->getBaseType());
2064 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2065 CurrentPackingBits.addBit(!E->isImplicitAccess());
2066 if (!E->isImplicitAccess())
2067 Record.AddStmt(E->getBase());
2068
2069 Record.AddSourceLocation(E->getOperatorLoc());
2070
2071 if (E->hasFirstQualifierFoundInScope())
2072 Record.AddDeclRef(E->getFirstQualifierFoundInScope());
2073
2074 Record.AddDeclarationNameInfo(E->MemberNameInfo);
2076}
2077
2078void
2079ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2080 VisitExpr(E);
2081
2082 // Don't emit anything here, HasTemplateKWAndArgsInfo must be
2083 // emitted first.
2084 CurrentPackingBits.addBit(
2085 E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
2086
2087 if (E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo) {
2088 const ASTTemplateKWAndArgsInfo &ArgInfo =
2089 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2090 // 16 bits should be enought to store the number of args
2091 CurrentPackingBits.addBits(ArgInfo.NumTemplateArgs, /*Width=*/16);
2093 E->getTrailingObjects<TemplateArgumentLoc>());
2094 }
2095
2096 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2097 Record.AddDeclarationNameInfo(E->NameInfo);
2099}
2100
2101void
2102ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2103 VisitExpr(E);
2104 Record.push_back(E->getNumArgs());
2106 ArgI = E->arg_begin(), ArgE = E->arg_end(); ArgI != ArgE; ++ArgI)
2107 Record.AddStmt(*ArgI);
2108 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
2109 Record.AddSourceLocation(E->getLParenLoc());
2110 Record.AddSourceLocation(E->getRParenLoc());
2111 Record.push_back(E->isListInitialization());
2113}
2114
2115void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
2116 VisitExpr(E);
2117
2118 Record.push_back(E->getNumDecls());
2119
2120 CurrentPackingBits.updateBits();
2121 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2122 if (E->hasTemplateKWAndArgsInfo()) {
2123 const ASTTemplateKWAndArgsInfo &ArgInfo =
2125 Record.push_back(ArgInfo.NumTemplateArgs);
2127 }
2128
2130 OvE = E->decls_end();
2131 OvI != OvE; ++OvI) {
2132 Record.AddDeclRef(OvI.getDecl());
2133 Record.push_back(OvI.getAccess());
2134 }
2135
2136 Record.AddDeclarationNameInfo(E->getNameInfo());
2137 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2138}
2139
2140void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2141 VisitOverloadExpr(E);
2142 CurrentPackingBits.addBit(E->isArrow());
2143 CurrentPackingBits.addBit(E->hasUnresolvedUsing());
2144 CurrentPackingBits.addBit(!E->isImplicitAccess());
2145 if (!E->isImplicitAccess())
2146 Record.AddStmt(E->getBase());
2147
2148 Record.AddSourceLocation(E->getOperatorLoc());
2149
2150 Record.AddTypeRef(E->getBaseType());
2152}
2153
2154void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2155 VisitOverloadExpr(E);
2156 CurrentPackingBits.addBit(E->requiresADL());
2157 Record.AddDeclRef(E->getNamingClass());
2159
2160 if (Writer.isWritingStdCXXNamedModules() && Writer.getChain()) {
2161 // Referencing all the possible declarations to make sure the change get
2162 // propagted.
2163 DeclarationName Name = E->getName();
2164 for (auto *Found :
2165 Record.getASTContext().getTranslationUnitDecl()->lookup(Name))
2166 if (Found->isFromASTFile())
2167 Writer.GetDeclRef(Found);
2168
2169 llvm::SmallVector<NamespaceDecl *> ExternalNSs;
2170 Writer.getChain()->ReadKnownNamespaces(ExternalNSs);
2171 for (auto *NS : ExternalNSs)
2172 for (auto *Found : NS->lookup(Name))
2173 Writer.GetDeclRef(Found);
2174 }
2175}
2176
2177void ASTStmtWriter::VisitTypeTraitExpr(TypeTraitExpr *E) {
2178 VisitExpr(E);
2179 Record.push_back(E->TypeTraitExprBits.IsBooleanTypeTrait);
2180 Record.push_back(E->TypeTraitExprBits.NumArgs);
2181 Record.push_back(E->TypeTraitExprBits.Kind); // FIXME: Stable encoding
2182
2183 if (E->TypeTraitExprBits.IsBooleanTypeTrait)
2184 Record.push_back(E->TypeTraitExprBits.Value);
2185 else
2186 Record.AddAPValue(E->getAPValue());
2187
2188 Record.AddSourceRange(E->getSourceRange());
2189 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2190 Record.AddTypeSourceInfo(E->getArg(I));
2192}
2193
2194void ASTStmtWriter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2195 VisitExpr(E);
2196 Record.push_back(E->getTrait());
2197 Record.push_back(E->getValue());
2198 Record.AddSourceRange(E->getSourceRange());
2199 Record.AddTypeSourceInfo(E->getQueriedTypeSourceInfo());
2200 Record.AddStmt(E->getDimensionExpression());
2202}
2203
2204void ASTStmtWriter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2205 VisitExpr(E);
2206 Record.push_back(E->getTrait());
2207 Record.push_back(E->getValue());
2208 Record.AddSourceRange(E->getSourceRange());
2209 Record.AddStmt(E->getQueriedExpression());
2211}
2212
2213void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2214 VisitExpr(E);
2215 Record.push_back(E->getValue());
2216 Record.AddSourceRange(E->getSourceRange());
2217 Record.AddStmt(E->getOperand());
2219}
2220
2221void ASTStmtWriter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2222 VisitExpr(E);
2223 Record.AddSourceLocation(E->getEllipsisLoc());
2224 Record.push_back(E->NumExpansions);
2225 Record.AddStmt(E->getPattern());
2227}
2228
2229void ASTStmtWriter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2230 VisitExpr(E);
2231 Record.push_back(E->isPartiallySubstituted() ? E->getPartialArguments().size()
2232 : 0);
2233 Record.AddSourceLocation(E->OperatorLoc);
2234 Record.AddSourceLocation(E->PackLoc);
2235 Record.AddSourceLocation(E->RParenLoc);
2236 Record.AddDeclRef(E->Pack);
2237 if (E->isPartiallySubstituted()) {
2238 for (const auto &TA : E->getPartialArguments())
2239 Record.AddTemplateArgument(TA);
2240 } else if (!E->isValueDependent()) {
2241 Record.push_back(E->getPackLength());
2242 }
2244}
2245
2246void ASTStmtWriter::VisitPackIndexingExpr(PackIndexingExpr *E) {
2247 VisitExpr(E);
2248 Record.push_back(E->PackIndexingExprBits.TransformedExpressions);
2249 Record.push_back(E->PackIndexingExprBits.FullySubstituted);
2250 Record.AddSourceLocation(E->getEllipsisLoc());
2251 Record.AddSourceLocation(E->getRSquareLoc());
2252 Record.AddStmt(E->getPackIdExpression());
2253 Record.AddStmt(E->getIndexExpr());
2254 for (Expr *Sub : E->getExpressions())
2255 Record.AddStmt(Sub);
2257}
2258
2259void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
2261 VisitExpr(E);
2262 Record.AddDeclRef(E->getAssociatedDecl());
2263 CurrentPackingBits.addBit(E->isReferenceParameter());
2264 CurrentPackingBits.addBits(E->getIndex(), /*Width=*/12);
2265 Record.writeUnsignedOrNone(E->getPackIndex());
2266 CurrentPackingBits.addBit(E->getFinal());
2267
2268 Record.AddSourceLocation(E->getNameLoc());
2269 Record.AddStmt(E->getReplacement());
2271}
2272
2273void ASTStmtWriter::VisitSubstNonTypeTemplateParmPackExpr(
2275 VisitExpr(E);
2276 Record.AddDeclRef(E->getAssociatedDecl());
2277 CurrentPackingBits.addBit(E->getFinal());
2278 Record.push_back(E->getIndex());
2279 Record.AddTemplateArgument(E->getArgumentPack());
2280 Record.AddSourceLocation(E->getParameterPackLocation());
2282}
2283
2284void ASTStmtWriter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2285 VisitExpr(E);
2286 Record.push_back(E->getNumExpansions());
2287 Record.AddDeclRef(E->getParameterPack());
2288 Record.AddSourceLocation(E->getParameterPackLocation());
2289 for (FunctionParmPackExpr::iterator I = E->begin(), End = E->end();
2290 I != End; ++I)
2291 Record.AddDeclRef(*I);
2293}
2294
2295void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2296 VisitExpr(E);
2297 Record.push_back(static_cast<bool>(E->getLifetimeExtendedTemporaryDecl()));
2299 Record.AddDeclRef(E->getLifetimeExtendedTemporaryDecl());
2300 else
2301 Record.AddStmt(E->getSubExpr());
2303}
2304
2305void ASTStmtWriter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2306 VisitExpr(E);
2307 Record.AddSourceLocation(E->LParenLoc);
2308 Record.AddSourceLocation(E->EllipsisLoc);
2309 Record.AddSourceLocation(E->RParenLoc);
2310 Record.push_back(E->NumExpansions.toInternalRepresentation());
2311 Record.AddStmt(E->SubExprs[0]);
2312 Record.AddStmt(E->SubExprs[1]);
2313 Record.AddStmt(E->SubExprs[2]);
2314 Record.push_back(E->CXXFoldExprBits.Opcode);
2316}
2317
2318void ASTStmtWriter::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2319 VisitExpr(E);
2320 ArrayRef<Expr *> InitExprs = E->getInitExprs();
2321 Record.push_back(InitExprs.size());
2322 Record.push_back(E->getUserSpecifiedInitExprs().size());
2323 Record.AddSourceLocation(E->getInitLoc());
2324 Record.AddSourceLocation(E->getBeginLoc());
2325 Record.AddSourceLocation(E->getEndLoc());
2326 for (Expr *InitExpr : E->getInitExprs())
2327 Record.AddStmt(InitExpr);
2328 Expr *ArrayFiller = E->getArrayFiller();
2329 FieldDecl *UnionField = E->getInitializedFieldInUnion();
2330 bool HasArrayFillerOrUnionDecl = ArrayFiller || UnionField;
2331 Record.push_back(HasArrayFillerOrUnionDecl);
2332 if (HasArrayFillerOrUnionDecl) {
2333 Record.push_back(static_cast<bool>(ArrayFiller));
2334 if (ArrayFiller)
2335 Record.AddStmt(ArrayFiller);
2336 else
2337 Record.AddDeclRef(UnionField);
2338 }
2340}
2341
2342void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2343 VisitExpr(E);
2344 Record.AddStmt(E->getSourceExpr());
2345 Record.AddSourceLocation(E->getLocation());
2346 Record.push_back(E->isUnique());
2348}
2349
2350//===----------------------------------------------------------------------===//
2351// CUDA Expressions and Statements.
2352//===----------------------------------------------------------------------===//
2353
2354void ASTStmtWriter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2355 VisitCallExpr(E);
2356 Record.AddStmt(E->getConfig());
2358}
2359
2360//===----------------------------------------------------------------------===//
2361// OpenCL Expressions and Statements.
2362//===----------------------------------------------------------------------===//
2363void ASTStmtWriter::VisitAsTypeExpr(AsTypeExpr *E) {
2364 VisitExpr(E);
2365 Record.AddSourceLocation(E->getBuiltinLoc());
2366 Record.AddSourceLocation(E->getRParenLoc());
2367 Record.AddStmt(E->getSrcExpr());
2369}
2370
2371//===----------------------------------------------------------------------===//
2372// Microsoft Expressions and Statements.
2373//===----------------------------------------------------------------------===//
2374void ASTStmtWriter::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2375 VisitExpr(E);
2376 Record.push_back(E->isArrow());
2377 Record.AddStmt(E->getBaseExpr());
2378 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2379 Record.AddSourceLocation(E->getMemberLoc());
2380 Record.AddDeclRef(E->getPropertyDecl());
2382}
2383
2384void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2385 VisitExpr(E);
2386 Record.AddStmt(E->getBase());
2387 Record.AddStmt(E->getIdx());
2388 Record.AddSourceLocation(E->getRBracketLoc());
2390}
2391
2392void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2393 VisitExpr(E);
2394 Record.AddSourceRange(E->getSourceRange());
2395 Record.AddDeclRef(E->getGuidDecl());
2396 if (E->isTypeOperand()) {
2397 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
2399 } else {
2400 Record.AddStmt(E->getExprOperand());
2402 }
2403}
2404
2405void ASTStmtWriter::VisitSEHExceptStmt(SEHExceptStmt *S) {
2406 VisitStmt(S);
2407 Record.AddSourceLocation(S->getExceptLoc());
2408 Record.AddStmt(S->getFilterExpr());
2409 Record.AddStmt(S->getBlock());
2411}
2412
2413void ASTStmtWriter::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2414 VisitStmt(S);
2415 Record.AddSourceLocation(S->getFinallyLoc());
2416 Record.AddStmt(S->getBlock());
2418}
2419
2420void ASTStmtWriter::VisitSEHTryStmt(SEHTryStmt *S) {
2421 VisitStmt(S);
2422 Record.push_back(S->getIsCXXTry());
2423 Record.AddSourceLocation(S->getTryLoc());
2424 Record.AddStmt(S->getTryBlock());
2425 Record.AddStmt(S->getHandler());
2427}
2428
2429void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2430 VisitStmt(S);
2431 Record.AddSourceLocation(S->getLeaveLoc());
2433}
2434
2435//===----------------------------------------------------------------------===//
2436// OpenMP Directives.
2437//===----------------------------------------------------------------------===//
2438
2439void ASTStmtWriter::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2440 VisitStmt(S);
2441 for (Stmt *SubStmt : S->SubStmts)
2442 Record.AddStmt(SubStmt);
2444}
2445
2446void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2447 Record.writeOMPChildren(E->Data);
2448 Record.AddSourceLocation(E->getBeginLoc());
2449 Record.AddSourceLocation(E->getEndLoc());
2450}
2451
2452void ASTStmtWriter::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2453 VisitStmt(D);
2454 Record.writeUInt32(D->getLoopsNumber());
2455 VisitOMPExecutableDirective(D);
2456}
2457
2458void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) {
2459 VisitOMPLoopBasedDirective(D);
2460}
2461
2462void ASTStmtWriter::VisitOMPMetaDirective(OMPMetaDirective *D) {
2463 VisitStmt(D);
2464 Record.push_back(D->getNumClauses());
2465 VisitOMPExecutableDirective(D);
2467}
2468
2469void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) {
2470 VisitStmt(D);
2471 VisitOMPExecutableDirective(D);
2472 Record.writeBool(D->hasCancel());
2474}
2475
2476void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) {
2477 VisitOMPLoopDirective(D);
2479}
2480
2481void ASTStmtWriter::VisitOMPCanonicalLoopNestTransformationDirective(
2482 OMPCanonicalLoopNestTransformationDirective *D) {
2483 VisitOMPLoopBasedDirective(D);
2484 Record.writeUInt32(D->getNumGeneratedTopLevelLoops());
2485}
2486
2487void ASTStmtWriter::VisitOMPTileDirective(OMPTileDirective *D) {
2488 VisitOMPCanonicalLoopNestTransformationDirective(D);
2490}
2491
2492void ASTStmtWriter::VisitOMPStripeDirective(OMPStripeDirective *D) {
2493 VisitOMPCanonicalLoopNestTransformationDirective(D);
2495}
2496
2497void ASTStmtWriter::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2498 VisitOMPCanonicalLoopNestTransformationDirective(D);
2500}
2501
2502void ASTStmtWriter::VisitOMPReverseDirective(OMPReverseDirective *D) {
2503 VisitOMPCanonicalLoopNestTransformationDirective(D);
2505}
2506
2507void ASTStmtWriter::VisitOMPInterchangeDirective(OMPInterchangeDirective *D) {
2508 VisitOMPCanonicalLoopNestTransformationDirective(D);
2510}
2511
2512void ASTStmtWriter::VisitOMPCanonicalLoopSequenceTransformationDirective(
2513 OMPCanonicalLoopSequenceTransformationDirective *D) {
2514 VisitStmt(D);
2515 VisitOMPExecutableDirective(D);
2516 Record.writeUInt32(D->getNumGeneratedTopLevelLoops());
2517}
2518
2519void ASTStmtWriter::VisitOMPFuseDirective(OMPFuseDirective *D) {
2520 VisitOMPCanonicalLoopSequenceTransformationDirective(D);
2522}
2523
2524void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) {
2525 VisitOMPLoopDirective(D);
2526 Record.writeBool(D->hasCancel());
2528}
2529
2530void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2531 VisitOMPLoopDirective(D);
2533}
2534
2535void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2536 VisitStmt(D);
2537 VisitOMPExecutableDirective(D);
2538 Record.writeBool(D->hasCancel());
2540}
2541
2542void ASTStmtWriter::VisitOMPSectionDirective(OMPSectionDirective *D) {
2543 VisitStmt(D);
2544 VisitOMPExecutableDirective(D);
2545 Record.writeBool(D->hasCancel());
2547}
2548
2549void ASTStmtWriter::VisitOMPScopeDirective(OMPScopeDirective *D) {
2550 VisitStmt(D);
2551 VisitOMPExecutableDirective(D);
2553}
2554
2555void ASTStmtWriter::VisitOMPSingleDirective(OMPSingleDirective *D) {
2556 VisitStmt(D);
2557 VisitOMPExecutableDirective(D);
2559}
2560
2561void ASTStmtWriter::VisitOMPMasterDirective(OMPMasterDirective *D) {
2562 VisitStmt(D);
2563 VisitOMPExecutableDirective(D);
2565}
2566
2567void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2568 VisitStmt(D);
2569 VisitOMPExecutableDirective(D);
2570 Record.AddDeclarationNameInfo(D->getDirectiveName());
2572}
2573
2574void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2575 VisitOMPLoopDirective(D);
2576 Record.writeBool(D->hasCancel());
2578}
2579
2580void ASTStmtWriter::VisitOMPParallelForSimdDirective(
2581 OMPParallelForSimdDirective *D) {
2582 VisitOMPLoopDirective(D);
2584}
2585
2586void ASTStmtWriter::VisitOMPParallelMasterDirective(
2587 OMPParallelMasterDirective *D) {
2588 VisitStmt(D);
2589 VisitOMPExecutableDirective(D);
2591}
2592
2593void ASTStmtWriter::VisitOMPParallelMaskedDirective(
2594 OMPParallelMaskedDirective *D) {
2595 VisitStmt(D);
2596 VisitOMPExecutableDirective(D);
2598}
2599
2600void ASTStmtWriter::VisitOMPParallelSectionsDirective(
2601 OMPParallelSectionsDirective *D) {
2602 VisitStmt(D);
2603 VisitOMPExecutableDirective(D);
2604 Record.writeBool(D->hasCancel());
2606}
2607
2608void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) {
2609 VisitStmt(D);
2610 VisitOMPExecutableDirective(D);
2611 Record.writeBool(D->hasCancel());
2613}
2614
2615void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2616 VisitStmt(D);
2617 VisitOMPExecutableDirective(D);
2618 Record.writeBool(D->isXLHSInRHSPart());
2619 Record.writeBool(D->isPostfixUpdate());
2620 Record.writeBool(D->isFailOnly());
2622}
2623
2624void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) {
2625 VisitStmt(D);
2626 VisitOMPExecutableDirective(D);
2628}
2629
2630void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2631 VisitStmt(D);
2632 VisitOMPExecutableDirective(D);
2634}
2635
2636void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
2637 OMPTargetEnterDataDirective *D) {
2638 VisitStmt(D);
2639 VisitOMPExecutableDirective(D);
2641}
2642
2643void ASTStmtWriter::VisitOMPTargetExitDataDirective(
2644 OMPTargetExitDataDirective *D) {
2645 VisitStmt(D);
2646 VisitOMPExecutableDirective(D);
2648}
2649
2650void ASTStmtWriter::VisitOMPTargetParallelDirective(
2651 OMPTargetParallelDirective *D) {
2652 VisitStmt(D);
2653 VisitOMPExecutableDirective(D);
2654 Record.writeBool(D->hasCancel());
2656}
2657
2658void ASTStmtWriter::VisitOMPTargetParallelForDirective(
2659 OMPTargetParallelForDirective *D) {
2660 VisitOMPLoopDirective(D);
2661 Record.writeBool(D->hasCancel());
2663}
2664
2665void ASTStmtWriter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2666 VisitStmt(D);
2667 VisitOMPExecutableDirective(D);
2669}
2670
2671void ASTStmtWriter::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2672 VisitStmt(D);
2673 VisitOMPExecutableDirective(D);
2675}
2676
2677void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2678 VisitStmt(D);
2679 Record.push_back(D->getNumClauses());
2680 VisitOMPExecutableDirective(D);
2682}
2683
2684void ASTStmtWriter::VisitOMPAssumeDirective(OMPAssumeDirective *D) {
2685 VisitStmt(D);
2686 VisitOMPExecutableDirective(D);
2688}
2689
2690void ASTStmtWriter::VisitOMPErrorDirective(OMPErrorDirective *D) {
2691 VisitStmt(D);
2692 Record.push_back(D->getNumClauses());
2693 VisitOMPExecutableDirective(D);
2695}
2696
2697void ASTStmtWriter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2698 VisitStmt(D);
2699 VisitOMPExecutableDirective(D);
2701}
2702
2703void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) {
2704 VisitStmt(D);
2705 VisitOMPExecutableDirective(D);
2707}
2708
2709void ASTStmtWriter::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2710 VisitStmt(D);
2711 VisitOMPExecutableDirective(D);
2713}
2714
2715void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
2716 VisitStmt(D);
2717 VisitOMPExecutableDirective(D);
2719}
2720
2721void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2722 VisitStmt(D);
2723 VisitOMPExecutableDirective(D);
2725}
2726
2727void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2728 VisitStmt(D);
2729 VisitOMPExecutableDirective(D);
2731}
2732
2733void ASTStmtWriter::VisitOMPCancellationPointDirective(
2734 OMPCancellationPointDirective *D) {
2735 VisitStmt(D);
2736 VisitOMPExecutableDirective(D);
2737 Record.writeEnum(D->getCancelRegion());
2739}
2740
2741void ASTStmtWriter::VisitOMPCancelDirective(OMPCancelDirective *D) {
2742 VisitStmt(D);
2743 VisitOMPExecutableDirective(D);
2744 Record.writeEnum(D->getCancelRegion());
2746}
2747
2748void ASTStmtWriter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2749 VisitOMPLoopDirective(D);
2750 Record.writeBool(D->hasCancel());
2752}
2753
2754void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2755 VisitOMPLoopDirective(D);
2757}
2758
2759void ASTStmtWriter::VisitOMPMasterTaskLoopDirective(
2760 OMPMasterTaskLoopDirective *D) {
2761 VisitOMPLoopDirective(D);
2762 Record.writeBool(D->hasCancel());
2764}
2765
2766void ASTStmtWriter::VisitOMPMaskedTaskLoopDirective(
2767 OMPMaskedTaskLoopDirective *D) {
2768 VisitOMPLoopDirective(D);
2769 Record.writeBool(D->hasCancel());
2771}
2772
2773void ASTStmtWriter::VisitOMPMasterTaskLoopSimdDirective(
2774 OMPMasterTaskLoopSimdDirective *D) {
2775 VisitOMPLoopDirective(D);
2777}
2778
2779void ASTStmtWriter::VisitOMPMaskedTaskLoopSimdDirective(
2780 OMPMaskedTaskLoopSimdDirective *D) {
2781 VisitOMPLoopDirective(D);
2783}
2784
2785void ASTStmtWriter::VisitOMPParallelMasterTaskLoopDirective(
2786 OMPParallelMasterTaskLoopDirective *D) {
2787 VisitOMPLoopDirective(D);
2788 Record.writeBool(D->hasCancel());
2790}
2791
2792void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopDirective(
2793 OMPParallelMaskedTaskLoopDirective *D) {
2794 VisitOMPLoopDirective(D);
2795 Record.writeBool(D->hasCancel());
2797}
2798
2799void ASTStmtWriter::VisitOMPParallelMasterTaskLoopSimdDirective(
2800 OMPParallelMasterTaskLoopSimdDirective *D) {
2801 VisitOMPLoopDirective(D);
2803}
2804
2805void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopSimdDirective(
2806 OMPParallelMaskedTaskLoopSimdDirective *D) {
2807 VisitOMPLoopDirective(D);
2809}
2810
2811void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2812 VisitOMPLoopDirective(D);
2814}
2815
2816void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2817 VisitStmt(D);
2818 VisitOMPExecutableDirective(D);
2820}
2821
2822void ASTStmtWriter::VisitOMPDistributeParallelForDirective(
2823 OMPDistributeParallelForDirective *D) {
2824 VisitOMPLoopDirective(D);
2825 Record.writeBool(D->hasCancel());
2827}
2828
2829void ASTStmtWriter::VisitOMPDistributeParallelForSimdDirective(
2830 OMPDistributeParallelForSimdDirective *D) {
2831 VisitOMPLoopDirective(D);
2833}
2834
2835void ASTStmtWriter::VisitOMPDistributeSimdDirective(
2836 OMPDistributeSimdDirective *D) {
2837 VisitOMPLoopDirective(D);
2839}
2840
2841void ASTStmtWriter::VisitOMPTargetParallelForSimdDirective(
2842 OMPTargetParallelForSimdDirective *D) {
2843 VisitOMPLoopDirective(D);
2845}
2846
2847void ASTStmtWriter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2848 VisitOMPLoopDirective(D);
2850}
2851
2852void ASTStmtWriter::VisitOMPTeamsDistributeDirective(
2853 OMPTeamsDistributeDirective *D) {
2854 VisitOMPLoopDirective(D);
2856}
2857
2858void ASTStmtWriter::VisitOMPTeamsDistributeSimdDirective(
2859 OMPTeamsDistributeSimdDirective *D) {
2860 VisitOMPLoopDirective(D);
2862}
2863
2864void ASTStmtWriter::VisitOMPTeamsDistributeParallelForSimdDirective(
2865 OMPTeamsDistributeParallelForSimdDirective *D) {
2866 VisitOMPLoopDirective(D);
2868}
2869
2870void ASTStmtWriter::VisitOMPTeamsDistributeParallelForDirective(
2871 OMPTeamsDistributeParallelForDirective *D) {
2872 VisitOMPLoopDirective(D);
2873 Record.writeBool(D->hasCancel());
2875}
2876
2877void ASTStmtWriter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2878 VisitStmt(D);
2879 VisitOMPExecutableDirective(D);
2881}
2882
2883void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective(
2884 OMPTargetTeamsDistributeDirective *D) {
2885 VisitOMPLoopDirective(D);
2887}
2888
2889void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective(
2890 OMPTargetTeamsDistributeParallelForDirective *D) {
2891 VisitOMPLoopDirective(D);
2892 Record.writeBool(D->hasCancel());
2894}
2895
2896void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2897 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
2898 VisitOMPLoopDirective(D);
2899 Code = serialization::
2900 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE;
2901}
2902
2903void ASTStmtWriter::VisitOMPTargetTeamsDistributeSimdDirective(
2904 OMPTargetTeamsDistributeSimdDirective *D) {
2905 VisitOMPLoopDirective(D);
2907}
2908
2909void ASTStmtWriter::VisitOMPInteropDirective(OMPInteropDirective *D) {
2910 VisitStmt(D);
2911 VisitOMPExecutableDirective(D);
2913}
2914
2915void ASTStmtWriter::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2916 VisitStmt(D);
2917 VisitOMPExecutableDirective(D);
2918 Record.AddSourceLocation(D->getTargetCallLoc());
2920}
2921
2922void ASTStmtWriter::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2923 VisitStmt(D);
2924 VisitOMPExecutableDirective(D);
2926}
2927
2928void ASTStmtWriter::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2929 VisitOMPLoopDirective(D);
2931}
2932
2933void ASTStmtWriter::VisitOMPTeamsGenericLoopDirective(
2934 OMPTeamsGenericLoopDirective *D) {
2935 VisitOMPLoopDirective(D);
2937}
2938
2939void ASTStmtWriter::VisitOMPTargetTeamsGenericLoopDirective(
2940 OMPTargetTeamsGenericLoopDirective *D) {
2941 VisitOMPLoopDirective(D);
2942 Record.writeBool(D->canBeParallelFor());
2944}
2945
2946void ASTStmtWriter::VisitOMPParallelGenericLoopDirective(
2947 OMPParallelGenericLoopDirective *D) {
2948 VisitOMPLoopDirective(D);
2950}
2951
2952void ASTStmtWriter::VisitOMPTargetParallelGenericLoopDirective(
2953 OMPTargetParallelGenericLoopDirective *D) {
2954 VisitOMPLoopDirective(D);
2956}
2957
2958//===----------------------------------------------------------------------===//
2959// OpenACC Constructs/Directives.
2960//===----------------------------------------------------------------------===//
2961void ASTStmtWriter::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2962 Record.push_back(S->clauses().size());
2963 Record.writeEnum(S->Kind);
2964 Record.AddSourceRange(S->Range);
2965 Record.AddSourceLocation(S->DirectiveLoc);
2966 Record.writeOpenACCClauseList(S->clauses());
2967}
2968
2969void ASTStmtWriter::VisitOpenACCAssociatedStmtConstruct(
2971 VisitOpenACCConstructStmt(S);
2972 Record.AddStmt(S->getAssociatedStmt());
2973}
2974
2975void ASTStmtWriter::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2976 VisitStmt(S);
2977 VisitOpenACCAssociatedStmtConstruct(S);
2979}
2980
2981void ASTStmtWriter::VisitOpenACCLoopConstruct(OpenACCLoopConstruct *S) {
2982 VisitStmt(S);
2983 VisitOpenACCAssociatedStmtConstruct(S);
2984 Record.writeEnum(S->getParentComputeConstructKind());
2986}
2987
2988void ASTStmtWriter::VisitOpenACCCombinedConstruct(OpenACCCombinedConstruct *S) {
2989 VisitStmt(S);
2990 VisitOpenACCAssociatedStmtConstruct(S);
2992}
2993
2994void ASTStmtWriter::VisitOpenACCDataConstruct(OpenACCDataConstruct *S) {
2995 VisitStmt(S);
2996 VisitOpenACCAssociatedStmtConstruct(S);
2998}
2999
3000void ASTStmtWriter::VisitOpenACCEnterDataConstruct(
3001 OpenACCEnterDataConstruct *S) {
3002 VisitStmt(S);
3003 VisitOpenACCConstructStmt(S);
3005}
3006
3007void ASTStmtWriter::VisitOpenACCExitDataConstruct(OpenACCExitDataConstruct *S) {
3008 VisitStmt(S);
3009 VisitOpenACCConstructStmt(S);
3011}
3012
3013void ASTStmtWriter::VisitOpenACCInitConstruct(OpenACCInitConstruct *S) {
3014 VisitStmt(S);
3015 VisitOpenACCConstructStmt(S);
3017}
3018
3019void ASTStmtWriter::VisitOpenACCShutdownConstruct(OpenACCShutdownConstruct *S) {
3020 VisitStmt(S);
3021 VisitOpenACCConstructStmt(S);
3023}
3024
3025void ASTStmtWriter::VisitOpenACCSetConstruct(OpenACCSetConstruct *S) {
3026 VisitStmt(S);
3027 VisitOpenACCConstructStmt(S);
3029}
3030
3031void ASTStmtWriter::VisitOpenACCUpdateConstruct(OpenACCUpdateConstruct *S) {
3032 VisitStmt(S);
3033 VisitOpenACCConstructStmt(S);
3035}
3036
3037void ASTStmtWriter::VisitOpenACCHostDataConstruct(OpenACCHostDataConstruct *S) {
3038 VisitStmt(S);
3039 VisitOpenACCAssociatedStmtConstruct(S);
3041}
3042
3043void ASTStmtWriter::VisitOpenACCWaitConstruct(OpenACCWaitConstruct *S) {
3044 VisitStmt(S);
3045 Record.push_back(S->getExprs().size());
3046 VisitOpenACCConstructStmt(S);
3047 Record.AddSourceLocation(S->LParenLoc);
3048 Record.AddSourceLocation(S->RParenLoc);
3049 Record.AddSourceLocation(S->QueuesLoc);
3050
3051 for(Expr *E : S->getExprs())
3052 Record.AddStmt(E);
3053
3055}
3056
3057void ASTStmtWriter::VisitOpenACCAtomicConstruct(OpenACCAtomicConstruct *S) {
3058 VisitStmt(S);
3059 VisitOpenACCConstructStmt(S);
3060 Record.writeEnum(S->getAtomicKind());
3061 Record.AddStmt(S->getAssociatedStmt());
3062
3064}
3065
3066void ASTStmtWriter::VisitOpenACCCacheConstruct(OpenACCCacheConstruct *S) {
3067 VisitStmt(S);
3068 Record.push_back(S->getVarList().size());
3069 VisitOpenACCConstructStmt(S);
3070 Record.AddSourceRange(S->ParensLoc);
3071 Record.AddSourceLocation(S->ReadOnlyLoc);
3072
3073 for (Expr *E : S->getVarList())
3074 Record.AddStmt(E);
3076}
3077
3078//===----------------------------------------------------------------------===//
3079// HLSL Constructs/Directives.
3080//===----------------------------------------------------------------------===//
3081
3082void ASTStmtWriter::VisitHLSLOutArgExpr(HLSLOutArgExpr *S) {
3083 VisitExpr(S);
3084 Record.AddStmt(S->getOpaqueArgLValue());
3085 Record.AddStmt(S->getCastedTemporary());
3086 Record.AddStmt(S->getWritebackCast());
3087 Record.writeBool(S->isInOut());
3089}
3090
3091//===----------------------------------------------------------------------===//
3092// ASTWriter Implementation
3093//===----------------------------------------------------------------------===//
3094
3096 assert(!SwitchCaseIDs.contains(S) && "SwitchCase recorded twice");
3097 unsigned NextID = SwitchCaseIDs.size();
3098 SwitchCaseIDs[S] = NextID;
3099 return NextID;
3100}
3101
3103 assert(SwitchCaseIDs.contains(S) && "SwitchCase hasn't been seen yet");
3104 return SwitchCaseIDs[S];
3105}
3106
3108 SwitchCaseIDs.clear();
3109}
3110
3111/// Write the given substatement or subexpression to the
3112/// bitstream.
3113void ASTWriter::WriteSubStmt(ASTContext &Context, Stmt *S) {
3115 ASTStmtWriter Writer(Context, *this, Record);
3116 ++NumStatements;
3117
3118 if (!S) {
3119 Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
3120 return;
3121 }
3122
3123 llvm::DenseMap<Stmt *, uint64_t>::iterator I = SubStmtEntries.find(S);
3124 if (I != SubStmtEntries.end()) {
3125 Record.push_back(I->second);
3126 Stream.EmitRecord(serialization::STMT_REF_PTR, Record);
3127 return;
3128 }
3129
3130#ifndef NDEBUG
3131 assert(!ParentStmts.count(S) && "There is a Stmt cycle!");
3132
3133 struct ParentStmtInserterRAII {
3134 Stmt *S;
3135 llvm::DenseSet<Stmt *> &ParentStmts;
3136
3137 ParentStmtInserterRAII(Stmt *S, llvm::DenseSet<Stmt *> &ParentStmts)
3138 : S(S), ParentStmts(ParentStmts) {
3139 ParentStmts.insert(S);
3140 }
3141 ~ParentStmtInserterRAII() {
3142 ParentStmts.erase(S);
3143 }
3144 };
3145
3146 ParentStmtInserterRAII ParentStmtInserter(S, ParentStmts);
3147#endif
3148
3149 Writer.Visit(S);
3150
3151 uint64_t Offset = Writer.Emit();
3152 SubStmtEntries[S] = Offset;
3153}
3154
3155/// Flush all of the statements that have been added to the
3156/// queue via AddStmt().
3157void ASTRecordWriter::FlushStmts() {
3158 // We expect to be the only consumer of the two temporary statement maps,
3159 // assert that they are empty.
3160 assert(Writer->SubStmtEntries.empty() && "unexpected entries in sub-stmt map");
3161 assert(Writer->ParentStmts.empty() && "unexpected entries in parent stmt map");
3162
3163 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3164 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[I]);
3165
3166 assert(N == StmtsToEmit.size() && "record modified while being written!");
3167
3168 // Note that we are at the end of a full expression. Any
3169 // expression records that follow this one are part of a different
3170 // expression.
3171 Writer->Stream.EmitRecord(serialization::STMT_STOP, ArrayRef<uint32_t>());
3172
3173 Writer->SubStmtEntries.clear();
3174 Writer->ParentStmts.clear();
3175 }
3176
3177 StmtsToEmit.clear();
3178}
3179
3180void ASTRecordWriter::FlushSubStmts() {
3181 // For a nested statement, write out the substatements in reverse order (so
3182 // that a simple stack machine can be used when loading), and don't emit a
3183 // STMT_STOP after each one.
3184 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3185 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[N - I - 1]);
3186 assert(N == StmtsToEmit.size() && "record modified while being written!");
3187 }
3188
3189 StmtsToEmit.clear();
3190}
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)
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
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
SourceLocation getTargetCallLoc() const
Return location of target-call.
bool hasCancel() const
Return true if current directive has inner cancel directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
bool canBeParallelFor() const
Return true if current loop directive's associated loop can be a parallel for.
bool hasCancel() const
Return true if current directive has inner cancel directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
const Stmt * getAssociatedStmt() const
OpenACCAtomicKind getAtomicKind() const
ArrayRef< Expr * > getVarList() const
OpenACCDirectiveKind getParentComputeConstructKind() const
unsigned getBitWidth() const
llvm::APInt getValue() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:220
An object for streaming information to a record.
void push_back(uint64_t N)
Minimal vector-like interface.
void AddTemplateKWAndArgsInfo(const ASTTemplateKWAndArgsInfo &ArgInfo, const TemplateArgumentLoc *Args)
ASTStmtWriter(const ASTStmtWriter &)=delete
ASTStmtWriter & operator=(const ASTStmtWriter &)=delete
ASTStmtWriter(ASTContext &Context, ASTWriter &Writer, ASTWriter::RecordData &Record)
Writes an AST file containing the contents of a translation unit.
Definition ASTWriter.h:97
unsigned getSwitchCaseID(SwitchCase *S)
Retrieve the ID for the given switch-case statement.
unsigned RecordSwitchCaseID(SwitchCase *S)
Record an ID for the given switch-case statement.
unsigned getCompoundStmtAbbrev() const
Definition ASTWriter.h:901
SmallVector< uint64_t, 64 > RecordData
Definition ASTWriter.h:102
SourceLocation getColonLoc() const
Definition Expr.h:4381
SourceLocation getQuestionLoc() const
Definition Expr.h:4380
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition Expr.h:4550
SourceLocation getAmpAmpLoc() const
Definition Expr.h:4565
SourceLocation getLabelLoc() const
Definition Expr.h:4567
LabelDecl * getLabel() const
Definition Expr.h:4573
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition Expr.h:6021
Represents a loop initializing the elements of an array.
Definition Expr.h:5968
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition Expr.h:7171
SourceLocation getRBracketLoc() const
Definition Expr.h:7286
Expr * getBase()
Get base of the array section.
Definition Expr.h:7249
Expr * getLength()
Get length of array section.
Definition Expr.h:7259
bool isOMPArraySection() const
Definition Expr.h:7245
Expr * getStride()
Get stride of array section.
Definition Expr.h:7263
SourceLocation getColonLocSecond() const
Definition Expr.h:7281
Expr * getLowerBound()
Get lower bound of array section.
Definition Expr.h:7253
SourceLocation getColonLocFirst() const
Definition Expr.h:7280
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition Expr.h:2721
SourceLocation getRBracketLoc() const
Definition Expr.h:2769
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
Definition Expr.h:2750
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition ExprCXX.h:2996
uint64_t getValue() const
Definition ExprCXX.h:3044
ArrayTypeTrait getTrait() const
Definition ExprCXX.h:3036
Expr * getDimensionExpression() const
Definition ExprCXX.h:3046
TypeSourceInfo * getQueriedTypeSourceInfo() const
Definition ExprCXX.h:3042
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition Expr.h:6685
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition Expr.h:6704
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_astype token.
Definition Expr.h:6707
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition Expr.h:6710
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition Stmt.h:3268
bool isVolatile() const
Definition Stmt.h:3304
SourceLocation getAsmLoc() const
Definition Stmt.h:3298
unsigned getNumClobbers() const
Definition Stmt.h:3349
unsigned getNumOutputs() const
Definition Stmt.h:3317
unsigned getNumInputs() const
Definition Stmt.h:3339
bool isSimple() const
Definition Stmt.h:3301
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition Expr.h:6880
Expr ** getSubExprs()
Definition Expr.h:6955
SourceLocation getRParenLoc() const
Definition Expr.h:7009
static unsigned getNumSubExprs(AtomicOp Op)
Determine the number of arguments the specified atomic builtin should have.
Definition Expr.cpp:5156
AtomicOp getOp() const
Definition Expr.h:6943
SourceLocation getBuiltinLoc() const
Definition Expr.h:7008
Represents an attribute applied to a statement.
Definition Stmt.h:2194
Stmt * getSubStmt()
Definition Stmt.h:2230
SourceLocation getAttrLoc() const
Definition Stmt.h:2225
ArrayRef< const Attr * > getAttrs() const
Definition Stmt.h:2226
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition Expr.h:4453
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condition evaluates to false; ...
Definition Expr.h:4507
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition Expr.h:4491
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value.
Definition Expr.h:4495
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
Definition Expr.h:4500
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Definition Expr.h:4488
A builtin binary operation expression such as "x + y" or "x <= y".
Definition Expr.h:4038
Expr * getLHS() const
Definition Expr.h:4088
SourceLocation getOperatorLoc() const
Definition Expr.h:4080
bool hasStoredFPFeatures() const
Definition Expr.h:4223
Expr * getRHS() const
Definition Expr.h:4090
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:4235
Opcode getOpcode() const
Definition Expr.h:4083
bool hasExcludedOverflowPattern() const
Definition Expr.h:4230
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
Definition ASTWriter.h:1074
void addBit(bool Value)
Definition ASTWriter.h:1094
void addBits(uint32_t Value, uint32_t BitsWidth)
Definition ASTWriter.h:1095
void reset(uint32_t Value)
Definition ASTWriter.h:1089
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition Expr.h:6624
const BlockDecl * getBlockDecl() const
Definition Expr.h:6636
BreakStmt - This represents a break.
Definition Stmt.h:3126
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition ExprCXX.h:5476
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5495
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5494
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition Expr.h:3969
SourceLocation getRParenLoc() const
Definition Expr.h:4004
SourceLocation getLParenLoc() const
Definition Expr.h:4001
Represents a call to a CUDA kernel function.
Definition ExprCXX.h:234
const CallExpr * getConfig() const
Definition ExprCXX.h:260
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Definition ExprCXX.h:604
Represents binding an expression to a temporary.
Definition ExprCXX.h:1493
CXXTemporary * getTemporary()
Definition ExprCXX.h:1511
const Expr * getSubExpr() const
Definition ExprCXX.h:1515
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition ExprCXX.h:723
bool getValue() const
Definition ExprCXX.h:740
SourceLocation getLocation() const
Definition ExprCXX.h:746
CXXCatchStmt - This represents a C++ catch block.
Definition StmtCXX.h:28
SourceLocation getCatchLoc() const
Definition StmtCXX.h:48
Stmt * getHandlerBlock() const
Definition StmtCXX.h:51
VarDecl * getExceptionDecl() const
Definition StmtCXX.h:49
A C++ const_cast expression (C++ [expr.const.cast]).
Definition ExprCXX.h:566
Represents a call to a C++ constructor.
Definition ExprCXX.h:1548
SourceRange getParenOrBraceRange() const
Definition ExprCXX.h:1729
bool isElidable() const
Whether this construction is elidable.
Definition ExprCXX.h:1617
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1.
Definition ExprCXX.h:1622
Expr * getArg(unsigned Arg)
Return the specified argument.
Definition ExprCXX.h:1691
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition ExprCXX.h:1641
bool isImmediateEscalating() const
Definition ExprCXX.h:1706
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called.
Definition ExprCXX.h:1650
SourceLocation getLocation() const
Definition ExprCXX.h:1613
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition ExprCXX.h:1611
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition ExprCXX.h:1630
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Definition ExprCXX.h:1688
CXXConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition ExprCXX.h:1659
A default argument (C++ [dcl.fct.default]).
Definition ExprCXX.h:1270
SourceLocation getUsedLocation() const
Retrieve the location where this default argument was actually used.
Definition ExprCXX.h:1344
const ParmVarDecl * getParam() const
Definition ExprCXX.h:1312
const DeclContext * getUsedContext() const
Definition ExprCXX.h:1340
bool hasRewrittenInit() const
Definition ExprCXX.h:1315
A use of a default initializer in a constructor or in aggregate initialization.
Definition ExprCXX.h:1377
const DeclContext * getUsedContext() const
Definition ExprCXX.h:1434
const Expr * getRewrittenExpr() const
Retrieve the initializing expression with evaluated immediate calls, if any.
Definition ExprCXX.h:1422
bool hasRewrittenInit() const
Definition ExprCXX.h:1406
FieldDecl * getField()
Get the field whose initializer will be used.
Definition ExprCXX.h:1411
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition ExprCXX.h:2626
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2665
bool isArrayForm() const
Definition ExprCXX.h:2652
SourceLocation getBeginLoc() const
Definition ExprCXX.h:2676
bool isGlobalDelete() const
Definition ExprCXX.h:2651
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2661
bool isArrayFormAsWritten() const
Definition ExprCXX.h:2653
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition ExprCXX.h:3870
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:3969
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:3972
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition ExprCXX.h:4064
NamedDecl * getFirstQualifierFoundInScope() const
Retrieve the first part of the nested-name-specifier that was found in the scope of the member access...
Definition ExprCXX.h:3996
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:3960
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information.
Definition ExprCXX.h:3983
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition ExprCXX.h:3952
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition ExprCXX.h:481
Represents a folding of a pack over an operator.
Definition ExprCXX.h:5032
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Definition StmtCXX.h:135
DeclStmt * getBeginStmt()
Definition StmtCXX.h:163
DeclStmt * getLoopVarStmt()
Definition StmtCXX.h:169
DeclStmt * getEndStmt()
Definition StmtCXX.h:166
SourceLocation getForLoc() const
Definition StmtCXX.h:202
DeclStmt * getRangeStmt()
Definition StmtCXX.h:162
SourceLocation getRParenLoc() const
Definition StmtCXX.h:205
SourceLocation getColonLoc() const
Definition StmtCXX.h:204
SourceLocation getCoawaitLoc() const
Definition StmtCXX.h:203
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Definition ExprCXX.h:1831
SourceLocation getLParenLoc() const
Definition ExprCXX.h:1868
SourceLocation getRParenLoc() const
Definition ExprCXX.h:1870
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition ExprCXX.h:1751
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition ExprCXX.h:1792
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
Definition ExprCXX.h:1788
SourceLocation getLocation() const LLVM_READONLY
Definition ExprCXX.h:1804
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
Definition ExprCXX.h:1802
Represents a call to a member function that may be written either with member call syntax (e....
Definition ExprCXX.h:179
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition ExprCXX.h:375
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
Definition ExprCXX.h:406
SourceRange getAngleBrackets() const LLVM_READONLY
Definition ExprCXX.h:413
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
Definition ExprCXX.h:409
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition ExprCXX.h:2355
bool isArray() const
Definition ExprCXX.h:2464
SourceRange getDirectInitRange() const
Definition ExprCXX.h:2609
ExprIterator arg_iterator
Definition ExprCXX.h:2569
ImplicitAllocationParameters implicitAllocationParameters() const
Provides the full set of information about expected implicit parameters in this call.
Definition ExprCXX.h:2562
bool hasInitializer() const
Whether this new-expression has any initializer at all.
Definition ExprCXX.h:2524
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2461
unsigned getNumPlacementArgs() const
Definition ExprCXX.h:2494
TypeSourceInfo * getAllocatedTypeSourceInfo() const
Definition ExprCXX.h:2438
SourceRange getSourceRange() const
Definition ExprCXX.h:2610
SourceRange getTypeIdParens() const
Definition ExprCXX.h:2516
bool isParenTypeId() const
Definition ExprCXX.h:2515
raw_arg_iterator raw_arg_end()
Definition ExprCXX.h:2596
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2556
raw_arg_iterator raw_arg_begin()
Definition ExprCXX.h:2595
FunctionDecl * getOperatorNew() const
Definition ExprCXX.h:2459
bool isGlobalNew() const
Definition ExprCXX.h:2521
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition ExprCXX.h:4309
bool getValue() const
Definition ExprCXX.h:4332
Expr * getOperand() const
Definition ExprCXX.h:4326
SourceRange getSourceRange() const
Definition ExprCXX.h:4330
The null pointer literal (C++11 [lex.nullptr])
Definition ExprCXX.h:768
SourceLocation getLocation() const
Definition ExprCXX.h:782
A call to an overloaded operator written using operator syntax.
Definition ExprCXX.h:84
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Definition ExprCXX.h:114
Represents a list-initialization with parenthesis.
Definition ExprCXX.h:5141
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5197
SourceLocation getInitLoc() const LLVM_READONLY
Definition ExprCXX.h:5199
MutableArrayRef< Expr * > getInitExprs()
Definition ExprCXX.h:5181
ArrayRef< Expr * > getUserSpecifiedInitExprs()
Definition ExprCXX.h:5187
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5195
FieldDecl * getInitializedFieldInUnion()
Definition ExprCXX.h:5219
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition ExprCXX.h:2745
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Definition ExprCXX.h:2839
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise,...
Definition ExprCXX.h:2809
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2823
SourceLocation getTildeLoc() const
Retrieve the location of the '~'.
Definition ExprCXX.h:2830
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information.
Definition ExprCXX.h:2798
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
Definition ExprCXX.h:2854
SourceLocation getColonColonLoc() const
Retrieve the location of the '::' in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2827
SourceLocation getOperatorLoc() const
Retrieve the location of the '.' or '->' operator.
Definition ExprCXX.h:2812
const IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
Definition ExprCXX.h:2846
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition ExprCXX.h:526
A rewritten comparison expression that was originally written using operator syntax.
Definition ExprCXX.h:286
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
Definition ExprCXX.h:304
bool isReversed() const
Determine whether this expression was rewritten in reverse form.
Definition ExprCXX.h:322
An expression "T()" which creates an rvalue of a non-class type T.
Definition ExprCXX.h:2196
TypeSourceInfo * getTypeSourceInfo() const
Definition ExprCXX.h:2215
SourceLocation getRParenLoc() const
Definition ExprCXX.h:2219
A C++ static_cast expression (C++ [expr.static.cast]).
Definition ExprCXX.h:436
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition ExprCXX.h:800
Represents a C++ functional cast expression that builds a temporary object.
Definition ExprCXX.h:1899
TypeSourceInfo * getTypeSourceInfo() const
Definition ExprCXX.h:1928
Represents the this expression in C++.
Definition ExprCXX.h:1154
bool isCapturedByCopyInLambdaWithExplicitObjectParameter() const
Definition ExprCXX.h:1180
bool isImplicit() const
Definition ExprCXX.h:1177
SourceLocation getLocation() const
Definition ExprCXX.h:1171
A C++ throw-expression (C++ [except.throw]).
Definition ExprCXX.h:1208
const Expr * getSubExpr() const
Definition ExprCXX.h:1228
SourceLocation getThrowLoc() const
Definition ExprCXX.h:1231
bool isThrownVariableInScope() const
Determines whether the variable thrown by this expression (if any!) is within the innermost try block...
Definition ExprCXX.h:1238
CXXTryStmt - A C++ try block, including all handlers.
Definition StmtCXX.h:69
SourceLocation getTryLoc() const
Definition StmtCXX.h:95
CXXCatchStmt * getHandler(unsigned i)
Definition StmtCXX.h:108
unsigned getNumHandlers() const
Definition StmtCXX.h:107
CompoundStmt * getTryBlock()
Definition StmtCXX.h:100
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition ExprCXX.h:848
bool isTypeOperand() const
Definition ExprCXX.h:884
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition ExprCXX.h:891
Expr * getExprOperand() const
Definition ExprCXX.h:895
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprCXX.h:902
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition ExprCXX.h:3744
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
Definition ExprCXX.h:3788
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition ExprCXX.h:3799
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
Definition ExprCXX.h:3782
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
Definition ExprCXX.h:3793
unsigned getNumArgs() const
Retrieve the number of arguments.
Definition ExprCXX.h:3802
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition ExprCXX.h:1068
Expr * getExprOperand() const
Definition ExprCXX.h:1109
MSGuidDecl * getGuidDecl() const
Definition ExprCXX.h:1114
bool isTypeOperand() const
Definition ExprCXX.h:1098
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition ExprCXX.h:1105
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprCXX.h:1118
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:2943
bool hasStoredFPFeatures() const
Definition Expr.h:3102
bool usesMemberSyntax() const
Definition Expr.h:3104
ExprIterator arg_iterator
Definition Expr.h:3190
arg_iterator arg_begin()
Definition Expr.h:3200
arg_iterator arg_end()
Definition Expr.h:3203
ADLCallKind getADLCallKind() const
Definition Expr.h:3094
Expr * getCallee()
Definition Expr.h:3090
FPOptionsOverride getFPFeatures() const
Definition Expr.h:3242
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition Expr.h:3134
bool isCoroElideSafe() const
Definition Expr.h:3117
SourceLocation getRParenLoc() const
Definition Expr.h:3274
This captures a statement into a function.
Definition Stmt.h:3918
capture_init_range capture_inits()
Definition Stmt.h:4086
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition Stmt.cpp:1455
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
Definition Stmt.h:4069
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Definition Stmt.h:4039
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition Stmt.h:4022
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
Definition Stmt.h:4064
capture_range captures()
Definition Stmt.h:4056
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
Definition Stmt.cpp:1470
CaseStmt - Represent a case statement.
Definition Stmt.h:1911
Stmt * getSubStmt()
Definition Stmt.h:2024
Expr * getLHS()
Definition Stmt.h:1994
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ... RHS, which is a GNU extension.
Definition Stmt.h:1974
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
Definition Stmt.h:1980
Expr * getRHS()
Definition Stmt.h:2006
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition Expr.h:3676
path_iterator path_begin()
Definition Expr.h:3746
unsigned path_size() const
Definition Expr.h:3745
CastKind getCastKind() const
Definition Expr.h:3720
bool hasStoredFPFeatures() const
Definition Expr.h:3775
path_iterator path_end()
Definition Expr.h:3747
CXXBaseSpecifier ** path_iterator
Definition Expr.h:3742
FPOptionsOverride getFPFeatures() const
Definition Expr.h:3796
Expr * getSubExpr()
Definition Expr.h:3726
SourceLocation getLocation() const
Definition Expr.h:1621
unsigned getValue() const
Definition Expr.h:1629
CharacterLiteralKind getKind() const
Definition Expr.h:1622
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition Expr.h:4848
SourceLocation getBuiltinLoc() const
Definition Expr.h:4895
Expr * getLHS() const
Definition Expr.h:4890
bool isConditionDependent() const
Definition Expr.h:4878
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
Definition Expr.h:4871
Expr * getRHS() const
Definition Expr.h:4892
SourceLocation getRParenLoc() const
Definition Expr.h:4898
Expr * getCond() const
Definition Expr.h:4888
Represents a 'co_await' expression.
Definition ExprCXX.h:5369
bool isImplicit() const
Definition ExprCXX.h:5391
CompoundAssignOperator - For compound assignments (e.g.
Definition Expr.h:4300
QualType getComputationLHSType() const
Definition Expr.h:4334
QualType getComputationResultType() const
Definition Expr.h:4337
CompoundLiteralExpr - [C99 6.5.2.5].
Definition Expr.h:3605
SourceLocation getLParenLoc() const
Definition Expr.h:3640
bool isFileScope() const
Definition Expr.h:3637
const Expr * getInitializer() const
Definition Expr.h:3633
TypeSourceInfo * getTypeSourceInfo() const
Definition Expr.h:3643
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition Stmt.h:1731
unsigned size() const
Definition Stmt.h:1776
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
Definition Stmt.h:1781
body_range body()
Definition Stmt.h:1794
SourceLocation getLBracLoc() const
Definition Stmt.h:1848
bool hasStoredFPFeatures() const
Definition Stmt.h:1778
SourceLocation getRBracLoc() const
Definition Stmt.h:1849
Represents the specialization of a concept - evaluates to a prvalue of type bool.
ConceptReference * getConceptReference() const
const ImplicitConceptSpecializationDecl * getSpecializationDecl() const
const ASTConstraintSatisfaction & getSatisfaction() const
Get elaborated satisfaction info about the template arguments' satisfaction of the named concept.
ConditionalOperator - The ?
Definition Expr.h:4391
Expr * getLHS() const
Definition Expr.h:4425
Expr * getCond() const
getCond - Return the expression representing the condition for the ?
Definition Expr.h:4414
Expr * getRHS() const
Definition Expr.h:4426
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition Expr.h:1082
ConstantResultStorageKind getResultStorageKind() const
Definition Expr.h:1151
ContinueStmt - This represents a continue.
Definition Stmt.h:3110
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition Expr.h:4719
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition Expr.h:4823
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_convertvector token.
Definition Expr.h:4820
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:4782
TypeSourceInfo * getTypeSourceInfo() const
getTypeSourceInfo - Return the destination type.
Definition Expr.h:4812
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition Expr.h:4777
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition Expr.h:4809
Represents a 'co_return' statement in the C++ Coroutines TS.
Definition StmtCXX.h:473
Expr * getOperand() const
Retrieve the operand of the 'co_return' statement.
Definition StmtCXX.h:497
Expr * getPromiseCall() const
Retrieve the promise call that results from this 'co_return' statement.
Definition StmtCXX.h:502
bool isImplicit() const
Definition StmtCXX.h:506
SourceLocation getKeywordLoc() const
Definition StmtCXX.h:493
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:5255
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5346
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition ExprCXX.h:5309
Represents a 'co_yield' expression.
Definition ExprCXX.h:5450
NamedDecl * getDecl() const
AccessSpecifier getAccess() const
iterator begin()
Definition DeclGroup.h:95
A reference to a declared variable, function, enum, etc.
Definition Expr.h:1270
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition Expr.h:1445
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition Expr.h:1381
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
Definition Expr.h:1474
bool hasTemplateKWAndArgsInfo() const
Definition Expr.h:1391
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier,...
Definition Expr.h:1359
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name,...
Definition Expr.h:1363
ValueDecl * getDecl()
Definition Expr.h:1338
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition Expr.h:1468
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
Definition Expr.h:1457
SourceLocation getLocation() const
Definition Expr.h:1346
bool isImmediateEscalating() const
Definition Expr.h:1478
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition Stmt.h:1622
SourceLocation getEndLoc() const
Definition Stmt.h:1645
const DeclGroupRef getDeclGroup() const
Definition Stmt.h:1640
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:1648
NameKind
The kind of the name stored in this DeclarationName.
Stmt * getSubStmt()
Definition Stmt.h:2072
DeferStmt - This represents a deferred statement.
Definition Stmt.h:3227
Stmt * getBody()
Definition Stmt.h:3246
SourceLocation getDeferLoc() const
Definition Stmt.h:3241
Represents a 'co_await' expression while the type of the promise is dependent.
Definition ExprCXX.h:5401
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5430
A qualified reference to a name whose declaration cannot yet be resolved.
Definition ExprCXX.h:3510
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
Definition ExprCXX.h:3558
Represents a C99 designated initializer expression.
Definition Expr.h:5551
Expr * getSubExpr(unsigned Idx) const
Definition Expr.h:5833
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
Definition Expr.h:5815
MutableArrayRef< Designator > designators()
Definition Expr.h:5784
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the '=' that precedes the initializer value itself, if present.
Definition Expr.h:5806
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression,...
Definition Expr.h:5831
InitListExpr * getUpdater() const
Definition Expr.h:5936
DoStmt - This represents a 'do/while' stmt.
Definition Stmt.h:2823
Stmt * getBody()
Definition Stmt.h:2848
Expr * getCond()
Definition Stmt.h:2841
SourceLocation getWhileLoc() const
Definition Stmt.h:2854
SourceLocation getDoLoc() const
Definition Stmt.h:2852
SourceLocation getRParenLoc() const
Definition Stmt.h:2856
Represents a reference to emded data.
Definition Expr.h:5126
unsigned getStartingElementPos() const
Definition Expr.h:5147
SourceLocation getEndLoc() const
Definition Expr.h:5141
StringLiteral * getDataStringLiteral() const
Definition Expr.h:5143
SourceLocation getBeginLoc() const
Definition Expr.h:5140
size_t getDataElementCount() const
Definition Expr.h:5148
ExplicitCastExpr - An explicit cast written in the source code.
Definition Expr.h:3928
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Definition Expr.h:3950
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition ExprCXX.h:3661
bool cleanupsHaveSideEffects() const
Definition ExprCXX.h:3696
ArrayRef< CleanupObject > getObjects() const
Definition ExprCXX.h:3685
unsigned getNumObjects() const
Definition ExprCXX.h:3689
This represents one expression.
Definition Expr.h:112
bool isValueDependent() const
Determines whether the value of this expression depends on.
Definition Expr.h:177
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Definition Expr.h:444
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Definition Expr.h:451
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition Expr.cpp:276
QualType getType() const
Definition Expr.h:144
ExprDependence getDependence() const
Definition Expr.h:164
An expression trait intrinsic.
Definition ExprCXX.h:3069
Expr * getQueriedExpression() const
Definition ExprCXX.h:3108
ExpressionTrait getTrait() const
Definition ExprCXX.h:3104
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition Expr.h:6564
SourceLocation getAccessorLoc() const
Definition Expr.h:6588
const Expr * getBase() const
Definition Expr.h:6581
IdentifierInfo & getAccessor() const
Definition Expr.h:6585
storage_type getAsOpaqueInt() const
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition Expr.h:1581
unsigned getScale() const
Definition Expr.h:1585
llvm::APInt getValue() const
Returns an internal integer representation of the literal.
Definition Expr.h:1575
SourceLocation getLocation() const
Definition Expr.h:1707
llvm::APFloatBase::Semantics getRawSemantics() const
Get a raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE,...
Definition Expr.h:1676
llvm::APFloat getValue() const
Definition Expr.h:1666
bool isExact() const
Definition Expr.h:1699
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition Stmt.h:2879
Stmt * getInit()
Definition Stmt.h:2894
SourceLocation getRParenLoc() const
Definition Stmt.h:2939
Stmt * getBody()
Definition Stmt.h:2923
Expr * getInc()
Definition Stmt.h:2922
SourceLocation getForLoc() const
Definition Stmt.h:2935
Expr * getCond()
Definition Stmt.h:2921
SourceLocation getLParenLoc() const
Definition Stmt.h:2937
DeclStmt * getConditionVariableDeclStmt()
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
Definition Stmt.h:2909
const Expr * getSubExpr() const
Definition Expr.h:1062
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Definition ExprCXX.h:4841
ValueDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition ExprCXX.h:4874
ValueDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition ExprCXX.h:4867
iterator end() const
Definition ExprCXX.h:4876
unsigned getNumExpansions() const
Get the number of parameters in this parameter pack.
Definition ExprCXX.h:4879
SourceLocation getParameterPackLocation() const
Get the location of the parameter pack.
Definition ExprCXX.h:4870
iterator begin() const
Definition ExprCXX.h:4875
This represents a GCC inline-assembly statement extension.
Definition Stmt.h:3427
unsigned getNumLabels() const
Definition Stmt.h:3577
SourceLocation getRParenLoc() const
Definition Stmt.h:3449
IdentifierInfo * getInputIdentifier(unsigned i) const
Definition Stmt.h:3542
const Expr * getOutputConstraintExpr(unsigned i) const
Definition Stmt.h:3529
IdentifierInfo * getLabelIdentifier(unsigned i) const
Definition Stmt.h:3581
const Expr * getInputConstraintExpr(unsigned i) const
Definition Stmt.h:3555
IdentifierInfo * getOutputIdentifier(unsigned i) const
Definition Stmt.h:3518
const Expr * getAsmStringExpr() const
Definition Stmt.h:3454
Expr * getOutputExpr(unsigned i)
Definition Stmt.cpp:544
Expr * getClobberExpr(unsigned i)
Definition Stmt.h:3634
Expr * getInputExpr(unsigned i)
Definition Stmt.cpp:555
AddrLabelExpr * getLabelExpr(unsigned i) const
Definition Stmt.cpp:563
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition Expr.h:4923
SourceLocation getTokenLocation() const
getTokenLocation - The location of the __null token.
Definition Expr.h:4937
Represents a C11 generic selection.
Definition Expr.h:6178
unsigned getNumAssocs() const
The number of association expressions.
Definition Expr.h:6418
bool isExprPredicate() const
Whether this generic selection uses an expression as its controlling argument.
Definition Expr.h:6434
SourceLocation getGenericLoc() const
Definition Expr.h:6531
SourceLocation getRParenLoc() const
Definition Expr.h:6535
SourceLocation getDefaultLoc() const
Definition Expr.h:6534
GotoStmt - This represents a direct goto.
Definition Stmt.h:2960
SourceLocation getLabelLoc() const
Definition Stmt.h:2978
SourceLocation getGotoLoc() const
Definition Stmt.h:2976
LabelDecl * getLabel() const
Definition Stmt.h:2973
This class represents temporary values used to represent inout and out arguments in HLSL.
Definition Expr.h:7349
const OpaqueValueExpr * getCastedTemporary() const
Definition Expr.h:7400
const OpaqueValueExpr * getOpaqueArgLValue() const
Definition Expr.h:7381
bool isInOut() const
returns true if the parameter is inout and false if the parameter is out.
Definition Expr.h:7408
const Expr * getWritebackCast() const
Definition Expr.h:7395
IfStmt - This represents an if/then/else.
Definition Stmt.h:2250
Stmt * getThen()
Definition Stmt.h:2339
SourceLocation getIfLoc() const
Definition Stmt.h:2416
IfStatementKind getStatementKind() const
Definition Stmt.h:2451
SourceLocation getElseLoc() const
Definition Stmt.h:2419
Stmt * getInit()
Definition Stmt.h:2400
SourceLocation getLParenLoc() const
Definition Stmt.h:2468
Expr * getCond()
Definition Stmt.h:2327
Stmt * getElse()
Definition Stmt.h:2348
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Definition Stmt.h:2383
SourceLocation getRParenLoc() const
Definition Stmt.h:2470
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
Definition Expr.h:1731
const Expr * getSubExpr() const
Definition Expr.h:1743
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition Expr.h:3853
bool isPartOfExplicitCast() const
Definition Expr.h:3884
Represents an implicitly-generated value initialization of an object of a given type.
Definition Expr.h:6057
IndirectGotoStmt - This represents an indirect goto.
Definition Stmt.h:2999
SourceLocation getGotoLoc() const
Definition Stmt.h:3015
SourceLocation getStarLoc() const
Definition Stmt.h:3017
Describes an C or C++ initializer list.
Definition Expr.h:5299
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition Expr.h:5425
unsigned getNumInits() const
Definition Expr.h:5329
SourceLocation getLBraceLoc() const
Definition Expr.h:5460
InitListExpr * getSyntacticForm() const
Definition Expr.h:5472
bool hadArrayRangeDesignator() const
Definition Expr.h:5483
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition Expr.h:5401
SourceLocation getRBraceLoc() const
Definition Expr.h:5462
const Expr * getInit(unsigned Init) const
Definition Expr.h:5353
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition Expr.h:1536
LabelStmt - Represents a label, which has a substatement.
Definition Stmt.h:2137
LabelDecl * getDecl() const
Definition Stmt.h:2155
bool isSideEntry() const
Definition Stmt.h:2184
Stmt * getSubStmt()
Definition Stmt.h:2159
SourceLocation getIdentLoc() const
Definition Stmt.h:2152
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition ExprCXX.h:1968
Expr ** capture_init_iterator
Iterator that walks over the capture initialization arguments.
Definition ExprCXX.h:2075
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Definition ExprCXX.h:2106
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition ExprCXX.h:2094
Base class for BreakStmt and ContinueStmt.
Definition Stmt.h:3048
SourceLocation getLabelLoc() const
Definition Stmt.h:3083
LabelDecl * getLabelDecl()
Definition Stmt.h:3086
SourceLocation getKwLoc() const
Definition Stmt.h:3073
bool hasLabelTarget() const
Definition Stmt.h:3081
This represents a Microsoft inline-assembly statement extension.
Definition Stmt.h:3646
Token * getAsmToks()
Definition Stmt.h:3677
Expr * getOutputExpr(unsigned i)
Definition Stmt.cpp:881
StringRef getAsmString() const
Definition Stmt.h:3680
SourceLocation getLBraceLoc() const
Definition Stmt.h:3669
SourceLocation getEndLoc() const
Definition Stmt.h:3671
StringRef getInputConstraint(unsigned i) const
Definition Stmt.h:3700
StringRef getOutputConstraint(unsigned i) const
Definition Stmt.h:3687
StringRef getClobber(unsigned i) const
Definition Stmt.h:3724
unsigned getNumAsmToks()
Definition Stmt.h:3676
Expr * getInputExpr(unsigned i)
Definition Stmt.cpp:885
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
Definition StmtCXX.h:253
bool isIfExists() const
Determine whether this is an __if_exists statement.
Definition StmtCXX.h:278
DeclarationNameInfo getNameInfo() const
Retrieve the name of the entity we're testing for, along with location information.
Definition StmtCXX.h:289
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies this name, if any.
Definition StmtCXX.h:285
CompoundStmt * getSubStmt() const
Retrieve the compound statement that will be included in the program only if the existence of the sym...
Definition StmtCXX.h:293
SourceLocation getKeywordLoc() const
Retrieve the location of the __if_exists or __if_not_exists keyword.
Definition StmtCXX.h:275
A member reference to an MSPropertyDecl.
Definition ExprCXX.h:936
NestedNameSpecifierLoc getQualifierLoc() const
Definition ExprCXX.h:992
bool isArrow() const
Definition ExprCXX.h:990
MSPropertyDecl * getPropertyDecl() const
Definition ExprCXX.h:989
Expr * getBaseExpr() const
Definition ExprCXX.h:988
SourceLocation getMemberLoc() const
Definition ExprCXX.h:991
MS property subscript expression.
Definition ExprCXX.h:1006
SourceLocation getRBracketLoc() const
Definition ExprCXX.h:1043
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition ExprCXX.h:4920
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
Definition ExprCXX.h:4937
LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl()
Definition ExprCXX.h:4960
MatrixSingleSubscriptExpr - Matrix single subscript expression for the MatrixType extension when you ...
Definition Expr.h:2795
SourceLocation getRBracketLoc() const
Definition Expr.h:2839
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition Expr.h:2865
SourceLocation getRBracketLoc() const
Definition Expr.h:2917
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition Expr.h:3364
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
Definition Expr.h:3553
SourceLocation getOperatorLoc() const
Definition Expr.h:3546
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name,...
Definition Expr.h:3466
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition Expr.h:3447
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition Expr.h:3588
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
Definition Expr.h:3461
Expr * getBase() const
Definition Expr.h:3441
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition Expr.h:3529
bool hadMultipleCandidates() const
Returns true if this member expression refers to a method that was resolved from an overloaded set ha...
Definition Expr.h:3568
bool isArrow() const
Definition Expr.h:3548
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Definition Expr.h:3451
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition Decl.h:340
Represents a place-holder for an object not to be initialized by anything.
Definition Expr.h:5877
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition Stmt.h:1694
SourceLocation getSemiLoc() const
Definition Stmt.h:1705
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
Definition ExprOpenMP.h:24
Expr * getBase()
Fetches base expression of array shaping expression.
Definition ExprOpenMP.h:90
SourceLocation getLParenLoc() const
Definition ExprOpenMP.h:68
ArrayRef< Expr * > getDimensions() const
Fetches the dimensions for array shaping expression.
Definition ExprOpenMP.h:80
SourceLocation getRParenLoc() const
Definition ExprOpenMP.h:71
ArrayRef< SourceRange > getBracketsRanges() const
Fetches source ranges for the brackets os the array shaping expression.
Definition ExprOpenMP.h:85
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition ExprOpenMP.h:151
SourceLocation getLParenLoc() const
Definition ExprOpenMP.h:242
SourceLocation getSecondColonLoc(unsigned I) const
Gets the location of the second ':' (if any) in the range for the given iteratori definition.
Definition Expr.cpp:5468
SourceLocation getColonLoc(unsigned I) const
Gets the location of the first ':' in the range for the given iterator definition.
Definition Expr.cpp:5462
SourceLocation getRParenLoc() const
Definition ExprOpenMP.h:245
IteratorRange getIteratorRange(unsigned I)
Gets the iterator range for the given iterator.
Definition Expr.cpp:5439
OMPIteratorHelperData & getHelper(unsigned I)
Fetches helper data for the specified iteration space.
Definition Expr.cpp:5478
SourceLocation getAssignLoc(unsigned I) const
Gets the location of '=' for the given iterator definition.
Definition Expr.cpp:5456
SourceLocation getIteratorKwLoc() const
Definition ExprOpenMP.h:248
unsigned numOfIterators() const
Returns number of iterator definitions.
Definition ExprOpenMP.h:275
Decl * getIteratorDecl(unsigned I)
Gets the iterator declaration for the given iterator.
Definition Expr.cpp:5435
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Definition ExprObjC.h:192
Expr * getElement(unsigned Index)
getElement - Return the Element at the specified index.
Definition ExprObjC.h:230
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c array literal.
Definition ExprObjC.h:227
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprObjC.h:218
ObjCMethodDecl * getArrayWithObjectsMethod() const
Definition ExprObjC.h:239
Represents Objective-C's @catch statement.
Definition StmtObjC.h:77
const VarDecl * getCatchParamDecl() const
Definition StmtObjC.h:97
const Stmt * getCatchBody() const
Definition StmtObjC.h:93
SourceLocation getAtCatchLoc() const
Definition StmtObjC.h:105
SourceLocation getRParenLoc() const
Definition StmtObjC.h:107
Represents Objective-C's @finally statement.
Definition StmtObjC.h:127
const Stmt * getFinallyBody() const
Definition StmtObjC.h:139
SourceLocation getAtFinallyLoc() const
Definition StmtObjC.h:148
Represents Objective-C's @synchronized statement.
Definition StmtObjC.h:303
const Expr * getSynchExpr() const
Definition StmtObjC.h:331
const CompoundStmt * getSynchBody() const
Definition StmtObjC.h:323
SourceLocation getAtSynchronizedLoc() const
Definition StmtObjC.h:320
Represents Objective-C's @throw statement.
Definition StmtObjC.h:358
const Expr * getThrowExpr() const
Definition StmtObjC.h:370
SourceLocation getThrowLoc() const LLVM_READONLY
Definition StmtObjC.h:374
Represents Objective-C's @try ... @catch ... @finally statement.
Definition StmtObjC.h:167
const ObjCAtFinallyStmt * getFinallyStmt() const
Retrieve the @finally statement, if any.
Definition StmtObjC.h:241
unsigned getNumCatchStmts() const
Retrieve the number of @catch statements in this try-catch-finally block.
Definition StmtObjC.h:220
const Stmt * getTryBody() const
Retrieve the @try body.
Definition StmtObjC.h:214
SourceLocation getAtTryLoc() const
Retrieve the location of the @ in the @try.
Definition StmtObjC.h:210
catch_range catch_stmts()
Definition StmtObjC.h:282
Represents Objective-C's @autoreleasepool Statement.
Definition StmtObjC.h:394
SourceLocation getAtLoc() const
Definition StmtObjC.h:414
const Stmt * getSubStmt() const
Definition StmtObjC.h:405
A runtime availability query.
Definition ExprObjC.h:1700
SourceRange getSourceRange() const
Definition ExprObjC.h:1719
VersionTuple getVersion() const
Definition ExprObjC.h:1723
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition ExprObjC.h:88
SourceLocation getLocation() const
Definition ExprObjC.h:107
ObjCBoxedExpr - used for generalized expression boxing.
Definition ExprObjC.h:128
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprObjC.h:162
ObjCMethodDecl * getBoxingMethod() const
Definition ExprObjC.h:147
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
Definition ExprObjC.h:1640
SourceLocation getLParenLoc() const
Definition ExprObjC.h:1663
SourceLocation getBridgeKeywordLoc() const
The location of the bridge keyword.
Definition ExprObjC.h:1674
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
Definition ExprObjC.h:1666
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition ExprObjC.h:307
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
Definition ExprObjC.h:358
ObjCMethodDecl * getDictWithObjectsMethod() const
Definition ExprObjC.h:375
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
Definition ExprObjC.h:360
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprObjC.h:381
ObjCEncodeExpr, used for @encode in Objective-C.
Definition ExprObjC.h:407
TypeSourceInfo * getEncodedTypeSourceInfo() const
Definition ExprObjC.h:428
SourceLocation getRParenLoc() const
Definition ExprObjC.h:423
SourceLocation getAtLoc() const
Definition ExprObjC.h:421
Represents Objective-C's collection statement.
Definition StmtObjC.h:23
SourceLocation getForLoc() const
Definition StmtObjC.h:52
SourceLocation getRParenLoc() const
Definition StmtObjC.h:54
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition ExprObjC.h:1579
bool shouldCopy() const
shouldCopy - True if we should do the 'copy' part of the copy-restore.
Definition ExprObjC.h:1607
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
Definition ExprObjC.h:1495
SourceLocation getIsaMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
Definition ExprObjC.h:1527
SourceLocation getOpLoc() const
Definition ExprObjC.h:1530
Expr * getBase() const
Definition ExprObjC.h:1520
bool isArrow() const
Definition ExprObjC.h:1522
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition ExprObjC.h:546
SourceLocation getLocation() const
Definition ExprObjC.h:589
SourceLocation getOpLoc() const
Definition ExprObjC.h:597
ObjCIvarDecl * getDecl()
Definition ExprObjC.h:576
bool isArrow() const
Definition ExprObjC.h:584
bool isFreeIvar() const
Definition ExprObjC.h:585
const Expr * getBase() const
Definition ExprObjC.h:580
An expression that sends a message to the given Objective-C object or class.
Definition ExprObjC.h:937
bool isDelegateInitCall() const
isDelegateInitCall - Answers whether this message send has been tagged as a "delegate init call",...
Definition ExprObjC.h:1418
SourceLocation getLeftLoc() const
Definition ExprObjC.h:1421
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Definition ExprObjC.h:1265
SourceLocation getSuperLoc() const
Retrieve the location of the 'super' keyword for a class or instance message to 'super',...
Definition ExprObjC.h:1306
Selector getSelector() const
Definition ExprObjC.cpp:289
@ SuperInstance
The receiver is the instance of the superclass object.
Definition ExprObjC.h:951
@ Instance
The receiver is an object instance.
Definition ExprObjC.h:945
@ SuperClass
The receiver is a superclass.
Definition ExprObjC.h:948
@ Class
The receiver is a class.
Definition ExprObjC.h:942
TypeSourceInfo * getClassReceiverTypeInfo() const
Returns a type-source information of a class message send, or nullptr if the message is not a class m...
Definition ExprObjC.h:1293
QualType getSuperType() const
Retrieve the type referred to by 'super'.
Definition ExprObjC.h:1341
const ObjCMethodDecl * getMethodDecl() const
Definition ExprObjC.h:1361
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition ExprObjC.h:1226
arg_iterator arg_begin()
Definition ExprObjC.h:1474
SourceLocation getRightLoc() const
Definition ExprObjC.h:1422
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver.
Definition ExprObjC.h:1387
arg_iterator arg_end()
Definition ExprObjC.h:1476
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition ExprObjC.h:614
ObjCPropertyDecl * getExplicitProperty() const
Definition ExprObjC.h:703
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition ExprObjC.h:708
SourceLocation getReceiverLocation() const
Definition ExprObjC.h:757
const Expr * getBase() const
Definition ExprObjC.h:752
bool isObjectReceiver() const
Definition ExprObjC.h:767
QualType getSuperReceiverType() const
Definition ExprObjC.h:759
bool isImplicitProperty() const
Definition ExprObjC.h:700
ObjCMethodDecl * getImplicitPropertySetter() const
Definition ExprObjC.h:713
ObjCInterfaceDecl * getClassReceiver() const
Definition ExprObjC.h:763
SourceLocation getLocation() const
Definition ExprObjC.h:755
bool isSuperReceiver() const
Definition ExprObjC.h:768
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition ExprObjC.h:502
ObjCProtocolDecl * getProtocol() const
Definition ExprObjC.h:519
SourceLocation getRParenLoc() const
Definition ExprObjC.h:524
SourceLocation getAtLoc() const
Definition ExprObjC.h:523
ObjCSelectorExpr used for @selector in Objective-C.
Definition ExprObjC.h:452
SourceLocation getRParenLoc() const
Definition ExprObjC.h:470
Selector getSelector() const
Definition ExprObjC.h:466
SourceLocation getAtLoc() const
Definition ExprObjC.h:469
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition ExprObjC.h:52
SourceLocation getAtLoc() const
Definition ExprObjC.h:69
StringLiteral * getString()
Definition ExprObjC.h:65
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition ExprObjC.h:836
Expr * getKeyExpr() const
Definition ExprObjC.h:878
Expr * getBaseExpr() const
Definition ExprObjC.h:875
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition ExprObjC.h:881
SourceLocation getRBracket() const
Definition ExprObjC.h:866
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition ExprObjC.h:885
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Definition Expr.h:2527
Expr * getIndexExpr(unsigned Idx)
Definition Expr.h:2586
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition Expr.h:2560
const OffsetOfNode & getComponent(unsigned Idx) const
Definition Expr.h:2574
TypeSourceInfo * getTypeSourceInfo() const
Definition Expr.h:2567
unsigned getNumExpressions() const
Definition Expr.h:2598
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
Definition Expr.h:2564
unsigned getNumComponents() const
Definition Expr.h:2582
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
Definition Expr.h:2479
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition Expr.h:2485
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition Expr.cpp:1687
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this offsetof node.
Definition Expr.h:2506
@ Array
An index into an array.
Definition Expr.h:2426
@ Identifier
A field in a dependent type, known only by its name.
Definition Expr.h:2430
@ Field
A field.
Definition Expr.h:2428
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Definition Expr.h:2433
Kind getKind() const
Determine what kind of offsetof node this is.
Definition Expr.h:2475
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
Definition Expr.h:2495
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition Expr.h:1178
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition Expr.h:1228
SourceLocation getLocation() const
Retrieve the location of this expression.
Definition Expr.h:1200
bool isUnique() const
Definition Expr.h:1236
This is a base class for any OpenACC statement-level constructs that have an associated statement.
Definition StmtOpenACC.h:81
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
Definition Expr.h:2090
SourceLocation getLocation() const
Definition Expr.h:2107
This is the base class for an OpenACC statement-level construct, other construct types are expected t...
Definition StmtOpenACC.h:26
ArrayRef< const OpenACCClause * > clauses() const
Definition StmtOpenACC.h:67
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Definition ExprCXX.h:3128
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition ExprCXX.h:4282
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
Definition ExprCXX.h:3235
UnresolvedSetImpl::iterator decls_iterator
Definition ExprCXX.h:3219
decls_iterator decls_begin() const
Definition ExprCXX.h:3221
unsigned getNumDecls() const
Gets the number of declarations in the unresolved set.
Definition ExprCXX.h:3232
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
Definition ExprCXX.h:3250
TemplateArgumentLoc * getTrailingTemplateArgumentLoc()
Return the optional template arguments.
Definition ExprCXX.h:4292
bool hasTemplateKWAndArgsInfo() const
Definition ExprCXX.h:3172
decls_iterator decls_end() const
Definition ExprCXX.h:3224
DeclarationName getName() const
Gets the name looked up.
Definition ExprCXX.h:3238
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition ExprCXX.h:4363
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition ExprCXX.h:4392
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
Definition ExprCXX.h:4399
SourceLocation getEllipsisLoc() const
Determine the location of the 'sizeof' keyword.
Definition ExprCXX.h:4613
Expr * getIndexExpr() const
Definition ExprCXX.h:4628
ArrayRef< Expr * > getExpressions() const
Return the trailing expressions, regardless of the expansion.
Definition ExprCXX.h:4646
SourceLocation getRSquareLoc() const
Determine the location of the right parenthesis.
Definition ExprCXX.h:4619
Expr * getPackIdExpression() const
Definition ExprCXX.h:4624
ParenExpr - This represents a parenthesized expression, e.g.
Definition Expr.h:2182
SourceLocation getLParen() const
Get the location of the left parentheses '('.
Definition Expr.h:2207
const Expr * getSubExpr() const
Definition Expr.h:2199
bool isProducedByFoldExpansion() const
Definition Expr.h:2224
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
Definition Expr.h:2211
ArrayRef< Expr * > exprs()
Definition Expr.h:6123
unsigned getNumExprs() const
Return the number of expressions in this paren list.
Definition Expr.h:6110
SourceLocation getLParenLoc() const
Definition Expr.h:6125
SourceLocation getRParenLoc() const
Definition Expr.h:6126
[C99 6.4.2.2] - A predefined identifier such as func.
Definition Expr.h:2005
bool isTransparent() const
Definition Expr.h:2044
PredefinedIdentKind getIdentKind() const
Definition Expr.h:2040
SourceLocation getLocation() const
Definition Expr.h:2046
StringLiteral * getFunctionName()
Definition Expr.h:2049
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition Expr.h:6756
semantics_iterator semantics_end()
Definition Expr.h:6821
unsigned getResultExprIndex() const
Return the index of the result-bearing expression into the semantics expressions, or PseudoObjectExpr...
Definition Expr.h:6798
semantics_iterator semantics_begin()
Definition Expr.h:6817
Expr *const * semantics_iterator
Definition Expr.h:6815
unsigned getNumSemanticExprs() const
Definition Expr.h:6813
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Definition Expr.h:6793
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition Expr.h:7455
SourceLocation getEndLoc() const
Definition Expr.h:7474
child_range children()
Definition Expr.h:7468
SourceLocation getBeginLoc() const
Definition Expr.h:7473
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
RequiresExprBodyDecl * getBody() const
ArrayRef< concepts::Requirement * > getRequirements() const
ArrayRef< ParmVarDecl * > getLocalParameters() const
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Definition Stmt.h:3151
SourceLocation getReturnLoc() const
Definition Stmt.h:3200
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization.
Definition Stmt.h:3187
Expr * getRetValue()
Definition Stmt.h:3178
CompoundStmt * getBlock() const
Definition Stmt.h:3774
SourceLocation getExceptLoc() const
Definition Stmt.h:3767
Expr * getFilterExpr() const
Definition Stmt.h:3770
SourceLocation getFinallyLoc() const
Definition Stmt.h:3808
CompoundStmt * getBlock() const
Definition Stmt.h:3811
Represents a __leave statement.
Definition Stmt.h:3879
SourceLocation getLeaveLoc() const
Definition Stmt.h:3889
CompoundStmt * getTryBlock() const
Definition Stmt.h:3855
SourceLocation getTryLoc() const
Definition Stmt.h:3850
bool getIsCXXTry() const
Definition Stmt.h:3853
Stmt * getHandler() const
Definition Stmt.h:3859
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Definition StmtSYCL.h:37
CompoundStmt * getOriginalStmt()
Retrieve the model statement.
Definition StmtSYCL.h:54
OutlinedFunctionDecl * getOutlinedFunctionDecl()
Retrieve the outlined function declaration.
Definition StmtSYCL.h:61
SourceLocation getLocation() const
Definition Expr.h:2155
SourceLocation getLParenLocation() const
Definition Expr.h:2156
TypeSourceInfo * getTypeSourceInfo()
Definition Expr.h:2143
SourceLocation getRParenLocation() const
Definition Expr.h:2157
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition Expr.h:4643
SourceLocation getBuiltinLoc() const
Definition Expr.h:4660
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
Definition Expr.h:4676
SourceLocation getRParenLoc() const
Definition Expr.h:4663
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
Definition Expr.h:4682
Represents an expression that computes the length of a parameter pack.
Definition ExprCXX.h:4441
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
Definition ExprCXX.h:4526
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition ExprCXX.h:4531
unsigned getPackLength() const
Retrieve the length of the parameter pack.
Definition ExprCXX.h:4515
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Definition Expr.h:5017
SourceLocation getBeginLoc() const
Definition Expr.h:5062
const DeclContext * getParentContext() const
If the SourceLocExpr has been resolved return the subexpression representing the resolved value.
Definition Expr.h:5058
SourceLocation getEndLoc() const
Definition Expr.h:5063
SourceLocIdentKind getIdentKind() const
Definition Expr.h:5037
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition Expr.h:4595
CompoundStmt * getSubStmt()
Definition Expr.h:4612
unsigned getTemplateDepth() const
Definition Expr.h:4624
SourceLocation getRParenLoc() const
Definition Expr.h:4621
SourceLocation getLParenLoc() const
Definition Expr.h:4619
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
Definition Stmt.h:85
LambdaExprBitfields LambdaExprBits
Definition Stmt.h:1384
StmtClass getStmtClass() const
Definition Stmt.h:1484
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition Stmt.cpp:338
TypeTraitExprBitfields TypeTraitExprBits
Definition Stmt.h:1373
CXXNewExprBitfields CXXNewExprBits
Definition Stmt.h:1371
ConstantExprBitfields ConstantExprBits
Definition Stmt.h:1336
RequiresExprBitfields RequiresExprBits
Definition Stmt.h:1385
CXXFoldExprBitfields CXXFoldExprBits
Definition Stmt.h:1388
PackIndexingExprBitfields PackIndexingExprBits
Definition Stmt.h:1389
NullStmtBitfields NullStmtBits
Definition Stmt.h:1319
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition Stmt.h:1374
StringLiteral - This represents a string literal expression, e.g.
Definition Expr.h:1799
SourceLocation getStrTokenLoc(unsigned TokNum) const
Get one of the string literal token.
Definition Expr.h:1945
bool isPascal() const
Definition Expr.h:1922
unsigned getLength() const
Definition Expr.h:1909
StringLiteralKind getKind() const
Definition Expr.h:1912
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
Definition Expr.h:1875
unsigned getByteLength() const
Definition Expr.h:1908
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
Definition Expr.h:1940
unsigned getCharByteWidth() const
Definition Expr.h:1910
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition ExprCXX.h:4664
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition ExprCXX.h:4709
UnsignedOrNone getPackIndex() const
Definition ExprCXX.h:4715
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4713
SourceLocation getNameLoc() const
Definition ExprCXX.h:4699
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition ExprCXX.h:4754
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
Definition ExprCXX.cpp:1799
SourceLocation getParameterPackLocation() const
Retrieve the location of the parameter pack name.
Definition ExprCXX.h:4802
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition ExprCXX.h:4788
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4792
SourceLocation getKeywordLoc() const
Definition Stmt.h:1888
SourceLocation getColonLoc() const
Definition Stmt.h:1890
const SwitchCase * getNextSwitchCase() const
Definition Stmt.h:1884
SwitchStmt - This represents a 'switch' stmt.
Definition Stmt.h:2500
SourceLocation getSwitchLoc() const
Definition Stmt.h:2635
SourceLocation getLParenLoc() const
Definition Stmt.h:2637
bool isAllEnumCasesCovered() const
Returns true if the SwitchStmt is a switch of an enum value and all cases have been explicitly covere...
Definition Stmt.h:2660
SourceLocation getRParenLoc() const
Definition Stmt.h:2639
Expr * getCond()
Definition Stmt.h:2563
Stmt * getBody()
Definition Stmt.h:2575
Stmt * getInit()
Definition Stmt.h:2580
SwitchCase * getSwitchCaseList()
Definition Stmt.h:2631
DeclStmt * getConditionVariableDeclStmt()
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Definition Stmt.h:2614
Location wrapper for a TemplateArgument.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition ExprCXX.h:2896
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition ExprCXX.h:2961
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition ExprCXX.h:2958
const APValue & getAPValue() const
Definition ExprCXX.h:2952
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition Expr.h:2625
SourceLocation getRParenLoc() const
Definition Expr.h:2701
SourceLocation getOperatorLoc() const
Definition Expr.h:2698
TypeSourceInfo * getArgumentTypeInfo() const
Definition Expr.h:2671
UnaryExprOrTypeTrait getKind() const
Definition Expr.h:2657
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition Expr.h:2244
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition Expr.h:2289
Expr * getSubExpr() const
Definition Expr.h:2285
Opcode getOpcode() const
Definition Expr.h:2280
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition Expr.h:2381
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:2384
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition Expr.h:2298
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition ExprCXX.h:3390
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
Definition ExprCXX.h:3464
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition ExprCXX.h:3459
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition ExprCXX.h:4126
QualType getBaseType() const
Definition ExprCXX.h:4208
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:4218
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:4221
bool hasUnresolvedUsing() const
Determine whether the lookup results contain an unresolved using declaration.
Definition ExprCXX.h:4212
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:4199
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
Definition ExprCXX.cpp:1645
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Definition ExprCXX.h:640
Represents a call to the builtin function __builtin_va_arg.
Definition Expr.h:4957
TypeSourceInfo * getWrittenTypeInfo() const
Definition Expr.h:4981
SourceLocation getBuiltinLoc() const
Definition Expr.h:4984
SourceLocation getRParenLoc() const
Definition Expr.h:4987
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
Definition Expr.h:4978
const Expr * getSubExpr() const
Definition Expr.h:4973
WhileStmt - This represents a 'while' stmt.
Definition Stmt.h:2688
Expr * getCond()
Definition Stmt.h:2740
SourceLocation getWhileLoc() const
Definition Stmt.h:2793
SourceLocation getRParenLoc() const
Definition Stmt.h:2798
DeclStmt * getConditionVariableDeclStmt()
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Definition Stmt.h:2776
SourceLocation getLParenLoc() const
Definition Stmt.h:2796
Stmt * getBody()
Definition Stmt.h:2752
StmtCode
Record codes for each kind of statement or expression.
@ EXPR_DESIGNATED_INIT
A DesignatedInitExpr record.
@ EXPR_COMPOUND_LITERAL
A CompoundLiteralExpr record.
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
@ EXPR_OBJC_IVAR_REF_EXPR
An ObjCIvarRefExpr record.
@ EXPR_MEMBER
A MemberExpr record.
@ EXPR_CXX_TEMPORARY_OBJECT
A CXXTemporaryObjectExpr record.
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
@ EXPR_CXX_STATIC_CAST
A CXXStaticCastExpr record.
@ EXPR_OBJC_STRING_LITERAL
An ObjCStringLiteral record.
@ EXPR_VA_ARG
A VAArgExpr record.
@ EXPR_OBJC_ISA
An ObjCIsa Expr record.
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
@ STMT_OBJC_AT_TRY
An ObjCAtTryStmt record.
@ STMT_DO
A DoStmt record.
@ STMT_OBJC_CATCH
An ObjCAtCatchStmt record.
@ STMT_IF
An IfStmt record.
@ EXPR_STRING_LITERAL
A StringLiteral record.
@ EXPR_OBJC_AVAILABILITY_CHECK
An ObjCAvailabilityCheckExpr record.
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_DIRECTIVE
@ EXPR_PSEUDO_OBJECT
A PseudoObjectExpr record.
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
@ STMT_CAPTURED
A CapturedStmt record.
@ STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE
@ STMT_GCCASM
A GCC-style AsmStmt record.
@ EXPR_IMAGINARY_LITERAL
An ImaginaryLiteral record.
@ STMT_WHILE
A WhileStmt record.
@ EXPR_CONVERT_VECTOR
A ConvertVectorExpr record.
@ EXPR_OBJC_SUBSCRIPT_REF_EXPR
An ObjCSubscriptRefExpr record.
@ EXPR_STMT
A StmtExpr record.
@ EXPR_CXX_REINTERPRET_CAST
A CXXReinterpretCastExpr record.
@ EXPR_DESIGNATED_INIT_UPDATE
A DesignatedInitUpdateExpr record.
@ STMT_OBJC_AT_SYNCHRONIZED
An ObjCAtSynchronizedStmt record.
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
@ EXPR_BUILTIN_BIT_CAST
A BuiltinBitCastExpr record.
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
@ STMT_SYCLKERNELCALL
A SYCLKernelCallStmt record.
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
@ EXPR_OBJC_ENCODE
An ObjCEncodeExpr record.
@ EXPR_CSTYLE_CAST
A CStyleCastExpr record.
@ EXPR_OBJC_BOOL_LITERAL
An ObjCBoolLiteralExpr record.
@ EXPR_EXT_VECTOR_ELEMENT
An ExtVectorElementExpr record.
@ EXPR_ATOMIC
An AtomicExpr record.
@ EXPR_OFFSETOF
An OffsetOfExpr record.
@ STMT_RETURN
A ReturnStmt record.
@ STMT_OBJC_FOR_COLLECTION
An ObjCForCollectionStmt record.
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE
@ EXPR_ARRAY_INIT_LOOP
An ArrayInitLoopExpr record.
@ STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_SIMD_DIRECTIVE
@ STMT_CONTINUE
A ContinueStmt record.
@ EXPR_PREDEFINED
A PredefinedExpr record.
@ EXPR_CXX_BOOL_LITERAL
A CXXBoolLiteralExpr record.
@ EXPR_PAREN_LIST
A ParenListExpr record.
@ EXPR_CXX_PAREN_LIST_INIT
A CXXParenListInitExpr record.
@ STMT_COMPOUND
A CompoundStmt record.
@ STMT_FOR
A ForStmt record.
@ STMT_ATTRIBUTED
An AttributedStmt record.
@ STMT_OMP_TARGET_TEAMS_GENERIC_LOOP_DIRECTIVE
@ EXPR_CXX_REWRITTEN_BINARY_OPERATOR
A CXXRewrittenBinaryOperator record.
@ STMT_GOTO
A GotoStmt record.
@ EXPR_NO_INIT
An NoInitExpr record.
@ EXPR_OBJC_PROTOCOL_EXPR
An ObjCProtocolExpr record.
@ EXPR_ARRAY_INIT_INDEX
An ArrayInitIndexExpr record.
@ EXPR_CXX_CONSTRUCT
A CXXConstructExpr record.
@ STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
@ STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE
@ STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
@ EXPR_CXX_DYNAMIC_CAST
A CXXDynamicCastExpr record.
@ STMT_CXX_TRY
A CXXTryStmt record.
@ EXPR_GENERIC_SELECTION
A GenericSelectionExpr record.
@ EXPR_OBJC_INDIRECT_COPY_RESTORE
An ObjCIndirectCopyRestoreExpr record.
@ EXPR_CXX_INHERITED_CTOR_INIT
A CXXInheritedCtorInitExpr record.
@ EXPR_CALL
A CallExpr record.
@ EXPR_GNU_NULL
A GNUNullExpr record.
@ EXPR_OBJC_PROPERTY_REF_EXPR
An ObjCPropertyRefExpr record.
@ EXPR_CXX_CONST_CAST
A CXXConstCastExpr record.
@ STMT_REF_PTR
A reference to a previously [de]serialized Stmt record.
@ EXPR_OBJC_MESSAGE_EXPR
An ObjCMessageExpr record.
@ STMT_CASE
A CaseStmt record.
@ EXPR_CONSTANT
A constant expression context.
@ STMT_STOP
A marker record that indicates that we are at the end of an expression.
@ STMT_MSASM
A MS-style AsmStmt record.
@ EXPR_CONDITIONAL_OPERATOR
A ConditionOperator record.
@ EXPR_BINARY_OPERATOR
A BinaryOperator record.
@ EXPR_CXX_STD_INITIALIZER_LIST
A CXXStdInitializerListExpr record.
@ EXPR_SHUFFLE_VECTOR
A ShuffleVectorExpr record.
@ STMT_OBJC_FINALLY
An ObjCAtFinallyStmt record.
@ EXPR_OBJC_SELECTOR_EXPR
An ObjCSelectorExpr record.
@ EXPR_FLOATING_LITERAL
A FloatingLiteral record.
@ STMT_NULL_PTR
A NULL expression.
@ STMT_DEFAULT
A DefaultStmt record.
@ EXPR_CHOOSE
A ChooseExpr record.
@ STMT_NULL
A NullStmt record.
@ EXPR_DECL_REF
A DeclRefExpr record.
@ EXPR_INIT_LIST
An InitListExpr record.
@ EXPR_IMPLICIT_VALUE_INIT
An ImplicitValueInitExpr record.
@ STMT_OBJC_AUTORELEASE_POOL
An ObjCAutoreleasePoolStmt record.
@ EXPR_RECOVERY
A RecoveryExpr record.
@ EXPR_PAREN
A ParenExpr record.
@ STMT_OMP_TARGET_PARALLEL_GENERIC_LOOP_DIRECTIVE
@ STMT_LABEL
A LabelStmt record.
@ EXPR_CXX_FUNCTIONAL_CAST
A CXXFunctionalCastExpr record.
@ EXPR_USER_DEFINED_LITERAL
A UserDefinedLiteral record.
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
@ EXPR_SOURCE_LOC
A SourceLocExpr record.
@ EXPR_CXX_MEMBER_CALL
A CXXMemberCallExpr record.
@ STMT_SWITCH
A SwitchStmt record.
@ STMT_DECL
A DeclStmt record.
@ EXPR_SIZEOF_ALIGN_OF
A SizefAlignOfExpr record.
@ STMT_BREAK
A BreakStmt record.
@ STMT_OBJC_AT_THROW
An ObjCAtThrowStmt record.
@ EXPR_ADDR_LABEL
An AddrLabelExpr record.
@ STMT_CXX_FOR_RANGE
A CXXForRangeStmt record.
@ EXPR_CXX_ADDRSPACE_CAST
A CXXAddrspaceCastExpr record.
@ EXPR_ARRAY_SUBSCRIPT
An ArraySubscriptExpr record.
@ EXPR_UNARY_OPERATOR
A UnaryOperator record.
@ STMT_CXX_CATCH
A CXXCatchStmt record.
@ EXPR_BUILTIN_PP_EMBED
A EmbedExpr record.
@ STMT_INDIRECT_GOTO
An IndirectGotoStmt record.
@ DESIG_ARRAY_RANGE
GNU array range designator.
@ DESIG_FIELD_NAME
Field designator where only the field name is known.
@ DESIG_FIELD_DECL
Field designator where the field has been resolved to a declaration.
@ DESIG_ARRAY
Array designator.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
Definition Address.h:330
@ OK_Ordinary
An ordinary object is located at an address in memory.
Definition Specifiers.h:151
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
bool isAlignedAllocation(AlignedAllocationMode Mode)
Definition ExprCXX.h:2265
bool isTypeAwareAllocation(TypeAwareAllocationMode Mode)
Definition ExprCXX.h:2253
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
Definition Specifiers.h:135
U cast(CodeGen::Address addr)
Definition Address.h:327
unsigned long uint64_t
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition ASTConcept.h:91
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
SourceLocation TemplateKWLoc
The source location of the template keyword; this is used as part of the representation of qualified ...
AlignedAllocationMode PassAlignment
Definition ExprCXX.h:2307
TypeAwareAllocationMode PassTypeIdentity
Definition ExprCXX.h:2306
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
Expr * Value
The value of the dictionary element.
Definition ExprObjC.h:265
SourceLocation EllipsisLoc
The location of the ellipsis, if this is a pack expansion.
Definition ExprObjC.h:268
UnsignedOrNone NumExpansions
The number of elements this pack expansion will expand to, if this is a pack expansion and is known.
Definition ExprObjC.h:272
Expr * Key
The key for the dictionary element.
Definition ExprObjC.h:262
constexpr unsigned toInternalRepresentation() const