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::VisitReturnStmt(ReturnStmt *S) {
334 VisitStmt(S);
335
336 bool HasNRVOCandidate = S->getNRVOCandidate() != nullptr;
337 Record.push_back(HasNRVOCandidate);
338
339 Record.AddStmt(S->getRetValue());
340 if (HasNRVOCandidate)
341 Record.AddDeclRef(S->getNRVOCandidate());
342
343 Record.AddSourceLocation(S->getReturnLoc());
345}
346
347void ASTStmtWriter::VisitDeclStmt(DeclStmt *S) {
348 VisitStmt(S);
349 Record.AddSourceLocation(S->getBeginLoc());
350 Record.AddSourceLocation(S->getEndLoc());
351 DeclGroupRef DG = S->getDeclGroup();
352 for (DeclGroupRef::iterator D = DG.begin(), DEnd = DG.end(); D != DEnd; ++D)
353 Record.AddDeclRef(*D);
355}
356
357void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) {
358 VisitStmt(S);
359 Record.push_back(S->getNumOutputs());
360 Record.push_back(S->getNumInputs());
361 Record.push_back(S->getNumClobbers());
362 Record.AddSourceLocation(S->getAsmLoc());
363 Record.push_back(S->isVolatile());
364 Record.push_back(S->isSimple());
365}
366
367void ASTStmtWriter::VisitGCCAsmStmt(GCCAsmStmt *S) {
368 VisitAsmStmt(S);
369 Record.push_back(S->getNumLabels());
370 Record.AddSourceLocation(S->getRParenLoc());
371 Record.AddStmt(S->getAsmStringExpr());
372
373 // Outputs
374 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
375 Record.AddIdentifierRef(S->getOutputIdentifier(I));
376 Record.AddStmt(S->getOutputConstraintExpr(I));
377 Record.AddStmt(S->getOutputExpr(I));
378 }
379
380 // Inputs
381 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
382 Record.AddIdentifierRef(S->getInputIdentifier(I));
383 Record.AddStmt(S->getInputConstraintExpr(I));
384 Record.AddStmt(S->getInputExpr(I));
385 }
386
387 // Clobbers
388 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
389 Record.AddStmt(S->getClobberExpr(I));
390
391 // Labels
392 for (unsigned I = 0, N = S->getNumLabels(); I != N; ++I) {
393 Record.AddIdentifierRef(S->getLabelIdentifier(I));
394 Record.AddStmt(S->getLabelExpr(I));
395 }
396
398}
399
400void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) {
401 VisitAsmStmt(S);
402 Record.AddSourceLocation(S->getLBraceLoc());
403 Record.AddSourceLocation(S->getEndLoc());
404 Record.push_back(S->getNumAsmToks());
405 Record.AddString(S->getAsmString());
406
407 // Tokens
408 for (unsigned I = 0, N = S->getNumAsmToks(); I != N; ++I) {
409 // FIXME: Move this to ASTRecordWriter?
410 Writer.AddToken(S->getAsmToks()[I], Record.getRecordData());
411 }
412
413 // Clobbers
414 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) {
415 Record.AddString(S->getClobber(I));
416 }
417
418 // Outputs
419 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
420 Record.AddStmt(S->getOutputExpr(I));
421 Record.AddString(S->getOutputConstraint(I));
422 }
423
424 // Inputs
425 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
426 Record.AddStmt(S->getInputExpr(I));
427 Record.AddString(S->getInputConstraint(I));
428 }
429
431}
432
433void ASTStmtWriter::VisitCoroutineBodyStmt(CoroutineBodyStmt *CoroStmt) {
434 VisitStmt(CoroStmt);
435 Record.push_back(CoroStmt->getParamMoves().size());
436 for (Stmt *S : CoroStmt->children())
437 Record.AddStmt(S);
439}
440
441void ASTStmtWriter::VisitCoreturnStmt(CoreturnStmt *S) {
442 VisitStmt(S);
443 Record.AddSourceLocation(S->getKeywordLoc());
444 Record.AddStmt(S->getOperand());
445 Record.AddStmt(S->getPromiseCall());
446 Record.push_back(S->isImplicit());
448}
449
450void ASTStmtWriter::VisitCoroutineSuspendExpr(CoroutineSuspendExpr *E) {
451 VisitExpr(E);
452 Record.AddSourceLocation(E->getKeywordLoc());
453 for (Stmt *S : E->children())
454 Record.AddStmt(S);
455 Record.AddStmt(E->getOpaqueValue());
456}
457
458void ASTStmtWriter::VisitCoawaitExpr(CoawaitExpr *E) {
459 VisitCoroutineSuspendExpr(E);
460 Record.push_back(E->isImplicit());
462}
463
464void ASTStmtWriter::VisitCoyieldExpr(CoyieldExpr *E) {
465 VisitCoroutineSuspendExpr(E);
467}
468
469void ASTStmtWriter::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
470 VisitExpr(E);
471 Record.AddSourceLocation(E->getKeywordLoc());
472 for (Stmt *S : E->children())
473 Record.AddStmt(S);
475}
476
477static void
479 const ASTConstraintSatisfaction &Satisfaction) {
480 Record.push_back(Satisfaction.IsSatisfied);
481 Record.push_back(Satisfaction.ContainsErrors);
482 if (!Satisfaction.IsSatisfied) {
483 Record.push_back(Satisfaction.NumRecords);
484 for (const auto &DetailRecord : Satisfaction) {
485 if (auto *Diag = dyn_cast<const ConstraintSubstitutionDiagnostic *>(
486 DetailRecord)) {
487 Record.push_back(/*Kind=*/0);
488 Record.AddSourceLocation(Diag->first);
489 Record.AddString(Diag->second);
490 continue;
491 }
492 if (auto *E = dyn_cast<const Expr *>(DetailRecord)) {
493 Record.push_back(/*Kind=*/1);
494 Record.AddStmt(const_cast<Expr *>(E));
495 } else {
496 Record.push_back(/*Kind=*/2);
497 auto *CR = cast<const ConceptReference *>(DetailRecord);
498 Record.AddConceptReference(CR);
499 }
500 }
501 }
502}
503
504static void
508 Record.AddString(D->SubstitutedEntity);
509 Record.AddSourceLocation(D->DiagLoc);
510 Record.AddString(D->DiagMessage);
511}
512
513void ASTStmtWriter::VisitConceptSpecializationExpr(
515 VisitExpr(E);
516 Record.AddDeclRef(E->getSpecializationDecl());
517 const ConceptReference *CR = E->getConceptReference();
518 Record.push_back(CR != nullptr);
519 if (CR)
520 Record.AddConceptReference(CR);
521 if (!E->isValueDependent())
523
525}
526
527void ASTStmtWriter::VisitRequiresExpr(RequiresExpr *E) {
528 VisitExpr(E);
529 Record.push_back(E->getLocalParameters().size());
530 Record.push_back(E->getRequirements().size());
531 Record.AddSourceLocation(E->RequiresExprBits.RequiresKWLoc);
532 Record.push_back(E->RequiresExprBits.IsSatisfied);
533 Record.AddDeclRef(E->getBody());
534 for (ParmVarDecl *P : E->getLocalParameters())
535 Record.AddDeclRef(P);
536 for (concepts::Requirement *R : E->getRequirements()) {
537 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(R)) {
538 Record.push_back(concepts::Requirement::RK_Type);
539 Record.push_back(TypeReq->Status);
541 addSubstitutionDiagnostic(Record, TypeReq->getSubstitutionDiagnostic());
542 else
543 Record.AddTypeSourceInfo(TypeReq->getType());
544 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(R)) {
545 Record.push_back(ExprReq->getKind());
546 Record.push_back(ExprReq->Status);
547 if (ExprReq->isExprSubstitutionFailure()) {
550 ExprReq->Value));
551 } else
552 Record.AddStmt(cast<Expr *>(ExprReq->Value));
553 if (ExprReq->getKind() == concepts::Requirement::RK_Compound) {
554 Record.AddSourceLocation(ExprReq->NoexceptLoc);
555 const auto &RetReq = ExprReq->getReturnTypeRequirement();
556 if (RetReq.isSubstitutionFailure()) {
557 Record.push_back(2);
558 addSubstitutionDiagnostic(Record, RetReq.getSubstitutionDiagnostic());
559 } else if (RetReq.isTypeConstraint()) {
560 Record.push_back(1);
561 Record.AddTemplateParameterList(
562 RetReq.getTypeConstraintTemplateParameterList());
563 if (ExprReq->Status >=
565 Record.AddStmt(
566 ExprReq->getReturnTypeRequirementSubstitutedConstraintExpr());
567 } else {
568 assert(RetReq.isEmpty());
569 Record.push_back(0);
570 }
571 }
572 } else {
573 auto *NestedReq = cast<concepts::NestedRequirement>(R);
574 Record.push_back(concepts::Requirement::RK_Nested);
575 Record.push_back(NestedReq->hasInvalidConstraint());
576 if (NestedReq->hasInvalidConstraint()) {
577 Record.AddString(NestedReq->getInvalidConstraintEntity());
578 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
579 } else {
580 Record.AddStmt(NestedReq->getConstraintExpr());
581 if (!NestedReq->isDependent())
582 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
583 }
584 }
585 }
586 Record.AddSourceLocation(E->getLParenLoc());
587 Record.AddSourceLocation(E->getRParenLoc());
588 Record.AddSourceLocation(E->getEndLoc());
589
591}
592
593
594void ASTStmtWriter::VisitCapturedStmt(CapturedStmt *S) {
595 VisitStmt(S);
596 // NumCaptures
597 Record.push_back(std::distance(S->capture_begin(), S->capture_end()));
598
599 // CapturedDecl and captured region kind
600 Record.AddDeclRef(S->getCapturedDecl());
601 Record.push_back(S->getCapturedRegionKind());
602
603 Record.AddDeclRef(S->getCapturedRecordDecl());
604
605 // Capture inits
606 for (auto *I : S->capture_inits())
607 Record.AddStmt(I);
608
609 // Body
610 Record.AddStmt(S->getCapturedStmt());
611
612 // Captures
613 for (const auto &I : S->captures()) {
614 if (I.capturesThis() || I.capturesVariableArrayType())
615 Record.AddDeclRef(nullptr);
616 else
617 Record.AddDeclRef(I.getCapturedVar());
618 Record.push_back(I.getCaptureKind());
619 Record.AddSourceLocation(I.getLocation());
620 }
621
623}
624
625void ASTStmtWriter::VisitSYCLKernelCallStmt(SYCLKernelCallStmt *S) {
626 VisitStmt(S);
627 Record.AddStmt(S->getOriginalStmt());
628 Record.AddDeclRef(S->getOutlinedFunctionDecl());
629
631}
632
633void ASTStmtWriter::VisitExpr(Expr *E) {
634 VisitStmt(E);
635
636 CurrentPackingBits.updateBits();
637 CurrentPackingBits.addBits(E->getDependence(), /*BitsWidth=*/5);
638 CurrentPackingBits.addBits(E->getValueKind(), /*BitsWidth=*/2);
639 CurrentPackingBits.addBits(E->getObjectKind(), /*BitsWidth=*/3);
640
641 Record.AddTypeRef(E->getType());
642}
643
644void ASTStmtWriter::VisitConstantExpr(ConstantExpr *E) {
645 VisitExpr(E);
646 Record.push_back(E->ConstantExprBits.ResultKind);
647
648 Record.push_back(E->ConstantExprBits.APValueKind);
649 Record.push_back(E->ConstantExprBits.IsUnsigned);
650 Record.push_back(E->ConstantExprBits.BitWidth);
651 // HasCleanup not serialized since we can just query the APValue.
652 Record.push_back(E->ConstantExprBits.IsImmediateInvocation);
653
654 switch (E->getResultStorageKind()) {
656 break;
658 Record.push_back(E->Int64Result());
659 break;
661 Record.AddAPValue(E->APValueResult());
662 break;
663 }
664
665 Record.AddStmt(E->getSubExpr());
667}
668
669void ASTStmtWriter::VisitOpenACCAsteriskSizeExpr(OpenACCAsteriskSizeExpr *E) {
670 VisitExpr(E);
671 Record.AddSourceLocation(E->getLocation());
673}
674
675void ASTStmtWriter::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *E) {
676 VisitExpr(E);
677
678 Record.AddSourceLocation(E->getLocation());
679 Record.AddSourceLocation(E->getLParenLocation());
680 Record.AddSourceLocation(E->getRParenLocation());
681 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
682
684}
685
686void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
687 VisitExpr(E);
688
689 bool HasFunctionName = E->getFunctionName() != nullptr;
690 Record.push_back(HasFunctionName);
691 Record.push_back(
692 llvm::to_underlying(E->getIdentKind())); // FIXME: stable encoding
693 Record.push_back(E->isTransparent());
694 Record.AddSourceLocation(E->getLocation());
695 if (HasFunctionName)
696 Record.AddStmt(E->getFunctionName());
698}
699
700void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
701 VisitExpr(E);
702
703 CurrentPackingBits.updateBits();
704
705 CurrentPackingBits.addBit(E->hadMultipleCandidates());
706 CurrentPackingBits.addBit(E->refersToEnclosingVariableOrCapture());
707 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
708 CurrentPackingBits.addBit(E->isImmediateEscalating());
709 CurrentPackingBits.addBit(E->getDecl() != E->getFoundDecl());
710 CurrentPackingBits.addBit(E->hasQualifier());
711 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
712
713 if (E->hasTemplateKWAndArgsInfo()) {
714 unsigned NumTemplateArgs = E->getNumTemplateArgs();
715 Record.push_back(NumTemplateArgs);
716 }
717
718 DeclarationName::NameKind nk = (E->getDecl()->getDeclName().getNameKind());
719
720 if ((!E->hasTemplateKWAndArgsInfo()) && (!E->hasQualifier()) &&
721 (E->getDecl() == E->getFoundDecl()) &&
723 AbbrevToUse = Writer.getDeclRefExprAbbrev();
724 }
725
726 if (E->hasQualifier())
727 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
728
729 if (E->getDecl() != E->getFoundDecl())
730 Record.AddDeclRef(E->getFoundDecl());
731
733 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
734 E->getTrailingObjects<TemplateArgumentLoc>());
735
736 Record.AddDeclRef(E->getDecl());
737 Record.AddSourceLocation(E->getLocation());
738 Record.AddDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
740}
741
742void ASTStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
743 VisitExpr(E);
744 Record.AddSourceLocation(E->getLocation());
745 Record.AddAPInt(E->getValue());
746
747 if (E->getBitWidth() == 32) {
748 AbbrevToUse = Writer.getIntegerLiteralAbbrev();
749 }
750
752}
753
754void ASTStmtWriter::VisitFixedPointLiteral(FixedPointLiteral *E) {
755 VisitExpr(E);
756 Record.AddSourceLocation(E->getLocation());
757 Record.push_back(E->getScale());
758 Record.AddAPInt(E->getValue());
760}
761
762void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
763 VisitExpr(E);
764 Record.push_back(E->getRawSemantics());
765 Record.push_back(E->isExact());
766 Record.AddAPFloat(E->getValue());
767 Record.AddSourceLocation(E->getLocation());
769}
770
771void ASTStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
772 VisitExpr(E);
773 Record.AddStmt(E->getSubExpr());
775}
776
777void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
778 VisitExpr(E);
779
780 // Store the various bits of data of StringLiteral.
781 Record.push_back(E->getNumConcatenated());
782 Record.push_back(E->getLength());
783 Record.push_back(E->getCharByteWidth());
784 Record.push_back(llvm::to_underlying(E->getKind()));
785 Record.push_back(E->isPascal());
786
787 // Store the trailing array of SourceLocation.
788 for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
789 Record.AddSourceLocation(E->getStrTokenLoc(I));
790
791 // Store the trailing array of char holding the string data.
792 StringRef StrData = E->getBytes();
793 for (unsigned I = 0, N = E->getByteLength(); I != N; ++I)
794 Record.push_back(StrData[I]);
795
797}
798
799void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
800 VisitExpr(E);
801 Record.push_back(E->getValue());
802 Record.AddSourceLocation(E->getLocation());
803 Record.push_back(llvm::to_underlying(E->getKind()));
804
805 AbbrevToUse = Writer.getCharacterLiteralAbbrev();
806
808}
809
810void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
811 VisitExpr(E);
812 Record.push_back(E->isProducedByFoldExpansion());
813 Record.AddSourceLocation(E->getLParen());
814 Record.AddSourceLocation(E->getRParen());
815 Record.AddStmt(E->getSubExpr());
817}
818
819void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
820 VisitExpr(E);
821 Record.push_back(E->getNumExprs());
822 for (auto *SubStmt : E->exprs())
823 Record.AddStmt(SubStmt);
824 Record.AddSourceLocation(E->getLParenLoc());
825 Record.AddSourceLocation(E->getRParenLoc());
827}
828
829void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
830 VisitExpr(E);
831 bool HasFPFeatures = E->hasStoredFPFeatures();
832 // Write this first for easy access when deserializing, as they affect the
833 // size of the UnaryOperator.
834 CurrentPackingBits.addBit(HasFPFeatures);
835 Record.AddStmt(E->getSubExpr());
836 CurrentPackingBits.addBits(E->getOpcode(),
837 /*Width=*/5); // FIXME: stable encoding
838 Record.AddSourceLocation(E->getOperatorLoc());
839 CurrentPackingBits.addBit(E->canOverflow());
840
841 if (HasFPFeatures)
842 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
844}
845
846void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
847 VisitExpr(E);
848 Record.push_back(E->getNumComponents());
849 Record.push_back(E->getNumExpressions());
850 Record.AddSourceLocation(E->getOperatorLoc());
851 Record.AddSourceLocation(E->getRParenLoc());
852 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
853 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
854 const OffsetOfNode &ON = E->getComponent(I);
855 Record.push_back(ON.getKind()); // FIXME: Stable encoding
856 Record.AddSourceLocation(ON.getSourceRange().getBegin());
857 Record.AddSourceLocation(ON.getSourceRange().getEnd());
858 switch (ON.getKind()) {
860 Record.push_back(ON.getArrayExprIndex());
861 break;
862
864 Record.AddDeclRef(ON.getField());
865 break;
866
868 Record.AddIdentifierRef(ON.getFieldName());
869 break;
870
872 Record.AddCXXBaseSpecifier(*ON.getBase());
873 break;
874 }
875 }
876 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
877 Record.AddStmt(E->getIndexExpr(I));
879}
880
881void ASTStmtWriter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
882 VisitExpr(E);
883 Record.push_back(E->getKind());
884 if (E->isArgumentType())
885 Record.AddTypeSourceInfo(E->getArgumentTypeInfo());
886 else {
887 Record.push_back(0);
888 Record.AddStmt(E->getArgumentExpr());
889 }
890 Record.AddSourceLocation(E->getOperatorLoc());
891 Record.AddSourceLocation(E->getRParenLoc());
893}
894
895void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
896 VisitExpr(E);
897 Record.AddStmt(E->getLHS());
898 Record.AddStmt(E->getRHS());
899 Record.AddSourceLocation(E->getRBracketLoc());
901}
902
903void ASTStmtWriter::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
904 VisitExpr(E);
905 Record.AddStmt(E->getBase());
906 Record.AddStmt(E->getRowIdx());
907 Record.AddStmt(E->getColumnIdx());
908 Record.AddSourceLocation(E->getRBracketLoc());
910}
911
912void ASTStmtWriter::VisitArraySectionExpr(ArraySectionExpr *E) {
913 VisitExpr(E);
914 Record.writeEnum(E->ASType);
915 Record.AddStmt(E->getBase());
916 Record.AddStmt(E->getLowerBound());
917 Record.AddStmt(E->getLength());
918 if (E->isOMPArraySection())
919 Record.AddStmt(E->getStride());
920 Record.AddSourceLocation(E->getColonLocFirst());
921
922 if (E->isOMPArraySection())
923 Record.AddSourceLocation(E->getColonLocSecond());
924
925 Record.AddSourceLocation(E->getRBracketLoc());
927}
928
929void ASTStmtWriter::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
930 VisitExpr(E);
931 Record.push_back(E->getDimensions().size());
932 Record.AddStmt(E->getBase());
933 for (Expr *Dim : E->getDimensions())
934 Record.AddStmt(Dim);
935 for (SourceRange SR : E->getBracketsRanges())
936 Record.AddSourceRange(SR);
937 Record.AddSourceLocation(E->getLParenLoc());
938 Record.AddSourceLocation(E->getRParenLoc());
940}
941
942void ASTStmtWriter::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
943 VisitExpr(E);
944 Record.push_back(E->numOfIterators());
945 Record.AddSourceLocation(E->getIteratorKwLoc());
946 Record.AddSourceLocation(E->getLParenLoc());
947 Record.AddSourceLocation(E->getRParenLoc());
948 for (unsigned I = 0, End = E->numOfIterators(); I < End; ++I) {
949 Record.AddDeclRef(E->getIteratorDecl(I));
950 Record.AddSourceLocation(E->getAssignLoc(I));
951 OMPIteratorExpr::IteratorRange Range = E->getIteratorRange(I);
952 Record.AddStmt(Range.Begin);
953 Record.AddStmt(Range.End);
954 Record.AddStmt(Range.Step);
955 Record.AddSourceLocation(E->getColonLoc(I));
956 if (Range.Step)
957 Record.AddSourceLocation(E->getSecondColonLoc(I));
958 // Serialize helpers
959 OMPIteratorHelperData &HD = E->getHelper(I);
960 Record.AddDeclRef(HD.CounterVD);
961 Record.AddStmt(HD.Upper);
962 Record.AddStmt(HD.Update);
963 Record.AddStmt(HD.CounterUpdate);
964 }
966}
967
968void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
969 VisitExpr(E);
970
971 Record.push_back(E->getNumArgs());
972 CurrentPackingBits.updateBits();
973 CurrentPackingBits.addBit(static_cast<bool>(E->getADLCallKind()));
974 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
975 CurrentPackingBits.addBit(E->isCoroElideSafe());
976 CurrentPackingBits.addBit(E->usesMemberSyntax());
977
978 Record.AddSourceLocation(E->getRParenLoc());
979 Record.AddStmt(E->getCallee());
980 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
981 Arg != ArgEnd; ++Arg)
982 Record.AddStmt(*Arg);
983
984 if (E->hasStoredFPFeatures())
985 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
986
987 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
988 !E->isCoroElideSafe() && !E->usesMemberSyntax() &&
989 E->getStmtClass() == Stmt::CallExprClass)
990 AbbrevToUse = Writer.getCallExprAbbrev();
991
993}
994
995void ASTStmtWriter::VisitRecoveryExpr(RecoveryExpr *E) {
996 VisitExpr(E);
997 Record.push_back(std::distance(E->children().begin(), E->children().end()));
998 Record.AddSourceLocation(E->getBeginLoc());
999 Record.AddSourceLocation(E->getEndLoc());
1000 for (Stmt *Child : E->children())
1001 Record.AddStmt(Child);
1003}
1004
1005void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
1006 VisitExpr(E);
1007
1008 bool HasQualifier = E->hasQualifier();
1009 bool HasFoundDecl = E->hasFoundDecl();
1010 bool HasTemplateInfo = E->hasTemplateKWAndArgsInfo();
1011 unsigned NumTemplateArgs = E->getNumTemplateArgs();
1012
1013 // Write these first for easy access when deserializing, as they affect the
1014 // size of the MemberExpr.
1015 CurrentPackingBits.updateBits();
1016 CurrentPackingBits.addBit(HasQualifier);
1017 CurrentPackingBits.addBit(HasFoundDecl);
1018 CurrentPackingBits.addBit(HasTemplateInfo);
1019 Record.push_back(NumTemplateArgs);
1020
1021 Record.AddStmt(E->getBase());
1022 Record.AddDeclRef(E->getMemberDecl());
1023 Record.AddDeclarationNameLoc(E->MemberDNLoc,
1024 E->getMemberDecl()->getDeclName());
1025 Record.AddSourceLocation(E->getMemberLoc());
1026 CurrentPackingBits.addBit(E->isArrow());
1027 CurrentPackingBits.addBit(E->hadMultipleCandidates());
1028 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
1029 Record.AddSourceLocation(E->getOperatorLoc());
1030
1031 if (HasQualifier)
1032 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1033
1034 if (HasFoundDecl) {
1035 DeclAccessPair FoundDecl = E->getFoundDecl();
1036 Record.AddDeclRef(FoundDecl.getDecl());
1037 CurrentPackingBits.addBits(FoundDecl.getAccess(), /*BitWidth=*/2);
1038 }
1039
1040 if (HasTemplateInfo)
1041 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1042 E->getTrailingObjects<TemplateArgumentLoc>());
1043
1045}
1046
1047void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1048 VisitExpr(E);
1049 Record.AddStmt(E->getBase());
1050 Record.AddSourceLocation(E->getIsaMemberLoc());
1051 Record.AddSourceLocation(E->getOpLoc());
1052 Record.push_back(E->isArrow());
1054}
1055
1056void ASTStmtWriter::
1057VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1058 VisitExpr(E);
1059 Record.AddStmt(E->getSubExpr());
1060 Record.push_back(E->shouldCopy());
1062}
1063
1064void ASTStmtWriter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1065 VisitExplicitCastExpr(E);
1066 Record.AddSourceLocation(E->getLParenLoc());
1067 Record.AddSourceLocation(E->getBridgeKeywordLoc());
1068 Record.push_back(E->getBridgeKind()); // FIXME: Stable encoding
1070}
1071
1072void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
1073 VisitExpr(E);
1074
1075 Record.push_back(E->path_size());
1076 CurrentPackingBits.updateBits();
1077 // 7 bits should be enough to store the casting kinds.
1078 CurrentPackingBits.addBits(E->getCastKind(), /*Width=*/7);
1079 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
1080 Record.AddStmt(E->getSubExpr());
1081
1083 PI = E->path_begin(), PE = E->path_end(); PI != PE; ++PI)
1084 Record.AddCXXBaseSpecifier(**PI);
1085
1086 if (E->hasStoredFPFeatures())
1087 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
1088}
1089
1090void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
1091 VisitExpr(E);
1092
1093 // Write this first for easy access when deserializing, as they affect the
1094 // size of the UnaryOperator.
1095 CurrentPackingBits.updateBits();
1096 CurrentPackingBits.addBits(E->getOpcode(), /*Width=*/6);
1097 bool HasFPFeatures = E->hasStoredFPFeatures();
1098 CurrentPackingBits.addBit(HasFPFeatures);
1099 CurrentPackingBits.addBit(E->hasExcludedOverflowPattern());
1100 Record.AddStmt(E->getLHS());
1101 Record.AddStmt(E->getRHS());
1102 Record.AddSourceLocation(E->getOperatorLoc());
1103 if (HasFPFeatures)
1104 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1105
1106 if (!HasFPFeatures && E->getValueKind() == VK_PRValue &&
1107 E->getObjectKind() == OK_Ordinary)
1108 AbbrevToUse = Writer.getBinaryOperatorAbbrev();
1109
1111}
1112
1113void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1114 VisitBinaryOperator(E);
1115 Record.AddTypeRef(E->getComputationLHSType());
1116 Record.AddTypeRef(E->getComputationResultType());
1117
1118 if (!E->hasStoredFPFeatures() && E->getValueKind() == VK_PRValue &&
1119 E->getObjectKind() == OK_Ordinary)
1120 AbbrevToUse = Writer.getCompoundAssignOperatorAbbrev();
1121
1123}
1124
1125void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
1126 VisitExpr(E);
1127 Record.AddStmt(E->getCond());
1128 Record.AddStmt(E->getLHS());
1129 Record.AddStmt(E->getRHS());
1130 Record.AddSourceLocation(E->getQuestionLoc());
1131 Record.AddSourceLocation(E->getColonLoc());
1133}
1134
1135void
1136ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1137 VisitExpr(E);
1138 Record.AddStmt(E->getOpaqueValue());
1139 Record.AddStmt(E->getCommon());
1140 Record.AddStmt(E->getCond());
1141 Record.AddStmt(E->getTrueExpr());
1142 Record.AddStmt(E->getFalseExpr());
1143 Record.AddSourceLocation(E->getQuestionLoc());
1144 Record.AddSourceLocation(E->getColonLoc());
1146}
1147
1148void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1149 VisitCastExpr(E);
1150 CurrentPackingBits.addBit(E->isPartOfExplicitCast());
1151
1152 if (E->path_size() == 0 && !E->hasStoredFPFeatures())
1153 AbbrevToUse = Writer.getExprImplicitCastAbbrev();
1154
1156}
1157
1158void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1159 VisitCastExpr(E);
1160 Record.AddTypeSourceInfo(E->getTypeInfoAsWritten());
1161}
1162
1163void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
1164 VisitExplicitCastExpr(E);
1165 Record.AddSourceLocation(E->getLParenLoc());
1166 Record.AddSourceLocation(E->getRParenLoc());
1168}
1169
1170void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1171 VisitExpr(E);
1172 Record.AddSourceLocation(E->getLParenLoc());
1173 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1174 Record.AddStmt(E->getInitializer());
1175 Record.push_back(E->isFileScope());
1177}
1178
1179void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1180 VisitExpr(E);
1181 Record.AddStmt(E->getBase());
1182 Record.AddIdentifierRef(&E->getAccessor());
1183 Record.AddSourceLocation(E->getAccessorLoc());
1185}
1186
1187void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
1188 VisitExpr(E);
1189 // NOTE: only add the (possibly null) syntactic form.
1190 // No need to serialize the isSemanticForm flag and the semantic form.
1191 Record.AddStmt(E->getSyntacticForm());
1192 Record.AddSourceLocation(E->getLBraceLoc());
1193 Record.AddSourceLocation(E->getRBraceLoc());
1194 bool isArrayFiller = isa<Expr *>(E->ArrayFillerOrUnionFieldInit);
1195 Record.push_back(isArrayFiller);
1196 if (isArrayFiller)
1197 Record.AddStmt(E->getArrayFiller());
1198 else
1199 Record.AddDeclRef(E->getInitializedFieldInUnion());
1200 Record.push_back(E->hadArrayRangeDesignator());
1201 Record.push_back(E->getNumInits());
1202 if (isArrayFiller) {
1203 // ArrayFiller may have filled "holes" due to designated initializer.
1204 // Replace them by 0 to indicate that the filler goes in that place.
1205 Expr *filler = E->getArrayFiller();
1206 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1207 Record.AddStmt(E->getInit(I) != filler ? E->getInit(I) : nullptr);
1208 } else {
1209 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1210 Record.AddStmt(E->getInit(I));
1211 }
1213}
1214
1215void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1216 VisitExpr(E);
1217 Record.push_back(E->getNumSubExprs());
1218 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1219 Record.AddStmt(E->getSubExpr(I));
1220 Record.AddSourceLocation(E->getEqualOrColonLoc());
1221 Record.push_back(E->usesGNUSyntax());
1222 for (const DesignatedInitExpr::Designator &D : E->designators()) {
1223 if (D.isFieldDesignator()) {
1224 if (FieldDecl *Field = D.getFieldDecl()) {
1225 Record.push_back(serialization::DESIG_FIELD_DECL);
1226 Record.AddDeclRef(Field);
1227 } else {
1228 Record.push_back(serialization::DESIG_FIELD_NAME);
1229 Record.AddIdentifierRef(D.getFieldName());
1230 }
1231 Record.AddSourceLocation(D.getDotLoc());
1232 Record.AddSourceLocation(D.getFieldLoc());
1233 } else if (D.isArrayDesignator()) {
1234 Record.push_back(serialization::DESIG_ARRAY);
1235 Record.push_back(D.getArrayIndex());
1236 Record.AddSourceLocation(D.getLBracketLoc());
1237 Record.AddSourceLocation(D.getRBracketLoc());
1238 } else {
1239 assert(D.isArrayRangeDesignator() && "Unknown designator");
1240 Record.push_back(serialization::DESIG_ARRAY_RANGE);
1241 Record.push_back(D.getArrayIndex());
1242 Record.AddSourceLocation(D.getLBracketLoc());
1243 Record.AddSourceLocation(D.getEllipsisLoc());
1244 Record.AddSourceLocation(D.getRBracketLoc());
1245 }
1246 }
1248}
1249
1250void ASTStmtWriter::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1251 VisitExpr(E);
1252 Record.AddStmt(E->getBase());
1253 Record.AddStmt(E->getUpdater());
1255}
1256
1257void ASTStmtWriter::VisitNoInitExpr(NoInitExpr *E) {
1258 VisitExpr(E);
1260}
1261
1262void ASTStmtWriter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1263 VisitExpr(E);
1264 Record.AddStmt(E->SubExprs[0]);
1265 Record.AddStmt(E->SubExprs[1]);
1267}
1268
1269void ASTStmtWriter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1270 VisitExpr(E);
1272}
1273
1274void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1275 VisitExpr(E);
1277}
1278
1279void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
1280 VisitExpr(E);
1281 Record.AddStmt(E->getSubExpr());
1282 Record.AddTypeSourceInfo(E->getWrittenTypeInfo());
1283 Record.AddSourceLocation(E->getBuiltinLoc());
1284 Record.AddSourceLocation(E->getRParenLoc());
1285 Record.push_back(E->isMicrosoftABI());
1287}
1288
1289void ASTStmtWriter::VisitSourceLocExpr(SourceLocExpr *E) {
1290 VisitExpr(E);
1291 Record.AddDeclRef(cast_or_null<Decl>(E->getParentContext()));
1292 Record.AddSourceLocation(E->getBeginLoc());
1293 Record.AddSourceLocation(E->getEndLoc());
1294 Record.push_back(llvm::to_underlying(E->getIdentKind()));
1296}
1297
1298void ASTStmtWriter::VisitEmbedExpr(EmbedExpr *E) {
1299 VisitExpr(E);
1300 Record.AddSourceLocation(E->getBeginLoc());
1301 Record.AddSourceLocation(E->getEndLoc());
1302 Record.AddStmt(E->getDataStringLiteral());
1303 Record.writeUInt32(E->getStartingElementPos());
1304 Record.writeUInt32(E->getDataElementCount());
1306}
1307
1308void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
1309 VisitExpr(E);
1310 Record.AddSourceLocation(E->getAmpAmpLoc());
1311 Record.AddSourceLocation(E->getLabelLoc());
1312 Record.AddDeclRef(E->getLabel());
1314}
1315
1316void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
1317 VisitExpr(E);
1318 Record.AddStmt(E->getSubStmt());
1319 Record.AddSourceLocation(E->getLParenLoc());
1320 Record.AddSourceLocation(E->getRParenLoc());
1321 Record.push_back(E->getTemplateDepth());
1323}
1324
1325void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
1326 VisitExpr(E);
1327 Record.AddStmt(E->getCond());
1328 Record.AddStmt(E->getLHS());
1329 Record.AddStmt(E->getRHS());
1330 Record.AddSourceLocation(E->getBuiltinLoc());
1331 Record.AddSourceLocation(E->getRParenLoc());
1332 Record.push_back(E->isConditionDependent() ? false : E->isConditionTrue());
1334}
1335
1336void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
1337 VisitExpr(E);
1338 Record.AddSourceLocation(E->getTokenLocation());
1340}
1341
1342void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1343 VisitExpr(E);
1344 Record.push_back(E->getNumSubExprs());
1345 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1346 Record.AddStmt(E->getExpr(I));
1347 Record.AddSourceLocation(E->getBuiltinLoc());
1348 Record.AddSourceLocation(E->getRParenLoc());
1350}
1351
1352void ASTStmtWriter::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1353 VisitExpr(E);
1354 bool HasFPFeatures = E->hasStoredFPFeatures();
1355 CurrentPackingBits.addBit(HasFPFeatures);
1356 Record.AddSourceLocation(E->getBuiltinLoc());
1357 Record.AddSourceLocation(E->getRParenLoc());
1358 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1359 Record.AddStmt(E->getSrcExpr());
1361 if (HasFPFeatures)
1362 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1363}
1364
1365void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
1366 VisitExpr(E);
1367 Record.AddDeclRef(E->getBlockDecl());
1369}
1370
1371void ASTStmtWriter::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1372 VisitExpr(E);
1373
1374 Record.push_back(E->getNumAssocs());
1375 Record.push_back(E->isExprPredicate());
1376 Record.push_back(E->ResultIndex);
1377 Record.AddSourceLocation(E->getGenericLoc());
1378 Record.AddSourceLocation(E->getDefaultLoc());
1379 Record.AddSourceLocation(E->getRParenLoc());
1380
1381 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1382 // Add 1 to account for the controlling expression which is the first
1383 // expression in the trailing array of Stmt *. This is not needed for
1384 // the trailing array of TypeSourceInfo *.
1385 for (unsigned I = 0, N = E->getNumAssocs() + 1; I < N; ++I)
1386 Record.AddStmt(Stmts[I]);
1387
1388 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1389 for (unsigned I = 0, N = E->getNumAssocs(); I < N; ++I)
1390 Record.AddTypeSourceInfo(TSIs[I]);
1391
1393}
1394
1395void ASTStmtWriter::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1396 VisitExpr(E);
1397 Record.push_back(E->getNumSemanticExprs());
1398
1399 // Push the result index. Currently, this needs to exactly match
1400 // the encoding used internally for ResultIndex.
1401 unsigned result = E->getResultExprIndex();
1402 result = (result == PseudoObjectExpr::NoResult ? 0 : result + 1);
1403 Record.push_back(result);
1404
1405 Record.AddStmt(E->getSyntacticForm());
1407 i = E->semantics_begin(), e = E->semantics_end(); i != e; ++i) {
1408 Record.AddStmt(*i);
1409 }
1411}
1412
1413void ASTStmtWriter::VisitAtomicExpr(AtomicExpr *E) {
1414 VisitExpr(E);
1415 Record.push_back(E->getOp());
1416 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1417 Record.AddStmt(E->getSubExprs()[I]);
1418 Record.AddSourceLocation(E->getBuiltinLoc());
1419 Record.AddSourceLocation(E->getRParenLoc());
1421}
1422
1423//===----------------------------------------------------------------------===//
1424// Objective-C Expressions and Statements.
1425//===----------------------------------------------------------------------===//
1426
1427void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1428 VisitExpr(E);
1429 Record.AddStmt(E->getString());
1430 Record.AddSourceLocation(E->getAtLoc());
1432}
1433
1434void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1435 VisitExpr(E);
1436 Record.AddStmt(E->getSubExpr());
1437 Record.AddDeclRef(E->getBoxingMethod());
1438 Record.AddSourceRange(E->getSourceRange());
1440}
1441
1442void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1443 VisitExpr(E);
1444 Record.push_back(E->getNumElements());
1445 for (unsigned i = 0; i < E->getNumElements(); i++)
1446 Record.AddStmt(E->getElement(i));
1447 Record.AddDeclRef(E->getArrayWithObjectsMethod());
1448 Record.AddSourceRange(E->getSourceRange());
1450}
1451
1452void ASTStmtWriter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1453 VisitExpr(E);
1454 Record.push_back(E->getNumElements());
1455 Record.push_back(E->HasPackExpansions);
1456 for (unsigned i = 0; i < E->getNumElements(); i++) {
1457 ObjCDictionaryElement Element = E->getKeyValueElement(i);
1458 Record.AddStmt(Element.Key);
1459 Record.AddStmt(Element.Value);
1460 if (E->HasPackExpansions) {
1461 Record.AddSourceLocation(Element.EllipsisLoc);
1462 unsigned NumExpansions = 0;
1463 if (Element.NumExpansions)
1464 NumExpansions = *Element.NumExpansions + 1;
1465 Record.push_back(NumExpansions);
1466 }
1467 }
1468
1469 Record.AddDeclRef(E->getDictWithObjectsMethod());
1470 Record.AddSourceRange(E->getSourceRange());
1472}
1473
1474void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1475 VisitExpr(E);
1476 Record.AddTypeSourceInfo(E->getEncodedTypeSourceInfo());
1477 Record.AddSourceLocation(E->getAtLoc());
1478 Record.AddSourceLocation(E->getRParenLoc());
1480}
1481
1482void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1483 VisitExpr(E);
1484 Record.AddSelectorRef(E->getSelector());
1485 Record.AddSourceLocation(E->getAtLoc());
1486 Record.AddSourceLocation(E->getRParenLoc());
1488}
1489
1490void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1491 VisitExpr(E);
1492 Record.AddDeclRef(E->getProtocol());
1493 Record.AddSourceLocation(E->getAtLoc());
1494 Record.AddSourceLocation(E->ProtoLoc);
1495 Record.AddSourceLocation(E->getRParenLoc());
1497}
1498
1499void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1500 VisitExpr(E);
1501 Record.AddDeclRef(E->getDecl());
1502 Record.AddSourceLocation(E->getLocation());
1503 Record.AddSourceLocation(E->getOpLoc());
1504 Record.AddStmt(E->getBase());
1505 Record.push_back(E->isArrow());
1506 Record.push_back(E->isFreeIvar());
1508}
1509
1510void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1511 VisitExpr(E);
1512 Record.push_back(E->SetterAndMethodRefFlags.getInt());
1513 Record.push_back(E->isImplicitProperty());
1514 if (E->isImplicitProperty()) {
1515 Record.AddDeclRef(E->getImplicitPropertyGetter());
1516 Record.AddDeclRef(E->getImplicitPropertySetter());
1517 } else {
1518 Record.AddDeclRef(E->getExplicitProperty());
1519 }
1520 Record.AddSourceLocation(E->getLocation());
1521 Record.AddSourceLocation(E->getReceiverLocation());
1522 if (E->isObjectReceiver()) {
1523 Record.push_back(0);
1524 Record.AddStmt(E->getBase());
1525 } else if (E->isSuperReceiver()) {
1526 Record.push_back(1);
1527 Record.AddTypeRef(E->getSuperReceiverType());
1528 } else {
1529 Record.push_back(2);
1530 Record.AddDeclRef(E->getClassReceiver());
1531 }
1532
1534}
1535
1536void ASTStmtWriter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1537 VisitExpr(E);
1538 Record.AddSourceLocation(E->getRBracket());
1539 Record.AddStmt(E->getBaseExpr());
1540 Record.AddStmt(E->getKeyExpr());
1541 Record.AddDeclRef(E->getAtIndexMethodDecl());
1542 Record.AddDeclRef(E->setAtIndexMethodDecl());
1543
1545}
1546
1547void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1548 VisitExpr(E);
1549 Record.push_back(E->getNumArgs());
1550 Record.push_back(E->getNumStoredSelLocs());
1551 Record.push_back(E->SelLocsKind);
1552 Record.push_back(E->isDelegateInitCall());
1553 Record.push_back(E->IsImplicit);
1554 Record.push_back((unsigned)E->getReceiverKind()); // FIXME: stable encoding
1555 switch (E->getReceiverKind()) {
1557 Record.AddStmt(E->getInstanceReceiver());
1558 break;
1559
1561 Record.AddTypeSourceInfo(E->getClassReceiverTypeInfo());
1562 break;
1563
1566 Record.AddTypeRef(E->getSuperType());
1567 Record.AddSourceLocation(E->getSuperLoc());
1568 break;
1569 }
1570
1571 if (E->getMethodDecl()) {
1572 Record.push_back(1);
1573 Record.AddDeclRef(E->getMethodDecl());
1574 } else {
1575 Record.push_back(0);
1576 Record.AddSelectorRef(E->getSelector());
1577 }
1578
1579 Record.AddSourceLocation(E->getLeftLoc());
1580 Record.AddSourceLocation(E->getRightLoc());
1581
1582 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
1583 Arg != ArgEnd; ++Arg)
1584 Record.AddStmt(*Arg);
1585
1586 SourceLocation *Locs = E->getStoredSelLocs();
1587 for (unsigned i = 0, e = E->getNumStoredSelLocs(); i != e; ++i)
1588 Record.AddSourceLocation(Locs[i]);
1589
1591}
1592
1593void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1594 VisitStmt(S);
1595 Record.AddStmt(S->getElement());
1596 Record.AddStmt(S->getCollection());
1597 Record.AddStmt(S->getBody());
1598 Record.AddSourceLocation(S->getForLoc());
1599 Record.AddSourceLocation(S->getRParenLoc());
1601}
1602
1603void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1604 VisitStmt(S);
1605 Record.AddStmt(S->getCatchBody());
1606 Record.AddDeclRef(S->getCatchParamDecl());
1607 Record.AddSourceLocation(S->getAtCatchLoc());
1608 Record.AddSourceLocation(S->getRParenLoc());
1610}
1611
1612void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1613 VisitStmt(S);
1614 Record.AddStmt(S->getFinallyBody());
1615 Record.AddSourceLocation(S->getAtFinallyLoc());
1617}
1618
1619void ASTStmtWriter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1620 VisitStmt(S); // FIXME: no test coverage.
1621 Record.AddStmt(S->getSubStmt());
1622 Record.AddSourceLocation(S->getAtLoc());
1624}
1625
1626void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1627 VisitStmt(S);
1628 Record.push_back(S->getNumCatchStmts());
1629 Record.push_back(S->getFinallyStmt() != nullptr);
1630 Record.AddStmt(S->getTryBody());
1631 for (ObjCAtCatchStmt *C : S->catch_stmts())
1632 Record.AddStmt(C);
1633 if (S->getFinallyStmt())
1634 Record.AddStmt(S->getFinallyStmt());
1635 Record.AddSourceLocation(S->getAtTryLoc());
1637}
1638
1639void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1640 VisitStmt(S); // FIXME: no test coverage.
1641 Record.AddStmt(S->getSynchExpr());
1642 Record.AddStmt(S->getSynchBody());
1643 Record.AddSourceLocation(S->getAtSynchronizedLoc());
1645}
1646
1647void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1648 VisitStmt(S); // FIXME: no test coverage.
1649 Record.AddStmt(S->getThrowExpr());
1650 Record.AddSourceLocation(S->getThrowLoc());
1652}
1653
1654void ASTStmtWriter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1655 VisitExpr(E);
1656 Record.push_back(E->getValue());
1657 Record.AddSourceLocation(E->getLocation());
1659}
1660
1661void ASTStmtWriter::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1662 VisitExpr(E);
1663 Record.AddSourceRange(E->getSourceRange());
1664 Record.AddVersionTuple(E->getVersion());
1666}
1667
1668//===----------------------------------------------------------------------===//
1669// C++ Expressions and Statements.
1670//===----------------------------------------------------------------------===//
1671
1672void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
1673 VisitStmt(S);
1674 Record.AddSourceLocation(S->getCatchLoc());
1675 Record.AddDeclRef(S->getExceptionDecl());
1676 Record.AddStmt(S->getHandlerBlock());
1678}
1679
1680void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
1681 VisitStmt(S);
1682 Record.push_back(S->getNumHandlers());
1683 Record.AddSourceLocation(S->getTryLoc());
1684 Record.AddStmt(S->getTryBlock());
1685 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1686 Record.AddStmt(S->getHandler(i));
1688}
1689
1690void ASTStmtWriter::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1691 VisitStmt(S);
1692 Record.AddSourceLocation(S->getForLoc());
1693 Record.AddSourceLocation(S->getCoawaitLoc());
1694 Record.AddSourceLocation(S->getColonLoc());
1695 Record.AddSourceLocation(S->getRParenLoc());
1696 Record.AddStmt(S->getInit());
1697 Record.AddStmt(S->getRangeStmt());
1698 Record.AddStmt(S->getBeginStmt());
1699 Record.AddStmt(S->getEndStmt());
1700 Record.AddStmt(S->getCond());
1701 Record.AddStmt(S->getInc());
1702 Record.AddStmt(S->getLoopVarStmt());
1703 Record.AddStmt(S->getBody());
1705}
1706
1707void ASTStmtWriter::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1708 VisitStmt(S);
1709 Record.AddSourceLocation(S->getKeywordLoc());
1710 Record.push_back(S->isIfExists());
1711 Record.AddNestedNameSpecifierLoc(S->getQualifierLoc());
1712 Record.AddDeclarationNameInfo(S->getNameInfo());
1713 Record.AddStmt(S->getSubStmt());
1715}
1716
1717void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1718 VisitCallExpr(E);
1719 Record.push_back(E->getOperator());
1720 Record.AddSourceLocation(E->BeginLoc);
1721
1722 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1723 !E->isCoroElideSafe() && !E->usesMemberSyntax())
1724 AbbrevToUse = Writer.getCXXOperatorCallExprAbbrev();
1725
1727}
1728
1729void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1730 VisitCallExpr(E);
1731
1732 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1733 !E->isCoroElideSafe() && !E->usesMemberSyntax())
1734 AbbrevToUse = Writer.getCXXMemberCallExprAbbrev();
1735
1737}
1738
1739void ASTStmtWriter::VisitCXXRewrittenBinaryOperator(
1741 VisitExpr(E);
1742 Record.push_back(E->isReversed());
1743 Record.AddStmt(E->getSemanticForm());
1745}
1746
1747void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
1748 VisitExpr(E);
1749
1750 Record.push_back(E->getNumArgs());
1751 Record.push_back(E->isElidable());
1752 Record.push_back(E->hadMultipleCandidates());
1753 Record.push_back(E->isListInitialization());
1754 Record.push_back(E->isStdInitListInitialization());
1755 Record.push_back(E->requiresZeroInitialization());
1756 Record.push_back(
1757 llvm::to_underlying(E->getConstructionKind())); // FIXME: stable encoding
1758 Record.push_back(E->isImmediateEscalating());
1759 Record.AddSourceLocation(E->getLocation());
1760 Record.AddDeclRef(E->getConstructor());
1761 Record.AddSourceRange(E->getParenOrBraceRange());
1762
1763 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1764 Record.AddStmt(E->getArg(I));
1765
1767}
1768
1769void ASTStmtWriter::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1770 VisitExpr(E);
1771 Record.AddDeclRef(E->getConstructor());
1772 Record.AddSourceLocation(E->getLocation());
1773 Record.push_back(E->constructsVBase());
1774 Record.push_back(E->inheritedFromVBase());
1776}
1777
1778void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1779 VisitCXXConstructExpr(E);
1780 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1782}
1783
1784void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) {
1785 VisitExpr(E);
1786 Record.push_back(E->LambdaExprBits.NumCaptures);
1787 Record.AddSourceRange(E->IntroducerRange);
1788 Record.push_back(E->LambdaExprBits.CaptureDefault); // FIXME: stable encoding
1789 Record.AddSourceLocation(E->CaptureDefaultLoc);
1790 Record.push_back(E->LambdaExprBits.ExplicitParams);
1791 Record.push_back(E->LambdaExprBits.ExplicitResultType);
1792 Record.AddSourceLocation(E->ClosingBrace);
1793
1794 // Add capture initializers.
1796 CEnd = E->capture_init_end();
1797 C != CEnd; ++C) {
1798 Record.AddStmt(*C);
1799 }
1800
1801 // Don't serialize the body. It belongs to the call operator declaration.
1802 // LambdaExpr only stores a copy of the Stmt *.
1803
1805}
1806
1807void ASTStmtWriter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1808 VisitExpr(E);
1809 Record.AddStmt(E->getSubExpr());
1811}
1812
1813void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1814 VisitExplicitCastExpr(E);
1815 Record.AddSourceRange(SourceRange(E->getOperatorLoc(), E->getRParenLoc()));
1816 CurrentPackingBits.addBit(E->getAngleBrackets().isValid());
1817 if (E->getAngleBrackets().isValid())
1818 Record.AddSourceRange(E->getAngleBrackets());
1819}
1820
1821void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1822 VisitCXXNamedCastExpr(E);
1824}
1825
1826void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1827 VisitCXXNamedCastExpr(E);
1829}
1830
1831void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1832 VisitCXXNamedCastExpr(E);
1834}
1835
1836void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1837 VisitCXXNamedCastExpr(E);
1839}
1840
1841void ASTStmtWriter::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1842 VisitCXXNamedCastExpr(E);
1844}
1845
1846void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1847 VisitExplicitCastExpr(E);
1848 Record.AddSourceLocation(E->getLParenLoc());
1849 Record.AddSourceLocation(E->getRParenLoc());
1851}
1852
1853void ASTStmtWriter::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1854 VisitExplicitCastExpr(E);
1855 Record.AddSourceLocation(E->getBeginLoc());
1856 Record.AddSourceLocation(E->getEndLoc());
1858}
1859
1860void ASTStmtWriter::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1861 VisitCallExpr(E);
1862 Record.AddSourceLocation(E->UDSuffixLoc);
1864}
1865
1866void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1867 VisitExpr(E);
1868 Record.push_back(E->getValue());
1869 Record.AddSourceLocation(E->getLocation());
1871}
1872
1873void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1874 VisitExpr(E);
1875 Record.AddSourceLocation(E->getLocation());
1877}
1878
1879void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1880 VisitExpr(E);
1881 Record.AddSourceRange(E->getSourceRange());
1882 if (E->isTypeOperand()) {
1883 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
1885 } else {
1886 Record.AddStmt(E->getExprOperand());
1888 }
1889}
1890
1891void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
1892 VisitExpr(E);
1893 Record.AddSourceLocation(E->getLocation());
1894 Record.push_back(E->isImplicit());
1896
1898}
1899
1900void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
1901 VisitExpr(E);
1902 Record.AddSourceLocation(E->getThrowLoc());
1903 Record.AddStmt(E->getSubExpr());
1904 Record.push_back(E->isThrownVariableInScope());
1906}
1907
1908void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1909 VisitExpr(E);
1910 Record.AddDeclRef(E->getParam());
1911 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1912 Record.AddSourceLocation(E->getUsedLocation());
1913 Record.push_back(E->hasRewrittenInit());
1914 if (E->hasRewrittenInit())
1915 Record.AddStmt(E->getRewrittenExpr());
1917}
1918
1919void ASTStmtWriter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1920 VisitExpr(E);
1921 Record.push_back(E->hasRewrittenInit());
1922 Record.AddDeclRef(E->getField());
1923 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1924 Record.AddSourceLocation(E->getExprLoc());
1925 if (E->hasRewrittenInit())
1926 Record.AddStmt(E->getRewrittenExpr());
1928}
1929
1930void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1931 VisitExpr(E);
1932 Record.AddCXXTemporary(E->getTemporary());
1933 Record.AddStmt(E->getSubExpr());
1935}
1936
1937void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1938 VisitExpr(E);
1939 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1940 Record.AddSourceLocation(E->getRParenLoc());
1942}
1943
1944void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
1945 VisitExpr(E);
1946
1947 Record.push_back(E->isArray());
1948 Record.push_back(E->hasInitializer());
1949 Record.push_back(E->getNumPlacementArgs());
1950 Record.push_back(E->isParenTypeId());
1951
1952 Record.push_back(E->isGlobalNew());
1953 ImplicitAllocationParameters IAP = E->implicitAllocationParameters();
1954 Record.push_back(isAlignedAllocation(IAP.PassAlignment));
1955 Record.push_back(isTypeAwareAllocation(IAP.PassTypeIdentity));
1956 Record.push_back(E->doesUsualArrayDeleteWantSize());
1957 Record.push_back(E->CXXNewExprBits.HasInitializer);
1958 Record.push_back(E->CXXNewExprBits.StoredInitializationStyle);
1959
1960 Record.AddDeclRef(E->getOperatorNew());
1961 Record.AddDeclRef(E->getOperatorDelete());
1962 Record.AddTypeSourceInfo(E->getAllocatedTypeSourceInfo());
1963 if (E->isParenTypeId())
1964 Record.AddSourceRange(E->getTypeIdParens());
1965 Record.AddSourceRange(E->getSourceRange());
1966 Record.AddSourceRange(E->getDirectInitRange());
1967
1968 for (CXXNewExpr::arg_iterator I = E->raw_arg_begin(), N = E->raw_arg_end();
1969 I != N; ++I)
1970 Record.AddStmt(*I);
1971
1973}
1974
1975void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1976 VisitExpr(E);
1977 Record.push_back(E->isGlobalDelete());
1978 Record.push_back(E->isArrayForm());
1979 Record.push_back(E->isArrayFormAsWritten());
1980 Record.push_back(E->doesUsualArrayDeleteWantSize());
1981 Record.AddDeclRef(E->getOperatorDelete());
1982 Record.AddStmt(E->getArgument());
1983 Record.AddSourceLocation(E->getBeginLoc());
1984
1986}
1987
1988void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1989 VisitExpr(E);
1990
1991 Record.AddStmt(E->getBase());
1992 Record.push_back(E->isArrow());
1993 Record.AddSourceLocation(E->getOperatorLoc());
1994 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1995 Record.AddTypeSourceInfo(E->getScopeTypeInfo());
1996 Record.AddSourceLocation(E->getColonColonLoc());
1997 Record.AddSourceLocation(E->getTildeLoc());
1998
1999 // PseudoDestructorTypeStorage.
2000 Record.AddIdentifierRef(E->getDestroyedTypeIdentifier());
2002 Record.AddSourceLocation(E->getDestroyedTypeLoc());
2003 else
2004 Record.AddTypeSourceInfo(E->getDestroyedTypeInfo());
2005
2007}
2008
2009void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) {
2010 VisitExpr(E);
2011 Record.push_back(E->getNumObjects());
2012 for (auto &Obj : E->getObjects()) {
2013 if (auto *BD = Obj.dyn_cast<BlockDecl *>()) {
2014 Record.push_back(serialization::COK_Block);
2015 Record.AddDeclRef(BD);
2016 } else if (auto *CLE = Obj.dyn_cast<CompoundLiteralExpr *>()) {
2017 Record.push_back(serialization::COK_CompoundLiteral);
2018 Record.AddStmt(CLE);
2019 }
2020 }
2021
2022 Record.push_back(E->cleanupsHaveSideEffects());
2023 Record.AddStmt(E->getSubExpr());
2025}
2026
2027void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
2029 VisitExpr(E);
2030
2031 // Don't emit anything here (or if you do you will have to update
2032 // the corresponding deserialization function).
2033 Record.push_back(E->getNumTemplateArgs());
2034 CurrentPackingBits.updateBits();
2035 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2036 CurrentPackingBits.addBit(E->hasFirstQualifierFoundInScope());
2037
2038 if (E->hasTemplateKWAndArgsInfo()) {
2039 const ASTTemplateKWAndArgsInfo &ArgInfo =
2040 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2042 E->getTrailingObjects<TemplateArgumentLoc>());
2043 }
2044
2045 CurrentPackingBits.addBit(E->isArrow());
2046
2047 Record.AddTypeRef(E->getBaseType());
2048 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2049 CurrentPackingBits.addBit(!E->isImplicitAccess());
2050 if (!E->isImplicitAccess())
2051 Record.AddStmt(E->getBase());
2052
2053 Record.AddSourceLocation(E->getOperatorLoc());
2054
2055 if (E->hasFirstQualifierFoundInScope())
2056 Record.AddDeclRef(E->getFirstQualifierFoundInScope());
2057
2058 Record.AddDeclarationNameInfo(E->MemberNameInfo);
2060}
2061
2062void
2063ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2064 VisitExpr(E);
2065
2066 // Don't emit anything here, HasTemplateKWAndArgsInfo must be
2067 // emitted first.
2068 CurrentPackingBits.addBit(
2069 E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
2070
2071 if (E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo) {
2072 const ASTTemplateKWAndArgsInfo &ArgInfo =
2073 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2074 // 16 bits should be enought to store the number of args
2075 CurrentPackingBits.addBits(ArgInfo.NumTemplateArgs, /*Width=*/16);
2077 E->getTrailingObjects<TemplateArgumentLoc>());
2078 }
2079
2080 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2081 Record.AddDeclarationNameInfo(E->NameInfo);
2083}
2084
2085void
2086ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2087 VisitExpr(E);
2088 Record.push_back(E->getNumArgs());
2090 ArgI = E->arg_begin(), ArgE = E->arg_end(); ArgI != ArgE; ++ArgI)
2091 Record.AddStmt(*ArgI);
2092 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
2093 Record.AddSourceLocation(E->getLParenLoc());
2094 Record.AddSourceLocation(E->getRParenLoc());
2095 Record.push_back(E->isListInitialization());
2097}
2098
2099void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
2100 VisitExpr(E);
2101
2102 Record.push_back(E->getNumDecls());
2103
2104 CurrentPackingBits.updateBits();
2105 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2106 if (E->hasTemplateKWAndArgsInfo()) {
2107 const ASTTemplateKWAndArgsInfo &ArgInfo =
2109 Record.push_back(ArgInfo.NumTemplateArgs);
2111 }
2112
2114 OvE = E->decls_end();
2115 OvI != OvE; ++OvI) {
2116 Record.AddDeclRef(OvI.getDecl());
2117 Record.push_back(OvI.getAccess());
2118 }
2119
2120 Record.AddDeclarationNameInfo(E->getNameInfo());
2121 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2122}
2123
2124void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2125 VisitOverloadExpr(E);
2126 CurrentPackingBits.addBit(E->isArrow());
2127 CurrentPackingBits.addBit(E->hasUnresolvedUsing());
2128 CurrentPackingBits.addBit(!E->isImplicitAccess());
2129 if (!E->isImplicitAccess())
2130 Record.AddStmt(E->getBase());
2131
2132 Record.AddSourceLocation(E->getOperatorLoc());
2133
2134 Record.AddTypeRef(E->getBaseType());
2136}
2137
2138void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2139 VisitOverloadExpr(E);
2140 CurrentPackingBits.addBit(E->requiresADL());
2141 Record.AddDeclRef(E->getNamingClass());
2143
2144 if (Writer.isWritingStdCXXNamedModules() && Writer.getChain()) {
2145 // Referencing all the possible declarations to make sure the change get
2146 // propagted.
2147 DeclarationName Name = E->getName();
2148 for (auto *Found :
2149 Record.getASTContext().getTranslationUnitDecl()->lookup(Name))
2150 if (Found->isFromASTFile())
2151 Writer.GetDeclRef(Found);
2152
2153 llvm::SmallVector<NamespaceDecl *> ExternalNSs;
2154 Writer.getChain()->ReadKnownNamespaces(ExternalNSs);
2155 for (auto *NS : ExternalNSs)
2156 for (auto *Found : NS->lookup(Name))
2157 Writer.GetDeclRef(Found);
2158 }
2159}
2160
2161void ASTStmtWriter::VisitTypeTraitExpr(TypeTraitExpr *E) {
2162 VisitExpr(E);
2163 Record.push_back(E->TypeTraitExprBits.IsBooleanTypeTrait);
2164 Record.push_back(E->TypeTraitExprBits.NumArgs);
2165 Record.push_back(E->TypeTraitExprBits.Kind); // FIXME: Stable encoding
2166
2167 if (E->TypeTraitExprBits.IsBooleanTypeTrait)
2168 Record.push_back(E->TypeTraitExprBits.Value);
2169 else
2170 Record.AddAPValue(E->getAPValue());
2171
2172 Record.AddSourceRange(E->getSourceRange());
2173 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2174 Record.AddTypeSourceInfo(E->getArg(I));
2176}
2177
2178void ASTStmtWriter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2179 VisitExpr(E);
2180 Record.push_back(E->getTrait());
2181 Record.push_back(E->getValue());
2182 Record.AddSourceRange(E->getSourceRange());
2183 Record.AddTypeSourceInfo(E->getQueriedTypeSourceInfo());
2184 Record.AddStmt(E->getDimensionExpression());
2186}
2187
2188void ASTStmtWriter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2189 VisitExpr(E);
2190 Record.push_back(E->getTrait());
2191 Record.push_back(E->getValue());
2192 Record.AddSourceRange(E->getSourceRange());
2193 Record.AddStmt(E->getQueriedExpression());
2195}
2196
2197void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2198 VisitExpr(E);
2199 Record.push_back(E->getValue());
2200 Record.AddSourceRange(E->getSourceRange());
2201 Record.AddStmt(E->getOperand());
2203}
2204
2205void ASTStmtWriter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2206 VisitExpr(E);
2207 Record.AddSourceLocation(E->getEllipsisLoc());
2208 Record.push_back(E->NumExpansions);
2209 Record.AddStmt(E->getPattern());
2211}
2212
2213void ASTStmtWriter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2214 VisitExpr(E);
2215 Record.push_back(E->isPartiallySubstituted() ? E->getPartialArguments().size()
2216 : 0);
2217 Record.AddSourceLocation(E->OperatorLoc);
2218 Record.AddSourceLocation(E->PackLoc);
2219 Record.AddSourceLocation(E->RParenLoc);
2220 Record.AddDeclRef(E->Pack);
2221 if (E->isPartiallySubstituted()) {
2222 for (const auto &TA : E->getPartialArguments())
2223 Record.AddTemplateArgument(TA);
2224 } else if (!E->isValueDependent()) {
2225 Record.push_back(E->getPackLength());
2226 }
2228}
2229
2230void ASTStmtWriter::VisitPackIndexingExpr(PackIndexingExpr *E) {
2231 VisitExpr(E);
2232 Record.push_back(E->PackIndexingExprBits.TransformedExpressions);
2233 Record.push_back(E->PackIndexingExprBits.FullySubstituted);
2234 Record.AddSourceLocation(E->getEllipsisLoc());
2235 Record.AddSourceLocation(E->getRSquareLoc());
2236 Record.AddStmt(E->getPackIdExpression());
2237 Record.AddStmt(E->getIndexExpr());
2238 for (Expr *Sub : E->getExpressions())
2239 Record.AddStmt(Sub);
2241}
2242
2243void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
2245 VisitExpr(E);
2246 Record.AddDeclRef(E->getAssociatedDecl());
2247 CurrentPackingBits.addBit(E->isReferenceParameter());
2248 CurrentPackingBits.addBits(E->getIndex(), /*Width=*/12);
2249 Record.writeUnsignedOrNone(E->getPackIndex());
2250 CurrentPackingBits.addBit(E->getFinal());
2251
2252 Record.AddSourceLocation(E->getNameLoc());
2253 Record.AddStmt(E->getReplacement());
2255}
2256
2257void ASTStmtWriter::VisitSubstNonTypeTemplateParmPackExpr(
2259 VisitExpr(E);
2260 Record.AddDeclRef(E->getAssociatedDecl());
2261 CurrentPackingBits.addBit(E->getFinal());
2262 Record.push_back(E->getIndex());
2263 Record.AddTemplateArgument(E->getArgumentPack());
2264 Record.AddSourceLocation(E->getParameterPackLocation());
2266}
2267
2268void ASTStmtWriter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2269 VisitExpr(E);
2270 Record.push_back(E->getNumExpansions());
2271 Record.AddDeclRef(E->getParameterPack());
2272 Record.AddSourceLocation(E->getParameterPackLocation());
2273 for (FunctionParmPackExpr::iterator I = E->begin(), End = E->end();
2274 I != End; ++I)
2275 Record.AddDeclRef(*I);
2277}
2278
2279void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2280 VisitExpr(E);
2281 Record.push_back(static_cast<bool>(E->getLifetimeExtendedTemporaryDecl()));
2283 Record.AddDeclRef(E->getLifetimeExtendedTemporaryDecl());
2284 else
2285 Record.AddStmt(E->getSubExpr());
2287}
2288
2289void ASTStmtWriter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2290 VisitExpr(E);
2291 Record.AddSourceLocation(E->LParenLoc);
2292 Record.AddSourceLocation(E->EllipsisLoc);
2293 Record.AddSourceLocation(E->RParenLoc);
2294 Record.push_back(E->NumExpansions.toInternalRepresentation());
2295 Record.AddStmt(E->SubExprs[0]);
2296 Record.AddStmt(E->SubExprs[1]);
2297 Record.AddStmt(E->SubExprs[2]);
2298 Record.push_back(E->CXXFoldExprBits.Opcode);
2300}
2301
2302void ASTStmtWriter::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2303 VisitExpr(E);
2304 ArrayRef<Expr *> InitExprs = E->getInitExprs();
2305 Record.push_back(InitExprs.size());
2306 Record.push_back(E->getUserSpecifiedInitExprs().size());
2307 Record.AddSourceLocation(E->getInitLoc());
2308 Record.AddSourceLocation(E->getBeginLoc());
2309 Record.AddSourceLocation(E->getEndLoc());
2310 for (Expr *InitExpr : E->getInitExprs())
2311 Record.AddStmt(InitExpr);
2312 Expr *ArrayFiller = E->getArrayFiller();
2313 FieldDecl *UnionField = E->getInitializedFieldInUnion();
2314 bool HasArrayFillerOrUnionDecl = ArrayFiller || UnionField;
2315 Record.push_back(HasArrayFillerOrUnionDecl);
2316 if (HasArrayFillerOrUnionDecl) {
2317 Record.push_back(static_cast<bool>(ArrayFiller));
2318 if (ArrayFiller)
2319 Record.AddStmt(ArrayFiller);
2320 else
2321 Record.AddDeclRef(UnionField);
2322 }
2324}
2325
2326void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2327 VisitExpr(E);
2328 Record.AddStmt(E->getSourceExpr());
2329 Record.AddSourceLocation(E->getLocation());
2330 Record.push_back(E->isUnique());
2332}
2333
2334//===----------------------------------------------------------------------===//
2335// CUDA Expressions and Statements.
2336//===----------------------------------------------------------------------===//
2337
2338void ASTStmtWriter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2339 VisitCallExpr(E);
2340 Record.AddStmt(E->getConfig());
2342}
2343
2344//===----------------------------------------------------------------------===//
2345// OpenCL Expressions and Statements.
2346//===----------------------------------------------------------------------===//
2347void ASTStmtWriter::VisitAsTypeExpr(AsTypeExpr *E) {
2348 VisitExpr(E);
2349 Record.AddSourceLocation(E->getBuiltinLoc());
2350 Record.AddSourceLocation(E->getRParenLoc());
2351 Record.AddStmt(E->getSrcExpr());
2353}
2354
2355//===----------------------------------------------------------------------===//
2356// Microsoft Expressions and Statements.
2357//===----------------------------------------------------------------------===//
2358void ASTStmtWriter::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2359 VisitExpr(E);
2360 Record.push_back(E->isArrow());
2361 Record.AddStmt(E->getBaseExpr());
2362 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2363 Record.AddSourceLocation(E->getMemberLoc());
2364 Record.AddDeclRef(E->getPropertyDecl());
2366}
2367
2368void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2369 VisitExpr(E);
2370 Record.AddStmt(E->getBase());
2371 Record.AddStmt(E->getIdx());
2372 Record.AddSourceLocation(E->getRBracketLoc());
2374}
2375
2376void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2377 VisitExpr(E);
2378 Record.AddSourceRange(E->getSourceRange());
2379 Record.AddDeclRef(E->getGuidDecl());
2380 if (E->isTypeOperand()) {
2381 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
2383 } else {
2384 Record.AddStmt(E->getExprOperand());
2386 }
2387}
2388
2389void ASTStmtWriter::VisitSEHExceptStmt(SEHExceptStmt *S) {
2390 VisitStmt(S);
2391 Record.AddSourceLocation(S->getExceptLoc());
2392 Record.AddStmt(S->getFilterExpr());
2393 Record.AddStmt(S->getBlock());
2395}
2396
2397void ASTStmtWriter::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2398 VisitStmt(S);
2399 Record.AddSourceLocation(S->getFinallyLoc());
2400 Record.AddStmt(S->getBlock());
2402}
2403
2404void ASTStmtWriter::VisitSEHTryStmt(SEHTryStmt *S) {
2405 VisitStmt(S);
2406 Record.push_back(S->getIsCXXTry());
2407 Record.AddSourceLocation(S->getTryLoc());
2408 Record.AddStmt(S->getTryBlock());
2409 Record.AddStmt(S->getHandler());
2411}
2412
2413void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2414 VisitStmt(S);
2415 Record.AddSourceLocation(S->getLeaveLoc());
2417}
2418
2419//===----------------------------------------------------------------------===//
2420// OpenMP Directives.
2421//===----------------------------------------------------------------------===//
2422
2423void ASTStmtWriter::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2424 VisitStmt(S);
2425 for (Stmt *SubStmt : S->SubStmts)
2426 Record.AddStmt(SubStmt);
2428}
2429
2430void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2431 Record.writeOMPChildren(E->Data);
2432 Record.AddSourceLocation(E->getBeginLoc());
2433 Record.AddSourceLocation(E->getEndLoc());
2434}
2435
2436void ASTStmtWriter::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2437 VisitStmt(D);
2438 Record.writeUInt32(D->getLoopsNumber());
2439 VisitOMPExecutableDirective(D);
2440}
2441
2442void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) {
2443 VisitOMPLoopBasedDirective(D);
2444}
2445
2446void ASTStmtWriter::VisitOMPMetaDirective(OMPMetaDirective *D) {
2447 VisitStmt(D);
2448 Record.push_back(D->getNumClauses());
2449 VisitOMPExecutableDirective(D);
2451}
2452
2453void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) {
2454 VisitStmt(D);
2455 VisitOMPExecutableDirective(D);
2456 Record.writeBool(D->hasCancel());
2458}
2459
2460void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) {
2461 VisitOMPLoopDirective(D);
2463}
2464
2465void ASTStmtWriter::VisitOMPCanonicalLoopNestTransformationDirective(
2466 OMPCanonicalLoopNestTransformationDirective *D) {
2467 VisitOMPLoopBasedDirective(D);
2468 Record.writeUInt32(D->getNumGeneratedTopLevelLoops());
2469}
2470
2471void ASTStmtWriter::VisitOMPTileDirective(OMPTileDirective *D) {
2472 VisitOMPCanonicalLoopNestTransformationDirective(D);
2474}
2475
2476void ASTStmtWriter::VisitOMPStripeDirective(OMPStripeDirective *D) {
2477 VisitOMPCanonicalLoopNestTransformationDirective(D);
2479}
2480
2481void ASTStmtWriter::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2482 VisitOMPCanonicalLoopNestTransformationDirective(D);
2484}
2485
2486void ASTStmtWriter::VisitOMPReverseDirective(OMPReverseDirective *D) {
2487 VisitOMPCanonicalLoopNestTransformationDirective(D);
2489}
2490
2491void ASTStmtWriter::VisitOMPInterchangeDirective(OMPInterchangeDirective *D) {
2492 VisitOMPCanonicalLoopNestTransformationDirective(D);
2494}
2495
2496void ASTStmtWriter::VisitOMPCanonicalLoopSequenceTransformationDirective(
2497 OMPCanonicalLoopSequenceTransformationDirective *D) {
2498 VisitStmt(D);
2499 VisitOMPExecutableDirective(D);
2500 Record.writeUInt32(D->getNumGeneratedTopLevelLoops());
2501}
2502
2503void ASTStmtWriter::VisitOMPFuseDirective(OMPFuseDirective *D) {
2504 VisitOMPCanonicalLoopSequenceTransformationDirective(D);
2506}
2507
2508void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) {
2509 VisitOMPLoopDirective(D);
2510 Record.writeBool(D->hasCancel());
2512}
2513
2514void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2515 VisitOMPLoopDirective(D);
2517}
2518
2519void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2520 VisitStmt(D);
2521 VisitOMPExecutableDirective(D);
2522 Record.writeBool(D->hasCancel());
2524}
2525
2526void ASTStmtWriter::VisitOMPSectionDirective(OMPSectionDirective *D) {
2527 VisitStmt(D);
2528 VisitOMPExecutableDirective(D);
2529 Record.writeBool(D->hasCancel());
2531}
2532
2533void ASTStmtWriter::VisitOMPScopeDirective(OMPScopeDirective *D) {
2534 VisitStmt(D);
2535 VisitOMPExecutableDirective(D);
2537}
2538
2539void ASTStmtWriter::VisitOMPSingleDirective(OMPSingleDirective *D) {
2540 VisitStmt(D);
2541 VisitOMPExecutableDirective(D);
2543}
2544
2545void ASTStmtWriter::VisitOMPMasterDirective(OMPMasterDirective *D) {
2546 VisitStmt(D);
2547 VisitOMPExecutableDirective(D);
2549}
2550
2551void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2552 VisitStmt(D);
2553 VisitOMPExecutableDirective(D);
2554 Record.AddDeclarationNameInfo(D->getDirectiveName());
2556}
2557
2558void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2559 VisitOMPLoopDirective(D);
2560 Record.writeBool(D->hasCancel());
2562}
2563
2564void ASTStmtWriter::VisitOMPParallelForSimdDirective(
2565 OMPParallelForSimdDirective *D) {
2566 VisitOMPLoopDirective(D);
2568}
2569
2570void ASTStmtWriter::VisitOMPParallelMasterDirective(
2571 OMPParallelMasterDirective *D) {
2572 VisitStmt(D);
2573 VisitOMPExecutableDirective(D);
2575}
2576
2577void ASTStmtWriter::VisitOMPParallelMaskedDirective(
2578 OMPParallelMaskedDirective *D) {
2579 VisitStmt(D);
2580 VisitOMPExecutableDirective(D);
2582}
2583
2584void ASTStmtWriter::VisitOMPParallelSectionsDirective(
2585 OMPParallelSectionsDirective *D) {
2586 VisitStmt(D);
2587 VisitOMPExecutableDirective(D);
2588 Record.writeBool(D->hasCancel());
2590}
2591
2592void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) {
2593 VisitStmt(D);
2594 VisitOMPExecutableDirective(D);
2595 Record.writeBool(D->hasCancel());
2597}
2598
2599void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2600 VisitStmt(D);
2601 VisitOMPExecutableDirective(D);
2602 Record.writeBool(D->isXLHSInRHSPart());
2603 Record.writeBool(D->isPostfixUpdate());
2604 Record.writeBool(D->isFailOnly());
2606}
2607
2608void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) {
2609 VisitStmt(D);
2610 VisitOMPExecutableDirective(D);
2612}
2613
2614void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2615 VisitStmt(D);
2616 VisitOMPExecutableDirective(D);
2618}
2619
2620void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
2621 OMPTargetEnterDataDirective *D) {
2622 VisitStmt(D);
2623 VisitOMPExecutableDirective(D);
2625}
2626
2627void ASTStmtWriter::VisitOMPTargetExitDataDirective(
2628 OMPTargetExitDataDirective *D) {
2629 VisitStmt(D);
2630 VisitOMPExecutableDirective(D);
2632}
2633
2634void ASTStmtWriter::VisitOMPTargetParallelDirective(
2635 OMPTargetParallelDirective *D) {
2636 VisitStmt(D);
2637 VisitOMPExecutableDirective(D);
2638 Record.writeBool(D->hasCancel());
2640}
2641
2642void ASTStmtWriter::VisitOMPTargetParallelForDirective(
2643 OMPTargetParallelForDirective *D) {
2644 VisitOMPLoopDirective(D);
2645 Record.writeBool(D->hasCancel());
2647}
2648
2649void ASTStmtWriter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2650 VisitStmt(D);
2651 VisitOMPExecutableDirective(D);
2653}
2654
2655void ASTStmtWriter::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2656 VisitStmt(D);
2657 VisitOMPExecutableDirective(D);
2659}
2660
2661void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2662 VisitStmt(D);
2663 Record.push_back(D->getNumClauses());
2664 VisitOMPExecutableDirective(D);
2666}
2667
2668void ASTStmtWriter::VisitOMPAssumeDirective(OMPAssumeDirective *D) {
2669 VisitStmt(D);
2670 VisitOMPExecutableDirective(D);
2672}
2673
2674void ASTStmtWriter::VisitOMPErrorDirective(OMPErrorDirective *D) {
2675 VisitStmt(D);
2676 Record.push_back(D->getNumClauses());
2677 VisitOMPExecutableDirective(D);
2679}
2680
2681void ASTStmtWriter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2682 VisitStmt(D);
2683 VisitOMPExecutableDirective(D);
2685}
2686
2687void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) {
2688 VisitStmt(D);
2689 VisitOMPExecutableDirective(D);
2691}
2692
2693void ASTStmtWriter::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2694 VisitStmt(D);
2695 VisitOMPExecutableDirective(D);
2697}
2698
2699void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
2700 VisitStmt(D);
2701 VisitOMPExecutableDirective(D);
2703}
2704
2705void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2706 VisitStmt(D);
2707 VisitOMPExecutableDirective(D);
2709}
2710
2711void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2712 VisitStmt(D);
2713 VisitOMPExecutableDirective(D);
2715}
2716
2717void ASTStmtWriter::VisitOMPCancellationPointDirective(
2718 OMPCancellationPointDirective *D) {
2719 VisitStmt(D);
2720 VisitOMPExecutableDirective(D);
2721 Record.writeEnum(D->getCancelRegion());
2723}
2724
2725void ASTStmtWriter::VisitOMPCancelDirective(OMPCancelDirective *D) {
2726 VisitStmt(D);
2727 VisitOMPExecutableDirective(D);
2728 Record.writeEnum(D->getCancelRegion());
2730}
2731
2732void ASTStmtWriter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2733 VisitOMPLoopDirective(D);
2734 Record.writeBool(D->hasCancel());
2736}
2737
2738void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2739 VisitOMPLoopDirective(D);
2741}
2742
2743void ASTStmtWriter::VisitOMPMasterTaskLoopDirective(
2744 OMPMasterTaskLoopDirective *D) {
2745 VisitOMPLoopDirective(D);
2746 Record.writeBool(D->hasCancel());
2748}
2749
2750void ASTStmtWriter::VisitOMPMaskedTaskLoopDirective(
2751 OMPMaskedTaskLoopDirective *D) {
2752 VisitOMPLoopDirective(D);
2753 Record.writeBool(D->hasCancel());
2755}
2756
2757void ASTStmtWriter::VisitOMPMasterTaskLoopSimdDirective(
2758 OMPMasterTaskLoopSimdDirective *D) {
2759 VisitOMPLoopDirective(D);
2761}
2762
2763void ASTStmtWriter::VisitOMPMaskedTaskLoopSimdDirective(
2764 OMPMaskedTaskLoopSimdDirective *D) {
2765 VisitOMPLoopDirective(D);
2767}
2768
2769void ASTStmtWriter::VisitOMPParallelMasterTaskLoopDirective(
2770 OMPParallelMasterTaskLoopDirective *D) {
2771 VisitOMPLoopDirective(D);
2772 Record.writeBool(D->hasCancel());
2774}
2775
2776void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopDirective(
2777 OMPParallelMaskedTaskLoopDirective *D) {
2778 VisitOMPLoopDirective(D);
2779 Record.writeBool(D->hasCancel());
2781}
2782
2783void ASTStmtWriter::VisitOMPParallelMasterTaskLoopSimdDirective(
2784 OMPParallelMasterTaskLoopSimdDirective *D) {
2785 VisitOMPLoopDirective(D);
2787}
2788
2789void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopSimdDirective(
2790 OMPParallelMaskedTaskLoopSimdDirective *D) {
2791 VisitOMPLoopDirective(D);
2793}
2794
2795void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2796 VisitOMPLoopDirective(D);
2798}
2799
2800void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2801 VisitStmt(D);
2802 VisitOMPExecutableDirective(D);
2804}
2805
2806void ASTStmtWriter::VisitOMPDistributeParallelForDirective(
2807 OMPDistributeParallelForDirective *D) {
2808 VisitOMPLoopDirective(D);
2809 Record.writeBool(D->hasCancel());
2811}
2812
2813void ASTStmtWriter::VisitOMPDistributeParallelForSimdDirective(
2814 OMPDistributeParallelForSimdDirective *D) {
2815 VisitOMPLoopDirective(D);
2817}
2818
2819void ASTStmtWriter::VisitOMPDistributeSimdDirective(
2820 OMPDistributeSimdDirective *D) {
2821 VisitOMPLoopDirective(D);
2823}
2824
2825void ASTStmtWriter::VisitOMPTargetParallelForSimdDirective(
2826 OMPTargetParallelForSimdDirective *D) {
2827 VisitOMPLoopDirective(D);
2829}
2830
2831void ASTStmtWriter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2832 VisitOMPLoopDirective(D);
2834}
2835
2836void ASTStmtWriter::VisitOMPTeamsDistributeDirective(
2837 OMPTeamsDistributeDirective *D) {
2838 VisitOMPLoopDirective(D);
2840}
2841
2842void ASTStmtWriter::VisitOMPTeamsDistributeSimdDirective(
2843 OMPTeamsDistributeSimdDirective *D) {
2844 VisitOMPLoopDirective(D);
2846}
2847
2848void ASTStmtWriter::VisitOMPTeamsDistributeParallelForSimdDirective(
2849 OMPTeamsDistributeParallelForSimdDirective *D) {
2850 VisitOMPLoopDirective(D);
2852}
2853
2854void ASTStmtWriter::VisitOMPTeamsDistributeParallelForDirective(
2855 OMPTeamsDistributeParallelForDirective *D) {
2856 VisitOMPLoopDirective(D);
2857 Record.writeBool(D->hasCancel());
2859}
2860
2861void ASTStmtWriter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2862 VisitStmt(D);
2863 VisitOMPExecutableDirective(D);
2865}
2866
2867void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective(
2868 OMPTargetTeamsDistributeDirective *D) {
2869 VisitOMPLoopDirective(D);
2871}
2872
2873void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective(
2874 OMPTargetTeamsDistributeParallelForDirective *D) {
2875 VisitOMPLoopDirective(D);
2876 Record.writeBool(D->hasCancel());
2878}
2879
2880void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2881 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
2882 VisitOMPLoopDirective(D);
2883 Code = serialization::
2884 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE;
2885}
2886
2887void ASTStmtWriter::VisitOMPTargetTeamsDistributeSimdDirective(
2888 OMPTargetTeamsDistributeSimdDirective *D) {
2889 VisitOMPLoopDirective(D);
2891}
2892
2893void ASTStmtWriter::VisitOMPInteropDirective(OMPInteropDirective *D) {
2894 VisitStmt(D);
2895 VisitOMPExecutableDirective(D);
2897}
2898
2899void ASTStmtWriter::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2900 VisitStmt(D);
2901 VisitOMPExecutableDirective(D);
2902 Record.AddSourceLocation(D->getTargetCallLoc());
2904}
2905
2906void ASTStmtWriter::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2907 VisitStmt(D);
2908 VisitOMPExecutableDirective(D);
2910}
2911
2912void ASTStmtWriter::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2913 VisitOMPLoopDirective(D);
2915}
2916
2917void ASTStmtWriter::VisitOMPTeamsGenericLoopDirective(
2918 OMPTeamsGenericLoopDirective *D) {
2919 VisitOMPLoopDirective(D);
2921}
2922
2923void ASTStmtWriter::VisitOMPTargetTeamsGenericLoopDirective(
2924 OMPTargetTeamsGenericLoopDirective *D) {
2925 VisitOMPLoopDirective(D);
2926 Record.writeBool(D->canBeParallelFor());
2928}
2929
2930void ASTStmtWriter::VisitOMPParallelGenericLoopDirective(
2931 OMPParallelGenericLoopDirective *D) {
2932 VisitOMPLoopDirective(D);
2934}
2935
2936void ASTStmtWriter::VisitOMPTargetParallelGenericLoopDirective(
2937 OMPTargetParallelGenericLoopDirective *D) {
2938 VisitOMPLoopDirective(D);
2940}
2941
2942//===----------------------------------------------------------------------===//
2943// OpenACC Constructs/Directives.
2944//===----------------------------------------------------------------------===//
2945void ASTStmtWriter::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2946 Record.push_back(S->clauses().size());
2947 Record.writeEnum(S->Kind);
2948 Record.AddSourceRange(S->Range);
2949 Record.AddSourceLocation(S->DirectiveLoc);
2950 Record.writeOpenACCClauseList(S->clauses());
2951}
2952
2953void ASTStmtWriter::VisitOpenACCAssociatedStmtConstruct(
2955 VisitOpenACCConstructStmt(S);
2956 Record.AddStmt(S->getAssociatedStmt());
2957}
2958
2959void ASTStmtWriter::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2960 VisitStmt(S);
2961 VisitOpenACCAssociatedStmtConstruct(S);
2963}
2964
2965void ASTStmtWriter::VisitOpenACCLoopConstruct(OpenACCLoopConstruct *S) {
2966 VisitStmt(S);
2967 VisitOpenACCAssociatedStmtConstruct(S);
2968 Record.writeEnum(S->getParentComputeConstructKind());
2970}
2971
2972void ASTStmtWriter::VisitOpenACCCombinedConstruct(OpenACCCombinedConstruct *S) {
2973 VisitStmt(S);
2974 VisitOpenACCAssociatedStmtConstruct(S);
2976}
2977
2978void ASTStmtWriter::VisitOpenACCDataConstruct(OpenACCDataConstruct *S) {
2979 VisitStmt(S);
2980 VisitOpenACCAssociatedStmtConstruct(S);
2982}
2983
2984void ASTStmtWriter::VisitOpenACCEnterDataConstruct(
2985 OpenACCEnterDataConstruct *S) {
2986 VisitStmt(S);
2987 VisitOpenACCConstructStmt(S);
2989}
2990
2991void ASTStmtWriter::VisitOpenACCExitDataConstruct(OpenACCExitDataConstruct *S) {
2992 VisitStmt(S);
2993 VisitOpenACCConstructStmt(S);
2995}
2996
2997void ASTStmtWriter::VisitOpenACCInitConstruct(OpenACCInitConstruct *S) {
2998 VisitStmt(S);
2999 VisitOpenACCConstructStmt(S);
3001}
3002
3003void ASTStmtWriter::VisitOpenACCShutdownConstruct(OpenACCShutdownConstruct *S) {
3004 VisitStmt(S);
3005 VisitOpenACCConstructStmt(S);
3007}
3008
3009void ASTStmtWriter::VisitOpenACCSetConstruct(OpenACCSetConstruct *S) {
3010 VisitStmt(S);
3011 VisitOpenACCConstructStmt(S);
3013}
3014
3015void ASTStmtWriter::VisitOpenACCUpdateConstruct(OpenACCUpdateConstruct *S) {
3016 VisitStmt(S);
3017 VisitOpenACCConstructStmt(S);
3019}
3020
3021void ASTStmtWriter::VisitOpenACCHostDataConstruct(OpenACCHostDataConstruct *S) {
3022 VisitStmt(S);
3023 VisitOpenACCAssociatedStmtConstruct(S);
3025}
3026
3027void ASTStmtWriter::VisitOpenACCWaitConstruct(OpenACCWaitConstruct *S) {
3028 VisitStmt(S);
3029 Record.push_back(S->getExprs().size());
3030 VisitOpenACCConstructStmt(S);
3031 Record.AddSourceLocation(S->LParenLoc);
3032 Record.AddSourceLocation(S->RParenLoc);
3033 Record.AddSourceLocation(S->QueuesLoc);
3034
3035 for(Expr *E : S->getExprs())
3036 Record.AddStmt(E);
3037
3039}
3040
3041void ASTStmtWriter::VisitOpenACCAtomicConstruct(OpenACCAtomicConstruct *S) {
3042 VisitStmt(S);
3043 VisitOpenACCConstructStmt(S);
3044 Record.writeEnum(S->getAtomicKind());
3045 Record.AddStmt(S->getAssociatedStmt());
3046
3048}
3049
3050void ASTStmtWriter::VisitOpenACCCacheConstruct(OpenACCCacheConstruct *S) {
3051 VisitStmt(S);
3052 Record.push_back(S->getVarList().size());
3053 VisitOpenACCConstructStmt(S);
3054 Record.AddSourceRange(S->ParensLoc);
3055 Record.AddSourceLocation(S->ReadOnlyLoc);
3056
3057 for (Expr *E : S->getVarList())
3058 Record.AddStmt(E);
3060}
3061
3062//===----------------------------------------------------------------------===//
3063// HLSL Constructs/Directives.
3064//===----------------------------------------------------------------------===//
3065
3066void ASTStmtWriter::VisitHLSLOutArgExpr(HLSLOutArgExpr *S) {
3067 VisitExpr(S);
3068 Record.AddStmt(S->getOpaqueArgLValue());
3069 Record.AddStmt(S->getCastedTemporary());
3070 Record.AddStmt(S->getWritebackCast());
3071 Record.writeBool(S->isInOut());
3073}
3074
3075//===----------------------------------------------------------------------===//
3076// ASTWriter Implementation
3077//===----------------------------------------------------------------------===//
3078
3080 assert(!SwitchCaseIDs.contains(S) && "SwitchCase recorded twice");
3081 unsigned NextID = SwitchCaseIDs.size();
3082 SwitchCaseIDs[S] = NextID;
3083 return NextID;
3084}
3085
3087 assert(SwitchCaseIDs.contains(S) && "SwitchCase hasn't been seen yet");
3088 return SwitchCaseIDs[S];
3089}
3090
3092 SwitchCaseIDs.clear();
3093}
3094
3095/// Write the given substatement or subexpression to the
3096/// bitstream.
3097void ASTWriter::WriteSubStmt(ASTContext &Context, Stmt *S) {
3099 ASTStmtWriter Writer(Context, *this, Record);
3100 ++NumStatements;
3101
3102 if (!S) {
3103 Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
3104 return;
3105 }
3106
3107 llvm::DenseMap<Stmt *, uint64_t>::iterator I = SubStmtEntries.find(S);
3108 if (I != SubStmtEntries.end()) {
3109 Record.push_back(I->second);
3110 Stream.EmitRecord(serialization::STMT_REF_PTR, Record);
3111 return;
3112 }
3113
3114#ifndef NDEBUG
3115 assert(!ParentStmts.count(S) && "There is a Stmt cycle!");
3116
3117 struct ParentStmtInserterRAII {
3118 Stmt *S;
3119 llvm::DenseSet<Stmt *> &ParentStmts;
3120
3121 ParentStmtInserterRAII(Stmt *S, llvm::DenseSet<Stmt *> &ParentStmts)
3122 : S(S), ParentStmts(ParentStmts) {
3123 ParentStmts.insert(S);
3124 }
3125 ~ParentStmtInserterRAII() {
3126 ParentStmts.erase(S);
3127 }
3128 };
3129
3130 ParentStmtInserterRAII ParentStmtInserter(S, ParentStmts);
3131#endif
3132
3133 Writer.Visit(S);
3134
3135 uint64_t Offset = Writer.Emit();
3136 SubStmtEntries[S] = Offset;
3137}
3138
3139/// Flush all of the statements that have been added to the
3140/// queue via AddStmt().
3141void ASTRecordWriter::FlushStmts() {
3142 // We expect to be the only consumer of the two temporary statement maps,
3143 // assert that they are empty.
3144 assert(Writer->SubStmtEntries.empty() && "unexpected entries in sub-stmt map");
3145 assert(Writer->ParentStmts.empty() && "unexpected entries in parent stmt map");
3146
3147 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3148 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[I]);
3149
3150 assert(N == StmtsToEmit.size() && "record modified while being written!");
3151
3152 // Note that we are at the end of a full expression. Any
3153 // expression records that follow this one are part of a different
3154 // expression.
3155 Writer->Stream.EmitRecord(serialization::STMT_STOP, ArrayRef<uint32_t>());
3156
3157 Writer->SubStmtEntries.clear();
3158 Writer->ParentStmts.clear();
3159 }
3160
3161 StmtsToEmit.clear();
3162}
3163
3164void ASTRecordWriter::FlushSubStmts() {
3165 // For a nested statement, write out the substatements in reverse order (so
3166 // that a simple stack machine can be used when loading), and don't emit a
3167 // STMT_STOP after each one.
3168 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3169 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[N - I - 1]);
3170 assert(N == StmtsToEmit.size() && "record modified while being written!");
3171 }
3172
3173 StmtsToEmit.clear();
3174}
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:896
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:7208
Expr * getBase()
Get base of the array section.
Definition Expr.h:7171
Expr * getLength()
Get length of array section.
Definition Expr.h:7181
bool isOMPArraySection() const
Definition Expr.h:7167
Expr * getStride()
Get stride of array section.
Definition Expr.h:7185
SourceLocation getColonLocSecond() const
Definition Expr.h:7203
Expr * getLowerBound()
Get lower bound of array section.
Definition Expr.h:7175
SourceLocation getColonLocFirst() const
Definition Expr.h:7202
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:2998
uint64_t getValue() const
Definition ExprCXX.h:3046
ArrayTypeTrait getTrait() const
Definition ExprCXX.h:3038
Expr * getDimensionExpression() const
Definition ExprCXX.h:3048
TypeSourceInfo * getQueriedTypeSourceInfo() const
Definition ExprCXX.h:3044
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:3236
bool isVolatile() const
Definition Stmt.h:3272
SourceLocation getAsmLoc() const
Definition Stmt.h:3266
unsigned getNumClobbers() const
Definition Stmt.h:3317
unsigned getNumOutputs() const
Definition Stmt.h:3285
unsigned getNumInputs() const
Definition Stmt.h:3307
bool isSimple() const
Definition Stmt.h:3269
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:5153
AtomicOp getOp() const
Definition Expr.h:6877
SourceLocation getBuiltinLoc() const
Definition Expr.h:6942
Represents an attribute applied to a statement.
Definition Stmt.h:2203
Stmt * getSubStmt()
Definition Stmt.h:2239
SourceLocation getAttrLoc() const
Definition Stmt.h:2234
ArrayRef< const Attr * > getAttrs() const
Definition Stmt.h:2235
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:1065
void addBit(bool Value)
Definition ASTWriter.h:1085
void addBits(uint32_t Value, uint32_t BitsWidth)
Definition ASTWriter.h:1086
void reset(uint32_t Value)
Definition ASTWriter.h:1080
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:3135
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition ExprCXX.h:5478
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5497
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5496
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:1494
CXXTemporary * getTemporary()
Definition ExprCXX.h:1512
const Expr * getSubExpr() const
Definition ExprCXX.h:1516
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:1549
SourceRange getParenOrBraceRange() const
Definition ExprCXX.h:1730
bool isElidable() const
Whether this construction is elidable.
Definition ExprCXX.h:1618
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1.
Definition ExprCXX.h:1623
Expr * getArg(unsigned Arg)
Return the specified argument.
Definition ExprCXX.h:1692
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition ExprCXX.h:1642
bool isImmediateEscalating() const
Definition ExprCXX.h:1707
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called.
Definition ExprCXX.h:1651
SourceLocation getLocation() const
Definition ExprCXX.h:1614
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition ExprCXX.h:1612
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition ExprCXX.h:1631
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Definition ExprCXX.h:1689
CXXConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition ExprCXX.h:1660
A default argument (C++ [dcl.fct.default]).
Definition ExprCXX.h:1271
SourceLocation getUsedLocation() const
Retrieve the location where this default argument was actually used.
Definition ExprCXX.h:1345
const ParmVarDecl * getParam() const
Definition ExprCXX.h:1313
const DeclContext * getUsedContext() const
Definition ExprCXX.h:1341
bool hasRewrittenInit() const
Definition ExprCXX.h:1316
A use of a default initializer in a constructor or in aggregate initialization.
Definition ExprCXX.h:1378
const DeclContext * getUsedContext() const
Definition ExprCXX.h:1435
const Expr * getRewrittenExpr() const
Retrieve the initializing expression with evaluated immediate calls, if any.
Definition ExprCXX.h:1423
bool hasRewrittenInit() const
Definition ExprCXX.h:1407
FieldDecl * getField()
Get the field whose initializer will be used.
Definition ExprCXX.h:1412
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition ExprCXX.h:2628
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2667
bool isArrayForm() const
Definition ExprCXX.h:2654
SourceLocation getBeginLoc() const
Definition ExprCXX.h:2678
bool isGlobalDelete() const
Definition ExprCXX.h:2653
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2663
bool isArrayFormAsWritten() const
Definition ExprCXX.h:2655
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition ExprCXX.h:3872
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:3971
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:3974
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition ExprCXX.h:4066
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:3998
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:3962
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information.
Definition ExprCXX.h:3985
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition ExprCXX.h:3954
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:5034
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:1833
SourceLocation getLParenLoc() const
Definition ExprCXX.h:1870
SourceLocation getRParenLoc() const
Definition ExprCXX.h:1872
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition ExprCXX.h:1753
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition ExprCXX.h:1794
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
Definition ExprCXX.h:1790
SourceLocation getLocation() const LLVM_READONLY
Definition ExprCXX.h:1806
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
Definition ExprCXX.h:1804
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:2357
bool isArray() const
Definition ExprCXX.h:2466
SourceRange getDirectInitRange() const
Definition ExprCXX.h:2611
ExprIterator arg_iterator
Definition ExprCXX.h:2571
ImplicitAllocationParameters implicitAllocationParameters() const
Provides the full set of information about expected implicit parameters in this call.
Definition ExprCXX.h:2564
bool hasInitializer() const
Whether this new-expression has any initializer at all.
Definition ExprCXX.h:2526
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2463
unsigned getNumPlacementArgs() const
Definition ExprCXX.h:2496
TypeSourceInfo * getAllocatedTypeSourceInfo() const
Definition ExprCXX.h:2440
SourceRange getSourceRange() const
Definition ExprCXX.h:2612
SourceRange getTypeIdParens() const
Definition ExprCXX.h:2518
bool isParenTypeId() const
Definition ExprCXX.h:2517
raw_arg_iterator raw_arg_end()
Definition ExprCXX.h:2598
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2558
raw_arg_iterator raw_arg_begin()
Definition ExprCXX.h:2597
FunctionDecl * getOperatorNew() const
Definition ExprCXX.h:2461
bool isGlobalNew() const
Definition ExprCXX.h:2523
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition ExprCXX.h:4311
bool getValue() const
Definition ExprCXX.h:4334
Expr * getOperand() const
Definition ExprCXX.h:4328
SourceRange getSourceRange() const
Definition ExprCXX.h:4332
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:5143
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5199
SourceLocation getInitLoc() const LLVM_READONLY
Definition ExprCXX.h:5201
MutableArrayRef< Expr * > getInitExprs()
Definition ExprCXX.h:5183
ArrayRef< Expr * > getUserSpecifiedInitExprs()
Definition ExprCXX.h:5189
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5197
FieldDecl * getInitializedFieldInUnion()
Definition ExprCXX.h:5221
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition ExprCXX.h:2747
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Definition ExprCXX.h:2841
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise,...
Definition ExprCXX.h:2811
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2825
SourceLocation getTildeLoc() const
Retrieve the location of the '~'.
Definition ExprCXX.h:2832
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information.
Definition ExprCXX.h:2800
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
Definition ExprCXX.h:2856
SourceLocation getColonColonLoc() const
Retrieve the location of the '::' in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2829
SourceLocation getOperatorLoc() const
Retrieve the location of the '.' or '->' operator.
Definition ExprCXX.h:2814
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:2848
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:2198
TypeSourceInfo * getTypeSourceInfo() const
Definition ExprCXX.h:2217
SourceLocation getRParenLoc() const
Definition ExprCXX.h:2221
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:1901
TypeSourceInfo * getTypeSourceInfo() const
Definition ExprCXX.h:1930
Represents the this expression in C++.
Definition ExprCXX.h:1155
bool isCapturedByCopyInLambdaWithExplicitObjectParameter() const
Definition ExprCXX.h:1181
bool isImplicit() const
Definition ExprCXX.h:1178
SourceLocation getLocation() const
Definition ExprCXX.h:1172
A C++ throw-expression (C++ [except.throw]).
Definition ExprCXX.h:1209
const Expr * getSubExpr() const
Definition ExprCXX.h:1229
SourceLocation getThrowLoc() const
Definition ExprCXX.h:1232
bool isThrownVariableInScope() const
Determines whether the variable thrown by this expression (if any!) is within the innermost try block...
Definition ExprCXX.h:1239
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:3746
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
Definition ExprCXX.h:3790
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition ExprCXX.h:3801
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
Definition ExprCXX.h:3784
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
Definition ExprCXX.h:3795
unsigned getNumArgs() const
Retrieve the number of arguments.
Definition ExprCXX.h:3804
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition ExprCXX.h:1069
Expr * getExprOperand() const
Definition ExprCXX.h:1110
MSGuidDecl * getGuidDecl() const
Definition ExprCXX.h:1115
bool isTypeOperand() const
Definition ExprCXX.h:1099
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition ExprCXX.h:1106
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprCXX.h:1119
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:3886
capture_init_range capture_inits()
Definition Stmt.h:4054
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition Stmt.cpp:1451
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
Definition Stmt.h:4037
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Definition Stmt.h:4007
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition Stmt.h:3990
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
Definition Stmt.h:4032
capture_range captures()
Definition Stmt.h:4024
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
Definition Stmt.cpp:1466
CaseStmt - Represent a case statement.
Definition Stmt.h:1920
Stmt * getSubStmt()
Definition Stmt.h:2033
Expr * getLHS()
Definition Stmt.h:2003
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ... RHS, which is a GNU extension.
Definition Stmt.h:1983
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
Definition Stmt.h:1989
Expr * getRHS()
Definition Stmt.h:2015
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:5371
bool isImplicit() const
Definition ExprCXX.h:5393
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:1720
unsigned size() const
Definition Stmt.h:1765
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
Definition Stmt.h:1770
body_range body()
Definition Stmt.h:1783
SourceLocation getLBracLoc() const
Definition Stmt.h:1857
bool hasStoredFPFeatures() const
Definition Stmt.h:1767
SourceLocation getRBracLoc() const
Definition Stmt.h:1858
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:3119
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:5257
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5348
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition ExprCXX.h:5311
Represents a 'co_yield' expression.
Definition ExprCXX.h:5452
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:1611
SourceLocation getEndLoc() const
Definition Stmt.h:1634
const DeclGroupRef getDeclGroup() const
Definition Stmt.h:1629
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:1637
NameKind
The kind of the name stored in this DeclarationName.
Stmt * getSubStmt()
Definition Stmt.h:2081
Represents a 'co_await' expression while the type of the promise is dependent.
Definition ExprCXX.h:5403
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5432
A qualified reference to a name whose declaration cannot yet be resolved.
Definition ExprCXX.h:3512
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
Definition ExprCXX.h:3560
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:2832
Stmt * getBody()
Definition Stmt.h:2857
Expr * getCond()
Definition Stmt.h:2850
SourceLocation getWhileLoc() const
Definition Stmt.h:2863
SourceLocation getDoLoc() const
Definition Stmt.h:2861
SourceLocation getRParenLoc() const
Definition Stmt.h:2865
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:3663
bool cleanupsHaveSideEffects() const
Definition ExprCXX.h:3698
ArrayRef< CleanupObject > getObjects() const
Definition ExprCXX.h:3687
unsigned getNumObjects() const
Definition ExprCXX.h:3691
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:273
QualType getType() const
Definition Expr.h:144
ExprDependence getDependence() const
Definition Expr.h:164
An expression trait intrinsic.
Definition ExprCXX.h:3071
Expr * getQueriedExpression() const
Definition ExprCXX.h:3110
ExpressionTrait getTrait() const
Definition ExprCXX.h:3106
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:2888
Stmt * getInit()
Definition Stmt.h:2903
SourceLocation getRParenLoc() const
Definition Stmt.h:2948
Stmt * getBody()
Definition Stmt.h:2932
Expr * getInc()
Definition Stmt.h:2931
SourceLocation getForLoc() const
Definition Stmt.h:2944
Expr * getCond()
Definition Stmt.h:2930
SourceLocation getLParenLoc() const
Definition Stmt.h:2946
DeclStmt * getConditionVariableDeclStmt()
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
Definition Stmt.h:2918
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:4843
ValueDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition ExprCXX.h:4876
ValueDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition ExprCXX.h:4869
iterator end() const
Definition ExprCXX.h:4878
unsigned getNumExpansions() const
Get the number of parameters in this parameter pack.
Definition ExprCXX.h:4881
SourceLocation getParameterPackLocation() const
Get the location of the parameter pack.
Definition ExprCXX.h:4872
iterator begin() const
Definition ExprCXX.h:4877
This represents a GCC inline-assembly statement extension.
Definition Stmt.h:3395
unsigned getNumLabels() const
Definition Stmt.h:3545
SourceLocation getRParenLoc() const
Definition Stmt.h:3417
IdentifierInfo * getInputIdentifier(unsigned i) const
Definition Stmt.h:3510
const Expr * getOutputConstraintExpr(unsigned i) const
Definition Stmt.h:3497
IdentifierInfo * getLabelIdentifier(unsigned i) const
Definition Stmt.h:3549
const Expr * getInputConstraintExpr(unsigned i) const
Definition Stmt.h:3523
IdentifierInfo * getOutputIdentifier(unsigned i) const
Definition Stmt.h:3486
const Expr * getAsmStringExpr() const
Definition Stmt.h:3422
Expr * getOutputExpr(unsigned i)
Definition Stmt.cpp:540
Expr * getClobberExpr(unsigned i)
Definition Stmt.h:3602
Expr * getInputExpr(unsigned i)
Definition Stmt.cpp:551
AddrLabelExpr * getLabelExpr(unsigned i) const
Definition Stmt.cpp:559
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:2969
SourceLocation getLabelLoc() const
Definition Stmt.h:2987
SourceLocation getGotoLoc() const
Definition Stmt.h:2985
LabelDecl * getLabel() const
Definition Stmt.h:2982
This class represents temporary values used to represent inout and out arguments in HLSL.
Definition Expr.h:7271
const OpaqueValueExpr * getCastedTemporary() const
Definition Expr.h:7322
const OpaqueValueExpr * getOpaqueArgLValue() const
Definition Expr.h:7303
bool isInOut() const
returns true if the parameter is inout and false if the parameter is out.
Definition Expr.h:7330
const Expr * getWritebackCast() const
Definition Expr.h:7317
IfStmt - This represents an if/then/else.
Definition Stmt.h:2259
Stmt * getThen()
Definition Stmt.h:2348
SourceLocation getIfLoc() const
Definition Stmt.h:2425
IfStatementKind getStatementKind() const
Definition Stmt.h:2460
SourceLocation getElseLoc() const
Definition Stmt.h:2428
Stmt * getInit()
Definition Stmt.h:2409
SourceLocation getLParenLoc() const
Definition Stmt.h:2477
Expr * getCond()
Definition Stmt.h:2336
Stmt * getElse()
Definition Stmt.h:2357
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Definition Stmt.h:2392
SourceLocation getRParenLoc() const
Definition Stmt.h:2479
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:3008
SourceLocation getGotoLoc() const
Definition Stmt.h:3024
SourceLocation getStarLoc() const
Definition Stmt.h:3026
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:2146
LabelDecl * getDecl() const
Definition Stmt.h:2164
bool isSideEntry() const
Definition Stmt.h:2193
Stmt * getSubStmt()
Definition Stmt.h:2168
SourceLocation getIdentLoc() const
Definition Stmt.h:2161
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition ExprCXX.h:1970
Expr ** capture_init_iterator
Iterator that walks over the capture initialization arguments.
Definition ExprCXX.h:2077
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Definition ExprCXX.h:2108
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition ExprCXX.h:2096
Base class for BreakStmt and ContinueStmt.
Definition Stmt.h:3057
SourceLocation getLabelLoc() const
Definition Stmt.h:3092
LabelDecl * getLabelDecl()
Definition Stmt.h:3095
SourceLocation getKwLoc() const
Definition Stmt.h:3082
bool hasLabelTarget() const
Definition Stmt.h:3090
This represents a Microsoft inline-assembly statement extension.
Definition Stmt.h:3614
Token * getAsmToks()
Definition Stmt.h:3645
Expr * getOutputExpr(unsigned i)
Definition Stmt.cpp:877
StringRef getAsmString() const
Definition Stmt.h:3648
SourceLocation getLBraceLoc() const
Definition Stmt.h:3637
SourceLocation getEndLoc() const
Definition Stmt.h:3639
StringRef getInputConstraint(unsigned i) const
Definition Stmt.h:3668
StringRef getOutputConstraint(unsigned i) const
Definition Stmt.h:3655
StringRef getClobber(unsigned i) const
Definition Stmt.h:3692
unsigned getNumAsmToks()
Definition Stmt.h:3644
Expr * getInputExpr(unsigned i)
Definition Stmt.cpp:881
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:993
bool isArrow() const
Definition ExprCXX.h:991
MSPropertyDecl * getPropertyDecl() const
Definition ExprCXX.h:990
Expr * getBaseExpr() const
Definition ExprCXX.h:989
SourceLocation getMemberLoc() const
Definition ExprCXX.h:992
MS property subscript expression.
Definition ExprCXX.h:1007
SourceLocation getRBracketLoc() const
Definition ExprCXX.h:1044
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition ExprCXX.h:4922
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
Definition ExprCXX.h:4939
LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl()
Definition ExprCXX.h:4962
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:1683
SourceLocation getSemiLoc() const
Definition Stmt.h:1694
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:5436
SourceLocation getColonLoc(unsigned I) const
Gets the location of the first ':' in the range for the given iterator definition.
Definition Expr.cpp:5430
SourceLocation getRParenLoc() const
Definition ExprOpenMP.h:245
IteratorRange getIteratorRange(unsigned I)
Gets the iterator range for the given iterator.
Definition Expr.cpp:5407
OMPIteratorHelperData & getHelper(unsigned I)
Fetches helper data for the specified iteration space.
Definition Expr.cpp:5446
SourceLocation getAssignLoc(unsigned I) const
Gets the location of '=' for the given iterator definition.
Definition Expr.cpp:5424
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:5403
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:1703
SourceRange getSourceRange() const
Definition ExprObjC.h:1722
VersionTuple getVersion() const
Definition ExprObjC.h:1726
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:1643
SourceLocation getLParenLoc() const
Definition ExprObjC.h:1666
SourceLocation getBridgeKeywordLoc() const
The location of the bridge keyword.
Definition ExprObjC.h:1677
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
Definition ExprObjC.h:1669
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition ExprObjC.h:308
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
Definition ExprObjC.h:359
ObjCMethodDecl * getDictWithObjectsMethod() const
Definition ExprObjC.h:376
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
Definition ExprObjC.h:361
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprObjC.h:382
ObjCEncodeExpr, used for @encode in Objective-C.
Definition ExprObjC.h:409
TypeSourceInfo * getEncodedTypeSourceInfo() const
Definition ExprObjC.h:430
SourceLocation getRParenLoc() const
Definition ExprObjC.h:425
SourceLocation getAtLoc() const
Definition ExprObjC.h:423
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:1582
bool shouldCopy() const
shouldCopy - True if we should do the 'copy' part of the copy-restore.
Definition ExprObjC.h:1610
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
Definition ExprObjC.h:1498
SourceLocation getIsaMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
Definition ExprObjC.h:1530
SourceLocation getOpLoc() const
Definition ExprObjC.h:1533
Expr * getBase() const
Definition ExprObjC.h:1523
bool isArrow() const
Definition ExprObjC.h:1525
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition ExprObjC.h:548
SourceLocation getLocation() const
Definition ExprObjC.h:591
SourceLocation getOpLoc() const
Definition ExprObjC.h:599
ObjCIvarDecl * getDecl()
Definition ExprObjC.h:578
bool isArrow() const
Definition ExprObjC.h:586
bool isFreeIvar() const
Definition ExprObjC.h:587
const Expr * getBase() const
Definition ExprObjC.h:582
An expression that sends a message to the given Objective-C object or class.
Definition ExprObjC.h:940
bool isDelegateInitCall() const
isDelegateInitCall - Answers whether this message send has been tagged as a "delegate init call",...
Definition ExprObjC.h:1421
SourceLocation getLeftLoc() const
Definition ExprObjC.h:1424
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Definition ExprObjC.h:1268
SourceLocation getSuperLoc() const
Retrieve the location of the 'super' keyword for a class or instance message to 'super',...
Definition ExprObjC.h:1309
Selector getSelector() const
Definition ExprObjC.cpp:289
@ SuperInstance
The receiver is the instance of the superclass object.
Definition ExprObjC.h:954
@ Instance
The receiver is an object instance.
Definition ExprObjC.h:948
@ SuperClass
The receiver is a superclass.
Definition ExprObjC.h:951
@ Class
The receiver is a class.
Definition ExprObjC.h:945
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:1296
QualType getSuperType() const
Retrieve the type referred to by 'super'.
Definition ExprObjC.h:1344
const ObjCMethodDecl * getMethodDecl() const
Definition ExprObjC.h:1364
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition ExprObjC.h:1229
arg_iterator arg_begin()
Definition ExprObjC.h:1477
SourceLocation getRightLoc() const
Definition ExprObjC.h:1425
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver.
Definition ExprObjC.h:1390
arg_iterator arg_end()
Definition ExprObjC.h:1479
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition ExprObjC.h:616
ObjCPropertyDecl * getExplicitProperty() const
Definition ExprObjC.h:705
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition ExprObjC.h:710
SourceLocation getReceiverLocation() const
Definition ExprObjC.h:759
const Expr * getBase() const
Definition ExprObjC.h:754
bool isObjectReceiver() const
Definition ExprObjC.h:769
QualType getSuperReceiverType() const
Definition ExprObjC.h:761
bool isImplicitProperty() const
Definition ExprObjC.h:702
ObjCMethodDecl * getImplicitPropertySetter() const
Definition ExprObjC.h:715
ObjCInterfaceDecl * getClassReceiver() const
Definition ExprObjC.h:765
SourceLocation getLocation() const
Definition ExprObjC.h:757
bool isSuperReceiver() const
Definition ExprObjC.h:770
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition ExprObjC.h:504
ObjCProtocolDecl * getProtocol() const
Definition ExprObjC.h:521
SourceLocation getRParenLoc() const
Definition ExprObjC.h:526
SourceLocation getAtLoc() const
Definition ExprObjC.h:525
ObjCSelectorExpr used for @selector in Objective-C.
Definition ExprObjC.h:454
SourceLocation getRParenLoc() const
Definition ExprObjC.h:472
Selector getSelector() const
Definition ExprObjC.h:468
SourceLocation getAtLoc() const
Definition ExprObjC.h:471
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:839
Expr * getKeyExpr() const
Definition ExprObjC.h:881
Expr * getBaseExpr() const
Definition ExprObjC.h:878
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition ExprObjC.h:884
SourceLocation getRBracket() const
Definition ExprObjC.h:869
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition ExprObjC.h:888
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:1684
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:3130
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition ExprCXX.h:4284
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
Definition ExprCXX.h:3237
UnresolvedSetImpl::iterator decls_iterator
Definition ExprCXX.h:3221
decls_iterator decls_begin() const
Definition ExprCXX.h:3223
unsigned getNumDecls() const
Gets the number of declarations in the unresolved set.
Definition ExprCXX.h:3234
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
Definition ExprCXX.h:3252
TemplateArgumentLoc * getTrailingTemplateArgumentLoc()
Return the optional template arguments.
Definition ExprCXX.h:4294
bool hasTemplateKWAndArgsInfo() const
Definition ExprCXX.h:3174
decls_iterator decls_end() const
Definition ExprCXX.h:3226
DeclarationName getName() const
Gets the name looked up.
Definition ExprCXX.h:3240
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition ExprCXX.h:4365
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition ExprCXX.h:4394
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
Definition ExprCXX.h:4401
SourceLocation getEllipsisLoc() const
Determine the location of the 'sizeof' keyword.
Definition ExprCXX.h:4615
Expr * getIndexExpr() const
Definition ExprCXX.h:4630
ArrayRef< Expr * > getExpressions() const
Return the trailing expressions, regardless of the expansion.
Definition ExprCXX.h:4648
SourceLocation getRSquareLoc() const
Determine the location of the right parenthesis.
Definition ExprCXX.h:4621
Expr * getPackIdExpression() const
Definition ExprCXX.h:4626
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:7377
SourceLocation getEndLoc() const
Definition Expr.h:7396
child_range children()
Definition Expr.h:7390
SourceLocation getBeginLoc() const
Definition Expr.h:7395
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:3160
SourceLocation getReturnLoc() const
Definition Stmt.h:3209
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization.
Definition Stmt.h:3196
Expr * getRetValue()
Definition Stmt.h:3187
CompoundStmt * getBlock() const
Definition Stmt.h:3742
SourceLocation getExceptLoc() const
Definition Stmt.h:3735
Expr * getFilterExpr() const
Definition Stmt.h:3738
SourceLocation getFinallyLoc() const
Definition Stmt.h:3776
CompoundStmt * getBlock() const
Definition Stmt.h:3779
Represents a __leave statement.
Definition Stmt.h:3847
SourceLocation getLeaveLoc() const
Definition Stmt.h:3857
CompoundStmt * getTryBlock() const
Definition Stmt.h:3823
SourceLocation getTryLoc() const
Definition Stmt.h:3818
bool getIsCXXTry() const
Definition Stmt.h:3821
Stmt * getHandler() const
Definition Stmt.h:3827
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:4443
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
Definition ExprCXX.h:4528
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition ExprCXX.h:4533
unsigned getPackLength() const
Retrieve the length of the parameter pack.
Definition ExprCXX.h:4517
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:1372
StmtClass getStmtClass() const
Definition Stmt.h:1472
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition Stmt.cpp:334
TypeTraitExprBitfields TypeTraitExprBits
Definition Stmt.h:1361
CXXNewExprBitfields CXXNewExprBits
Definition Stmt.h:1359
ConstantExprBitfields ConstantExprBits
Definition Stmt.h:1324
RequiresExprBitfields RequiresExprBits
Definition Stmt.h:1373
CXXFoldExprBitfields CXXFoldExprBits
Definition Stmt.h:1376
PackIndexingExprBitfields PackIndexingExprBits
Definition Stmt.h:1377
NullStmtBitfields NullStmtBits
Definition Stmt.h:1308
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition Stmt.h:1362
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:4666
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition ExprCXX.h:4711
UnsignedOrNone getPackIndex() const
Definition ExprCXX.h:4717
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4715
SourceLocation getNameLoc() const
Definition ExprCXX.h:4701
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition ExprCXX.h:4756
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:4804
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition ExprCXX.h:4790
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4794
SourceLocation getKeywordLoc() const
Definition Stmt.h:1897
SourceLocation getColonLoc() const
Definition Stmt.h:1899
const SwitchCase * getNextSwitchCase() const
Definition Stmt.h:1893
SwitchStmt - This represents a 'switch' stmt.
Definition Stmt.h:2509
SourceLocation getSwitchLoc() const
Definition Stmt.h:2644
SourceLocation getLParenLoc() const
Definition Stmt.h:2646
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:2669
SourceLocation getRParenLoc() const
Definition Stmt.h:2648
Expr * getCond()
Definition Stmt.h:2572
Stmt * getBody()
Definition Stmt.h:2584
Stmt * getInit()
Definition Stmt.h:2589
SwitchCase * getSwitchCaseList()
Definition Stmt.h:2640
DeclStmt * getConditionVariableDeclStmt()
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Definition Stmt.h:2623
Location wrapper for a TemplateArgument.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition ExprCXX.h:2898
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition ExprCXX.h:2963
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition ExprCXX.h:2960
const APValue & getAPValue() const
Definition ExprCXX.h:2954
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:3392
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
Definition ExprCXX.h:3466
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition ExprCXX.h:3461
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition ExprCXX.h:4128
QualType getBaseType() const
Definition ExprCXX.h:4210
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:4220
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:4223
bool hasUnresolvedUsing() const
Determine whether the lookup results contain an unresolved using declaration.
Definition ExprCXX.h:4214
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:4201
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:2697
Expr * getCond()
Definition Stmt.h:2749
SourceLocation getWhileLoc() const
Definition Stmt.h:2802
SourceLocation getRParenLoc() const
Definition Stmt.h:2807
DeclStmt * getConditionVariableDeclStmt()
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Definition Stmt.h:2785
SourceLocation getLParenLoc() const
Definition Stmt.h:2805
Stmt * getBody()
Definition Stmt.h:2761
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:2267
bool isTypeAwareAllocation(TypeAwareAllocationMode Mode)
Definition ExprCXX.h:2255
@ 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:2309
TypeAwareAllocationMode PassTypeIdentity
Definition ExprCXX.h:2308
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:266
SourceLocation EllipsisLoc
The location of the ellipsis, if this is a pack expansion.
Definition ExprObjC.h:269
UnsignedOrNone NumExpansions
The number of elements this pack expansion will expand to, if this is a pack expansion and is known.
Definition ExprObjC.h:273
Expr * Key
The key for the dictionary element.
Definition ExprObjC.h:263
constexpr unsigned toInternalRepresentation() const