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::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
911 VisitExpr(E);
912 Record.AddStmt(E->getBase());
913 Record.AddStmt(E->getRowIdx());
914 Record.AddStmt(E->getColumnIdx());
915 Record.AddSourceLocation(E->getRBracketLoc());
917}
918
919void ASTStmtWriter::VisitArraySectionExpr(ArraySectionExpr *E) {
920 VisitExpr(E);
921 Record.writeEnum(E->ASType);
922 Record.AddStmt(E->getBase());
923 Record.AddStmt(E->getLowerBound());
924 Record.AddStmt(E->getLength());
925 if (E->isOMPArraySection())
926 Record.AddStmt(E->getStride());
927 Record.AddSourceLocation(E->getColonLocFirst());
928
929 if (E->isOMPArraySection())
930 Record.AddSourceLocation(E->getColonLocSecond());
931
932 Record.AddSourceLocation(E->getRBracketLoc());
934}
935
936void ASTStmtWriter::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
937 VisitExpr(E);
938 Record.push_back(E->getDimensions().size());
939 Record.AddStmt(E->getBase());
940 for (Expr *Dim : E->getDimensions())
941 Record.AddStmt(Dim);
942 for (SourceRange SR : E->getBracketsRanges())
943 Record.AddSourceRange(SR);
944 Record.AddSourceLocation(E->getLParenLoc());
945 Record.AddSourceLocation(E->getRParenLoc());
947}
948
949void ASTStmtWriter::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
950 VisitExpr(E);
951 Record.push_back(E->numOfIterators());
952 Record.AddSourceLocation(E->getIteratorKwLoc());
953 Record.AddSourceLocation(E->getLParenLoc());
954 Record.AddSourceLocation(E->getRParenLoc());
955 for (unsigned I = 0, End = E->numOfIterators(); I < End; ++I) {
956 Record.AddDeclRef(E->getIteratorDecl(I));
957 Record.AddSourceLocation(E->getAssignLoc(I));
958 OMPIteratorExpr::IteratorRange Range = E->getIteratorRange(I);
959 Record.AddStmt(Range.Begin);
960 Record.AddStmt(Range.End);
961 Record.AddStmt(Range.Step);
962 Record.AddSourceLocation(E->getColonLoc(I));
963 if (Range.Step)
964 Record.AddSourceLocation(E->getSecondColonLoc(I));
965 // Serialize helpers
966 OMPIteratorHelperData &HD = E->getHelper(I);
967 Record.AddDeclRef(HD.CounterVD);
968 Record.AddStmt(HD.Upper);
969 Record.AddStmt(HD.Update);
970 Record.AddStmt(HD.CounterUpdate);
971 }
973}
974
975void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
976 VisitExpr(E);
977
978 Record.push_back(E->getNumArgs());
979 CurrentPackingBits.updateBits();
980 CurrentPackingBits.addBit(static_cast<bool>(E->getADLCallKind()));
981 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
982 CurrentPackingBits.addBit(E->isCoroElideSafe());
983 CurrentPackingBits.addBit(E->usesMemberSyntax());
984
985 Record.AddSourceLocation(E->getRParenLoc());
986 Record.AddStmt(E->getCallee());
987 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
988 Arg != ArgEnd; ++Arg)
989 Record.AddStmt(*Arg);
990
991 if (E->hasStoredFPFeatures())
992 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
993
994 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
995 !E->isCoroElideSafe() && !E->usesMemberSyntax() &&
996 E->getStmtClass() == Stmt::CallExprClass)
997 AbbrevToUse = Writer.getCallExprAbbrev();
998
1000}
1001
1002void ASTStmtWriter::VisitRecoveryExpr(RecoveryExpr *E) {
1003 VisitExpr(E);
1004 Record.push_back(std::distance(E->children().begin(), E->children().end()));
1005 Record.AddSourceLocation(E->getBeginLoc());
1006 Record.AddSourceLocation(E->getEndLoc());
1007 for (Stmt *Child : E->children())
1008 Record.AddStmt(Child);
1010}
1011
1012void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
1013 VisitExpr(E);
1014
1015 bool HasQualifier = E->hasQualifier();
1016 bool HasFoundDecl = E->hasFoundDecl();
1017 bool HasTemplateInfo = E->hasTemplateKWAndArgsInfo();
1018 unsigned NumTemplateArgs = E->getNumTemplateArgs();
1019
1020 // Write these first for easy access when deserializing, as they affect the
1021 // size of the MemberExpr.
1022 CurrentPackingBits.updateBits();
1023 CurrentPackingBits.addBit(HasQualifier);
1024 CurrentPackingBits.addBit(HasFoundDecl);
1025 CurrentPackingBits.addBit(HasTemplateInfo);
1026 Record.push_back(NumTemplateArgs);
1027
1028 Record.AddStmt(E->getBase());
1029 Record.AddDeclRef(E->getMemberDecl());
1030 Record.AddDeclarationNameLoc(E->MemberDNLoc,
1031 E->getMemberDecl()->getDeclName());
1032 Record.AddSourceLocation(E->getMemberLoc());
1033 CurrentPackingBits.addBit(E->isArrow());
1034 CurrentPackingBits.addBit(E->hadMultipleCandidates());
1035 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
1036 Record.AddSourceLocation(E->getOperatorLoc());
1037
1038 if (HasQualifier)
1039 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1040
1041 if (HasFoundDecl) {
1042 DeclAccessPair FoundDecl = E->getFoundDecl();
1043 Record.AddDeclRef(FoundDecl.getDecl());
1044 CurrentPackingBits.addBits(FoundDecl.getAccess(), /*BitWidth=*/2);
1045 }
1046
1047 if (HasTemplateInfo)
1048 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1049 E->getTrailingObjects<TemplateArgumentLoc>());
1050
1052}
1053
1054void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1055 VisitExpr(E);
1056 Record.AddStmt(E->getBase());
1057 Record.AddSourceLocation(E->getIsaMemberLoc());
1058 Record.AddSourceLocation(E->getOpLoc());
1059 Record.push_back(E->isArrow());
1061}
1062
1063void ASTStmtWriter::
1064VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1065 VisitExpr(E);
1066 Record.AddStmt(E->getSubExpr());
1067 Record.push_back(E->shouldCopy());
1069}
1070
1071void ASTStmtWriter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1072 VisitExplicitCastExpr(E);
1073 Record.AddSourceLocation(E->getLParenLoc());
1074 Record.AddSourceLocation(E->getBridgeKeywordLoc());
1075 Record.push_back(E->getBridgeKind()); // FIXME: Stable encoding
1077}
1078
1079void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
1080 VisitExpr(E);
1081
1082 Record.push_back(E->path_size());
1083 CurrentPackingBits.updateBits();
1084 // 7 bits should be enough to store the casting kinds.
1085 CurrentPackingBits.addBits(E->getCastKind(), /*Width=*/7);
1086 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
1087 Record.AddStmt(E->getSubExpr());
1088
1090 PI = E->path_begin(), PE = E->path_end(); PI != PE; ++PI)
1091 Record.AddCXXBaseSpecifier(**PI);
1092
1093 if (E->hasStoredFPFeatures())
1094 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
1095}
1096
1097void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
1098 VisitExpr(E);
1099
1100 // Write this first for easy access when deserializing, as they affect the
1101 // size of the UnaryOperator.
1102 CurrentPackingBits.updateBits();
1103 CurrentPackingBits.addBits(E->getOpcode(), /*Width=*/6);
1104 bool HasFPFeatures = E->hasStoredFPFeatures();
1105 CurrentPackingBits.addBit(HasFPFeatures);
1106 CurrentPackingBits.addBit(E->hasExcludedOverflowPattern());
1107 Record.AddStmt(E->getLHS());
1108 Record.AddStmt(E->getRHS());
1109 Record.AddSourceLocation(E->getOperatorLoc());
1110 if (HasFPFeatures)
1111 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1112
1113 if (!HasFPFeatures && E->getValueKind() == VK_PRValue &&
1114 E->getObjectKind() == OK_Ordinary)
1115 AbbrevToUse = Writer.getBinaryOperatorAbbrev();
1116
1118}
1119
1120void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1121 VisitBinaryOperator(E);
1122 Record.AddTypeRef(E->getComputationLHSType());
1123 Record.AddTypeRef(E->getComputationResultType());
1124
1125 if (!E->hasStoredFPFeatures() && E->getValueKind() == VK_PRValue &&
1126 E->getObjectKind() == OK_Ordinary)
1127 AbbrevToUse = Writer.getCompoundAssignOperatorAbbrev();
1128
1130}
1131
1132void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
1133 VisitExpr(E);
1134 Record.AddStmt(E->getCond());
1135 Record.AddStmt(E->getLHS());
1136 Record.AddStmt(E->getRHS());
1137 Record.AddSourceLocation(E->getQuestionLoc());
1138 Record.AddSourceLocation(E->getColonLoc());
1140}
1141
1142void
1143ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1144 VisitExpr(E);
1145 Record.AddStmt(E->getOpaqueValue());
1146 Record.AddStmt(E->getCommon());
1147 Record.AddStmt(E->getCond());
1148 Record.AddStmt(E->getTrueExpr());
1149 Record.AddStmt(E->getFalseExpr());
1150 Record.AddSourceLocation(E->getQuestionLoc());
1151 Record.AddSourceLocation(E->getColonLoc());
1153}
1154
1155void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1156 VisitCastExpr(E);
1157 CurrentPackingBits.addBit(E->isPartOfExplicitCast());
1158
1159 if (E->path_size() == 0 && !E->hasStoredFPFeatures())
1160 AbbrevToUse = Writer.getExprImplicitCastAbbrev();
1161
1163}
1164
1165void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1166 VisitCastExpr(E);
1167 Record.AddTypeSourceInfo(E->getTypeInfoAsWritten());
1168}
1169
1170void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
1171 VisitExplicitCastExpr(E);
1172 Record.AddSourceLocation(E->getLParenLoc());
1173 Record.AddSourceLocation(E->getRParenLoc());
1175}
1176
1177void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1178 VisitExpr(E);
1179 Record.AddSourceLocation(E->getLParenLoc());
1180 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1181 Record.AddStmt(E->getInitializer());
1182 Record.push_back(E->isFileScope());
1184}
1185
1186void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1187 VisitExpr(E);
1188 Record.AddStmt(E->getBase());
1189 Record.AddIdentifierRef(&E->getAccessor());
1190 Record.AddSourceLocation(E->getAccessorLoc());
1192}
1193
1194void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
1195 VisitExpr(E);
1196 // NOTE: only add the (possibly null) syntactic form.
1197 // No need to serialize the isSemanticForm flag and the semantic form.
1198 Record.AddStmt(E->getSyntacticForm());
1199 Record.AddSourceLocation(E->getLBraceLoc());
1200 Record.AddSourceLocation(E->getRBraceLoc());
1201 bool isArrayFiller = isa<Expr *>(E->ArrayFillerOrUnionFieldInit);
1202 Record.push_back(isArrayFiller);
1203 if (isArrayFiller)
1204 Record.AddStmt(E->getArrayFiller());
1205 else
1206 Record.AddDeclRef(E->getInitializedFieldInUnion());
1207 Record.push_back(E->hadArrayRangeDesignator());
1208 Record.push_back(E->getNumInits());
1209 if (isArrayFiller) {
1210 // ArrayFiller may have filled "holes" due to designated initializer.
1211 // Replace them by 0 to indicate that the filler goes in that place.
1212 Expr *filler = E->getArrayFiller();
1213 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1214 Record.AddStmt(E->getInit(I) != filler ? E->getInit(I) : nullptr);
1215 } else {
1216 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1217 Record.AddStmt(E->getInit(I));
1218 }
1220}
1221
1222void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1223 VisitExpr(E);
1224 Record.push_back(E->getNumSubExprs());
1225 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1226 Record.AddStmt(E->getSubExpr(I));
1227 Record.AddSourceLocation(E->getEqualOrColonLoc());
1228 Record.push_back(E->usesGNUSyntax());
1229 for (const DesignatedInitExpr::Designator &D : E->designators()) {
1230 if (D.isFieldDesignator()) {
1231 if (FieldDecl *Field = D.getFieldDecl()) {
1232 Record.push_back(serialization::DESIG_FIELD_DECL);
1233 Record.AddDeclRef(Field);
1234 } else {
1235 Record.push_back(serialization::DESIG_FIELD_NAME);
1236 Record.AddIdentifierRef(D.getFieldName());
1237 }
1238 Record.AddSourceLocation(D.getDotLoc());
1239 Record.AddSourceLocation(D.getFieldLoc());
1240 } else if (D.isArrayDesignator()) {
1241 Record.push_back(serialization::DESIG_ARRAY);
1242 Record.push_back(D.getArrayIndex());
1243 Record.AddSourceLocation(D.getLBracketLoc());
1244 Record.AddSourceLocation(D.getRBracketLoc());
1245 } else {
1246 assert(D.isArrayRangeDesignator() && "Unknown designator");
1247 Record.push_back(serialization::DESIG_ARRAY_RANGE);
1248 Record.push_back(D.getArrayIndex());
1249 Record.AddSourceLocation(D.getLBracketLoc());
1250 Record.AddSourceLocation(D.getEllipsisLoc());
1251 Record.AddSourceLocation(D.getRBracketLoc());
1252 }
1253 }
1255}
1256
1257void ASTStmtWriter::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1258 VisitExpr(E);
1259 Record.AddStmt(E->getBase());
1260 Record.AddStmt(E->getUpdater());
1262}
1263
1264void ASTStmtWriter::VisitNoInitExpr(NoInitExpr *E) {
1265 VisitExpr(E);
1267}
1268
1269void ASTStmtWriter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1270 VisitExpr(E);
1271 Record.AddStmt(E->SubExprs[0]);
1272 Record.AddStmt(E->SubExprs[1]);
1274}
1275
1276void ASTStmtWriter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1277 VisitExpr(E);
1279}
1280
1281void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1282 VisitExpr(E);
1284}
1285
1286void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
1287 VisitExpr(E);
1288 Record.AddStmt(E->getSubExpr());
1289 Record.AddTypeSourceInfo(E->getWrittenTypeInfo());
1290 Record.AddSourceLocation(E->getBuiltinLoc());
1291 Record.AddSourceLocation(E->getRParenLoc());
1292 Record.push_back(E->isMicrosoftABI());
1294}
1295
1296void ASTStmtWriter::VisitSourceLocExpr(SourceLocExpr *E) {
1297 VisitExpr(E);
1298 Record.AddDeclRef(cast_or_null<Decl>(E->getParentContext()));
1299 Record.AddSourceLocation(E->getBeginLoc());
1300 Record.AddSourceLocation(E->getEndLoc());
1301 Record.push_back(llvm::to_underlying(E->getIdentKind()));
1303}
1304
1305void ASTStmtWriter::VisitEmbedExpr(EmbedExpr *E) {
1306 VisitExpr(E);
1307 Record.AddSourceLocation(E->getBeginLoc());
1308 Record.AddSourceLocation(E->getEndLoc());
1309 Record.AddStmt(E->getDataStringLiteral());
1310 Record.writeUInt32(E->getStartingElementPos());
1311 Record.writeUInt32(E->getDataElementCount());
1313}
1314
1315void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
1316 VisitExpr(E);
1317 Record.AddSourceLocation(E->getAmpAmpLoc());
1318 Record.AddSourceLocation(E->getLabelLoc());
1319 Record.AddDeclRef(E->getLabel());
1321}
1322
1323void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
1324 VisitExpr(E);
1325 Record.AddStmt(E->getSubStmt());
1326 Record.AddSourceLocation(E->getLParenLoc());
1327 Record.AddSourceLocation(E->getRParenLoc());
1328 Record.push_back(E->getTemplateDepth());
1330}
1331
1332void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
1333 VisitExpr(E);
1334 Record.AddStmt(E->getCond());
1335 Record.AddStmt(E->getLHS());
1336 Record.AddStmt(E->getRHS());
1337 Record.AddSourceLocation(E->getBuiltinLoc());
1338 Record.AddSourceLocation(E->getRParenLoc());
1339 Record.push_back(E->isConditionDependent() ? false : E->isConditionTrue());
1341}
1342
1343void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
1344 VisitExpr(E);
1345 Record.AddSourceLocation(E->getTokenLocation());
1347}
1348
1349void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1350 VisitExpr(E);
1351 Record.push_back(E->getNumSubExprs());
1352 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1353 Record.AddStmt(E->getExpr(I));
1354 Record.AddSourceLocation(E->getBuiltinLoc());
1355 Record.AddSourceLocation(E->getRParenLoc());
1357}
1358
1359void ASTStmtWriter::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1360 VisitExpr(E);
1361 bool HasFPFeatures = E->hasStoredFPFeatures();
1362 CurrentPackingBits.addBit(HasFPFeatures);
1363 Record.AddSourceLocation(E->getBuiltinLoc());
1364 Record.AddSourceLocation(E->getRParenLoc());
1365 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1366 Record.AddStmt(E->getSrcExpr());
1368 if (HasFPFeatures)
1369 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1370}
1371
1372void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
1373 VisitExpr(E);
1374 Record.AddDeclRef(E->getBlockDecl());
1376}
1377
1378void ASTStmtWriter::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1379 VisitExpr(E);
1380
1381 Record.push_back(E->getNumAssocs());
1382 Record.push_back(E->isExprPredicate());
1383 Record.push_back(E->ResultIndex);
1384 Record.AddSourceLocation(E->getGenericLoc());
1385 Record.AddSourceLocation(E->getDefaultLoc());
1386 Record.AddSourceLocation(E->getRParenLoc());
1387
1388 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1389 // Add 1 to account for the controlling expression which is the first
1390 // expression in the trailing array of Stmt *. This is not needed for
1391 // the trailing array of TypeSourceInfo *.
1392 for (unsigned I = 0, N = E->getNumAssocs() + 1; I < N; ++I)
1393 Record.AddStmt(Stmts[I]);
1394
1395 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1396 for (unsigned I = 0, N = E->getNumAssocs(); I < N; ++I)
1397 Record.AddTypeSourceInfo(TSIs[I]);
1398
1400}
1401
1402void ASTStmtWriter::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1403 VisitExpr(E);
1404 Record.push_back(E->getNumSemanticExprs());
1405
1406 // Push the result index. Currently, this needs to exactly match
1407 // the encoding used internally for ResultIndex.
1408 unsigned result = E->getResultExprIndex();
1409 result = (result == PseudoObjectExpr::NoResult ? 0 : result + 1);
1410 Record.push_back(result);
1411
1412 Record.AddStmt(E->getSyntacticForm());
1414 i = E->semantics_begin(), e = E->semantics_end(); i != e; ++i) {
1415 Record.AddStmt(*i);
1416 }
1418}
1419
1420void ASTStmtWriter::VisitAtomicExpr(AtomicExpr *E) {
1421 VisitExpr(E);
1422 Record.push_back(E->getOp());
1423 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1424 Record.AddStmt(E->getSubExprs()[I]);
1425 Record.AddSourceLocation(E->getBuiltinLoc());
1426 Record.AddSourceLocation(E->getRParenLoc());
1428}
1429
1430//===----------------------------------------------------------------------===//
1431// Objective-C Expressions and Statements.
1432//===----------------------------------------------------------------------===//
1433
1434void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1435 VisitExpr(E);
1436 Record.AddStmt(E->getString());
1437 Record.AddSourceLocation(E->getAtLoc());
1439}
1440
1441void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1442 VisitExpr(E);
1443 Record.AddStmt(E->getSubExpr());
1444 Record.AddDeclRef(E->getBoxingMethod());
1445 Record.AddSourceRange(E->getSourceRange());
1447}
1448
1449void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1450 VisitExpr(E);
1451 Record.push_back(E->getNumElements());
1452 for (unsigned i = 0; i < E->getNumElements(); i++)
1453 Record.AddStmt(E->getElement(i));
1454 Record.AddDeclRef(E->getArrayWithObjectsMethod());
1455 Record.AddSourceRange(E->getSourceRange());
1457}
1458
1459void ASTStmtWriter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1460 VisitExpr(E);
1461 Record.push_back(E->getNumElements());
1462 Record.push_back(E->HasPackExpansions);
1463 for (unsigned i = 0; i < E->getNumElements(); i++) {
1464 ObjCDictionaryElement Element = E->getKeyValueElement(i);
1465 Record.AddStmt(Element.Key);
1466 Record.AddStmt(Element.Value);
1467 if (E->HasPackExpansions) {
1468 Record.AddSourceLocation(Element.EllipsisLoc);
1469 unsigned NumExpansions = 0;
1470 if (Element.NumExpansions)
1471 NumExpansions = *Element.NumExpansions + 1;
1472 Record.push_back(NumExpansions);
1473 }
1474 }
1475
1476 Record.AddDeclRef(E->getDictWithObjectsMethod());
1477 Record.AddSourceRange(E->getSourceRange());
1479}
1480
1481void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1482 VisitExpr(E);
1483 Record.AddTypeSourceInfo(E->getEncodedTypeSourceInfo());
1484 Record.AddSourceLocation(E->getAtLoc());
1485 Record.AddSourceLocation(E->getRParenLoc());
1487}
1488
1489void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1490 VisitExpr(E);
1491 Record.AddSelectorRef(E->getSelector());
1492 Record.AddSourceLocation(E->getAtLoc());
1493 Record.AddSourceLocation(E->getRParenLoc());
1495}
1496
1497void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1498 VisitExpr(E);
1499 Record.AddDeclRef(E->getProtocol());
1500 Record.AddSourceLocation(E->getAtLoc());
1501 Record.AddSourceLocation(E->ProtoLoc);
1502 Record.AddSourceLocation(E->getRParenLoc());
1504}
1505
1506void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1507 VisitExpr(E);
1508 Record.AddDeclRef(E->getDecl());
1509 Record.AddSourceLocation(E->getLocation());
1510 Record.AddSourceLocation(E->getOpLoc());
1511 Record.AddStmt(E->getBase());
1512 Record.push_back(E->isArrow());
1513 Record.push_back(E->isFreeIvar());
1515}
1516
1517void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1518 VisitExpr(E);
1519 Record.push_back(E->SetterAndMethodRefFlags.getInt());
1520 Record.push_back(E->isImplicitProperty());
1521 if (E->isImplicitProperty()) {
1522 Record.AddDeclRef(E->getImplicitPropertyGetter());
1523 Record.AddDeclRef(E->getImplicitPropertySetter());
1524 } else {
1525 Record.AddDeclRef(E->getExplicitProperty());
1526 }
1527 Record.AddSourceLocation(E->getLocation());
1528 Record.AddSourceLocation(E->getReceiverLocation());
1529 if (E->isObjectReceiver()) {
1530 Record.push_back(0);
1531 Record.AddStmt(E->getBase());
1532 } else if (E->isSuperReceiver()) {
1533 Record.push_back(1);
1534 Record.AddTypeRef(E->getSuperReceiverType());
1535 } else {
1536 Record.push_back(2);
1537 Record.AddDeclRef(E->getClassReceiver());
1538 }
1539
1541}
1542
1543void ASTStmtWriter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1544 VisitExpr(E);
1545 Record.AddSourceLocation(E->getRBracket());
1546 Record.AddStmt(E->getBaseExpr());
1547 Record.AddStmt(E->getKeyExpr());
1548 Record.AddDeclRef(E->getAtIndexMethodDecl());
1549 Record.AddDeclRef(E->setAtIndexMethodDecl());
1550
1552}
1553
1554void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1555 VisitExpr(E);
1556 Record.push_back(E->getNumArgs());
1557 Record.push_back(E->getNumStoredSelLocs());
1558 Record.push_back(E->SelLocsKind);
1559 Record.push_back(E->isDelegateInitCall());
1560 Record.push_back(E->IsImplicit);
1561 Record.push_back((unsigned)E->getReceiverKind()); // FIXME: stable encoding
1562 switch (E->getReceiverKind()) {
1564 Record.AddStmt(E->getInstanceReceiver());
1565 break;
1566
1568 Record.AddTypeSourceInfo(E->getClassReceiverTypeInfo());
1569 break;
1570
1573 Record.AddTypeRef(E->getSuperType());
1574 Record.AddSourceLocation(E->getSuperLoc());
1575 break;
1576 }
1577
1578 if (E->getMethodDecl()) {
1579 Record.push_back(1);
1580 Record.AddDeclRef(E->getMethodDecl());
1581 } else {
1582 Record.push_back(0);
1583 Record.AddSelectorRef(E->getSelector());
1584 }
1585
1586 Record.AddSourceLocation(E->getLeftLoc());
1587 Record.AddSourceLocation(E->getRightLoc());
1588
1589 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
1590 Arg != ArgEnd; ++Arg)
1591 Record.AddStmt(*Arg);
1592
1593 SourceLocation *Locs = E->getStoredSelLocs();
1594 for (unsigned i = 0, e = E->getNumStoredSelLocs(); i != e; ++i)
1595 Record.AddSourceLocation(Locs[i]);
1596
1598}
1599
1600void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1601 VisitStmt(S);
1602 Record.AddStmt(S->getElement());
1603 Record.AddStmt(S->getCollection());
1604 Record.AddStmt(S->getBody());
1605 Record.AddSourceLocation(S->getForLoc());
1606 Record.AddSourceLocation(S->getRParenLoc());
1608}
1609
1610void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1611 VisitStmt(S);
1612 Record.AddStmt(S->getCatchBody());
1613 Record.AddDeclRef(S->getCatchParamDecl());
1614 Record.AddSourceLocation(S->getAtCatchLoc());
1615 Record.AddSourceLocation(S->getRParenLoc());
1617}
1618
1619void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1620 VisitStmt(S);
1621 Record.AddStmt(S->getFinallyBody());
1622 Record.AddSourceLocation(S->getAtFinallyLoc());
1624}
1625
1626void ASTStmtWriter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1627 VisitStmt(S); // FIXME: no test coverage.
1628 Record.AddStmt(S->getSubStmt());
1629 Record.AddSourceLocation(S->getAtLoc());
1631}
1632
1633void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1634 VisitStmt(S);
1635 Record.push_back(S->getNumCatchStmts());
1636 Record.push_back(S->getFinallyStmt() != nullptr);
1637 Record.AddStmt(S->getTryBody());
1638 for (ObjCAtCatchStmt *C : S->catch_stmts())
1639 Record.AddStmt(C);
1640 if (S->getFinallyStmt())
1641 Record.AddStmt(S->getFinallyStmt());
1642 Record.AddSourceLocation(S->getAtTryLoc());
1644}
1645
1646void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1647 VisitStmt(S); // FIXME: no test coverage.
1648 Record.AddStmt(S->getSynchExpr());
1649 Record.AddStmt(S->getSynchBody());
1650 Record.AddSourceLocation(S->getAtSynchronizedLoc());
1652}
1653
1654void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1655 VisitStmt(S); // FIXME: no test coverage.
1656 Record.AddStmt(S->getThrowExpr());
1657 Record.AddSourceLocation(S->getThrowLoc());
1659}
1660
1661void ASTStmtWriter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1662 VisitExpr(E);
1663 Record.push_back(E->getValue());
1664 Record.AddSourceLocation(E->getLocation());
1666}
1667
1668void ASTStmtWriter::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1669 VisitExpr(E);
1670 Record.AddSourceRange(E->getSourceRange());
1671 Record.AddVersionTuple(E->getVersion());
1673}
1674
1675//===----------------------------------------------------------------------===//
1676// C++ Expressions and Statements.
1677//===----------------------------------------------------------------------===//
1678
1679void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
1680 VisitStmt(S);
1681 Record.AddSourceLocation(S->getCatchLoc());
1682 Record.AddDeclRef(S->getExceptionDecl());
1683 Record.AddStmt(S->getHandlerBlock());
1685}
1686
1687void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
1688 VisitStmt(S);
1689 Record.push_back(S->getNumHandlers());
1690 Record.AddSourceLocation(S->getTryLoc());
1691 Record.AddStmt(S->getTryBlock());
1692 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1693 Record.AddStmt(S->getHandler(i));
1695}
1696
1697void ASTStmtWriter::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1698 VisitStmt(S);
1699 Record.AddSourceLocation(S->getForLoc());
1700 Record.AddSourceLocation(S->getCoawaitLoc());
1701 Record.AddSourceLocation(S->getColonLoc());
1702 Record.AddSourceLocation(S->getRParenLoc());
1703 Record.AddStmt(S->getInit());
1704 Record.AddStmt(S->getRangeStmt());
1705 Record.AddStmt(S->getBeginStmt());
1706 Record.AddStmt(S->getEndStmt());
1707 Record.AddStmt(S->getCond());
1708 Record.AddStmt(S->getInc());
1709 Record.AddStmt(S->getLoopVarStmt());
1710 Record.AddStmt(S->getBody());
1712}
1713
1714void ASTStmtWriter::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1715 VisitStmt(S);
1716 Record.AddSourceLocation(S->getKeywordLoc());
1717 Record.push_back(S->isIfExists());
1718 Record.AddNestedNameSpecifierLoc(S->getQualifierLoc());
1719 Record.AddDeclarationNameInfo(S->getNameInfo());
1720 Record.AddStmt(S->getSubStmt());
1722}
1723
1724void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1725 VisitCallExpr(E);
1726 Record.push_back(E->getOperator());
1727 Record.AddSourceLocation(E->BeginLoc);
1728
1729 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1730 !E->isCoroElideSafe() && !E->usesMemberSyntax())
1731 AbbrevToUse = Writer.getCXXOperatorCallExprAbbrev();
1732
1734}
1735
1736void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1737 VisitCallExpr(E);
1738
1739 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1740 !E->isCoroElideSafe() && !E->usesMemberSyntax())
1741 AbbrevToUse = Writer.getCXXMemberCallExprAbbrev();
1742
1744}
1745
1746void ASTStmtWriter::VisitCXXRewrittenBinaryOperator(
1748 VisitExpr(E);
1749 Record.push_back(E->isReversed());
1750 Record.AddStmt(E->getSemanticForm());
1752}
1753
1754void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
1755 VisitExpr(E);
1756
1757 Record.push_back(E->getNumArgs());
1758 Record.push_back(E->isElidable());
1759 Record.push_back(E->hadMultipleCandidates());
1760 Record.push_back(E->isListInitialization());
1761 Record.push_back(E->isStdInitListInitialization());
1762 Record.push_back(E->requiresZeroInitialization());
1763 Record.push_back(
1764 llvm::to_underlying(E->getConstructionKind())); // FIXME: stable encoding
1765 Record.push_back(E->isImmediateEscalating());
1766 Record.AddSourceLocation(E->getLocation());
1767 Record.AddDeclRef(E->getConstructor());
1768 Record.AddSourceRange(E->getParenOrBraceRange());
1769
1770 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1771 Record.AddStmt(E->getArg(I));
1772
1774}
1775
1776void ASTStmtWriter::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1777 VisitExpr(E);
1778 Record.AddDeclRef(E->getConstructor());
1779 Record.AddSourceLocation(E->getLocation());
1780 Record.push_back(E->constructsVBase());
1781 Record.push_back(E->inheritedFromVBase());
1783}
1784
1785void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1786 VisitCXXConstructExpr(E);
1787 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1789}
1790
1791void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) {
1792 VisitExpr(E);
1793 Record.push_back(E->LambdaExprBits.NumCaptures);
1794 Record.AddSourceRange(E->IntroducerRange);
1795 Record.push_back(E->LambdaExprBits.CaptureDefault); // FIXME: stable encoding
1796 Record.AddSourceLocation(E->CaptureDefaultLoc);
1797 Record.push_back(E->LambdaExprBits.ExplicitParams);
1798 Record.push_back(E->LambdaExprBits.ExplicitResultType);
1799 Record.AddSourceLocation(E->ClosingBrace);
1800
1801 // Add capture initializers.
1803 CEnd = E->capture_init_end();
1804 C != CEnd; ++C) {
1805 Record.AddStmt(*C);
1806 }
1807
1808 // Don't serialize the body. It belongs to the call operator declaration.
1809 // LambdaExpr only stores a copy of the Stmt *.
1810
1812}
1813
1814void ASTStmtWriter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1815 VisitExpr(E);
1816 Record.AddStmt(E->getSubExpr());
1818}
1819
1820void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1821 VisitExplicitCastExpr(E);
1822 Record.AddSourceRange(SourceRange(E->getOperatorLoc(), E->getRParenLoc()));
1823 CurrentPackingBits.addBit(E->getAngleBrackets().isValid());
1824 if (E->getAngleBrackets().isValid())
1825 Record.AddSourceRange(E->getAngleBrackets());
1826}
1827
1828void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1829 VisitCXXNamedCastExpr(E);
1831}
1832
1833void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1834 VisitCXXNamedCastExpr(E);
1836}
1837
1838void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1839 VisitCXXNamedCastExpr(E);
1841}
1842
1843void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1844 VisitCXXNamedCastExpr(E);
1846}
1847
1848void ASTStmtWriter::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1849 VisitCXXNamedCastExpr(E);
1851}
1852
1853void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1854 VisitExplicitCastExpr(E);
1855 Record.AddSourceLocation(E->getLParenLoc());
1856 Record.AddSourceLocation(E->getRParenLoc());
1858}
1859
1860void ASTStmtWriter::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1861 VisitExplicitCastExpr(E);
1862 Record.AddSourceLocation(E->getBeginLoc());
1863 Record.AddSourceLocation(E->getEndLoc());
1865}
1866
1867void ASTStmtWriter::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1868 VisitCallExpr(E);
1869 Record.AddSourceLocation(E->UDSuffixLoc);
1871}
1872
1873void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1874 VisitExpr(E);
1875 Record.push_back(E->getValue());
1876 Record.AddSourceLocation(E->getLocation());
1878}
1879
1880void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1881 VisitExpr(E);
1882 Record.AddSourceLocation(E->getLocation());
1884}
1885
1886void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1887 VisitExpr(E);
1888 Record.AddSourceRange(E->getSourceRange());
1889 if (E->isTypeOperand()) {
1890 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
1892 } else {
1893 Record.AddStmt(E->getExprOperand());
1895 }
1896}
1897
1898void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
1899 VisitExpr(E);
1900 Record.AddSourceLocation(E->getLocation());
1901 Record.push_back(E->isImplicit());
1903
1905}
1906
1907void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
1908 VisitExpr(E);
1909 Record.AddSourceLocation(E->getThrowLoc());
1910 Record.AddStmt(E->getSubExpr());
1911 Record.push_back(E->isThrownVariableInScope());
1913}
1914
1915void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1916 VisitExpr(E);
1917 Record.AddDeclRef(E->getParam());
1918 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1919 Record.AddSourceLocation(E->getUsedLocation());
1920 Record.push_back(E->hasRewrittenInit());
1921 if (E->hasRewrittenInit())
1922 Record.AddStmt(E->getRewrittenExpr());
1924}
1925
1926void ASTStmtWriter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1927 VisitExpr(E);
1928 Record.push_back(E->hasRewrittenInit());
1929 Record.AddDeclRef(E->getField());
1930 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1931 Record.AddSourceLocation(E->getExprLoc());
1932 if (E->hasRewrittenInit())
1933 Record.AddStmt(E->getRewrittenExpr());
1935}
1936
1937void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1938 VisitExpr(E);
1939 Record.AddCXXTemporary(E->getTemporary());
1940 Record.AddStmt(E->getSubExpr());
1942}
1943
1944void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1945 VisitExpr(E);
1946 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1947 Record.AddSourceLocation(E->getRParenLoc());
1949}
1950
1951void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
1952 VisitExpr(E);
1953
1954 Record.push_back(E->isArray());
1955 Record.push_back(E->hasInitializer());
1956 Record.push_back(E->getNumPlacementArgs());
1957 Record.push_back(E->isParenTypeId());
1958
1959 Record.push_back(E->isGlobalNew());
1960 ImplicitAllocationParameters IAP = E->implicitAllocationParameters();
1961 Record.push_back(isAlignedAllocation(IAP.PassAlignment));
1962 Record.push_back(isTypeAwareAllocation(IAP.PassTypeIdentity));
1963 Record.push_back(E->doesUsualArrayDeleteWantSize());
1964 Record.push_back(E->CXXNewExprBits.HasInitializer);
1965 Record.push_back(E->CXXNewExprBits.StoredInitializationStyle);
1966
1967 Record.AddDeclRef(E->getOperatorNew());
1968 Record.AddDeclRef(E->getOperatorDelete());
1969 Record.AddTypeSourceInfo(E->getAllocatedTypeSourceInfo());
1970 if (E->isParenTypeId())
1971 Record.AddSourceRange(E->getTypeIdParens());
1972 Record.AddSourceRange(E->getSourceRange());
1973 Record.AddSourceRange(E->getDirectInitRange());
1974
1975 for (CXXNewExpr::arg_iterator I = E->raw_arg_begin(), N = E->raw_arg_end();
1976 I != N; ++I)
1977 Record.AddStmt(*I);
1978
1980}
1981
1982void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1983 VisitExpr(E);
1984 Record.push_back(E->isGlobalDelete());
1985 Record.push_back(E->isArrayForm());
1986 Record.push_back(E->isArrayFormAsWritten());
1987 Record.push_back(E->doesUsualArrayDeleteWantSize());
1988 Record.AddDeclRef(E->getOperatorDelete());
1989 Record.AddStmt(E->getArgument());
1990 Record.AddSourceLocation(E->getBeginLoc());
1991
1993}
1994
1995void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1996 VisitExpr(E);
1997
1998 Record.AddStmt(E->getBase());
1999 Record.push_back(E->isArrow());
2000 Record.AddSourceLocation(E->getOperatorLoc());
2001 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2002 Record.AddTypeSourceInfo(E->getScopeTypeInfo());
2003 Record.AddSourceLocation(E->getColonColonLoc());
2004 Record.AddSourceLocation(E->getTildeLoc());
2005
2006 // PseudoDestructorTypeStorage.
2007 Record.AddIdentifierRef(E->getDestroyedTypeIdentifier());
2009 Record.AddSourceLocation(E->getDestroyedTypeLoc());
2010 else
2011 Record.AddTypeSourceInfo(E->getDestroyedTypeInfo());
2012
2014}
2015
2016void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) {
2017 VisitExpr(E);
2018 Record.push_back(E->getNumObjects());
2019 for (auto &Obj : E->getObjects()) {
2020 if (auto *BD = Obj.dyn_cast<BlockDecl *>()) {
2021 Record.push_back(serialization::COK_Block);
2022 Record.AddDeclRef(BD);
2023 } else if (auto *CLE = Obj.dyn_cast<CompoundLiteralExpr *>()) {
2024 Record.push_back(serialization::COK_CompoundLiteral);
2025 Record.AddStmt(CLE);
2026 }
2027 }
2028
2029 Record.push_back(E->cleanupsHaveSideEffects());
2030 Record.AddStmt(E->getSubExpr());
2032}
2033
2034void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
2036 VisitExpr(E);
2037
2038 // Don't emit anything here (or if you do you will have to update
2039 // the corresponding deserialization function).
2040 Record.push_back(E->getNumTemplateArgs());
2041 CurrentPackingBits.updateBits();
2042 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2043 CurrentPackingBits.addBit(E->hasFirstQualifierFoundInScope());
2044
2045 if (E->hasTemplateKWAndArgsInfo()) {
2046 const ASTTemplateKWAndArgsInfo &ArgInfo =
2047 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2049 E->getTrailingObjects<TemplateArgumentLoc>());
2050 }
2051
2052 CurrentPackingBits.addBit(E->isArrow());
2053
2054 Record.AddTypeRef(E->getBaseType());
2055 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2056 CurrentPackingBits.addBit(!E->isImplicitAccess());
2057 if (!E->isImplicitAccess())
2058 Record.AddStmt(E->getBase());
2059
2060 Record.AddSourceLocation(E->getOperatorLoc());
2061
2062 if (E->hasFirstQualifierFoundInScope())
2063 Record.AddDeclRef(E->getFirstQualifierFoundInScope());
2064
2065 Record.AddDeclarationNameInfo(E->MemberNameInfo);
2067}
2068
2069void
2070ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2071 VisitExpr(E);
2072
2073 // Don't emit anything here, HasTemplateKWAndArgsInfo must be
2074 // emitted first.
2075 CurrentPackingBits.addBit(
2076 E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
2077
2078 if (E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo) {
2079 const ASTTemplateKWAndArgsInfo &ArgInfo =
2080 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2081 // 16 bits should be enought to store the number of args
2082 CurrentPackingBits.addBits(ArgInfo.NumTemplateArgs, /*Width=*/16);
2084 E->getTrailingObjects<TemplateArgumentLoc>());
2085 }
2086
2087 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2088 Record.AddDeclarationNameInfo(E->NameInfo);
2090}
2091
2092void
2093ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2094 VisitExpr(E);
2095 Record.push_back(E->getNumArgs());
2097 ArgI = E->arg_begin(), ArgE = E->arg_end(); ArgI != ArgE; ++ArgI)
2098 Record.AddStmt(*ArgI);
2099 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
2100 Record.AddSourceLocation(E->getLParenLoc());
2101 Record.AddSourceLocation(E->getRParenLoc());
2102 Record.push_back(E->isListInitialization());
2104}
2105
2106void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
2107 VisitExpr(E);
2108
2109 Record.push_back(E->getNumDecls());
2110
2111 CurrentPackingBits.updateBits();
2112 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2113 if (E->hasTemplateKWAndArgsInfo()) {
2114 const ASTTemplateKWAndArgsInfo &ArgInfo =
2116 Record.push_back(ArgInfo.NumTemplateArgs);
2118 }
2119
2121 OvE = E->decls_end();
2122 OvI != OvE; ++OvI) {
2123 Record.AddDeclRef(OvI.getDecl());
2124 Record.push_back(OvI.getAccess());
2125 }
2126
2127 Record.AddDeclarationNameInfo(E->getNameInfo());
2128 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2129}
2130
2131void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2132 VisitOverloadExpr(E);
2133 CurrentPackingBits.addBit(E->isArrow());
2134 CurrentPackingBits.addBit(E->hasUnresolvedUsing());
2135 CurrentPackingBits.addBit(!E->isImplicitAccess());
2136 if (!E->isImplicitAccess())
2137 Record.AddStmt(E->getBase());
2138
2139 Record.AddSourceLocation(E->getOperatorLoc());
2140
2141 Record.AddTypeRef(E->getBaseType());
2143}
2144
2145void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2146 VisitOverloadExpr(E);
2147 CurrentPackingBits.addBit(E->requiresADL());
2148 Record.AddDeclRef(E->getNamingClass());
2150
2151 if (Writer.isWritingStdCXXNamedModules() && Writer.getChain()) {
2152 // Referencing all the possible declarations to make sure the change get
2153 // propagted.
2154 DeclarationName Name = E->getName();
2155 for (auto *Found :
2156 Record.getASTContext().getTranslationUnitDecl()->lookup(Name))
2157 if (Found->isFromASTFile())
2158 Writer.GetDeclRef(Found);
2159
2160 llvm::SmallVector<NamespaceDecl *> ExternalNSs;
2161 Writer.getChain()->ReadKnownNamespaces(ExternalNSs);
2162 for (auto *NS : ExternalNSs)
2163 for (auto *Found : NS->lookup(Name))
2164 Writer.GetDeclRef(Found);
2165 }
2166}
2167
2168void ASTStmtWriter::VisitTypeTraitExpr(TypeTraitExpr *E) {
2169 VisitExpr(E);
2170 Record.push_back(E->TypeTraitExprBits.IsBooleanTypeTrait);
2171 Record.push_back(E->TypeTraitExprBits.NumArgs);
2172 Record.push_back(E->TypeTraitExprBits.Kind); // FIXME: Stable encoding
2173
2174 if (E->TypeTraitExprBits.IsBooleanTypeTrait)
2175 Record.push_back(E->TypeTraitExprBits.Value);
2176 else
2177 Record.AddAPValue(E->getAPValue());
2178
2179 Record.AddSourceRange(E->getSourceRange());
2180 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2181 Record.AddTypeSourceInfo(E->getArg(I));
2183}
2184
2185void ASTStmtWriter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2186 VisitExpr(E);
2187 Record.push_back(E->getTrait());
2188 Record.push_back(E->getValue());
2189 Record.AddSourceRange(E->getSourceRange());
2190 Record.AddTypeSourceInfo(E->getQueriedTypeSourceInfo());
2191 Record.AddStmt(E->getDimensionExpression());
2193}
2194
2195void ASTStmtWriter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2196 VisitExpr(E);
2197 Record.push_back(E->getTrait());
2198 Record.push_back(E->getValue());
2199 Record.AddSourceRange(E->getSourceRange());
2200 Record.AddStmt(E->getQueriedExpression());
2202}
2203
2204void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2205 VisitExpr(E);
2206 Record.push_back(E->getValue());
2207 Record.AddSourceRange(E->getSourceRange());
2208 Record.AddStmt(E->getOperand());
2210}
2211
2212void ASTStmtWriter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2213 VisitExpr(E);
2214 Record.AddSourceLocation(E->getEllipsisLoc());
2215 Record.push_back(E->NumExpansions);
2216 Record.AddStmt(E->getPattern());
2218}
2219
2220void ASTStmtWriter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2221 VisitExpr(E);
2222 Record.push_back(E->isPartiallySubstituted() ? E->getPartialArguments().size()
2223 : 0);
2224 Record.AddSourceLocation(E->OperatorLoc);
2225 Record.AddSourceLocation(E->PackLoc);
2226 Record.AddSourceLocation(E->RParenLoc);
2227 Record.AddDeclRef(E->Pack);
2228 if (E->isPartiallySubstituted()) {
2229 for (const auto &TA : E->getPartialArguments())
2230 Record.AddTemplateArgument(TA);
2231 } else if (!E->isValueDependent()) {
2232 Record.push_back(E->getPackLength());
2233 }
2235}
2236
2237void ASTStmtWriter::VisitPackIndexingExpr(PackIndexingExpr *E) {
2238 VisitExpr(E);
2239 Record.push_back(E->PackIndexingExprBits.TransformedExpressions);
2240 Record.push_back(E->PackIndexingExprBits.FullySubstituted);
2241 Record.AddSourceLocation(E->getEllipsisLoc());
2242 Record.AddSourceLocation(E->getRSquareLoc());
2243 Record.AddStmt(E->getPackIdExpression());
2244 Record.AddStmt(E->getIndexExpr());
2245 for (Expr *Sub : E->getExpressions())
2246 Record.AddStmt(Sub);
2248}
2249
2250void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
2252 VisitExpr(E);
2253 Record.AddDeclRef(E->getAssociatedDecl());
2254 CurrentPackingBits.addBit(E->isReferenceParameter());
2255 CurrentPackingBits.addBits(E->getIndex(), /*Width=*/12);
2256 Record.writeUnsignedOrNone(E->getPackIndex());
2257 CurrentPackingBits.addBit(E->getFinal());
2258
2259 Record.AddSourceLocation(E->getNameLoc());
2260 Record.AddStmt(E->getReplacement());
2262}
2263
2264void ASTStmtWriter::VisitSubstNonTypeTemplateParmPackExpr(
2266 VisitExpr(E);
2267 Record.AddDeclRef(E->getAssociatedDecl());
2268 CurrentPackingBits.addBit(E->getFinal());
2269 Record.push_back(E->getIndex());
2270 Record.AddTemplateArgument(E->getArgumentPack());
2271 Record.AddSourceLocation(E->getParameterPackLocation());
2273}
2274
2275void ASTStmtWriter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2276 VisitExpr(E);
2277 Record.push_back(E->getNumExpansions());
2278 Record.AddDeclRef(E->getParameterPack());
2279 Record.AddSourceLocation(E->getParameterPackLocation());
2280 for (FunctionParmPackExpr::iterator I = E->begin(), End = E->end();
2281 I != End; ++I)
2282 Record.AddDeclRef(*I);
2284}
2285
2286void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2287 VisitExpr(E);
2288 Record.push_back(static_cast<bool>(E->getLifetimeExtendedTemporaryDecl()));
2290 Record.AddDeclRef(E->getLifetimeExtendedTemporaryDecl());
2291 else
2292 Record.AddStmt(E->getSubExpr());
2294}
2295
2296void ASTStmtWriter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2297 VisitExpr(E);
2298 Record.AddSourceLocation(E->LParenLoc);
2299 Record.AddSourceLocation(E->EllipsisLoc);
2300 Record.AddSourceLocation(E->RParenLoc);
2301 Record.push_back(E->NumExpansions.toInternalRepresentation());
2302 Record.AddStmt(E->SubExprs[0]);
2303 Record.AddStmt(E->SubExprs[1]);
2304 Record.AddStmt(E->SubExprs[2]);
2305 Record.push_back(E->CXXFoldExprBits.Opcode);
2307}
2308
2309void ASTStmtWriter::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2310 VisitExpr(E);
2311 ArrayRef<Expr *> InitExprs = E->getInitExprs();
2312 Record.push_back(InitExprs.size());
2313 Record.push_back(E->getUserSpecifiedInitExprs().size());
2314 Record.AddSourceLocation(E->getInitLoc());
2315 Record.AddSourceLocation(E->getBeginLoc());
2316 Record.AddSourceLocation(E->getEndLoc());
2317 for (Expr *InitExpr : E->getInitExprs())
2318 Record.AddStmt(InitExpr);
2319 Expr *ArrayFiller = E->getArrayFiller();
2320 FieldDecl *UnionField = E->getInitializedFieldInUnion();
2321 bool HasArrayFillerOrUnionDecl = ArrayFiller || UnionField;
2322 Record.push_back(HasArrayFillerOrUnionDecl);
2323 if (HasArrayFillerOrUnionDecl) {
2324 Record.push_back(static_cast<bool>(ArrayFiller));
2325 if (ArrayFiller)
2326 Record.AddStmt(ArrayFiller);
2327 else
2328 Record.AddDeclRef(UnionField);
2329 }
2331}
2332
2333void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2334 VisitExpr(E);
2335 Record.AddStmt(E->getSourceExpr());
2336 Record.AddSourceLocation(E->getLocation());
2337 Record.push_back(E->isUnique());
2339}
2340
2341//===----------------------------------------------------------------------===//
2342// CUDA Expressions and Statements.
2343//===----------------------------------------------------------------------===//
2344
2345void ASTStmtWriter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2346 VisitCallExpr(E);
2347 Record.AddStmt(E->getConfig());
2349}
2350
2351//===----------------------------------------------------------------------===//
2352// OpenCL Expressions and Statements.
2353//===----------------------------------------------------------------------===//
2354void ASTStmtWriter::VisitAsTypeExpr(AsTypeExpr *E) {
2355 VisitExpr(E);
2356 Record.AddSourceLocation(E->getBuiltinLoc());
2357 Record.AddSourceLocation(E->getRParenLoc());
2358 Record.AddStmt(E->getSrcExpr());
2360}
2361
2362//===----------------------------------------------------------------------===//
2363// Microsoft Expressions and Statements.
2364//===----------------------------------------------------------------------===//
2365void ASTStmtWriter::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2366 VisitExpr(E);
2367 Record.push_back(E->isArrow());
2368 Record.AddStmt(E->getBaseExpr());
2369 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2370 Record.AddSourceLocation(E->getMemberLoc());
2371 Record.AddDeclRef(E->getPropertyDecl());
2373}
2374
2375void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2376 VisitExpr(E);
2377 Record.AddStmt(E->getBase());
2378 Record.AddStmt(E->getIdx());
2379 Record.AddSourceLocation(E->getRBracketLoc());
2381}
2382
2383void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2384 VisitExpr(E);
2385 Record.AddSourceRange(E->getSourceRange());
2386 Record.AddDeclRef(E->getGuidDecl());
2387 if (E->isTypeOperand()) {
2388 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
2390 } else {
2391 Record.AddStmt(E->getExprOperand());
2393 }
2394}
2395
2396void ASTStmtWriter::VisitSEHExceptStmt(SEHExceptStmt *S) {
2397 VisitStmt(S);
2398 Record.AddSourceLocation(S->getExceptLoc());
2399 Record.AddStmt(S->getFilterExpr());
2400 Record.AddStmt(S->getBlock());
2402}
2403
2404void ASTStmtWriter::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2405 VisitStmt(S);
2406 Record.AddSourceLocation(S->getFinallyLoc());
2407 Record.AddStmt(S->getBlock());
2409}
2410
2411void ASTStmtWriter::VisitSEHTryStmt(SEHTryStmt *S) {
2412 VisitStmt(S);
2413 Record.push_back(S->getIsCXXTry());
2414 Record.AddSourceLocation(S->getTryLoc());
2415 Record.AddStmt(S->getTryBlock());
2416 Record.AddStmt(S->getHandler());
2418}
2419
2420void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2421 VisitStmt(S);
2422 Record.AddSourceLocation(S->getLeaveLoc());
2424}
2425
2426//===----------------------------------------------------------------------===//
2427// OpenMP Directives.
2428//===----------------------------------------------------------------------===//
2429
2430void ASTStmtWriter::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2431 VisitStmt(S);
2432 for (Stmt *SubStmt : S->SubStmts)
2433 Record.AddStmt(SubStmt);
2435}
2436
2437void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2438 Record.writeOMPChildren(E->Data);
2439 Record.AddSourceLocation(E->getBeginLoc());
2440 Record.AddSourceLocation(E->getEndLoc());
2441}
2442
2443void ASTStmtWriter::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2444 VisitStmt(D);
2445 Record.writeUInt32(D->getLoopsNumber());
2446 VisitOMPExecutableDirective(D);
2447}
2448
2449void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) {
2450 VisitOMPLoopBasedDirective(D);
2451}
2452
2453void ASTStmtWriter::VisitOMPMetaDirective(OMPMetaDirective *D) {
2454 VisitStmt(D);
2455 Record.push_back(D->getNumClauses());
2456 VisitOMPExecutableDirective(D);
2458}
2459
2460void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) {
2461 VisitStmt(D);
2462 VisitOMPExecutableDirective(D);
2463 Record.writeBool(D->hasCancel());
2465}
2466
2467void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) {
2468 VisitOMPLoopDirective(D);
2470}
2471
2472void ASTStmtWriter::VisitOMPCanonicalLoopNestTransformationDirective(
2473 OMPCanonicalLoopNestTransformationDirective *D) {
2474 VisitOMPLoopBasedDirective(D);
2475 Record.writeUInt32(D->getNumGeneratedTopLevelLoops());
2476}
2477
2478void ASTStmtWriter::VisitOMPTileDirective(OMPTileDirective *D) {
2479 VisitOMPCanonicalLoopNestTransformationDirective(D);
2481}
2482
2483void ASTStmtWriter::VisitOMPStripeDirective(OMPStripeDirective *D) {
2484 VisitOMPCanonicalLoopNestTransformationDirective(D);
2486}
2487
2488void ASTStmtWriter::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2489 VisitOMPCanonicalLoopNestTransformationDirective(D);
2491}
2492
2493void ASTStmtWriter::VisitOMPReverseDirective(OMPReverseDirective *D) {
2494 VisitOMPCanonicalLoopNestTransformationDirective(D);
2496}
2497
2498void ASTStmtWriter::VisitOMPInterchangeDirective(OMPInterchangeDirective *D) {
2499 VisitOMPCanonicalLoopNestTransformationDirective(D);
2501}
2502
2503void ASTStmtWriter::VisitOMPCanonicalLoopSequenceTransformationDirective(
2504 OMPCanonicalLoopSequenceTransformationDirective *D) {
2505 VisitStmt(D);
2506 VisitOMPExecutableDirective(D);
2507 Record.writeUInt32(D->getNumGeneratedTopLevelLoops());
2508}
2509
2510void ASTStmtWriter::VisitOMPFuseDirective(OMPFuseDirective *D) {
2511 VisitOMPCanonicalLoopSequenceTransformationDirective(D);
2513}
2514
2515void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) {
2516 VisitOMPLoopDirective(D);
2517 Record.writeBool(D->hasCancel());
2519}
2520
2521void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2522 VisitOMPLoopDirective(D);
2524}
2525
2526void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2527 VisitStmt(D);
2528 VisitOMPExecutableDirective(D);
2529 Record.writeBool(D->hasCancel());
2531}
2532
2533void ASTStmtWriter::VisitOMPSectionDirective(OMPSectionDirective *D) {
2534 VisitStmt(D);
2535 VisitOMPExecutableDirective(D);
2536 Record.writeBool(D->hasCancel());
2538}
2539
2540void ASTStmtWriter::VisitOMPScopeDirective(OMPScopeDirective *D) {
2541 VisitStmt(D);
2542 VisitOMPExecutableDirective(D);
2544}
2545
2546void ASTStmtWriter::VisitOMPSingleDirective(OMPSingleDirective *D) {
2547 VisitStmt(D);
2548 VisitOMPExecutableDirective(D);
2550}
2551
2552void ASTStmtWriter::VisitOMPMasterDirective(OMPMasterDirective *D) {
2553 VisitStmt(D);
2554 VisitOMPExecutableDirective(D);
2556}
2557
2558void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2559 VisitStmt(D);
2560 VisitOMPExecutableDirective(D);
2561 Record.AddDeclarationNameInfo(D->getDirectiveName());
2563}
2564
2565void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2566 VisitOMPLoopDirective(D);
2567 Record.writeBool(D->hasCancel());
2569}
2570
2571void ASTStmtWriter::VisitOMPParallelForSimdDirective(
2572 OMPParallelForSimdDirective *D) {
2573 VisitOMPLoopDirective(D);
2575}
2576
2577void ASTStmtWriter::VisitOMPParallelMasterDirective(
2578 OMPParallelMasterDirective *D) {
2579 VisitStmt(D);
2580 VisitOMPExecutableDirective(D);
2582}
2583
2584void ASTStmtWriter::VisitOMPParallelMaskedDirective(
2585 OMPParallelMaskedDirective *D) {
2586 VisitStmt(D);
2587 VisitOMPExecutableDirective(D);
2589}
2590
2591void ASTStmtWriter::VisitOMPParallelSectionsDirective(
2592 OMPParallelSectionsDirective *D) {
2593 VisitStmt(D);
2594 VisitOMPExecutableDirective(D);
2595 Record.writeBool(D->hasCancel());
2597}
2598
2599void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) {
2600 VisitStmt(D);
2601 VisitOMPExecutableDirective(D);
2602 Record.writeBool(D->hasCancel());
2604}
2605
2606void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2607 VisitStmt(D);
2608 VisitOMPExecutableDirective(D);
2609 Record.writeBool(D->isXLHSInRHSPart());
2610 Record.writeBool(D->isPostfixUpdate());
2611 Record.writeBool(D->isFailOnly());
2613}
2614
2615void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) {
2616 VisitStmt(D);
2617 VisitOMPExecutableDirective(D);
2619}
2620
2621void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2622 VisitStmt(D);
2623 VisitOMPExecutableDirective(D);
2625}
2626
2627void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
2628 OMPTargetEnterDataDirective *D) {
2629 VisitStmt(D);
2630 VisitOMPExecutableDirective(D);
2632}
2633
2634void ASTStmtWriter::VisitOMPTargetExitDataDirective(
2635 OMPTargetExitDataDirective *D) {
2636 VisitStmt(D);
2637 VisitOMPExecutableDirective(D);
2639}
2640
2641void ASTStmtWriter::VisitOMPTargetParallelDirective(
2642 OMPTargetParallelDirective *D) {
2643 VisitStmt(D);
2644 VisitOMPExecutableDirective(D);
2645 Record.writeBool(D->hasCancel());
2647}
2648
2649void ASTStmtWriter::VisitOMPTargetParallelForDirective(
2650 OMPTargetParallelForDirective *D) {
2651 VisitOMPLoopDirective(D);
2652 Record.writeBool(D->hasCancel());
2654}
2655
2656void ASTStmtWriter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2657 VisitStmt(D);
2658 VisitOMPExecutableDirective(D);
2660}
2661
2662void ASTStmtWriter::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2663 VisitStmt(D);
2664 VisitOMPExecutableDirective(D);
2666}
2667
2668void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2669 VisitStmt(D);
2670 Record.push_back(D->getNumClauses());
2671 VisitOMPExecutableDirective(D);
2673}
2674
2675void ASTStmtWriter::VisitOMPAssumeDirective(OMPAssumeDirective *D) {
2676 VisitStmt(D);
2677 VisitOMPExecutableDirective(D);
2679}
2680
2681void ASTStmtWriter::VisitOMPErrorDirective(OMPErrorDirective *D) {
2682 VisitStmt(D);
2683 Record.push_back(D->getNumClauses());
2684 VisitOMPExecutableDirective(D);
2686}
2687
2688void ASTStmtWriter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2689 VisitStmt(D);
2690 VisitOMPExecutableDirective(D);
2692}
2693
2694void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) {
2695 VisitStmt(D);
2696 VisitOMPExecutableDirective(D);
2698}
2699
2700void ASTStmtWriter::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2701 VisitStmt(D);
2702 VisitOMPExecutableDirective(D);
2704}
2705
2706void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
2707 VisitStmt(D);
2708 VisitOMPExecutableDirective(D);
2710}
2711
2712void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2713 VisitStmt(D);
2714 VisitOMPExecutableDirective(D);
2716}
2717
2718void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2719 VisitStmt(D);
2720 VisitOMPExecutableDirective(D);
2722}
2723
2724void ASTStmtWriter::VisitOMPCancellationPointDirective(
2725 OMPCancellationPointDirective *D) {
2726 VisitStmt(D);
2727 VisitOMPExecutableDirective(D);
2728 Record.writeEnum(D->getCancelRegion());
2730}
2731
2732void ASTStmtWriter::VisitOMPCancelDirective(OMPCancelDirective *D) {
2733 VisitStmt(D);
2734 VisitOMPExecutableDirective(D);
2735 Record.writeEnum(D->getCancelRegion());
2737}
2738
2739void ASTStmtWriter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2740 VisitOMPLoopDirective(D);
2741 Record.writeBool(D->hasCancel());
2743}
2744
2745void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2746 VisitOMPLoopDirective(D);
2748}
2749
2750void ASTStmtWriter::VisitOMPMasterTaskLoopDirective(
2751 OMPMasterTaskLoopDirective *D) {
2752 VisitOMPLoopDirective(D);
2753 Record.writeBool(D->hasCancel());
2755}
2756
2757void ASTStmtWriter::VisitOMPMaskedTaskLoopDirective(
2758 OMPMaskedTaskLoopDirective *D) {
2759 VisitOMPLoopDirective(D);
2760 Record.writeBool(D->hasCancel());
2762}
2763
2764void ASTStmtWriter::VisitOMPMasterTaskLoopSimdDirective(
2765 OMPMasterTaskLoopSimdDirective *D) {
2766 VisitOMPLoopDirective(D);
2768}
2769
2770void ASTStmtWriter::VisitOMPMaskedTaskLoopSimdDirective(
2771 OMPMaskedTaskLoopSimdDirective *D) {
2772 VisitOMPLoopDirective(D);
2774}
2775
2776void ASTStmtWriter::VisitOMPParallelMasterTaskLoopDirective(
2777 OMPParallelMasterTaskLoopDirective *D) {
2778 VisitOMPLoopDirective(D);
2779 Record.writeBool(D->hasCancel());
2781}
2782
2783void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopDirective(
2784 OMPParallelMaskedTaskLoopDirective *D) {
2785 VisitOMPLoopDirective(D);
2786 Record.writeBool(D->hasCancel());
2788}
2789
2790void ASTStmtWriter::VisitOMPParallelMasterTaskLoopSimdDirective(
2791 OMPParallelMasterTaskLoopSimdDirective *D) {
2792 VisitOMPLoopDirective(D);
2794}
2795
2796void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopSimdDirective(
2797 OMPParallelMaskedTaskLoopSimdDirective *D) {
2798 VisitOMPLoopDirective(D);
2800}
2801
2802void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2803 VisitOMPLoopDirective(D);
2805}
2806
2807void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2808 VisitStmt(D);
2809 VisitOMPExecutableDirective(D);
2811}
2812
2813void ASTStmtWriter::VisitOMPDistributeParallelForDirective(
2814 OMPDistributeParallelForDirective *D) {
2815 VisitOMPLoopDirective(D);
2816 Record.writeBool(D->hasCancel());
2818}
2819
2820void ASTStmtWriter::VisitOMPDistributeParallelForSimdDirective(
2821 OMPDistributeParallelForSimdDirective *D) {
2822 VisitOMPLoopDirective(D);
2824}
2825
2826void ASTStmtWriter::VisitOMPDistributeSimdDirective(
2827 OMPDistributeSimdDirective *D) {
2828 VisitOMPLoopDirective(D);
2830}
2831
2832void ASTStmtWriter::VisitOMPTargetParallelForSimdDirective(
2833 OMPTargetParallelForSimdDirective *D) {
2834 VisitOMPLoopDirective(D);
2836}
2837
2838void ASTStmtWriter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2839 VisitOMPLoopDirective(D);
2841}
2842
2843void ASTStmtWriter::VisitOMPTeamsDistributeDirective(
2844 OMPTeamsDistributeDirective *D) {
2845 VisitOMPLoopDirective(D);
2847}
2848
2849void ASTStmtWriter::VisitOMPTeamsDistributeSimdDirective(
2850 OMPTeamsDistributeSimdDirective *D) {
2851 VisitOMPLoopDirective(D);
2853}
2854
2855void ASTStmtWriter::VisitOMPTeamsDistributeParallelForSimdDirective(
2856 OMPTeamsDistributeParallelForSimdDirective *D) {
2857 VisitOMPLoopDirective(D);
2859}
2860
2861void ASTStmtWriter::VisitOMPTeamsDistributeParallelForDirective(
2862 OMPTeamsDistributeParallelForDirective *D) {
2863 VisitOMPLoopDirective(D);
2864 Record.writeBool(D->hasCancel());
2866}
2867
2868void ASTStmtWriter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2869 VisitStmt(D);
2870 VisitOMPExecutableDirective(D);
2872}
2873
2874void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective(
2875 OMPTargetTeamsDistributeDirective *D) {
2876 VisitOMPLoopDirective(D);
2878}
2879
2880void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective(
2881 OMPTargetTeamsDistributeParallelForDirective *D) {
2882 VisitOMPLoopDirective(D);
2883 Record.writeBool(D->hasCancel());
2885}
2886
2887void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2888 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
2889 VisitOMPLoopDirective(D);
2890 Code = serialization::
2891 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE;
2892}
2893
2894void ASTStmtWriter::VisitOMPTargetTeamsDistributeSimdDirective(
2895 OMPTargetTeamsDistributeSimdDirective *D) {
2896 VisitOMPLoopDirective(D);
2898}
2899
2900void ASTStmtWriter::VisitOMPInteropDirective(OMPInteropDirective *D) {
2901 VisitStmt(D);
2902 VisitOMPExecutableDirective(D);
2904}
2905
2906void ASTStmtWriter::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2907 VisitStmt(D);
2908 VisitOMPExecutableDirective(D);
2909 Record.AddSourceLocation(D->getTargetCallLoc());
2911}
2912
2913void ASTStmtWriter::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2914 VisitStmt(D);
2915 VisitOMPExecutableDirective(D);
2917}
2918
2919void ASTStmtWriter::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2920 VisitOMPLoopDirective(D);
2922}
2923
2924void ASTStmtWriter::VisitOMPTeamsGenericLoopDirective(
2925 OMPTeamsGenericLoopDirective *D) {
2926 VisitOMPLoopDirective(D);
2928}
2929
2930void ASTStmtWriter::VisitOMPTargetTeamsGenericLoopDirective(
2931 OMPTargetTeamsGenericLoopDirective *D) {
2932 VisitOMPLoopDirective(D);
2933 Record.writeBool(D->canBeParallelFor());
2935}
2936
2937void ASTStmtWriter::VisitOMPParallelGenericLoopDirective(
2938 OMPParallelGenericLoopDirective *D) {
2939 VisitOMPLoopDirective(D);
2941}
2942
2943void ASTStmtWriter::VisitOMPTargetParallelGenericLoopDirective(
2944 OMPTargetParallelGenericLoopDirective *D) {
2945 VisitOMPLoopDirective(D);
2947}
2948
2949//===----------------------------------------------------------------------===//
2950// OpenACC Constructs/Directives.
2951//===----------------------------------------------------------------------===//
2952void ASTStmtWriter::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2953 Record.push_back(S->clauses().size());
2954 Record.writeEnum(S->Kind);
2955 Record.AddSourceRange(S->Range);
2956 Record.AddSourceLocation(S->DirectiveLoc);
2957 Record.writeOpenACCClauseList(S->clauses());
2958}
2959
2960void ASTStmtWriter::VisitOpenACCAssociatedStmtConstruct(
2962 VisitOpenACCConstructStmt(S);
2963 Record.AddStmt(S->getAssociatedStmt());
2964}
2965
2966void ASTStmtWriter::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2967 VisitStmt(S);
2968 VisitOpenACCAssociatedStmtConstruct(S);
2970}
2971
2972void ASTStmtWriter::VisitOpenACCLoopConstruct(OpenACCLoopConstruct *S) {
2973 VisitStmt(S);
2974 VisitOpenACCAssociatedStmtConstruct(S);
2975 Record.writeEnum(S->getParentComputeConstructKind());
2977}
2978
2979void ASTStmtWriter::VisitOpenACCCombinedConstruct(OpenACCCombinedConstruct *S) {
2980 VisitStmt(S);
2981 VisitOpenACCAssociatedStmtConstruct(S);
2983}
2984
2985void ASTStmtWriter::VisitOpenACCDataConstruct(OpenACCDataConstruct *S) {
2986 VisitStmt(S);
2987 VisitOpenACCAssociatedStmtConstruct(S);
2989}
2990
2991void ASTStmtWriter::VisitOpenACCEnterDataConstruct(
2992 OpenACCEnterDataConstruct *S) {
2993 VisitStmt(S);
2994 VisitOpenACCConstructStmt(S);
2996}
2997
2998void ASTStmtWriter::VisitOpenACCExitDataConstruct(OpenACCExitDataConstruct *S) {
2999 VisitStmt(S);
3000 VisitOpenACCConstructStmt(S);
3002}
3003
3004void ASTStmtWriter::VisitOpenACCInitConstruct(OpenACCInitConstruct *S) {
3005 VisitStmt(S);
3006 VisitOpenACCConstructStmt(S);
3008}
3009
3010void ASTStmtWriter::VisitOpenACCShutdownConstruct(OpenACCShutdownConstruct *S) {
3011 VisitStmt(S);
3012 VisitOpenACCConstructStmt(S);
3014}
3015
3016void ASTStmtWriter::VisitOpenACCSetConstruct(OpenACCSetConstruct *S) {
3017 VisitStmt(S);
3018 VisitOpenACCConstructStmt(S);
3020}
3021
3022void ASTStmtWriter::VisitOpenACCUpdateConstruct(OpenACCUpdateConstruct *S) {
3023 VisitStmt(S);
3024 VisitOpenACCConstructStmt(S);
3026}
3027
3028void ASTStmtWriter::VisitOpenACCHostDataConstruct(OpenACCHostDataConstruct *S) {
3029 VisitStmt(S);
3030 VisitOpenACCAssociatedStmtConstruct(S);
3032}
3033
3034void ASTStmtWriter::VisitOpenACCWaitConstruct(OpenACCWaitConstruct *S) {
3035 VisitStmt(S);
3036 Record.push_back(S->getExprs().size());
3037 VisitOpenACCConstructStmt(S);
3038 Record.AddSourceLocation(S->LParenLoc);
3039 Record.AddSourceLocation(S->RParenLoc);
3040 Record.AddSourceLocation(S->QueuesLoc);
3041
3042 for(Expr *E : S->getExprs())
3043 Record.AddStmt(E);
3044
3046}
3047
3048void ASTStmtWriter::VisitOpenACCAtomicConstruct(OpenACCAtomicConstruct *S) {
3049 VisitStmt(S);
3050 VisitOpenACCConstructStmt(S);
3051 Record.writeEnum(S->getAtomicKind());
3052 Record.AddStmt(S->getAssociatedStmt());
3053
3055}
3056
3057void ASTStmtWriter::VisitOpenACCCacheConstruct(OpenACCCacheConstruct *S) {
3058 VisitStmt(S);
3059 Record.push_back(S->getVarList().size());
3060 VisitOpenACCConstructStmt(S);
3061 Record.AddSourceRange(S->ParensLoc);
3062 Record.AddSourceLocation(S->ReadOnlyLoc);
3063
3064 for (Expr *E : S->getVarList())
3065 Record.AddStmt(E);
3067}
3068
3069//===----------------------------------------------------------------------===//
3070// HLSL Constructs/Directives.
3071//===----------------------------------------------------------------------===//
3072
3073void ASTStmtWriter::VisitHLSLOutArgExpr(HLSLOutArgExpr *S) {
3074 VisitExpr(S);
3075 Record.AddStmt(S->getOpaqueArgLValue());
3076 Record.AddStmt(S->getCastedTemporary());
3077 Record.AddStmt(S->getWritebackCast());
3078 Record.writeBool(S->isInOut());
3080}
3081
3082//===----------------------------------------------------------------------===//
3083// ASTWriter Implementation
3084//===----------------------------------------------------------------------===//
3085
3087 assert(!SwitchCaseIDs.contains(S) && "SwitchCase recorded twice");
3088 unsigned NextID = SwitchCaseIDs.size();
3089 SwitchCaseIDs[S] = NextID;
3090 return NextID;
3091}
3092
3094 assert(SwitchCaseIDs.contains(S) && "SwitchCase hasn't been seen yet");
3095 return SwitchCaseIDs[S];
3096}
3097
3099 SwitchCaseIDs.clear();
3100}
3101
3102/// Write the given substatement or subexpression to the
3103/// bitstream.
3104void ASTWriter::WriteSubStmt(ASTContext &Context, Stmt *S) {
3106 ASTStmtWriter Writer(Context, *this, Record);
3107 ++NumStatements;
3108
3109 if (!S) {
3110 Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
3111 return;
3112 }
3113
3114 llvm::DenseMap<Stmt *, uint64_t>::iterator I = SubStmtEntries.find(S);
3115 if (I != SubStmtEntries.end()) {
3116 Record.push_back(I->second);
3117 Stream.EmitRecord(serialization::STMT_REF_PTR, Record);
3118 return;
3119 }
3120
3121#ifndef NDEBUG
3122 assert(!ParentStmts.count(S) && "There is a Stmt cycle!");
3123
3124 struct ParentStmtInserterRAII {
3125 Stmt *S;
3126 llvm::DenseSet<Stmt *> &ParentStmts;
3127
3128 ParentStmtInserterRAII(Stmt *S, llvm::DenseSet<Stmt *> &ParentStmts)
3129 : S(S), ParentStmts(ParentStmts) {
3130 ParentStmts.insert(S);
3131 }
3132 ~ParentStmtInserterRAII() {
3133 ParentStmts.erase(S);
3134 }
3135 };
3136
3137 ParentStmtInserterRAII ParentStmtInserter(S, ParentStmts);
3138#endif
3139
3140 Writer.Visit(S);
3141
3142 uint64_t Offset = Writer.Emit();
3143 SubStmtEntries[S] = Offset;
3144}
3145
3146/// Flush all of the statements that have been added to the
3147/// queue via AddStmt().
3148void ASTRecordWriter::FlushStmts() {
3149 // We expect to be the only consumer of the two temporary statement maps,
3150 // assert that they are empty.
3151 assert(Writer->SubStmtEntries.empty() && "unexpected entries in sub-stmt map");
3152 assert(Writer->ParentStmts.empty() && "unexpected entries in parent stmt map");
3153
3154 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3155 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[I]);
3156
3157 assert(N == StmtsToEmit.size() && "record modified while being written!");
3158
3159 // Note that we are at the end of a full expression. Any
3160 // expression records that follow this one are part of a different
3161 // expression.
3162 Writer->Stream.EmitRecord(serialization::STMT_STOP, ArrayRef<uint32_t>());
3163
3164 Writer->SubStmtEntries.clear();
3165 Writer->ParentStmts.clear();
3166 }
3167
3168 StmtsToEmit.clear();
3169}
3170
3171void ASTRecordWriter::FlushSubStmts() {
3172 // For a nested statement, write out the substatements in reverse order (so
3173 // that a simple stack machine can be used when loading), and don't emit a
3174 // STMT_STOP after each one.
3175 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3176 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[N - I - 1]);
3177 assert(N == StmtsToEmit.size() && "record modified while being written!");
3178 }
3179
3180 StmtsToEmit.clear();
3181}
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:900
SmallVector< uint64_t, 64 > RecordData
Definition ASTWriter.h:102
SourceLocation getColonLoc() const
Definition Expr.h:4315
SourceLocation getQuestionLoc() const
Definition Expr.h:4314
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition Expr.h:4484
SourceLocation getAmpAmpLoc() const
Definition Expr.h:4499
SourceLocation getLabelLoc() const
Definition Expr.h:4501
LabelDecl * getLabel() const
Definition Expr.h:4507
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition Expr.h:5955
Represents a loop initializing the elements of an array.
Definition Expr.h:5902
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition Expr.h:7105
SourceLocation getRBracketLoc() const
Definition Expr.h:7220
Expr * getBase()
Get base of the array section.
Definition Expr.h:7183
Expr * getLength()
Get length of array section.
Definition Expr.h:7193
bool isOMPArraySection() const
Definition Expr.h:7179
Expr * getStride()
Get stride of array section.
Definition Expr.h:7197
SourceLocation getColonLocSecond() const
Definition Expr.h:7215
Expr * getLowerBound()
Get lower bound of array section.
Definition Expr.h:7187
SourceLocation getColonLocFirst() const
Definition Expr.h:7214
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:6619
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition Expr.h:6638
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_astype token.
Definition Expr.h:6641
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition Expr.h:6644
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition Stmt.h:3267
bool isVolatile() const
Definition Stmt.h:3303
SourceLocation getAsmLoc() const
Definition Stmt.h:3297
unsigned getNumClobbers() const
Definition Stmt.h:3348
unsigned getNumOutputs() const
Definition Stmt.h:3316
unsigned getNumInputs() const
Definition Stmt.h:3338
bool isSimple() const
Definition Stmt.h:3300
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition Expr.h:6814
Expr ** getSubExprs()
Definition Expr.h:6889
SourceLocation getRParenLoc() const
Definition Expr.h:6943
static unsigned getNumSubExprs(AtomicOp Op)
Determine the number of arguments the specified atomic builtin should have.
Definition Expr.cpp:5155
AtomicOp getOp() const
Definition Expr.h:6877
SourceLocation getBuiltinLoc() const
Definition Expr.h:6942
Represents an attribute applied to a statement.
Definition Stmt.h:2193
Stmt * getSubStmt()
Definition Stmt.h:2229
SourceLocation getAttrLoc() const
Definition Stmt.h:2224
ArrayRef< const Attr * > getAttrs() const
Definition Stmt.h:2225
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition Expr.h:4387
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condition evaluates to false; ...
Definition Expr.h:4441
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition Expr.h:4425
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value.
Definition Expr.h:4429
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
Definition Expr.h:4434
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Definition Expr.h:4422
A builtin binary operation expression such as "x + y" or "x <= y".
Definition Expr.h:3972
Expr * getLHS() const
Definition Expr.h:4022
SourceLocation getOperatorLoc() const
Definition Expr.h:4014
bool hasStoredFPFeatures() const
Definition Expr.h:4157
Expr * getRHS() const
Definition Expr.h:4024
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:4169
Opcode getOpcode() const
Definition Expr.h:4017
bool hasExcludedOverflowPattern() const
Definition Expr.h:4164
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
Definition ASTWriter.h:1073
void addBit(bool Value)
Definition ASTWriter.h:1093
void addBits(uint32_t Value, uint32_t BitsWidth)
Definition ASTWriter.h:1094
void reset(uint32_t Value)
Definition ASTWriter.h:1088
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition Expr.h:6558
const BlockDecl * getBlockDecl() const
Definition Expr.h:6570
BreakStmt - This represents a break.
Definition Stmt.h:3125
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:3903
SourceLocation getRParenLoc() const
Definition Expr.h:3938
SourceLocation getLParenLoc() const
Definition Expr.h:3935
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:2877
bool hasStoredFPFeatures() const
Definition Expr.h:3036
bool usesMemberSyntax() const
Definition Expr.h:3038
ExprIterator arg_iterator
Definition Expr.h:3124
arg_iterator arg_begin()
Definition Expr.h:3134
arg_iterator arg_end()
Definition Expr.h:3137
ADLCallKind getADLCallKind() const
Definition Expr.h:3028
Expr * getCallee()
Definition Expr.h:3024
FPOptionsOverride getFPFeatures() const
Definition Expr.h:3176
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition Expr.h:3068
bool isCoroElideSafe() const
Definition Expr.h:3051
SourceLocation getRParenLoc() const
Definition Expr.h:3208
This captures a statement into a function.
Definition Stmt.h:3917
capture_init_range capture_inits()
Definition Stmt.h:4085
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:4068
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Definition Stmt.h:4038
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition Stmt.h:4021
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
Definition Stmt.h:4063
capture_range captures()
Definition Stmt.h:4055
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
Definition Stmt.cpp:1470
CaseStmt - Represent a case statement.
Definition Stmt.h:1910
Stmt * getSubStmt()
Definition Stmt.h:2023
Expr * getLHS()
Definition Stmt.h:1993
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ... RHS, which is a GNU extension.
Definition Stmt.h:1973
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
Definition Stmt.h:1979
Expr * getRHS()
Definition Stmt.h:2005
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition Expr.h:3610
path_iterator path_begin()
Definition Expr.h:3680
unsigned path_size() const
Definition Expr.h:3679
CastKind getCastKind() const
Definition Expr.h:3654
bool hasStoredFPFeatures() const
Definition Expr.h:3709
path_iterator path_end()
Definition Expr.h:3681
CXXBaseSpecifier ** path_iterator
Definition Expr.h:3676
FPOptionsOverride getFPFeatures() const
Definition Expr.h:3730
Expr * getSubExpr()
Definition Expr.h:3660
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:4782
SourceLocation getBuiltinLoc() const
Definition Expr.h:4829
Expr * getLHS() const
Definition Expr.h:4824
bool isConditionDependent() const
Definition Expr.h:4812
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
Definition Expr.h:4805
Expr * getRHS() const
Definition Expr.h:4826
SourceLocation getRParenLoc() const
Definition Expr.h:4832
Expr * getCond() const
Definition Expr.h:4822
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:4234
QualType getComputationLHSType() const
Definition Expr.h:4268
QualType getComputationResultType() const
Definition Expr.h:4271
CompoundLiteralExpr - [C99 6.5.2.5].
Definition Expr.h:3539
SourceLocation getLParenLoc() const
Definition Expr.h:3574
bool isFileScope() const
Definition Expr.h:3571
const Expr * getInitializer() const
Definition Expr.h:3567
TypeSourceInfo * getTypeSourceInfo() const
Definition Expr.h:3577
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition Stmt.h:1730
unsigned size() const
Definition Stmt.h:1775
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
Definition Stmt.h:1780
body_range body()
Definition Stmt.h:1793
SourceLocation getLBracLoc() const
Definition Stmt.h:1847
bool hasStoredFPFeatures() const
Definition Stmt.h:1777
SourceLocation getRBracLoc() const
Definition Stmt.h:1848
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:4325
Expr * getLHS() const
Definition Expr.h:4359
Expr * getCond() const
getCond - Return the expression representing the condition for the ?
Definition Expr.h:4348
Expr * getRHS() const
Definition Expr.h:4360
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:3109
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition Expr.h:4653
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition Expr.h:4757
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_convertvector token.
Definition Expr.h:4754
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:4716
TypeSourceInfo * getTypeSourceInfo() const
getTypeSourceInfo - Return the destination type.
Definition Expr.h:4746
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition Expr.h:4711
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition Expr.h:4743
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:1621
SourceLocation getEndLoc() const
Definition Stmt.h:1644
const DeclGroupRef getDeclGroup() const
Definition Stmt.h:1639
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:1647
NameKind
The kind of the name stored in this DeclarationName.
Stmt * getSubStmt()
Definition Stmt.h:2071
DeferStmt - This represents a deferred statement.
Definition Stmt.h:3226
Stmt * getBody()
Definition Stmt.h:3245
SourceLocation getDeferLoc() const
Definition Stmt.h:3240
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:5485
Expr * getSubExpr(unsigned Idx) const
Definition Expr.h:5767
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
Definition Expr.h:5749
MutableArrayRef< Designator > designators()
Definition Expr.h:5718
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the '=' that precedes the initializer value itself, if present.
Definition Expr.h:5740
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression,...
Definition Expr.h:5765
InitListExpr * getUpdater() const
Definition Expr.h:5870
DoStmt - This represents a 'do/while' stmt.
Definition Stmt.h:2822
Stmt * getBody()
Definition Stmt.h:2847
Expr * getCond()
Definition Stmt.h:2840
SourceLocation getWhileLoc() const
Definition Stmt.h:2853
SourceLocation getDoLoc() const
Definition Stmt.h:2851
SourceLocation getRParenLoc() const
Definition Stmt.h:2855
Represents a reference to emded data.
Definition Expr.h:5060
unsigned getStartingElementPos() const
Definition Expr.h:5081
SourceLocation getEndLoc() const
Definition Expr.h:5075
StringLiteral * getDataStringLiteral() const
Definition Expr.h:5077
SourceLocation getBeginLoc() const
Definition Expr.h:5074
size_t getDataElementCount() const
Definition Expr.h:5082
ExplicitCastExpr - An explicit cast written in the source code.
Definition Expr.h:3862
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Definition Expr.h:3884
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:6498
SourceLocation getAccessorLoc() const
Definition Expr.h:6522
const Expr * getBase() const
Definition Expr.h:6515
IdentifierInfo & getAccessor() const
Definition Expr.h:6519
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:2878
Stmt * getInit()
Definition Stmt.h:2893
SourceLocation getRParenLoc() const
Definition Stmt.h:2938
Stmt * getBody()
Definition Stmt.h:2922
Expr * getInc()
Definition Stmt.h:2921
SourceLocation getForLoc() const
Definition Stmt.h:2934
Expr * getCond()
Definition Stmt.h:2920
SourceLocation getLParenLoc() const
Definition Stmt.h:2936
DeclStmt * getConditionVariableDeclStmt()
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
Definition Stmt.h:2908
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:3426
unsigned getNumLabels() const
Definition Stmt.h:3576
SourceLocation getRParenLoc() const
Definition Stmt.h:3448
IdentifierInfo * getInputIdentifier(unsigned i) const
Definition Stmt.h:3541
const Expr * getOutputConstraintExpr(unsigned i) const
Definition Stmt.h:3528
IdentifierInfo * getLabelIdentifier(unsigned i) const
Definition Stmt.h:3580
const Expr * getInputConstraintExpr(unsigned i) const
Definition Stmt.h:3554
IdentifierInfo * getOutputIdentifier(unsigned i) const
Definition Stmt.h:3517
const Expr * getAsmStringExpr() const
Definition Stmt.h:3453
Expr * getOutputExpr(unsigned i)
Definition Stmt.cpp:544
Expr * getClobberExpr(unsigned i)
Definition Stmt.h:3633
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:4857
SourceLocation getTokenLocation() const
getTokenLocation - The location of the __null token.
Definition Expr.h:4871
Represents a C11 generic selection.
Definition Expr.h:6112
unsigned getNumAssocs() const
The number of association expressions.
Definition Expr.h:6352
bool isExprPredicate() const
Whether this generic selection uses an expression as its controlling argument.
Definition Expr.h:6368
SourceLocation getGenericLoc() const
Definition Expr.h:6465
SourceLocation getRParenLoc() const
Definition Expr.h:6469
SourceLocation getDefaultLoc() const
Definition Expr.h:6468
GotoStmt - This represents a direct goto.
Definition Stmt.h:2959
SourceLocation getLabelLoc() const
Definition Stmt.h:2977
SourceLocation getGotoLoc() const
Definition Stmt.h:2975
LabelDecl * getLabel() const
Definition Stmt.h:2972
This class represents temporary values used to represent inout and out arguments in HLSL.
Definition Expr.h:7283
const OpaqueValueExpr * getCastedTemporary() const
Definition Expr.h:7334
const OpaqueValueExpr * getOpaqueArgLValue() const
Definition Expr.h:7315
bool isInOut() const
returns true if the parameter is inout and false if the parameter is out.
Definition Expr.h:7342
const Expr * getWritebackCast() const
Definition Expr.h:7329
IfStmt - This represents an if/then/else.
Definition Stmt.h:2249
Stmt * getThen()
Definition Stmt.h:2338
SourceLocation getIfLoc() const
Definition Stmt.h:2415
IfStatementKind getStatementKind() const
Definition Stmt.h:2450
SourceLocation getElseLoc() const
Definition Stmt.h:2418
Stmt * getInit()
Definition Stmt.h:2399
SourceLocation getLParenLoc() const
Definition Stmt.h:2467
Expr * getCond()
Definition Stmt.h:2326
Stmt * getElse()
Definition Stmt.h:2347
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Definition Stmt.h:2382
SourceLocation getRParenLoc() const
Definition Stmt.h:2469
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:3787
bool isPartOfExplicitCast() const
Definition Expr.h:3818
Represents an implicitly-generated value initialization of an object of a given type.
Definition Expr.h:5991
IndirectGotoStmt - This represents an indirect goto.
Definition Stmt.h:2998
SourceLocation getGotoLoc() const
Definition Stmt.h:3014
SourceLocation getStarLoc() const
Definition Stmt.h:3016
Describes an C or C++ initializer list.
Definition Expr.h:5233
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition Expr.h:5359
unsigned getNumInits() const
Definition Expr.h:5263
SourceLocation getLBraceLoc() const
Definition Expr.h:5394
InitListExpr * getSyntacticForm() const
Definition Expr.h:5406
bool hadArrayRangeDesignator() const
Definition Expr.h:5417
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition Expr.h:5335
SourceLocation getRBraceLoc() const
Definition Expr.h:5396
const Expr * getInit(unsigned Init) const
Definition Expr.h:5287
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition Expr.h:1536
LabelStmt - Represents a label, which has a substatement.
Definition Stmt.h:2136
LabelDecl * getDecl() const
Definition Stmt.h:2154
bool isSideEntry() const
Definition Stmt.h:2183
Stmt * getSubStmt()
Definition Stmt.h:2158
SourceLocation getIdentLoc() const
Definition Stmt.h:2151
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:3047
SourceLocation getLabelLoc() const
Definition Stmt.h:3082
LabelDecl * getLabelDecl()
Definition Stmt.h:3085
SourceLocation getKwLoc() const
Definition Stmt.h:3072
bool hasLabelTarget() const
Definition Stmt.h:3080
This represents a Microsoft inline-assembly statement extension.
Definition Stmt.h:3645
Token * getAsmToks()
Definition Stmt.h:3676
Expr * getOutputExpr(unsigned i)
Definition Stmt.cpp:881
StringRef getAsmString() const
Definition Stmt.h:3679
SourceLocation getLBraceLoc() const
Definition Stmt.h:3668
SourceLocation getEndLoc() const
Definition Stmt.h:3670
StringRef getInputConstraint(unsigned i) const
Definition Stmt.h:3699
StringRef getOutputConstraint(unsigned i) const
Definition Stmt.h:3686
StringRef getClobber(unsigned i) const
Definition Stmt.h:3723
unsigned getNumAsmToks()
Definition Stmt.h:3675
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
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition Expr.h:2799
SourceLocation getRBracketLoc() const
Definition Expr.h:2851
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition Expr.h:3298
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
Definition Expr.h:3487
SourceLocation getOperatorLoc() const
Definition Expr.h:3480
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name,...
Definition Expr.h:3400
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition Expr.h:3381
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition Expr.h:3522
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
Definition Expr.h:3395
Expr * getBase() const
Definition Expr.h:3375
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition Expr.h:3463
bool hadMultipleCandidates() const
Returns true if this member expression refers to a method that was resolved from an overloaded set ha...
Definition Expr.h:3502
bool isArrow() const
Definition Expr.h:3482
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Definition Expr.h:3385
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:5811
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition Stmt.h:1693
SourceLocation getSemiLoc() const
Definition Stmt.h:1704
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:5467
SourceLocation getColonLoc(unsigned I) const
Gets the location of the first ':' in the range for the given iterator definition.
Definition Expr.cpp:5461
SourceLocation getRParenLoc() const
Definition ExprOpenMP.h:245
IteratorRange getIteratorRange(unsigned I)
Gets the iterator range for the given iterator.
Definition Expr.cpp:5438
OMPIteratorHelperData & getHelper(unsigned I)
Fetches helper data for the specified iteration space.
Definition Expr.cpp:5477
SourceLocation getAssignLoc(unsigned I) const
Gets the location of '=' for the given iterator definition.
Definition Expr.cpp:5455
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:5434
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:6057
unsigned getNumExprs() const
Return the number of expressions in this paren list.
Definition Expr.h:6044
SourceLocation getLParenLoc() const
Definition Expr.h:6059
SourceLocation getRParenLoc() const
Definition Expr.h:6060
[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:6690
semantics_iterator semantics_end()
Definition Expr.h:6755
unsigned getResultExprIndex() const
Return the index of the result-bearing expression into the semantics expressions, or PseudoObjectExpr...
Definition Expr.h:6732
semantics_iterator semantics_begin()
Definition Expr.h:6751
Expr *const * semantics_iterator
Definition Expr.h:6749
unsigned getNumSemanticExprs() const
Definition Expr.h:6747
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Definition Expr.h:6727
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition Expr.h:7389
SourceLocation getEndLoc() const
Definition Expr.h:7408
child_range children()
Definition Expr.h:7402
SourceLocation getBeginLoc() const
Definition Expr.h:7407
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:3150
SourceLocation getReturnLoc() const
Definition Stmt.h:3199
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization.
Definition Stmt.h:3186
Expr * getRetValue()
Definition Stmt.h:3177
CompoundStmt * getBlock() const
Definition Stmt.h:3773
SourceLocation getExceptLoc() const
Definition Stmt.h:3766
Expr * getFilterExpr() const
Definition Stmt.h:3769
SourceLocation getFinallyLoc() const
Definition Stmt.h:3807
CompoundStmt * getBlock() const
Definition Stmt.h:3810
Represents a __leave statement.
Definition Stmt.h:3878
SourceLocation getLeaveLoc() const
Definition Stmt.h:3888
CompoundStmt * getTryBlock() const
Definition Stmt.h:3854
SourceLocation getTryLoc() const
Definition Stmt.h:3849
bool getIsCXXTry() const
Definition Stmt.h:3852
Stmt * getHandler() const
Definition Stmt.h:3858
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:4577
SourceLocation getBuiltinLoc() const
Definition Expr.h:4594
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
Definition Expr.h:4610
SourceLocation getRParenLoc() const
Definition Expr.h:4597
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
Definition Expr.h:4616
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:4951
SourceLocation getBeginLoc() const
Definition Expr.h:4996
const DeclContext * getParentContext() const
If the SourceLocExpr has been resolved return the subexpression representing the resolved value.
Definition Expr.h:4992
SourceLocation getEndLoc() const
Definition Expr.h:4997
SourceLocIdentKind getIdentKind() const
Definition Expr.h:4971
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition Expr.h:4529
CompoundStmt * getSubStmt()
Definition Expr.h:4546
unsigned getTemplateDepth() const
Definition Expr.h:4558
SourceLocation getRParenLoc() const
Definition Expr.h:4555
SourceLocation getLParenLoc() const
Definition Expr.h:4553
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
Definition Stmt.h:85
LambdaExprBitfields LambdaExprBits
Definition Stmt.h:1383
StmtClass getStmtClass() const
Definition Stmt.h:1483
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:1372
CXXNewExprBitfields CXXNewExprBits
Definition Stmt.h:1370
ConstantExprBitfields ConstantExprBits
Definition Stmt.h:1335
RequiresExprBitfields RequiresExprBits
Definition Stmt.h:1384
CXXFoldExprBitfields CXXFoldExprBits
Definition Stmt.h:1387
PackIndexingExprBitfields PackIndexingExprBits
Definition Stmt.h:1388
NullStmtBitfields NullStmtBits
Definition Stmt.h:1318
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition Stmt.h:1373
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:1887
SourceLocation getColonLoc() const
Definition Stmt.h:1889
const SwitchCase * getNextSwitchCase() const
Definition Stmt.h:1883
SwitchStmt - This represents a 'switch' stmt.
Definition Stmt.h:2499
SourceLocation getSwitchLoc() const
Definition Stmt.h:2634
SourceLocation getLParenLoc() const
Definition Stmt.h:2636
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:2659
SourceLocation getRParenLoc() const
Definition Stmt.h:2638
Expr * getCond()
Definition Stmt.h:2562
Stmt * getBody()
Definition Stmt.h:2574
Stmt * getInit()
Definition Stmt.h:2579
SwitchCase * getSwitchCaseList()
Definition Stmt.h:2630
DeclStmt * getConditionVariableDeclStmt()
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Definition Stmt.h:2613
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:4891
TypeSourceInfo * getWrittenTypeInfo() const
Definition Expr.h:4915
SourceLocation getBuiltinLoc() const
Definition Expr.h:4918
SourceLocation getRParenLoc() const
Definition Expr.h:4921
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
Definition Expr.h:4912
const Expr * getSubExpr() const
Definition Expr.h:4907
WhileStmt - This represents a 'while' stmt.
Definition Stmt.h:2687
Expr * getCond()
Definition Stmt.h:2739
SourceLocation getWhileLoc() const
Definition Stmt.h:2792
SourceLocation getRParenLoc() const
Definition Stmt.h:2797
DeclStmt * getConditionVariableDeclStmt()
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Definition Stmt.h:2775
SourceLocation getLParenLoc() const
Definition Stmt.h:2795
Stmt * getBody()
Definition Stmt.h:2751
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