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 auto *E = dyn_cast<Expr *>(DetailRecord);
486 Record.push_back(/* IsDiagnostic */ E == nullptr);
487 if (E)
488 Record.AddStmt(E);
489 else {
490 auto *Diag = cast<std::pair<SourceLocation, StringRef> *>(DetailRecord);
491 Record.AddSourceLocation(Diag->first);
492 Record.AddString(Diag->second);
493 }
494 }
495 }
496}
497
498static void
502 Record.AddString(D->SubstitutedEntity);
503 Record.AddSourceLocation(D->DiagLoc);
504 Record.AddString(D->DiagMessage);
505}
506
507void ASTStmtWriter::VisitConceptSpecializationExpr(
509 VisitExpr(E);
510 Record.AddDeclRef(E->getSpecializationDecl());
511 const ConceptReference *CR = E->getConceptReference();
512 Record.push_back(CR != nullptr);
513 if (CR)
514 Record.AddConceptReference(CR);
515 if (!E->isValueDependent())
517
519}
520
521void ASTStmtWriter::VisitRequiresExpr(RequiresExpr *E) {
522 VisitExpr(E);
523 Record.push_back(E->getLocalParameters().size());
524 Record.push_back(E->getRequirements().size());
525 Record.AddSourceLocation(E->RequiresExprBits.RequiresKWLoc);
526 Record.push_back(E->RequiresExprBits.IsSatisfied);
527 Record.AddDeclRef(E->getBody());
528 for (ParmVarDecl *P : E->getLocalParameters())
529 Record.AddDeclRef(P);
530 for (concepts::Requirement *R : E->getRequirements()) {
531 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(R)) {
532 Record.push_back(concepts::Requirement::RK_Type);
533 Record.push_back(TypeReq->Status);
535 addSubstitutionDiagnostic(Record, TypeReq->getSubstitutionDiagnostic());
536 else
537 Record.AddTypeSourceInfo(TypeReq->getType());
538 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(R)) {
539 Record.push_back(ExprReq->getKind());
540 Record.push_back(ExprReq->Status);
541 if (ExprReq->isExprSubstitutionFailure()) {
544 ExprReq->Value));
545 } else
546 Record.AddStmt(cast<Expr *>(ExprReq->Value));
547 if (ExprReq->getKind() == concepts::Requirement::RK_Compound) {
548 Record.AddSourceLocation(ExprReq->NoexceptLoc);
549 const auto &RetReq = ExprReq->getReturnTypeRequirement();
550 if (RetReq.isSubstitutionFailure()) {
551 Record.push_back(2);
552 addSubstitutionDiagnostic(Record, RetReq.getSubstitutionDiagnostic());
553 } else if (RetReq.isTypeConstraint()) {
554 Record.push_back(1);
555 Record.AddTemplateParameterList(
556 RetReq.getTypeConstraintTemplateParameterList());
557 if (ExprReq->Status >=
559 Record.AddStmt(
560 ExprReq->getReturnTypeRequirementSubstitutedConstraintExpr());
561 } else {
562 assert(RetReq.isEmpty());
563 Record.push_back(0);
564 }
565 }
566 } else {
567 auto *NestedReq = cast<concepts::NestedRequirement>(R);
568 Record.push_back(concepts::Requirement::RK_Nested);
569 Record.push_back(NestedReq->hasInvalidConstraint());
570 if (NestedReq->hasInvalidConstraint()) {
571 Record.AddString(NestedReq->getInvalidConstraintEntity());
572 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
573 } else {
574 Record.AddStmt(NestedReq->getConstraintExpr());
575 if (!NestedReq->isDependent())
576 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
577 }
578 }
579 }
580 Record.AddSourceLocation(E->getLParenLoc());
581 Record.AddSourceLocation(E->getRParenLoc());
582 Record.AddSourceLocation(E->getEndLoc());
583
585}
586
587
588void ASTStmtWriter::VisitCapturedStmt(CapturedStmt *S) {
589 VisitStmt(S);
590 // NumCaptures
591 Record.push_back(std::distance(S->capture_begin(), S->capture_end()));
592
593 // CapturedDecl and captured region kind
594 Record.AddDeclRef(S->getCapturedDecl());
595 Record.push_back(S->getCapturedRegionKind());
596
597 Record.AddDeclRef(S->getCapturedRecordDecl());
598
599 // Capture inits
600 for (auto *I : S->capture_inits())
601 Record.AddStmt(I);
602
603 // Body
604 Record.AddStmt(S->getCapturedStmt());
605
606 // Captures
607 for (const auto &I : S->captures()) {
608 if (I.capturesThis() || I.capturesVariableArrayType())
609 Record.AddDeclRef(nullptr);
610 else
611 Record.AddDeclRef(I.getCapturedVar());
612 Record.push_back(I.getCaptureKind());
613 Record.AddSourceLocation(I.getLocation());
614 }
615
617}
618
619void ASTStmtWriter::VisitSYCLKernelCallStmt(SYCLKernelCallStmt *S) {
620 VisitStmt(S);
621 Record.AddStmt(S->getOriginalStmt());
622 Record.AddDeclRef(S->getOutlinedFunctionDecl());
623
625}
626
627void ASTStmtWriter::VisitExpr(Expr *E) {
628 VisitStmt(E);
629
630 CurrentPackingBits.updateBits();
631 CurrentPackingBits.addBits(E->getDependence(), /*BitsWidth=*/5);
632 CurrentPackingBits.addBits(E->getValueKind(), /*BitsWidth=*/2);
633 CurrentPackingBits.addBits(E->getObjectKind(), /*BitsWidth=*/3);
634
635 Record.AddTypeRef(E->getType());
636}
637
638void ASTStmtWriter::VisitConstantExpr(ConstantExpr *E) {
639 VisitExpr(E);
640 Record.push_back(E->ConstantExprBits.ResultKind);
641
642 Record.push_back(E->ConstantExprBits.APValueKind);
643 Record.push_back(E->ConstantExprBits.IsUnsigned);
644 Record.push_back(E->ConstantExprBits.BitWidth);
645 // HasCleanup not serialized since we can just query the APValue.
646 Record.push_back(E->ConstantExprBits.IsImmediateInvocation);
647
648 switch (E->getResultStorageKind()) {
650 break;
652 Record.push_back(E->Int64Result());
653 break;
655 Record.AddAPValue(E->APValueResult());
656 break;
657 }
658
659 Record.AddStmt(E->getSubExpr());
661}
662
663void ASTStmtWriter::VisitOpenACCAsteriskSizeExpr(OpenACCAsteriskSizeExpr *E) {
664 VisitExpr(E);
665 Record.AddSourceLocation(E->getLocation());
667}
668
669void ASTStmtWriter::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *E) {
670 VisitExpr(E);
671
672 Record.AddSourceLocation(E->getLocation());
673 Record.AddSourceLocation(E->getLParenLocation());
674 Record.AddSourceLocation(E->getRParenLocation());
675 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
676
678}
679
680void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
681 VisitExpr(E);
682
683 bool HasFunctionName = E->getFunctionName() != nullptr;
684 Record.push_back(HasFunctionName);
685 Record.push_back(
686 llvm::to_underlying(E->getIdentKind())); // FIXME: stable encoding
687 Record.push_back(E->isTransparent());
688 Record.AddSourceLocation(E->getLocation());
689 if (HasFunctionName)
690 Record.AddStmt(E->getFunctionName());
692}
693
694void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
695 VisitExpr(E);
696
697 CurrentPackingBits.updateBits();
698
699 CurrentPackingBits.addBit(E->hadMultipleCandidates());
700 CurrentPackingBits.addBit(E->refersToEnclosingVariableOrCapture());
701 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
702 CurrentPackingBits.addBit(E->isImmediateEscalating());
703 CurrentPackingBits.addBit(E->getDecl() != E->getFoundDecl());
704 CurrentPackingBits.addBit(E->hasQualifier());
705 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
706
707 if (E->hasTemplateKWAndArgsInfo()) {
708 unsigned NumTemplateArgs = E->getNumTemplateArgs();
709 Record.push_back(NumTemplateArgs);
710 }
711
712 DeclarationName::NameKind nk = (E->getDecl()->getDeclName().getNameKind());
713
714 if ((!E->hasTemplateKWAndArgsInfo()) && (!E->hasQualifier()) &&
715 (E->getDecl() == E->getFoundDecl()) &&
717 AbbrevToUse = Writer.getDeclRefExprAbbrev();
718 }
719
720 if (E->hasQualifier())
721 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
722
723 if (E->getDecl() != E->getFoundDecl())
724 Record.AddDeclRef(E->getFoundDecl());
725
727 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
728 E->getTrailingObjects<TemplateArgumentLoc>());
729
730 Record.AddDeclRef(E->getDecl());
731 Record.AddSourceLocation(E->getLocation());
732 Record.AddDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
734}
735
736void ASTStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
737 VisitExpr(E);
738 Record.AddSourceLocation(E->getLocation());
739 Record.AddAPInt(E->getValue());
740
741 if (E->getBitWidth() == 32) {
742 AbbrevToUse = Writer.getIntegerLiteralAbbrev();
743 }
744
746}
747
748void ASTStmtWriter::VisitFixedPointLiteral(FixedPointLiteral *E) {
749 VisitExpr(E);
750 Record.AddSourceLocation(E->getLocation());
751 Record.push_back(E->getScale());
752 Record.AddAPInt(E->getValue());
754}
755
756void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
757 VisitExpr(E);
758 Record.push_back(E->getRawSemantics());
759 Record.push_back(E->isExact());
760 Record.AddAPFloat(E->getValue());
761 Record.AddSourceLocation(E->getLocation());
763}
764
765void ASTStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
766 VisitExpr(E);
767 Record.AddStmt(E->getSubExpr());
769}
770
771void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
772 VisitExpr(E);
773
774 // Store the various bits of data of StringLiteral.
775 Record.push_back(E->getNumConcatenated());
776 Record.push_back(E->getLength());
777 Record.push_back(E->getCharByteWidth());
778 Record.push_back(llvm::to_underlying(E->getKind()));
779 Record.push_back(E->isPascal());
780
781 // Store the trailing array of SourceLocation.
782 for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
783 Record.AddSourceLocation(E->getStrTokenLoc(I));
784
785 // Store the trailing array of char holding the string data.
786 StringRef StrData = E->getBytes();
787 for (unsigned I = 0, N = E->getByteLength(); I != N; ++I)
788 Record.push_back(StrData[I]);
789
791}
792
793void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
794 VisitExpr(E);
795 Record.push_back(E->getValue());
796 Record.AddSourceLocation(E->getLocation());
797 Record.push_back(llvm::to_underlying(E->getKind()));
798
799 AbbrevToUse = Writer.getCharacterLiteralAbbrev();
800
802}
803
804void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
805 VisitExpr(E);
806 Record.push_back(E->isProducedByFoldExpansion());
807 Record.AddSourceLocation(E->getLParen());
808 Record.AddSourceLocation(E->getRParen());
809 Record.AddStmt(E->getSubExpr());
811}
812
813void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
814 VisitExpr(E);
815 Record.push_back(E->getNumExprs());
816 for (auto *SubStmt : E->exprs())
817 Record.AddStmt(SubStmt);
818 Record.AddSourceLocation(E->getLParenLoc());
819 Record.AddSourceLocation(E->getRParenLoc());
821}
822
823void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
824 VisitExpr(E);
825 bool HasFPFeatures = E->hasStoredFPFeatures();
826 // Write this first for easy access when deserializing, as they affect the
827 // size of the UnaryOperator.
828 CurrentPackingBits.addBit(HasFPFeatures);
829 Record.AddStmt(E->getSubExpr());
830 CurrentPackingBits.addBits(E->getOpcode(),
831 /*Width=*/5); // FIXME: stable encoding
832 Record.AddSourceLocation(E->getOperatorLoc());
833 CurrentPackingBits.addBit(E->canOverflow());
834
835 if (HasFPFeatures)
836 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
838}
839
840void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
841 VisitExpr(E);
842 Record.push_back(E->getNumComponents());
843 Record.push_back(E->getNumExpressions());
844 Record.AddSourceLocation(E->getOperatorLoc());
845 Record.AddSourceLocation(E->getRParenLoc());
846 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
847 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
848 const OffsetOfNode &ON = E->getComponent(I);
849 Record.push_back(ON.getKind()); // FIXME: Stable encoding
850 Record.AddSourceLocation(ON.getSourceRange().getBegin());
851 Record.AddSourceLocation(ON.getSourceRange().getEnd());
852 switch (ON.getKind()) {
854 Record.push_back(ON.getArrayExprIndex());
855 break;
856
858 Record.AddDeclRef(ON.getField());
859 break;
860
862 Record.AddIdentifierRef(ON.getFieldName());
863 break;
864
866 Record.AddCXXBaseSpecifier(*ON.getBase());
867 break;
868 }
869 }
870 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
871 Record.AddStmt(E->getIndexExpr(I));
873}
874
875void ASTStmtWriter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
876 VisitExpr(E);
877 Record.push_back(E->getKind());
878 if (E->isArgumentType())
879 Record.AddTypeSourceInfo(E->getArgumentTypeInfo());
880 else {
881 Record.push_back(0);
882 Record.AddStmt(E->getArgumentExpr());
883 }
884 Record.AddSourceLocation(E->getOperatorLoc());
885 Record.AddSourceLocation(E->getRParenLoc());
887}
888
889void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
890 VisitExpr(E);
891 Record.AddStmt(E->getLHS());
892 Record.AddStmt(E->getRHS());
893 Record.AddSourceLocation(E->getRBracketLoc());
895}
896
897void ASTStmtWriter::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
898 VisitExpr(E);
899 Record.AddStmt(E->getBase());
900 Record.AddStmt(E->getRowIdx());
901 Record.AddStmt(E->getColumnIdx());
902 Record.AddSourceLocation(E->getRBracketLoc());
904}
905
906void ASTStmtWriter::VisitArraySectionExpr(ArraySectionExpr *E) {
907 VisitExpr(E);
908 Record.writeEnum(E->ASType);
909 Record.AddStmt(E->getBase());
910 Record.AddStmt(E->getLowerBound());
911 Record.AddStmt(E->getLength());
912 if (E->isOMPArraySection())
913 Record.AddStmt(E->getStride());
914 Record.AddSourceLocation(E->getColonLocFirst());
915
916 if (E->isOMPArraySection())
917 Record.AddSourceLocation(E->getColonLocSecond());
918
919 Record.AddSourceLocation(E->getRBracketLoc());
921}
922
923void ASTStmtWriter::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
924 VisitExpr(E);
925 Record.push_back(E->getDimensions().size());
926 Record.AddStmt(E->getBase());
927 for (Expr *Dim : E->getDimensions())
928 Record.AddStmt(Dim);
929 for (SourceRange SR : E->getBracketsRanges())
930 Record.AddSourceRange(SR);
931 Record.AddSourceLocation(E->getLParenLoc());
932 Record.AddSourceLocation(E->getRParenLoc());
934}
935
936void ASTStmtWriter::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
937 VisitExpr(E);
938 Record.push_back(E->numOfIterators());
939 Record.AddSourceLocation(E->getIteratorKwLoc());
940 Record.AddSourceLocation(E->getLParenLoc());
941 Record.AddSourceLocation(E->getRParenLoc());
942 for (unsigned I = 0, End = E->numOfIterators(); I < End; ++I) {
943 Record.AddDeclRef(E->getIteratorDecl(I));
944 Record.AddSourceLocation(E->getAssignLoc(I));
945 OMPIteratorExpr::IteratorRange Range = E->getIteratorRange(I);
946 Record.AddStmt(Range.Begin);
947 Record.AddStmt(Range.End);
948 Record.AddStmt(Range.Step);
949 Record.AddSourceLocation(E->getColonLoc(I));
950 if (Range.Step)
951 Record.AddSourceLocation(E->getSecondColonLoc(I));
952 // Serialize helpers
953 OMPIteratorHelperData &HD = E->getHelper(I);
954 Record.AddDeclRef(HD.CounterVD);
955 Record.AddStmt(HD.Upper);
956 Record.AddStmt(HD.Update);
957 Record.AddStmt(HD.CounterUpdate);
958 }
960}
961
962void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
963 VisitExpr(E);
964
965 Record.push_back(E->getNumArgs());
966 CurrentPackingBits.updateBits();
967 CurrentPackingBits.addBit(static_cast<bool>(E->getADLCallKind()));
968 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
969 CurrentPackingBits.addBit(E->isCoroElideSafe());
970 CurrentPackingBits.addBit(E->usesMemberSyntax());
971
972 Record.AddSourceLocation(E->getRParenLoc());
973 Record.AddStmt(E->getCallee());
974 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
975 Arg != ArgEnd; ++Arg)
976 Record.AddStmt(*Arg);
977
978 if (E->hasStoredFPFeatures())
979 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
980
981 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
982 !E->isCoroElideSafe() && !E->usesMemberSyntax() &&
983 E->getStmtClass() == Stmt::CallExprClass)
984 AbbrevToUse = Writer.getCallExprAbbrev();
985
987}
988
989void ASTStmtWriter::VisitRecoveryExpr(RecoveryExpr *E) {
990 VisitExpr(E);
991 Record.push_back(std::distance(E->children().begin(), E->children().end()));
992 Record.AddSourceLocation(E->getBeginLoc());
993 Record.AddSourceLocation(E->getEndLoc());
994 for (Stmt *Child : E->children())
995 Record.AddStmt(Child);
997}
998
999void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
1000 VisitExpr(E);
1001
1002 bool HasQualifier = E->hasQualifier();
1003 bool HasFoundDecl = E->hasFoundDecl();
1004 bool HasTemplateInfo = E->hasTemplateKWAndArgsInfo();
1005 unsigned NumTemplateArgs = E->getNumTemplateArgs();
1006
1007 // Write these first for easy access when deserializing, as they affect the
1008 // size of the MemberExpr.
1009 CurrentPackingBits.updateBits();
1010 CurrentPackingBits.addBit(HasQualifier);
1011 CurrentPackingBits.addBit(HasFoundDecl);
1012 CurrentPackingBits.addBit(HasTemplateInfo);
1013 Record.push_back(NumTemplateArgs);
1014
1015 Record.AddStmt(E->getBase());
1016 Record.AddDeclRef(E->getMemberDecl());
1017 Record.AddDeclarationNameLoc(E->MemberDNLoc,
1018 E->getMemberDecl()->getDeclName());
1019 Record.AddSourceLocation(E->getMemberLoc());
1020 CurrentPackingBits.addBit(E->isArrow());
1021 CurrentPackingBits.addBit(E->hadMultipleCandidates());
1022 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
1023 Record.AddSourceLocation(E->getOperatorLoc());
1024
1025 if (HasQualifier)
1026 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1027
1028 if (HasFoundDecl) {
1029 DeclAccessPair FoundDecl = E->getFoundDecl();
1030 Record.AddDeclRef(FoundDecl.getDecl());
1031 CurrentPackingBits.addBits(FoundDecl.getAccess(), /*BitWidth=*/2);
1032 }
1033
1034 if (HasTemplateInfo)
1035 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1036 E->getTrailingObjects<TemplateArgumentLoc>());
1037
1039}
1040
1041void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1042 VisitExpr(E);
1043 Record.AddStmt(E->getBase());
1044 Record.AddSourceLocation(E->getIsaMemberLoc());
1045 Record.AddSourceLocation(E->getOpLoc());
1046 Record.push_back(E->isArrow());
1048}
1049
1050void ASTStmtWriter::
1051VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1052 VisitExpr(E);
1053 Record.AddStmt(E->getSubExpr());
1054 Record.push_back(E->shouldCopy());
1056}
1057
1058void ASTStmtWriter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1059 VisitExplicitCastExpr(E);
1060 Record.AddSourceLocation(E->getLParenLoc());
1061 Record.AddSourceLocation(E->getBridgeKeywordLoc());
1062 Record.push_back(E->getBridgeKind()); // FIXME: Stable encoding
1064}
1065
1066void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
1067 VisitExpr(E);
1068
1069 Record.push_back(E->path_size());
1070 CurrentPackingBits.updateBits();
1071 // 7 bits should be enough to store the casting kinds.
1072 CurrentPackingBits.addBits(E->getCastKind(), /*Width=*/7);
1073 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
1074 Record.AddStmt(E->getSubExpr());
1075
1077 PI = E->path_begin(), PE = E->path_end(); PI != PE; ++PI)
1078 Record.AddCXXBaseSpecifier(**PI);
1079
1080 if (E->hasStoredFPFeatures())
1081 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
1082}
1083
1084void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
1085 VisitExpr(E);
1086
1087 // Write this first for easy access when deserializing, as they affect the
1088 // size of the UnaryOperator.
1089 CurrentPackingBits.updateBits();
1090 CurrentPackingBits.addBits(E->getOpcode(), /*Width=*/6);
1091 bool HasFPFeatures = E->hasStoredFPFeatures();
1092 CurrentPackingBits.addBit(HasFPFeatures);
1093 CurrentPackingBits.addBit(E->hasExcludedOverflowPattern());
1094 Record.AddStmt(E->getLHS());
1095 Record.AddStmt(E->getRHS());
1096 Record.AddSourceLocation(E->getOperatorLoc());
1097 if (HasFPFeatures)
1098 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1099
1100 if (!HasFPFeatures && E->getValueKind() == VK_PRValue &&
1101 E->getObjectKind() == OK_Ordinary)
1102 AbbrevToUse = Writer.getBinaryOperatorAbbrev();
1103
1105}
1106
1107void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1108 VisitBinaryOperator(E);
1109 Record.AddTypeRef(E->getComputationLHSType());
1110 Record.AddTypeRef(E->getComputationResultType());
1111
1112 if (!E->hasStoredFPFeatures() && E->getValueKind() == VK_PRValue &&
1113 E->getObjectKind() == OK_Ordinary)
1114 AbbrevToUse = Writer.getCompoundAssignOperatorAbbrev();
1115
1117}
1118
1119void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
1120 VisitExpr(E);
1121 Record.AddStmt(E->getCond());
1122 Record.AddStmt(E->getLHS());
1123 Record.AddStmt(E->getRHS());
1124 Record.AddSourceLocation(E->getQuestionLoc());
1125 Record.AddSourceLocation(E->getColonLoc());
1127}
1128
1129void
1130ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1131 VisitExpr(E);
1132 Record.AddStmt(E->getOpaqueValue());
1133 Record.AddStmt(E->getCommon());
1134 Record.AddStmt(E->getCond());
1135 Record.AddStmt(E->getTrueExpr());
1136 Record.AddStmt(E->getFalseExpr());
1137 Record.AddSourceLocation(E->getQuestionLoc());
1138 Record.AddSourceLocation(E->getColonLoc());
1140}
1141
1142void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1143 VisitCastExpr(E);
1144 CurrentPackingBits.addBit(E->isPartOfExplicitCast());
1145
1146 if (E->path_size() == 0 && !E->hasStoredFPFeatures())
1147 AbbrevToUse = Writer.getExprImplicitCastAbbrev();
1148
1150}
1151
1152void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1153 VisitCastExpr(E);
1154 Record.AddTypeSourceInfo(E->getTypeInfoAsWritten());
1155}
1156
1157void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
1158 VisitExplicitCastExpr(E);
1159 Record.AddSourceLocation(E->getLParenLoc());
1160 Record.AddSourceLocation(E->getRParenLoc());
1162}
1163
1164void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1165 VisitExpr(E);
1166 Record.AddSourceLocation(E->getLParenLoc());
1167 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1168 Record.AddStmt(E->getInitializer());
1169 Record.push_back(E->isFileScope());
1171}
1172
1173void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1174 VisitExpr(E);
1175 Record.AddStmt(E->getBase());
1176 Record.AddIdentifierRef(&E->getAccessor());
1177 Record.AddSourceLocation(E->getAccessorLoc());
1179}
1180
1181void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
1182 VisitExpr(E);
1183 // NOTE: only add the (possibly null) syntactic form.
1184 // No need to serialize the isSemanticForm flag and the semantic form.
1185 Record.AddStmt(E->getSyntacticForm());
1186 Record.AddSourceLocation(E->getLBraceLoc());
1187 Record.AddSourceLocation(E->getRBraceLoc());
1188 bool isArrayFiller = isa<Expr *>(E->ArrayFillerOrUnionFieldInit);
1189 Record.push_back(isArrayFiller);
1190 if (isArrayFiller)
1191 Record.AddStmt(E->getArrayFiller());
1192 else
1193 Record.AddDeclRef(E->getInitializedFieldInUnion());
1194 Record.push_back(E->hadArrayRangeDesignator());
1195 Record.push_back(E->getNumInits());
1196 if (isArrayFiller) {
1197 // ArrayFiller may have filled "holes" due to designated initializer.
1198 // Replace them by 0 to indicate that the filler goes in that place.
1199 Expr *filler = E->getArrayFiller();
1200 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1201 Record.AddStmt(E->getInit(I) != filler ? E->getInit(I) : nullptr);
1202 } else {
1203 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1204 Record.AddStmt(E->getInit(I));
1205 }
1207}
1208
1209void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1210 VisitExpr(E);
1211 Record.push_back(E->getNumSubExprs());
1212 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1213 Record.AddStmt(E->getSubExpr(I));
1214 Record.AddSourceLocation(E->getEqualOrColonLoc());
1215 Record.push_back(E->usesGNUSyntax());
1216 for (const DesignatedInitExpr::Designator &D : E->designators()) {
1217 if (D.isFieldDesignator()) {
1218 if (FieldDecl *Field = D.getFieldDecl()) {
1219 Record.push_back(serialization::DESIG_FIELD_DECL);
1220 Record.AddDeclRef(Field);
1221 } else {
1222 Record.push_back(serialization::DESIG_FIELD_NAME);
1223 Record.AddIdentifierRef(D.getFieldName());
1224 }
1225 Record.AddSourceLocation(D.getDotLoc());
1226 Record.AddSourceLocation(D.getFieldLoc());
1227 } else if (D.isArrayDesignator()) {
1228 Record.push_back(serialization::DESIG_ARRAY);
1229 Record.push_back(D.getArrayIndex());
1230 Record.AddSourceLocation(D.getLBracketLoc());
1231 Record.AddSourceLocation(D.getRBracketLoc());
1232 } else {
1233 assert(D.isArrayRangeDesignator() && "Unknown designator");
1234 Record.push_back(serialization::DESIG_ARRAY_RANGE);
1235 Record.push_back(D.getArrayIndex());
1236 Record.AddSourceLocation(D.getLBracketLoc());
1237 Record.AddSourceLocation(D.getEllipsisLoc());
1238 Record.AddSourceLocation(D.getRBracketLoc());
1239 }
1240 }
1242}
1243
1244void ASTStmtWriter::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1245 VisitExpr(E);
1246 Record.AddStmt(E->getBase());
1247 Record.AddStmt(E->getUpdater());
1249}
1250
1251void ASTStmtWriter::VisitNoInitExpr(NoInitExpr *E) {
1252 VisitExpr(E);
1254}
1255
1256void ASTStmtWriter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1257 VisitExpr(E);
1258 Record.AddStmt(E->SubExprs[0]);
1259 Record.AddStmt(E->SubExprs[1]);
1261}
1262
1263void ASTStmtWriter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1264 VisitExpr(E);
1266}
1267
1268void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1269 VisitExpr(E);
1271}
1272
1273void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
1274 VisitExpr(E);
1275 Record.AddStmt(E->getSubExpr());
1276 Record.AddTypeSourceInfo(E->getWrittenTypeInfo());
1277 Record.AddSourceLocation(E->getBuiltinLoc());
1278 Record.AddSourceLocation(E->getRParenLoc());
1279 Record.push_back(E->isMicrosoftABI());
1281}
1282
1283void ASTStmtWriter::VisitSourceLocExpr(SourceLocExpr *E) {
1284 VisitExpr(E);
1285 Record.AddDeclRef(cast_or_null<Decl>(E->getParentContext()));
1286 Record.AddSourceLocation(E->getBeginLoc());
1287 Record.AddSourceLocation(E->getEndLoc());
1288 Record.push_back(llvm::to_underlying(E->getIdentKind()));
1290}
1291
1292void ASTStmtWriter::VisitEmbedExpr(EmbedExpr *E) {
1293 VisitExpr(E);
1294 Record.AddSourceLocation(E->getBeginLoc());
1295 Record.AddSourceLocation(E->getEndLoc());
1296 Record.AddStmt(E->getDataStringLiteral());
1297 Record.writeUInt32(E->getStartingElementPos());
1298 Record.writeUInt32(E->getDataElementCount());
1300}
1301
1302void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
1303 VisitExpr(E);
1304 Record.AddSourceLocation(E->getAmpAmpLoc());
1305 Record.AddSourceLocation(E->getLabelLoc());
1306 Record.AddDeclRef(E->getLabel());
1308}
1309
1310void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
1311 VisitExpr(E);
1312 Record.AddStmt(E->getSubStmt());
1313 Record.AddSourceLocation(E->getLParenLoc());
1314 Record.AddSourceLocation(E->getRParenLoc());
1315 Record.push_back(E->getTemplateDepth());
1317}
1318
1319void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
1320 VisitExpr(E);
1321 Record.AddStmt(E->getCond());
1322 Record.AddStmt(E->getLHS());
1323 Record.AddStmt(E->getRHS());
1324 Record.AddSourceLocation(E->getBuiltinLoc());
1325 Record.AddSourceLocation(E->getRParenLoc());
1326 Record.push_back(E->isConditionDependent() ? false : E->isConditionTrue());
1328}
1329
1330void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
1331 VisitExpr(E);
1332 Record.AddSourceLocation(E->getTokenLocation());
1334}
1335
1336void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1337 VisitExpr(E);
1338 Record.push_back(E->getNumSubExprs());
1339 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1340 Record.AddStmt(E->getExpr(I));
1341 Record.AddSourceLocation(E->getBuiltinLoc());
1342 Record.AddSourceLocation(E->getRParenLoc());
1344}
1345
1346void ASTStmtWriter::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1347 VisitExpr(E);
1348 bool HasFPFeatures = E->hasStoredFPFeatures();
1349 CurrentPackingBits.addBit(HasFPFeatures);
1350 Record.AddSourceLocation(E->getBuiltinLoc());
1351 Record.AddSourceLocation(E->getRParenLoc());
1352 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1353 Record.AddStmt(E->getSrcExpr());
1355 if (HasFPFeatures)
1356 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1357}
1358
1359void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
1360 VisitExpr(E);
1361 Record.AddDeclRef(E->getBlockDecl());
1363}
1364
1365void ASTStmtWriter::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1366 VisitExpr(E);
1367
1368 Record.push_back(E->getNumAssocs());
1369 Record.push_back(E->isExprPredicate());
1370 Record.push_back(E->ResultIndex);
1371 Record.AddSourceLocation(E->getGenericLoc());
1372 Record.AddSourceLocation(E->getDefaultLoc());
1373 Record.AddSourceLocation(E->getRParenLoc());
1374
1375 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1376 // Add 1 to account for the controlling expression which is the first
1377 // expression in the trailing array of Stmt *. This is not needed for
1378 // the trailing array of TypeSourceInfo *.
1379 for (unsigned I = 0, N = E->getNumAssocs() + 1; I < N; ++I)
1380 Record.AddStmt(Stmts[I]);
1381
1382 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1383 for (unsigned I = 0, N = E->getNumAssocs(); I < N; ++I)
1384 Record.AddTypeSourceInfo(TSIs[I]);
1385
1387}
1388
1389void ASTStmtWriter::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1390 VisitExpr(E);
1391 Record.push_back(E->getNumSemanticExprs());
1392
1393 // Push the result index. Currently, this needs to exactly match
1394 // the encoding used internally for ResultIndex.
1395 unsigned result = E->getResultExprIndex();
1396 result = (result == PseudoObjectExpr::NoResult ? 0 : result + 1);
1397 Record.push_back(result);
1398
1399 Record.AddStmt(E->getSyntacticForm());
1401 i = E->semantics_begin(), e = E->semantics_end(); i != e; ++i) {
1402 Record.AddStmt(*i);
1403 }
1405}
1406
1407void ASTStmtWriter::VisitAtomicExpr(AtomicExpr *E) {
1408 VisitExpr(E);
1409 Record.push_back(E->getOp());
1410 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1411 Record.AddStmt(E->getSubExprs()[I]);
1412 Record.AddSourceLocation(E->getBuiltinLoc());
1413 Record.AddSourceLocation(E->getRParenLoc());
1415}
1416
1417//===----------------------------------------------------------------------===//
1418// Objective-C Expressions and Statements.
1419//===----------------------------------------------------------------------===//
1420
1421void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1422 VisitExpr(E);
1423 Record.AddStmt(E->getString());
1424 Record.AddSourceLocation(E->getAtLoc());
1426}
1427
1428void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1429 VisitExpr(E);
1430 Record.AddStmt(E->getSubExpr());
1431 Record.AddDeclRef(E->getBoxingMethod());
1432 Record.AddSourceRange(E->getSourceRange());
1434}
1435
1436void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1437 VisitExpr(E);
1438 Record.push_back(E->getNumElements());
1439 for (unsigned i = 0; i < E->getNumElements(); i++)
1440 Record.AddStmt(E->getElement(i));
1441 Record.AddDeclRef(E->getArrayWithObjectsMethod());
1442 Record.AddSourceRange(E->getSourceRange());
1444}
1445
1446void ASTStmtWriter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1447 VisitExpr(E);
1448 Record.push_back(E->getNumElements());
1449 Record.push_back(E->HasPackExpansions);
1450 for (unsigned i = 0; i < E->getNumElements(); i++) {
1451 ObjCDictionaryElement Element = E->getKeyValueElement(i);
1452 Record.AddStmt(Element.Key);
1453 Record.AddStmt(Element.Value);
1454 if (E->HasPackExpansions) {
1455 Record.AddSourceLocation(Element.EllipsisLoc);
1456 unsigned NumExpansions = 0;
1457 if (Element.NumExpansions)
1458 NumExpansions = *Element.NumExpansions + 1;
1459 Record.push_back(NumExpansions);
1460 }
1461 }
1462
1463 Record.AddDeclRef(E->getDictWithObjectsMethod());
1464 Record.AddSourceRange(E->getSourceRange());
1466}
1467
1468void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1469 VisitExpr(E);
1470 Record.AddTypeSourceInfo(E->getEncodedTypeSourceInfo());
1471 Record.AddSourceLocation(E->getAtLoc());
1472 Record.AddSourceLocation(E->getRParenLoc());
1474}
1475
1476void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1477 VisitExpr(E);
1478 Record.AddSelectorRef(E->getSelector());
1479 Record.AddSourceLocation(E->getAtLoc());
1480 Record.AddSourceLocation(E->getRParenLoc());
1482}
1483
1484void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1485 VisitExpr(E);
1486 Record.AddDeclRef(E->getProtocol());
1487 Record.AddSourceLocation(E->getAtLoc());
1488 Record.AddSourceLocation(E->ProtoLoc);
1489 Record.AddSourceLocation(E->getRParenLoc());
1491}
1492
1493void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1494 VisitExpr(E);
1495 Record.AddDeclRef(E->getDecl());
1496 Record.AddSourceLocation(E->getLocation());
1497 Record.AddSourceLocation(E->getOpLoc());
1498 Record.AddStmt(E->getBase());
1499 Record.push_back(E->isArrow());
1500 Record.push_back(E->isFreeIvar());
1502}
1503
1504void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1505 VisitExpr(E);
1506 Record.push_back(E->SetterAndMethodRefFlags.getInt());
1507 Record.push_back(E->isImplicitProperty());
1508 if (E->isImplicitProperty()) {
1509 Record.AddDeclRef(E->getImplicitPropertyGetter());
1510 Record.AddDeclRef(E->getImplicitPropertySetter());
1511 } else {
1512 Record.AddDeclRef(E->getExplicitProperty());
1513 }
1514 Record.AddSourceLocation(E->getLocation());
1515 Record.AddSourceLocation(E->getReceiverLocation());
1516 if (E->isObjectReceiver()) {
1517 Record.push_back(0);
1518 Record.AddStmt(E->getBase());
1519 } else if (E->isSuperReceiver()) {
1520 Record.push_back(1);
1521 Record.AddTypeRef(E->getSuperReceiverType());
1522 } else {
1523 Record.push_back(2);
1524 Record.AddDeclRef(E->getClassReceiver());
1525 }
1526
1528}
1529
1530void ASTStmtWriter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1531 VisitExpr(E);
1532 Record.AddSourceLocation(E->getRBracket());
1533 Record.AddStmt(E->getBaseExpr());
1534 Record.AddStmt(E->getKeyExpr());
1535 Record.AddDeclRef(E->getAtIndexMethodDecl());
1536 Record.AddDeclRef(E->setAtIndexMethodDecl());
1537
1539}
1540
1541void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1542 VisitExpr(E);
1543 Record.push_back(E->getNumArgs());
1544 Record.push_back(E->getNumStoredSelLocs());
1545 Record.push_back(E->SelLocsKind);
1546 Record.push_back(E->isDelegateInitCall());
1547 Record.push_back(E->IsImplicit);
1548 Record.push_back((unsigned)E->getReceiverKind()); // FIXME: stable encoding
1549 switch (E->getReceiverKind()) {
1551 Record.AddStmt(E->getInstanceReceiver());
1552 break;
1553
1555 Record.AddTypeSourceInfo(E->getClassReceiverTypeInfo());
1556 break;
1557
1560 Record.AddTypeRef(E->getSuperType());
1561 Record.AddSourceLocation(E->getSuperLoc());
1562 break;
1563 }
1564
1565 if (E->getMethodDecl()) {
1566 Record.push_back(1);
1567 Record.AddDeclRef(E->getMethodDecl());
1568 } else {
1569 Record.push_back(0);
1570 Record.AddSelectorRef(E->getSelector());
1571 }
1572
1573 Record.AddSourceLocation(E->getLeftLoc());
1574 Record.AddSourceLocation(E->getRightLoc());
1575
1576 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
1577 Arg != ArgEnd; ++Arg)
1578 Record.AddStmt(*Arg);
1579
1580 SourceLocation *Locs = E->getStoredSelLocs();
1581 for (unsigned i = 0, e = E->getNumStoredSelLocs(); i != e; ++i)
1582 Record.AddSourceLocation(Locs[i]);
1583
1585}
1586
1587void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1588 VisitStmt(S);
1589 Record.AddStmt(S->getElement());
1590 Record.AddStmt(S->getCollection());
1591 Record.AddStmt(S->getBody());
1592 Record.AddSourceLocation(S->getForLoc());
1593 Record.AddSourceLocation(S->getRParenLoc());
1595}
1596
1597void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1598 VisitStmt(S);
1599 Record.AddStmt(S->getCatchBody());
1600 Record.AddDeclRef(S->getCatchParamDecl());
1601 Record.AddSourceLocation(S->getAtCatchLoc());
1602 Record.AddSourceLocation(S->getRParenLoc());
1604}
1605
1606void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1607 VisitStmt(S);
1608 Record.AddStmt(S->getFinallyBody());
1609 Record.AddSourceLocation(S->getAtFinallyLoc());
1611}
1612
1613void ASTStmtWriter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1614 VisitStmt(S); // FIXME: no test coverage.
1615 Record.AddStmt(S->getSubStmt());
1616 Record.AddSourceLocation(S->getAtLoc());
1618}
1619
1620void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1621 VisitStmt(S);
1622 Record.push_back(S->getNumCatchStmts());
1623 Record.push_back(S->getFinallyStmt() != nullptr);
1624 Record.AddStmt(S->getTryBody());
1625 for (ObjCAtCatchStmt *C : S->catch_stmts())
1626 Record.AddStmt(C);
1627 if (S->getFinallyStmt())
1628 Record.AddStmt(S->getFinallyStmt());
1629 Record.AddSourceLocation(S->getAtTryLoc());
1631}
1632
1633void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1634 VisitStmt(S); // FIXME: no test coverage.
1635 Record.AddStmt(S->getSynchExpr());
1636 Record.AddStmt(S->getSynchBody());
1637 Record.AddSourceLocation(S->getAtSynchronizedLoc());
1639}
1640
1641void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1642 VisitStmt(S); // FIXME: no test coverage.
1643 Record.AddStmt(S->getThrowExpr());
1644 Record.AddSourceLocation(S->getThrowLoc());
1646}
1647
1648void ASTStmtWriter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1649 VisitExpr(E);
1650 Record.push_back(E->getValue());
1651 Record.AddSourceLocation(E->getLocation());
1653}
1654
1655void ASTStmtWriter::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1656 VisitExpr(E);
1657 Record.AddSourceRange(E->getSourceRange());
1658 Record.AddVersionTuple(E->getVersion());
1660}
1661
1662//===----------------------------------------------------------------------===//
1663// C++ Expressions and Statements.
1664//===----------------------------------------------------------------------===//
1665
1666void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
1667 VisitStmt(S);
1668 Record.AddSourceLocation(S->getCatchLoc());
1669 Record.AddDeclRef(S->getExceptionDecl());
1670 Record.AddStmt(S->getHandlerBlock());
1672}
1673
1674void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
1675 VisitStmt(S);
1676 Record.push_back(S->getNumHandlers());
1677 Record.AddSourceLocation(S->getTryLoc());
1678 Record.AddStmt(S->getTryBlock());
1679 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1680 Record.AddStmt(S->getHandler(i));
1682}
1683
1684void ASTStmtWriter::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1685 VisitStmt(S);
1686 Record.AddSourceLocation(S->getForLoc());
1687 Record.AddSourceLocation(S->getCoawaitLoc());
1688 Record.AddSourceLocation(S->getColonLoc());
1689 Record.AddSourceLocation(S->getRParenLoc());
1690 Record.AddStmt(S->getInit());
1691 Record.AddStmt(S->getRangeStmt());
1692 Record.AddStmt(S->getBeginStmt());
1693 Record.AddStmt(S->getEndStmt());
1694 Record.AddStmt(S->getCond());
1695 Record.AddStmt(S->getInc());
1696 Record.AddStmt(S->getLoopVarStmt());
1697 Record.AddStmt(S->getBody());
1699}
1700
1701void ASTStmtWriter::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1702 VisitStmt(S);
1703 Record.AddSourceLocation(S->getKeywordLoc());
1704 Record.push_back(S->isIfExists());
1705 Record.AddNestedNameSpecifierLoc(S->getQualifierLoc());
1706 Record.AddDeclarationNameInfo(S->getNameInfo());
1707 Record.AddStmt(S->getSubStmt());
1709}
1710
1711void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1712 VisitCallExpr(E);
1713 Record.push_back(E->getOperator());
1714 Record.AddSourceLocation(E->BeginLoc);
1715
1716 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1717 !E->isCoroElideSafe() && !E->usesMemberSyntax())
1718 AbbrevToUse = Writer.getCXXOperatorCallExprAbbrev();
1719
1721}
1722
1723void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1724 VisitCallExpr(E);
1725
1726 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1727 !E->isCoroElideSafe() && !E->usesMemberSyntax())
1728 AbbrevToUse = Writer.getCXXMemberCallExprAbbrev();
1729
1731}
1732
1733void ASTStmtWriter::VisitCXXRewrittenBinaryOperator(
1735 VisitExpr(E);
1736 Record.push_back(E->isReversed());
1737 Record.AddStmt(E->getSemanticForm());
1739}
1740
1741void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
1742 VisitExpr(E);
1743
1744 Record.push_back(E->getNumArgs());
1745 Record.push_back(E->isElidable());
1746 Record.push_back(E->hadMultipleCandidates());
1747 Record.push_back(E->isListInitialization());
1748 Record.push_back(E->isStdInitListInitialization());
1749 Record.push_back(E->requiresZeroInitialization());
1750 Record.push_back(
1751 llvm::to_underlying(E->getConstructionKind())); // FIXME: stable encoding
1752 Record.push_back(E->isImmediateEscalating());
1753 Record.AddSourceLocation(E->getLocation());
1754 Record.AddDeclRef(E->getConstructor());
1755 Record.AddSourceRange(E->getParenOrBraceRange());
1756
1757 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1758 Record.AddStmt(E->getArg(I));
1759
1761}
1762
1763void ASTStmtWriter::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1764 VisitExpr(E);
1765 Record.AddDeclRef(E->getConstructor());
1766 Record.AddSourceLocation(E->getLocation());
1767 Record.push_back(E->constructsVBase());
1768 Record.push_back(E->inheritedFromVBase());
1770}
1771
1772void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1773 VisitCXXConstructExpr(E);
1774 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1776}
1777
1778void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) {
1779 VisitExpr(E);
1780 Record.push_back(E->LambdaExprBits.NumCaptures);
1781 Record.AddSourceRange(E->IntroducerRange);
1782 Record.push_back(E->LambdaExprBits.CaptureDefault); // FIXME: stable encoding
1783 Record.AddSourceLocation(E->CaptureDefaultLoc);
1784 Record.push_back(E->LambdaExprBits.ExplicitParams);
1785 Record.push_back(E->LambdaExprBits.ExplicitResultType);
1786 Record.AddSourceLocation(E->ClosingBrace);
1787
1788 // Add capture initializers.
1790 CEnd = E->capture_init_end();
1791 C != CEnd; ++C) {
1792 Record.AddStmt(*C);
1793 }
1794
1795 // Don't serialize the body. It belongs to the call operator declaration.
1796 // LambdaExpr only stores a copy of the Stmt *.
1797
1799}
1800
1801void ASTStmtWriter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1802 VisitExpr(E);
1803 Record.AddStmt(E->getSubExpr());
1805}
1806
1807void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1808 VisitExplicitCastExpr(E);
1809 Record.AddSourceRange(SourceRange(E->getOperatorLoc(), E->getRParenLoc()));
1810 CurrentPackingBits.addBit(E->getAngleBrackets().isValid());
1811 if (E->getAngleBrackets().isValid())
1812 Record.AddSourceRange(E->getAngleBrackets());
1813}
1814
1815void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1816 VisitCXXNamedCastExpr(E);
1818}
1819
1820void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1821 VisitCXXNamedCastExpr(E);
1823}
1824
1825void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1826 VisitCXXNamedCastExpr(E);
1828}
1829
1830void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1831 VisitCXXNamedCastExpr(E);
1833}
1834
1835void ASTStmtWriter::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1836 VisitCXXNamedCastExpr(E);
1838}
1839
1840void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1841 VisitExplicitCastExpr(E);
1842 Record.AddSourceLocation(E->getLParenLoc());
1843 Record.AddSourceLocation(E->getRParenLoc());
1845}
1846
1847void ASTStmtWriter::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1848 VisitExplicitCastExpr(E);
1849 Record.AddSourceLocation(E->getBeginLoc());
1850 Record.AddSourceLocation(E->getEndLoc());
1852}
1853
1854void ASTStmtWriter::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1855 VisitCallExpr(E);
1856 Record.AddSourceLocation(E->UDSuffixLoc);
1858}
1859
1860void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1861 VisitExpr(E);
1862 Record.push_back(E->getValue());
1863 Record.AddSourceLocation(E->getLocation());
1865}
1866
1867void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1868 VisitExpr(E);
1869 Record.AddSourceLocation(E->getLocation());
1871}
1872
1873void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1874 VisitExpr(E);
1875 Record.AddSourceRange(E->getSourceRange());
1876 if (E->isTypeOperand()) {
1877 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
1879 } else {
1880 Record.AddStmt(E->getExprOperand());
1882 }
1883}
1884
1885void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
1886 VisitExpr(E);
1887 Record.AddSourceLocation(E->getLocation());
1888 Record.push_back(E->isImplicit());
1890
1892}
1893
1894void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
1895 VisitExpr(E);
1896 Record.AddSourceLocation(E->getThrowLoc());
1897 Record.AddStmt(E->getSubExpr());
1898 Record.push_back(E->isThrownVariableInScope());
1900}
1901
1902void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1903 VisitExpr(E);
1904 Record.AddDeclRef(E->getParam());
1905 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1906 Record.AddSourceLocation(E->getUsedLocation());
1907 Record.push_back(E->hasRewrittenInit());
1908 if (E->hasRewrittenInit())
1909 Record.AddStmt(E->getRewrittenExpr());
1911}
1912
1913void ASTStmtWriter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1914 VisitExpr(E);
1915 Record.push_back(E->hasRewrittenInit());
1916 Record.AddDeclRef(E->getField());
1917 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1918 Record.AddSourceLocation(E->getExprLoc());
1919 if (E->hasRewrittenInit())
1920 Record.AddStmt(E->getRewrittenExpr());
1922}
1923
1924void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1925 VisitExpr(E);
1926 Record.AddCXXTemporary(E->getTemporary());
1927 Record.AddStmt(E->getSubExpr());
1929}
1930
1931void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1932 VisitExpr(E);
1933 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1934 Record.AddSourceLocation(E->getRParenLoc());
1936}
1937
1938void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
1939 VisitExpr(E);
1940
1941 Record.push_back(E->isArray());
1942 Record.push_back(E->hasInitializer());
1943 Record.push_back(E->getNumPlacementArgs());
1944 Record.push_back(E->isParenTypeId());
1945
1946 Record.push_back(E->isGlobalNew());
1947 ImplicitAllocationParameters IAP = E->implicitAllocationParameters();
1948 Record.push_back(isAlignedAllocation(IAP.PassAlignment));
1949 Record.push_back(isTypeAwareAllocation(IAP.PassTypeIdentity));
1950 Record.push_back(E->doesUsualArrayDeleteWantSize());
1951 Record.push_back(E->CXXNewExprBits.HasInitializer);
1952 Record.push_back(E->CXXNewExprBits.StoredInitializationStyle);
1953
1954 Record.AddDeclRef(E->getOperatorNew());
1955 Record.AddDeclRef(E->getOperatorDelete());
1956 Record.AddTypeSourceInfo(E->getAllocatedTypeSourceInfo());
1957 if (E->isParenTypeId())
1958 Record.AddSourceRange(E->getTypeIdParens());
1959 Record.AddSourceRange(E->getSourceRange());
1960 Record.AddSourceRange(E->getDirectInitRange());
1961
1962 for (CXXNewExpr::arg_iterator I = E->raw_arg_begin(), N = E->raw_arg_end();
1963 I != N; ++I)
1964 Record.AddStmt(*I);
1965
1967}
1968
1969void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1970 VisitExpr(E);
1971 Record.push_back(E->isGlobalDelete());
1972 Record.push_back(E->isArrayForm());
1973 Record.push_back(E->isArrayFormAsWritten());
1974 Record.push_back(E->doesUsualArrayDeleteWantSize());
1975 Record.AddDeclRef(E->getOperatorDelete());
1976 Record.AddStmt(E->getArgument());
1977 Record.AddSourceLocation(E->getBeginLoc());
1978
1980}
1981
1982void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1983 VisitExpr(E);
1984
1985 Record.AddStmt(E->getBase());
1986 Record.push_back(E->isArrow());
1987 Record.AddSourceLocation(E->getOperatorLoc());
1988 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1989 Record.AddTypeSourceInfo(E->getScopeTypeInfo());
1990 Record.AddSourceLocation(E->getColonColonLoc());
1991 Record.AddSourceLocation(E->getTildeLoc());
1992
1993 // PseudoDestructorTypeStorage.
1994 Record.AddIdentifierRef(E->getDestroyedTypeIdentifier());
1996 Record.AddSourceLocation(E->getDestroyedTypeLoc());
1997 else
1998 Record.AddTypeSourceInfo(E->getDestroyedTypeInfo());
1999
2001}
2002
2003void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) {
2004 VisitExpr(E);
2005 Record.push_back(E->getNumObjects());
2006 for (auto &Obj : E->getObjects()) {
2007 if (auto *BD = Obj.dyn_cast<BlockDecl *>()) {
2008 Record.push_back(serialization::COK_Block);
2009 Record.AddDeclRef(BD);
2010 } else if (auto *CLE = Obj.dyn_cast<CompoundLiteralExpr *>()) {
2011 Record.push_back(serialization::COK_CompoundLiteral);
2012 Record.AddStmt(CLE);
2013 }
2014 }
2015
2016 Record.push_back(E->cleanupsHaveSideEffects());
2017 Record.AddStmt(E->getSubExpr());
2019}
2020
2021void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
2023 VisitExpr(E);
2024
2025 // Don't emit anything here (or if you do you will have to update
2026 // the corresponding deserialization function).
2027 Record.push_back(E->getNumTemplateArgs());
2028 CurrentPackingBits.updateBits();
2029 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2030 CurrentPackingBits.addBit(E->hasFirstQualifierFoundInScope());
2031
2032 if (E->hasTemplateKWAndArgsInfo()) {
2033 const ASTTemplateKWAndArgsInfo &ArgInfo =
2034 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2036 E->getTrailingObjects<TemplateArgumentLoc>());
2037 }
2038
2039 CurrentPackingBits.addBit(E->isArrow());
2040
2041 Record.AddTypeRef(E->getBaseType());
2042 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2043 CurrentPackingBits.addBit(!E->isImplicitAccess());
2044 if (!E->isImplicitAccess())
2045 Record.AddStmt(E->getBase());
2046
2047 Record.AddSourceLocation(E->getOperatorLoc());
2048
2049 if (E->hasFirstQualifierFoundInScope())
2050 Record.AddDeclRef(E->getFirstQualifierFoundInScope());
2051
2052 Record.AddDeclarationNameInfo(E->MemberNameInfo);
2054}
2055
2056void
2057ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2058 VisitExpr(E);
2059
2060 // Don't emit anything here, HasTemplateKWAndArgsInfo must be
2061 // emitted first.
2062 CurrentPackingBits.addBit(
2063 E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
2064
2065 if (E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo) {
2066 const ASTTemplateKWAndArgsInfo &ArgInfo =
2067 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2068 // 16 bits should be enought to store the number of args
2069 CurrentPackingBits.addBits(ArgInfo.NumTemplateArgs, /*Width=*/16);
2071 E->getTrailingObjects<TemplateArgumentLoc>());
2072 }
2073
2074 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2075 Record.AddDeclarationNameInfo(E->NameInfo);
2077}
2078
2079void
2080ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2081 VisitExpr(E);
2082 Record.push_back(E->getNumArgs());
2084 ArgI = E->arg_begin(), ArgE = E->arg_end(); ArgI != ArgE; ++ArgI)
2085 Record.AddStmt(*ArgI);
2086 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
2087 Record.AddSourceLocation(E->getLParenLoc());
2088 Record.AddSourceLocation(E->getRParenLoc());
2089 Record.push_back(E->isListInitialization());
2091}
2092
2093void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
2094 VisitExpr(E);
2095
2096 Record.push_back(E->getNumDecls());
2097
2098 CurrentPackingBits.updateBits();
2099 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2100 if (E->hasTemplateKWAndArgsInfo()) {
2101 const ASTTemplateKWAndArgsInfo &ArgInfo =
2103 Record.push_back(ArgInfo.NumTemplateArgs);
2105 }
2106
2108 OvE = E->decls_end();
2109 OvI != OvE; ++OvI) {
2110 Record.AddDeclRef(OvI.getDecl());
2111 Record.push_back(OvI.getAccess());
2112 }
2113
2114 Record.AddDeclarationNameInfo(E->getNameInfo());
2115 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2116}
2117
2118void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2119 VisitOverloadExpr(E);
2120 CurrentPackingBits.addBit(E->isArrow());
2121 CurrentPackingBits.addBit(E->hasUnresolvedUsing());
2122 CurrentPackingBits.addBit(!E->isImplicitAccess());
2123 if (!E->isImplicitAccess())
2124 Record.AddStmt(E->getBase());
2125
2126 Record.AddSourceLocation(E->getOperatorLoc());
2127
2128 Record.AddTypeRef(E->getBaseType());
2130}
2131
2132void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2133 VisitOverloadExpr(E);
2134 CurrentPackingBits.addBit(E->requiresADL());
2135 Record.AddDeclRef(E->getNamingClass());
2137
2138 if (Writer.isWritingStdCXXNamedModules() && Writer.getChain()) {
2139 // Referencing all the possible declarations to make sure the change get
2140 // propagted.
2141 DeclarationName Name = E->getName();
2142 for (auto *Found :
2143 Record.getASTContext().getTranslationUnitDecl()->lookup(Name))
2144 if (Found->isFromASTFile())
2145 Writer.GetDeclRef(Found);
2146
2147 llvm::SmallVector<NamespaceDecl *> ExternalNSs;
2148 Writer.getChain()->ReadKnownNamespaces(ExternalNSs);
2149 for (auto *NS : ExternalNSs)
2150 for (auto *Found : NS->lookup(Name))
2151 Writer.GetDeclRef(Found);
2152 }
2153}
2154
2155void ASTStmtWriter::VisitTypeTraitExpr(TypeTraitExpr *E) {
2156 VisitExpr(E);
2157 Record.push_back(E->TypeTraitExprBits.IsBooleanTypeTrait);
2158 Record.push_back(E->TypeTraitExprBits.NumArgs);
2159 Record.push_back(E->TypeTraitExprBits.Kind); // FIXME: Stable encoding
2160
2161 if (E->TypeTraitExprBits.IsBooleanTypeTrait)
2162 Record.push_back(E->TypeTraitExprBits.Value);
2163 else
2164 Record.AddAPValue(E->getAPValue());
2165
2166 Record.AddSourceRange(E->getSourceRange());
2167 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2168 Record.AddTypeSourceInfo(E->getArg(I));
2170}
2171
2172void ASTStmtWriter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2173 VisitExpr(E);
2174 Record.push_back(E->getTrait());
2175 Record.push_back(E->getValue());
2176 Record.AddSourceRange(E->getSourceRange());
2177 Record.AddTypeSourceInfo(E->getQueriedTypeSourceInfo());
2178 Record.AddStmt(E->getDimensionExpression());
2180}
2181
2182void ASTStmtWriter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2183 VisitExpr(E);
2184 Record.push_back(E->getTrait());
2185 Record.push_back(E->getValue());
2186 Record.AddSourceRange(E->getSourceRange());
2187 Record.AddStmt(E->getQueriedExpression());
2189}
2190
2191void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2192 VisitExpr(E);
2193 Record.push_back(E->getValue());
2194 Record.AddSourceRange(E->getSourceRange());
2195 Record.AddStmt(E->getOperand());
2197}
2198
2199void ASTStmtWriter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2200 VisitExpr(E);
2201 Record.AddSourceLocation(E->getEllipsisLoc());
2202 Record.push_back(E->NumExpansions);
2203 Record.AddStmt(E->getPattern());
2205}
2206
2207void ASTStmtWriter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2208 VisitExpr(E);
2209 Record.push_back(E->isPartiallySubstituted() ? E->getPartialArguments().size()
2210 : 0);
2211 Record.AddSourceLocation(E->OperatorLoc);
2212 Record.AddSourceLocation(E->PackLoc);
2213 Record.AddSourceLocation(E->RParenLoc);
2214 Record.AddDeclRef(E->Pack);
2215 if (E->isPartiallySubstituted()) {
2216 for (const auto &TA : E->getPartialArguments())
2217 Record.AddTemplateArgument(TA);
2218 } else if (!E->isValueDependent()) {
2219 Record.push_back(E->getPackLength());
2220 }
2222}
2223
2224void ASTStmtWriter::VisitPackIndexingExpr(PackIndexingExpr *E) {
2225 VisitExpr(E);
2226 Record.push_back(E->PackIndexingExprBits.TransformedExpressions);
2227 Record.push_back(E->PackIndexingExprBits.FullySubstituted);
2228 Record.AddSourceLocation(E->getEllipsisLoc());
2229 Record.AddSourceLocation(E->getRSquareLoc());
2230 Record.AddStmt(E->getPackIdExpression());
2231 Record.AddStmt(E->getIndexExpr());
2232 for (Expr *Sub : E->getExpressions())
2233 Record.AddStmt(Sub);
2235}
2236
2237void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
2239 VisitExpr(E);
2240 Record.AddDeclRef(E->getAssociatedDecl());
2241 CurrentPackingBits.addBit(E->isReferenceParameter());
2242 CurrentPackingBits.addBits(E->getIndex(), /*Width=*/12);
2243 Record.writeUnsignedOrNone(E->getPackIndex());
2244 CurrentPackingBits.addBit(E->getFinal());
2245
2246 Record.AddSourceLocation(E->getNameLoc());
2247 Record.AddStmt(E->getReplacement());
2249}
2250
2251void ASTStmtWriter::VisitSubstNonTypeTemplateParmPackExpr(
2253 VisitExpr(E);
2254 Record.AddDeclRef(E->getAssociatedDecl());
2255 CurrentPackingBits.addBit(E->getFinal());
2256 Record.push_back(E->getIndex());
2257 Record.AddTemplateArgument(E->getArgumentPack());
2258 Record.AddSourceLocation(E->getParameterPackLocation());
2260}
2261
2262void ASTStmtWriter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2263 VisitExpr(E);
2264 Record.push_back(E->getNumExpansions());
2265 Record.AddDeclRef(E->getParameterPack());
2266 Record.AddSourceLocation(E->getParameterPackLocation());
2267 for (FunctionParmPackExpr::iterator I = E->begin(), End = E->end();
2268 I != End; ++I)
2269 Record.AddDeclRef(*I);
2271}
2272
2273void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2274 VisitExpr(E);
2275 Record.push_back(static_cast<bool>(E->getLifetimeExtendedTemporaryDecl()));
2277 Record.AddDeclRef(E->getLifetimeExtendedTemporaryDecl());
2278 else
2279 Record.AddStmt(E->getSubExpr());
2281}
2282
2283void ASTStmtWriter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2284 VisitExpr(E);
2285 Record.AddSourceLocation(E->LParenLoc);
2286 Record.AddSourceLocation(E->EllipsisLoc);
2287 Record.AddSourceLocation(E->RParenLoc);
2288 Record.push_back(E->NumExpansions.toInternalRepresentation());
2289 Record.AddStmt(E->SubExprs[0]);
2290 Record.AddStmt(E->SubExprs[1]);
2291 Record.AddStmt(E->SubExprs[2]);
2292 Record.push_back(E->CXXFoldExprBits.Opcode);
2294}
2295
2296void ASTStmtWriter::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2297 VisitExpr(E);
2298 ArrayRef<Expr *> InitExprs = E->getInitExprs();
2299 Record.push_back(InitExprs.size());
2300 Record.push_back(E->getUserSpecifiedInitExprs().size());
2301 Record.AddSourceLocation(E->getInitLoc());
2302 Record.AddSourceLocation(E->getBeginLoc());
2303 Record.AddSourceLocation(E->getEndLoc());
2304 for (Expr *InitExpr : E->getInitExprs())
2305 Record.AddStmt(InitExpr);
2306 Expr *ArrayFiller = E->getArrayFiller();
2307 FieldDecl *UnionField = E->getInitializedFieldInUnion();
2308 bool HasArrayFillerOrUnionDecl = ArrayFiller || UnionField;
2309 Record.push_back(HasArrayFillerOrUnionDecl);
2310 if (HasArrayFillerOrUnionDecl) {
2311 Record.push_back(static_cast<bool>(ArrayFiller));
2312 if (ArrayFiller)
2313 Record.AddStmt(ArrayFiller);
2314 else
2315 Record.AddDeclRef(UnionField);
2316 }
2318}
2319
2320void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2321 VisitExpr(E);
2322 Record.AddStmt(E->getSourceExpr());
2323 Record.AddSourceLocation(E->getLocation());
2324 Record.push_back(E->isUnique());
2326}
2327
2328//===----------------------------------------------------------------------===//
2329// CUDA Expressions and Statements.
2330//===----------------------------------------------------------------------===//
2331
2332void ASTStmtWriter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2333 VisitCallExpr(E);
2334 Record.AddStmt(E->getConfig());
2336}
2337
2338//===----------------------------------------------------------------------===//
2339// OpenCL Expressions and Statements.
2340//===----------------------------------------------------------------------===//
2341void ASTStmtWriter::VisitAsTypeExpr(AsTypeExpr *E) {
2342 VisitExpr(E);
2343 Record.AddSourceLocation(E->getBuiltinLoc());
2344 Record.AddSourceLocation(E->getRParenLoc());
2345 Record.AddStmt(E->getSrcExpr());
2347}
2348
2349//===----------------------------------------------------------------------===//
2350// Microsoft Expressions and Statements.
2351//===----------------------------------------------------------------------===//
2352void ASTStmtWriter::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2353 VisitExpr(E);
2354 Record.push_back(E->isArrow());
2355 Record.AddStmt(E->getBaseExpr());
2356 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2357 Record.AddSourceLocation(E->getMemberLoc());
2358 Record.AddDeclRef(E->getPropertyDecl());
2360}
2361
2362void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2363 VisitExpr(E);
2364 Record.AddStmt(E->getBase());
2365 Record.AddStmt(E->getIdx());
2366 Record.AddSourceLocation(E->getRBracketLoc());
2368}
2369
2370void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2371 VisitExpr(E);
2372 Record.AddSourceRange(E->getSourceRange());
2373 Record.AddDeclRef(E->getGuidDecl());
2374 if (E->isTypeOperand()) {
2375 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
2377 } else {
2378 Record.AddStmt(E->getExprOperand());
2380 }
2381}
2382
2383void ASTStmtWriter::VisitSEHExceptStmt(SEHExceptStmt *S) {
2384 VisitStmt(S);
2385 Record.AddSourceLocation(S->getExceptLoc());
2386 Record.AddStmt(S->getFilterExpr());
2387 Record.AddStmt(S->getBlock());
2389}
2390
2391void ASTStmtWriter::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2392 VisitStmt(S);
2393 Record.AddSourceLocation(S->getFinallyLoc());
2394 Record.AddStmt(S->getBlock());
2396}
2397
2398void ASTStmtWriter::VisitSEHTryStmt(SEHTryStmt *S) {
2399 VisitStmt(S);
2400 Record.push_back(S->getIsCXXTry());
2401 Record.AddSourceLocation(S->getTryLoc());
2402 Record.AddStmt(S->getTryBlock());
2403 Record.AddStmt(S->getHandler());
2405}
2406
2407void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2408 VisitStmt(S);
2409 Record.AddSourceLocation(S->getLeaveLoc());
2411}
2412
2413//===----------------------------------------------------------------------===//
2414// OpenMP Directives.
2415//===----------------------------------------------------------------------===//
2416
2417void ASTStmtWriter::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2418 VisitStmt(S);
2419 for (Stmt *SubStmt : S->SubStmts)
2420 Record.AddStmt(SubStmt);
2422}
2423
2424void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2425 Record.writeOMPChildren(E->Data);
2426 Record.AddSourceLocation(E->getBeginLoc());
2427 Record.AddSourceLocation(E->getEndLoc());
2428}
2429
2430void ASTStmtWriter::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2431 VisitStmt(D);
2432 Record.writeUInt32(D->getLoopsNumber());
2433 VisitOMPExecutableDirective(D);
2434}
2435
2436void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) {
2437 VisitOMPLoopBasedDirective(D);
2438}
2439
2440void ASTStmtWriter::VisitOMPMetaDirective(OMPMetaDirective *D) {
2441 VisitStmt(D);
2442 Record.push_back(D->getNumClauses());
2443 VisitOMPExecutableDirective(D);
2445}
2446
2447void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) {
2448 VisitStmt(D);
2449 VisitOMPExecutableDirective(D);
2450 Record.writeBool(D->hasCancel());
2452}
2453
2454void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) {
2455 VisitOMPLoopDirective(D);
2457}
2458
2459void ASTStmtWriter::VisitOMPCanonicalLoopNestTransformationDirective(
2460 OMPCanonicalLoopNestTransformationDirective *D) {
2461 VisitOMPLoopBasedDirective(D);
2462 Record.writeUInt32(D->getNumGeneratedLoops());
2463}
2464
2465void ASTStmtWriter::VisitOMPTileDirective(OMPTileDirective *D) {
2466 VisitOMPCanonicalLoopNestTransformationDirective(D);
2468}
2469
2470void ASTStmtWriter::VisitOMPStripeDirective(OMPStripeDirective *D) {
2471 VisitOMPCanonicalLoopNestTransformationDirective(D);
2473}
2474
2475void ASTStmtWriter::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2476 VisitOMPCanonicalLoopNestTransformationDirective(D);
2478}
2479
2480void ASTStmtWriter::VisitOMPReverseDirective(OMPReverseDirective *D) {
2481 VisitOMPCanonicalLoopNestTransformationDirective(D);
2483}
2484
2485void ASTStmtWriter::VisitOMPInterchangeDirective(OMPInterchangeDirective *D) {
2486 VisitOMPCanonicalLoopNestTransformationDirective(D);
2488}
2489
2490void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) {
2491 VisitOMPLoopDirective(D);
2492 Record.writeBool(D->hasCancel());
2494}
2495
2496void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2497 VisitOMPLoopDirective(D);
2499}
2500
2501void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2502 VisitStmt(D);
2503 VisitOMPExecutableDirective(D);
2504 Record.writeBool(D->hasCancel());
2506}
2507
2508void ASTStmtWriter::VisitOMPSectionDirective(OMPSectionDirective *D) {
2509 VisitStmt(D);
2510 VisitOMPExecutableDirective(D);
2511 Record.writeBool(D->hasCancel());
2513}
2514
2515void ASTStmtWriter::VisitOMPScopeDirective(OMPScopeDirective *D) {
2516 VisitStmt(D);
2517 VisitOMPExecutableDirective(D);
2519}
2520
2521void ASTStmtWriter::VisitOMPSingleDirective(OMPSingleDirective *D) {
2522 VisitStmt(D);
2523 VisitOMPExecutableDirective(D);
2525}
2526
2527void ASTStmtWriter::VisitOMPMasterDirective(OMPMasterDirective *D) {
2528 VisitStmt(D);
2529 VisitOMPExecutableDirective(D);
2531}
2532
2533void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2534 VisitStmt(D);
2535 VisitOMPExecutableDirective(D);
2536 Record.AddDeclarationNameInfo(D->getDirectiveName());
2538}
2539
2540void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2541 VisitOMPLoopDirective(D);
2542 Record.writeBool(D->hasCancel());
2544}
2545
2546void ASTStmtWriter::VisitOMPParallelForSimdDirective(
2547 OMPParallelForSimdDirective *D) {
2548 VisitOMPLoopDirective(D);
2550}
2551
2552void ASTStmtWriter::VisitOMPParallelMasterDirective(
2553 OMPParallelMasterDirective *D) {
2554 VisitStmt(D);
2555 VisitOMPExecutableDirective(D);
2557}
2558
2559void ASTStmtWriter::VisitOMPParallelMaskedDirective(
2560 OMPParallelMaskedDirective *D) {
2561 VisitStmt(D);
2562 VisitOMPExecutableDirective(D);
2564}
2565
2566void ASTStmtWriter::VisitOMPParallelSectionsDirective(
2567 OMPParallelSectionsDirective *D) {
2568 VisitStmt(D);
2569 VisitOMPExecutableDirective(D);
2570 Record.writeBool(D->hasCancel());
2572}
2573
2574void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) {
2575 VisitStmt(D);
2576 VisitOMPExecutableDirective(D);
2577 Record.writeBool(D->hasCancel());
2579}
2580
2581void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2582 VisitStmt(D);
2583 VisitOMPExecutableDirective(D);
2584 Record.writeBool(D->isXLHSInRHSPart());
2585 Record.writeBool(D->isPostfixUpdate());
2586 Record.writeBool(D->isFailOnly());
2588}
2589
2590void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) {
2591 VisitStmt(D);
2592 VisitOMPExecutableDirective(D);
2594}
2595
2596void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2597 VisitStmt(D);
2598 VisitOMPExecutableDirective(D);
2600}
2601
2602void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
2603 OMPTargetEnterDataDirective *D) {
2604 VisitStmt(D);
2605 VisitOMPExecutableDirective(D);
2607}
2608
2609void ASTStmtWriter::VisitOMPTargetExitDataDirective(
2610 OMPTargetExitDataDirective *D) {
2611 VisitStmt(D);
2612 VisitOMPExecutableDirective(D);
2614}
2615
2616void ASTStmtWriter::VisitOMPTargetParallelDirective(
2617 OMPTargetParallelDirective *D) {
2618 VisitStmt(D);
2619 VisitOMPExecutableDirective(D);
2620 Record.writeBool(D->hasCancel());
2622}
2623
2624void ASTStmtWriter::VisitOMPTargetParallelForDirective(
2625 OMPTargetParallelForDirective *D) {
2626 VisitOMPLoopDirective(D);
2627 Record.writeBool(D->hasCancel());
2629}
2630
2631void ASTStmtWriter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2632 VisitStmt(D);
2633 VisitOMPExecutableDirective(D);
2635}
2636
2637void ASTStmtWriter::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2638 VisitStmt(D);
2639 VisitOMPExecutableDirective(D);
2641}
2642
2643void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2644 VisitStmt(D);
2645 Record.push_back(D->getNumClauses());
2646 VisitOMPExecutableDirective(D);
2648}
2649
2650void ASTStmtWriter::VisitOMPAssumeDirective(OMPAssumeDirective *D) {
2651 VisitStmt(D);
2652 VisitOMPExecutableDirective(D);
2654}
2655
2656void ASTStmtWriter::VisitOMPErrorDirective(OMPErrorDirective *D) {
2657 VisitStmt(D);
2658 Record.push_back(D->getNumClauses());
2659 VisitOMPExecutableDirective(D);
2661}
2662
2663void ASTStmtWriter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2664 VisitStmt(D);
2665 VisitOMPExecutableDirective(D);
2667}
2668
2669void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) {
2670 VisitStmt(D);
2671 VisitOMPExecutableDirective(D);
2673}
2674
2675void ASTStmtWriter::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2676 VisitStmt(D);
2677 VisitOMPExecutableDirective(D);
2679}
2680
2681void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
2682 VisitStmt(D);
2683 VisitOMPExecutableDirective(D);
2685}
2686
2687void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2688 VisitStmt(D);
2689 VisitOMPExecutableDirective(D);
2691}
2692
2693void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2694 VisitStmt(D);
2695 VisitOMPExecutableDirective(D);
2697}
2698
2699void ASTStmtWriter::VisitOMPCancellationPointDirective(
2700 OMPCancellationPointDirective *D) {
2701 VisitStmt(D);
2702 VisitOMPExecutableDirective(D);
2703 Record.writeEnum(D->getCancelRegion());
2705}
2706
2707void ASTStmtWriter::VisitOMPCancelDirective(OMPCancelDirective *D) {
2708 VisitStmt(D);
2709 VisitOMPExecutableDirective(D);
2710 Record.writeEnum(D->getCancelRegion());
2712}
2713
2714void ASTStmtWriter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2715 VisitOMPLoopDirective(D);
2716 Record.writeBool(D->hasCancel());
2718}
2719
2720void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2721 VisitOMPLoopDirective(D);
2723}
2724
2725void ASTStmtWriter::VisitOMPMasterTaskLoopDirective(
2726 OMPMasterTaskLoopDirective *D) {
2727 VisitOMPLoopDirective(D);
2728 Record.writeBool(D->hasCancel());
2730}
2731
2732void ASTStmtWriter::VisitOMPMaskedTaskLoopDirective(
2733 OMPMaskedTaskLoopDirective *D) {
2734 VisitOMPLoopDirective(D);
2735 Record.writeBool(D->hasCancel());
2737}
2738
2739void ASTStmtWriter::VisitOMPMasterTaskLoopSimdDirective(
2740 OMPMasterTaskLoopSimdDirective *D) {
2741 VisitOMPLoopDirective(D);
2743}
2744
2745void ASTStmtWriter::VisitOMPMaskedTaskLoopSimdDirective(
2746 OMPMaskedTaskLoopSimdDirective *D) {
2747 VisitOMPLoopDirective(D);
2749}
2750
2751void ASTStmtWriter::VisitOMPParallelMasterTaskLoopDirective(
2752 OMPParallelMasterTaskLoopDirective *D) {
2753 VisitOMPLoopDirective(D);
2754 Record.writeBool(D->hasCancel());
2756}
2757
2758void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopDirective(
2759 OMPParallelMaskedTaskLoopDirective *D) {
2760 VisitOMPLoopDirective(D);
2761 Record.writeBool(D->hasCancel());
2763}
2764
2765void ASTStmtWriter::VisitOMPParallelMasterTaskLoopSimdDirective(
2766 OMPParallelMasterTaskLoopSimdDirective *D) {
2767 VisitOMPLoopDirective(D);
2769}
2770
2771void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopSimdDirective(
2772 OMPParallelMaskedTaskLoopSimdDirective *D) {
2773 VisitOMPLoopDirective(D);
2775}
2776
2777void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2778 VisitOMPLoopDirective(D);
2780}
2781
2782void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2783 VisitStmt(D);
2784 VisitOMPExecutableDirective(D);
2786}
2787
2788void ASTStmtWriter::VisitOMPDistributeParallelForDirective(
2789 OMPDistributeParallelForDirective *D) {
2790 VisitOMPLoopDirective(D);
2791 Record.writeBool(D->hasCancel());
2793}
2794
2795void ASTStmtWriter::VisitOMPDistributeParallelForSimdDirective(
2796 OMPDistributeParallelForSimdDirective *D) {
2797 VisitOMPLoopDirective(D);
2799}
2800
2801void ASTStmtWriter::VisitOMPDistributeSimdDirective(
2802 OMPDistributeSimdDirective *D) {
2803 VisitOMPLoopDirective(D);
2805}
2806
2807void ASTStmtWriter::VisitOMPTargetParallelForSimdDirective(
2808 OMPTargetParallelForSimdDirective *D) {
2809 VisitOMPLoopDirective(D);
2811}
2812
2813void ASTStmtWriter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2814 VisitOMPLoopDirective(D);
2816}
2817
2818void ASTStmtWriter::VisitOMPTeamsDistributeDirective(
2819 OMPTeamsDistributeDirective *D) {
2820 VisitOMPLoopDirective(D);
2822}
2823
2824void ASTStmtWriter::VisitOMPTeamsDistributeSimdDirective(
2825 OMPTeamsDistributeSimdDirective *D) {
2826 VisitOMPLoopDirective(D);
2828}
2829
2830void ASTStmtWriter::VisitOMPTeamsDistributeParallelForSimdDirective(
2831 OMPTeamsDistributeParallelForSimdDirective *D) {
2832 VisitOMPLoopDirective(D);
2834}
2835
2836void ASTStmtWriter::VisitOMPTeamsDistributeParallelForDirective(
2837 OMPTeamsDistributeParallelForDirective *D) {
2838 VisitOMPLoopDirective(D);
2839 Record.writeBool(D->hasCancel());
2841}
2842
2843void ASTStmtWriter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2844 VisitStmt(D);
2845 VisitOMPExecutableDirective(D);
2847}
2848
2849void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective(
2850 OMPTargetTeamsDistributeDirective *D) {
2851 VisitOMPLoopDirective(D);
2853}
2854
2855void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective(
2856 OMPTargetTeamsDistributeParallelForDirective *D) {
2857 VisitOMPLoopDirective(D);
2858 Record.writeBool(D->hasCancel());
2860}
2861
2862void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2863 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
2864 VisitOMPLoopDirective(D);
2865 Code = serialization::
2866 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE;
2867}
2868
2869void ASTStmtWriter::VisitOMPTargetTeamsDistributeSimdDirective(
2870 OMPTargetTeamsDistributeSimdDirective *D) {
2871 VisitOMPLoopDirective(D);
2873}
2874
2875void ASTStmtWriter::VisitOMPInteropDirective(OMPInteropDirective *D) {
2876 VisitStmt(D);
2877 VisitOMPExecutableDirective(D);
2879}
2880
2881void ASTStmtWriter::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2882 VisitStmt(D);
2883 VisitOMPExecutableDirective(D);
2884 Record.AddSourceLocation(D->getTargetCallLoc());
2886}
2887
2888void ASTStmtWriter::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2889 VisitStmt(D);
2890 VisitOMPExecutableDirective(D);
2892}
2893
2894void ASTStmtWriter::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2895 VisitOMPLoopDirective(D);
2897}
2898
2899void ASTStmtWriter::VisitOMPTeamsGenericLoopDirective(
2900 OMPTeamsGenericLoopDirective *D) {
2901 VisitOMPLoopDirective(D);
2903}
2904
2905void ASTStmtWriter::VisitOMPTargetTeamsGenericLoopDirective(
2906 OMPTargetTeamsGenericLoopDirective *D) {
2907 VisitOMPLoopDirective(D);
2908 Record.writeBool(D->canBeParallelFor());
2910}
2911
2912void ASTStmtWriter::VisitOMPParallelGenericLoopDirective(
2913 OMPParallelGenericLoopDirective *D) {
2914 VisitOMPLoopDirective(D);
2916}
2917
2918void ASTStmtWriter::VisitOMPTargetParallelGenericLoopDirective(
2919 OMPTargetParallelGenericLoopDirective *D) {
2920 VisitOMPLoopDirective(D);
2922}
2923
2924//===----------------------------------------------------------------------===//
2925// OpenACC Constructs/Directives.
2926//===----------------------------------------------------------------------===//
2927void ASTStmtWriter::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2928 Record.push_back(S->clauses().size());
2929 Record.writeEnum(S->Kind);
2930 Record.AddSourceRange(S->Range);
2931 Record.AddSourceLocation(S->DirectiveLoc);
2932 Record.writeOpenACCClauseList(S->clauses());
2933}
2934
2935void ASTStmtWriter::VisitOpenACCAssociatedStmtConstruct(
2937 VisitOpenACCConstructStmt(S);
2938 Record.AddStmt(S->getAssociatedStmt());
2939}
2940
2941void ASTStmtWriter::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2942 VisitStmt(S);
2943 VisitOpenACCAssociatedStmtConstruct(S);
2945}
2946
2947void ASTStmtWriter::VisitOpenACCLoopConstruct(OpenACCLoopConstruct *S) {
2948 VisitStmt(S);
2949 VisitOpenACCAssociatedStmtConstruct(S);
2950 Record.writeEnum(S->getParentComputeConstructKind());
2952}
2953
2954void ASTStmtWriter::VisitOpenACCCombinedConstruct(OpenACCCombinedConstruct *S) {
2955 VisitStmt(S);
2956 VisitOpenACCAssociatedStmtConstruct(S);
2958}
2959
2960void ASTStmtWriter::VisitOpenACCDataConstruct(OpenACCDataConstruct *S) {
2961 VisitStmt(S);
2962 VisitOpenACCAssociatedStmtConstruct(S);
2964}
2965
2966void ASTStmtWriter::VisitOpenACCEnterDataConstruct(
2967 OpenACCEnterDataConstruct *S) {
2968 VisitStmt(S);
2969 VisitOpenACCConstructStmt(S);
2971}
2972
2973void ASTStmtWriter::VisitOpenACCExitDataConstruct(OpenACCExitDataConstruct *S) {
2974 VisitStmt(S);
2975 VisitOpenACCConstructStmt(S);
2977}
2978
2979void ASTStmtWriter::VisitOpenACCInitConstruct(OpenACCInitConstruct *S) {
2980 VisitStmt(S);
2981 VisitOpenACCConstructStmt(S);
2983}
2984
2985void ASTStmtWriter::VisitOpenACCShutdownConstruct(OpenACCShutdownConstruct *S) {
2986 VisitStmt(S);
2987 VisitOpenACCConstructStmt(S);
2989}
2990
2991void ASTStmtWriter::VisitOpenACCSetConstruct(OpenACCSetConstruct *S) {
2992 VisitStmt(S);
2993 VisitOpenACCConstructStmt(S);
2995}
2996
2997void ASTStmtWriter::VisitOpenACCUpdateConstruct(OpenACCUpdateConstruct *S) {
2998 VisitStmt(S);
2999 VisitOpenACCConstructStmt(S);
3001}
3002
3003void ASTStmtWriter::VisitOpenACCHostDataConstruct(OpenACCHostDataConstruct *S) {
3004 VisitStmt(S);
3005 VisitOpenACCAssociatedStmtConstruct(S);
3007}
3008
3009void ASTStmtWriter::VisitOpenACCWaitConstruct(OpenACCWaitConstruct *S) {
3010 VisitStmt(S);
3011 Record.push_back(S->getExprs().size());
3012 VisitOpenACCConstructStmt(S);
3013 Record.AddSourceLocation(S->LParenLoc);
3014 Record.AddSourceLocation(S->RParenLoc);
3015 Record.AddSourceLocation(S->QueuesLoc);
3016
3017 for(Expr *E : S->getExprs())
3018 Record.AddStmt(E);
3019
3021}
3022
3023void ASTStmtWriter::VisitOpenACCAtomicConstruct(OpenACCAtomicConstruct *S) {
3024 VisitStmt(S);
3025 VisitOpenACCConstructStmt(S);
3026 Record.writeEnum(S->getAtomicKind());
3027 Record.AddStmt(S->getAssociatedStmt());
3028
3030}
3031
3032void ASTStmtWriter::VisitOpenACCCacheConstruct(OpenACCCacheConstruct *S) {
3033 VisitStmt(S);
3034 Record.push_back(S->getVarList().size());
3035 VisitOpenACCConstructStmt(S);
3036 Record.AddSourceRange(S->ParensLoc);
3037 Record.AddSourceLocation(S->ReadOnlyLoc);
3038
3039 for (Expr *E : S->getVarList())
3040 Record.AddStmt(E);
3042}
3043
3044//===----------------------------------------------------------------------===//
3045// HLSL Constructs/Directives.
3046//===----------------------------------------------------------------------===//
3047
3048void ASTStmtWriter::VisitHLSLOutArgExpr(HLSLOutArgExpr *S) {
3049 VisitExpr(S);
3050 Record.AddStmt(S->getOpaqueArgLValue());
3051 Record.AddStmt(S->getCastedTemporary());
3052 Record.AddStmt(S->getWritebackCast());
3053 Record.writeBool(S->isInOut());
3055}
3056
3057//===----------------------------------------------------------------------===//
3058// ASTWriter Implementation
3059//===----------------------------------------------------------------------===//
3060
3062 assert(!SwitchCaseIDs.contains(S) && "SwitchCase recorded twice");
3063 unsigned NextID = SwitchCaseIDs.size();
3064 SwitchCaseIDs[S] = NextID;
3065 return NextID;
3066}
3067
3069 assert(SwitchCaseIDs.contains(S) && "SwitchCase hasn't been seen yet");
3070 return SwitchCaseIDs[S];
3071}
3072
3074 SwitchCaseIDs.clear();
3075}
3076
3077/// Write the given substatement or subexpression to the
3078/// bitstream.
3079void ASTWriter::WriteSubStmt(ASTContext &Context, Stmt *S) {
3081 ASTStmtWriter Writer(Context, *this, Record);
3082 ++NumStatements;
3083
3084 if (!S) {
3085 Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
3086 return;
3087 }
3088
3089 llvm::DenseMap<Stmt *, uint64_t>::iterator I = SubStmtEntries.find(S);
3090 if (I != SubStmtEntries.end()) {
3091 Record.push_back(I->second);
3092 Stream.EmitRecord(serialization::STMT_REF_PTR, Record);
3093 return;
3094 }
3095
3096#ifndef NDEBUG
3097 assert(!ParentStmts.count(S) && "There is a Stmt cycle!");
3098
3099 struct ParentStmtInserterRAII {
3100 Stmt *S;
3101 llvm::DenseSet<Stmt *> &ParentStmts;
3102
3103 ParentStmtInserterRAII(Stmt *S, llvm::DenseSet<Stmt *> &ParentStmts)
3104 : S(S), ParentStmts(ParentStmts) {
3105 ParentStmts.insert(S);
3106 }
3107 ~ParentStmtInserterRAII() {
3108 ParentStmts.erase(S);
3109 }
3110 };
3111
3112 ParentStmtInserterRAII ParentStmtInserter(S, ParentStmts);
3113#endif
3114
3115 Writer.Visit(S);
3116
3117 uint64_t Offset = Writer.Emit();
3118 SubStmtEntries[S] = Offset;
3119}
3120
3121/// Flush all of the statements that have been added to the
3122/// queue via AddStmt().
3123void ASTRecordWriter::FlushStmts() {
3124 // We expect to be the only consumer of the two temporary statement maps,
3125 // assert that they are empty.
3126 assert(Writer->SubStmtEntries.empty() && "unexpected entries in sub-stmt map");
3127 assert(Writer->ParentStmts.empty() && "unexpected entries in parent stmt map");
3128
3129 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3130 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[I]);
3131
3132 assert(N == StmtsToEmit.size() && "record modified while being written!");
3133
3134 // Note that we are at the end of a full expression. Any
3135 // expression records that follow this one are part of a different
3136 // expression.
3137 Writer->Stream.EmitRecord(serialization::STMT_STOP, ArrayRef<uint32_t>());
3138
3139 Writer->SubStmtEntries.clear();
3140 Writer->ParentStmts.clear();
3141 }
3142
3143 StmtsToEmit.clear();
3144}
3145
3146void ASTRecordWriter::FlushSubStmts() {
3147 // For a nested statement, write out the substatements in reverse order (so
3148 // that a simple stack machine can be used when loading), and don't emit a
3149 // STMT_STOP after each one.
3150 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3151 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[N - I - 1]);
3152 assert(N == StmtsToEmit.size() && "record modified while being written!");
3153 }
3154
3155 StmtsToEmit.clear();
3156}
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:188
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:4317
SourceLocation getQuestionLoc() const
Definition Expr.h:4316
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition Expr.h:4486
SourceLocation getAmpAmpLoc() const
Definition Expr.h:4501
SourceLocation getLabelLoc() const
Definition Expr.h:4503
LabelDecl * getLabel() const
Definition Expr.h:4509
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition Expr.h:5957
Represents a loop initializing the elements of an array.
Definition Expr.h:5904
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition Expr.h:7092
SourceLocation getRBracketLoc() const
Definition Expr.h:7195
Expr * getBase()
Get base of the array section.
Definition Expr.h:7158
Expr * getLength()
Get length of array section.
Definition Expr.h:7168
bool isOMPArraySection() const
Definition Expr.h:7154
Expr * getStride()
Get stride of array section.
Definition Expr.h:7172
SourceLocation getColonLocSecond() const
Definition Expr.h:7190
Expr * getLowerBound()
Get lower bound of array section.
Definition Expr.h:7162
SourceLocation getColonLocFirst() const
Definition Expr.h:7189
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition Expr.h:2723
SourceLocation getRBracketLoc() const
Definition Expr.h:2771
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
Definition Expr.h:2752
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition ExprCXX.h:2990
uint64_t getValue() const
Definition ExprCXX.h:3038
ArrayTypeTrait getTrait() const
Definition ExprCXX.h:3030
Expr * getDimensionExpression() const
Definition ExprCXX.h:3040
TypeSourceInfo * getQueriedTypeSourceInfo() const
Definition ExprCXX.h:3036
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition Expr.h:6621
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition Expr.h:6640
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_astype token.
Definition Expr.h:6643
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition Expr.h:6646
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:6816
Expr ** getSubExprs()
Definition Expr.h:6891
SourceLocation getRParenLoc() const
Definition Expr.h:6930
static unsigned getNumSubExprs(AtomicOp Op)
Determine the number of arguments the specified atomic builtin should have.
Definition Expr.cpp:5112
AtomicOp getOp() const
Definition Expr.h:6879
SourceLocation getBuiltinLoc() const
Definition Expr.h:6929
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:4389
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condition evaluates to false; ...
Definition Expr.h:4443
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition Expr.h:4427
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value.
Definition Expr.h:4431
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
Definition Expr.h:4436
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Definition Expr.h:4424
A builtin binary operation expression such as "x + y" or "x <= y".
Definition Expr.h:3974
Expr * getLHS() const
Definition Expr.h:4024
SourceLocation getOperatorLoc() const
Definition Expr.h:4016
bool hasStoredFPFeatures() const
Definition Expr.h:4159
Expr * getRHS() const
Definition Expr.h:4026
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:4171
Opcode getOpcode() const
Definition Expr.h:4019
bool hasExcludedOverflowPattern() const
Definition Expr.h:4166
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
Definition ASTWriter.h:1063
void addBit(bool Value)
Definition ASTWriter.h:1083
void addBits(uint32_t Value, uint32_t BitsWidth)
Definition ASTWriter.h:1084
void reset(uint32_t Value)
Definition ASTWriter.h:1078
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition Expr.h:6560
const BlockDecl * getBlockDecl() const
Definition Expr.h:6572
BreakStmt - This represents a break.
Definition Stmt.h:3135
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition ExprCXX.h:5470
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5489
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5488
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition Expr.h:3905
SourceLocation getRParenLoc() const
Definition Expr.h:3940
SourceLocation getLParenLoc() const
Definition Expr.h:3937
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:2620
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2659
bool isArrayForm() const
Definition ExprCXX.h:2646
SourceLocation getBeginLoc() const
Definition ExprCXX.h:2670
bool isGlobalDelete() const
Definition ExprCXX.h:2645
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2655
bool isArrayFormAsWritten() const
Definition ExprCXX.h:2647
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition ExprCXX.h:3864
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:3963
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:3966
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition ExprCXX.h:4058
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:3990
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:3954
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information.
Definition ExprCXX.h:3977
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition ExprCXX.h:3946
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:5026
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:2349
bool isArray() const
Definition ExprCXX.h:2458
SourceRange getDirectInitRange() const
Definition ExprCXX.h:2603
ExprIterator arg_iterator
Definition ExprCXX.h:2563
ImplicitAllocationParameters implicitAllocationParameters() const
Provides the full set of information about expected implicit parameters in this call.
Definition ExprCXX.h:2556
bool hasInitializer() const
Whether this new-expression has any initializer at all.
Definition ExprCXX.h:2518
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2455
unsigned getNumPlacementArgs() const
Definition ExprCXX.h:2488
TypeSourceInfo * getAllocatedTypeSourceInfo() const
Definition ExprCXX.h:2432
SourceRange getSourceRange() const
Definition ExprCXX.h:2604
SourceRange getTypeIdParens() const
Definition ExprCXX.h:2510
bool isParenTypeId() const
Definition ExprCXX.h:2509
raw_arg_iterator raw_arg_end()
Definition ExprCXX.h:2590
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2550
raw_arg_iterator raw_arg_begin()
Definition ExprCXX.h:2589
FunctionDecl * getOperatorNew() const
Definition ExprCXX.h:2453
bool isGlobalNew() const
Definition ExprCXX.h:2515
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition ExprCXX.h:4303
bool getValue() const
Definition ExprCXX.h:4326
Expr * getOperand() const
Definition ExprCXX.h:4320
SourceRange getSourceRange() const
Definition ExprCXX.h:4324
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:5135
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5191
SourceLocation getInitLoc() const LLVM_READONLY
Definition ExprCXX.h:5193
MutableArrayRef< Expr * > getInitExprs()
Definition ExprCXX.h:5175
ArrayRef< Expr * > getUserSpecifiedInitExprs()
Definition ExprCXX.h:5181
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5189
FieldDecl * getInitializedFieldInUnion()
Definition ExprCXX.h:5213
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition ExprCXX.h:2739
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Definition ExprCXX.h:2833
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise,...
Definition ExprCXX.h:2803
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2817
SourceLocation getTildeLoc() const
Retrieve the location of the '~'.
Definition ExprCXX.h:2824
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information.
Definition ExprCXX.h:2792
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
Definition ExprCXX.h:2848
SourceLocation getColonColonLoc() const
Retrieve the location of the '::' in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2821
SourceLocation getOperatorLoc() const
Retrieve the location of the '.' or '->' operator.
Definition ExprCXX.h:2806
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:2840
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:3738
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
Definition ExprCXX.h:3782
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition ExprCXX.h:3793
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
Definition ExprCXX.h:3776
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
Definition ExprCXX.h:3787
unsigned getNumArgs() const
Retrieve the number of arguments.
Definition ExprCXX.h:3796
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:2879
bool hasStoredFPFeatures() const
Definition Expr.h:3038
bool usesMemberSyntax() const
Definition Expr.h:3040
ExprIterator arg_iterator
Definition Expr.h:3126
arg_iterator arg_begin()
Definition Expr.h:3136
arg_iterator arg_end()
Definition Expr.h:3139
ADLCallKind getADLCallKind() const
Definition Expr.h:3030
Expr * getCallee()
Definition Expr.h:3026
FPOptionsOverride getFPFeatures() const
Definition Expr.h:3178
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition Expr.h:3070
bool isCoroElideSafe() const
Definition Expr.h:3053
SourceLocation getRParenLoc() const
Definition Expr.h:3210
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:3612
path_iterator path_begin()
Definition Expr.h:3682
unsigned path_size() const
Definition Expr.h:3681
CastKind getCastKind() const
Definition Expr.h:3656
bool hasStoredFPFeatures() const
Definition Expr.h:3711
path_iterator path_end()
Definition Expr.h:3683
CXXBaseSpecifier ** path_iterator
Definition Expr.h:3678
FPOptionsOverride getFPFeatures() const
Definition Expr.h:3732
Expr * getSubExpr()
Definition Expr.h:3662
SourceLocation getLocation() const
Definition Expr.h:1623
unsigned getValue() const
Definition Expr.h:1631
CharacterLiteralKind getKind() const
Definition Expr.h:1624
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition Expr.h:4784
SourceLocation getBuiltinLoc() const
Definition Expr.h:4831
Expr * getLHS() const
Definition Expr.h:4826
bool isConditionDependent() const
Definition Expr.h:4814
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
Definition Expr.h:4807
Expr * getRHS() const
Definition Expr.h:4828
SourceLocation getRParenLoc() const
Definition Expr.h:4834
Expr * getCond() const
Definition Expr.h:4824
Represents a 'co_await' expression.
Definition ExprCXX.h:5363
bool isImplicit() const
Definition ExprCXX.h:5385
CompoundAssignOperator - For compound assignments (e.g.
Definition Expr.h:4236
QualType getComputationLHSType() const
Definition Expr.h:4270
QualType getComputationResultType() const
Definition Expr.h:4273
CompoundLiteralExpr - [C99 6.5.2.5].
Definition Expr.h:3541
SourceLocation getLParenLoc() const
Definition Expr.h:3576
bool isFileScope() const
Definition Expr.h:3573
const Expr * getInitializer() const
Definition Expr.h:3569
TypeSourceInfo * getTypeSourceInfo() const
Definition Expr.h:3579
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:4327
Expr * getLHS() const
Definition Expr.h:4361
Expr * getCond() const
getCond - Return the expression representing the condition for the ?
Definition Expr.h:4350
Expr * getRHS() const
Definition Expr.h:4362
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition Expr.h:1084
ConstantResultStorageKind getResultStorageKind() const
Definition Expr.h:1153
ContinueStmt - This represents a continue.
Definition Stmt.h:3119
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition Expr.h:4655
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition Expr.h:4759
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_convertvector token.
Definition Expr.h:4756
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:4718
TypeSourceInfo * getTypeSourceInfo() const
getTypeSourceInfo - Return the destination type.
Definition Expr.h:4748
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition Expr.h:4713
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition Expr.h:4745
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:5249
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5340
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition ExprCXX.h:5303
Represents a 'co_yield' expression.
Definition ExprCXX.h:5444
NamedDecl * getDecl() const
AccessSpecifier getAccess() const
iterator begin()
Definition DeclGroup.h:95
A reference to a declared variable, function, enum, etc.
Definition Expr.h:1272
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition Expr.h:1447
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition Expr.h:1383
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
Definition Expr.h:1476
bool hasTemplateKWAndArgsInfo() const
Definition Expr.h:1393
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier,...
Definition Expr.h:1361
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name,...
Definition Expr.h:1365
ValueDecl * getDecl()
Definition Expr.h:1340
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition Expr.h:1470
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
Definition Expr.h:1459
SourceLocation getLocation() const
Definition Expr.h:1348
bool isImmediateEscalating() const
Definition Expr.h:1480
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:5395
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5424
A qualified reference to a name whose declaration cannot yet be resolved.
Definition ExprCXX.h:3504
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
Definition ExprCXX.h:3552
Represents a C99 designated initializer expression.
Definition Expr.h:5487
Expr * getSubExpr(unsigned Idx) const
Definition Expr.h:5769
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
Definition Expr.h:5751
MutableArrayRef< Designator > designators()
Definition Expr.h:5720
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the '=' that precedes the initializer value itself, if present.
Definition Expr.h:5742
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression,...
Definition Expr.h:5767
InitListExpr * getUpdater() const
Definition Expr.h:5872
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:5062
unsigned getStartingElementPos() const
Definition Expr.h:5083
SourceLocation getEndLoc() const
Definition Expr.h:5077
StringLiteral * getDataStringLiteral() const
Definition Expr.h:5079
SourceLocation getBeginLoc() const
Definition Expr.h:5076
size_t getDataElementCount() const
Definition Expr.h:5084
ExplicitCastExpr - An explicit cast written in the source code.
Definition Expr.h:3864
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Definition Expr.h:3886
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition ExprCXX.h:3655
bool cleanupsHaveSideEffects() const
Definition ExprCXX.h:3690
ArrayRef< CleanupObject > getObjects() const
Definition ExprCXX.h:3679
unsigned getNumObjects() const
Definition ExprCXX.h:3683
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:3063
Expr * getQueriedExpression() const
Definition ExprCXX.h:3102
ExpressionTrait getTrait() const
Definition ExprCXX.h:3098
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition Expr.h:6500
SourceLocation getAccessorLoc() const
Definition Expr.h:6524
const Expr * getBase() const
Definition Expr.h:6517
IdentifierInfo & getAccessor() const
Definition Expr.h:6521
storage_type getAsOpaqueInt() const
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition Expr.h:1583
unsigned getScale() const
Definition Expr.h:1587
llvm::APInt getValue() const
Returns an internal integer representation of the literal.
Definition Expr.h:1577
SourceLocation getLocation() const
Definition Expr.h:1709
llvm::APFloatBase::Semantics getRawSemantics() const
Get a raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE,...
Definition Expr.h:1678
llvm::APFloat getValue() const
Definition Expr.h:1668
bool isExact() const
Definition Expr.h:1701
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:1064
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Definition ExprCXX.h:4835
ValueDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition ExprCXX.h:4868
ValueDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition ExprCXX.h:4861
iterator end() const
Definition ExprCXX.h:4870
unsigned getNumExpansions() const
Get the number of parameters in this parameter pack.
Definition ExprCXX.h:4873
SourceLocation getParameterPackLocation() const
Get the location of the parameter pack.
Definition ExprCXX.h:4864
iterator begin() const
Definition ExprCXX.h:4869
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:4859
SourceLocation getTokenLocation() const
getTokenLocation - The location of the __null token.
Definition Expr.h:4873
Represents a C11 generic selection.
Definition Expr.h:6114
unsigned getNumAssocs() const
The number of association expressions.
Definition Expr.h:6354
bool isExprPredicate() const
Whether this generic selection uses an expression as its controlling argument.
Definition Expr.h:6370
SourceLocation getGenericLoc() const
Definition Expr.h:6467
SourceLocation getRParenLoc() const
Definition Expr.h:6471
SourceLocation getDefaultLoc() const
Definition Expr.h:6470
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:7258
const OpaqueValueExpr * getCastedTemporary() const
Definition Expr.h:7309
const OpaqueValueExpr * getOpaqueArgLValue() const
Definition Expr.h:7290
bool isInOut() const
returns true if the parameter is inout and false if the parameter is out.
Definition Expr.h:7317
const Expr * getWritebackCast() const
Definition Expr.h:7304
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:1733
const Expr * getSubExpr() const
Definition Expr.h:1745
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition Expr.h:3789
bool isPartOfExplicitCast() const
Definition Expr.h:3820
Represents an implicitly-generated value initialization of an object of a given type.
Definition Expr.h:5993
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:5235
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition Expr.h:5361
unsigned getNumInits() const
Definition Expr.h:5265
SourceLocation getLBraceLoc() const
Definition Expr.h:5396
InitListExpr * getSyntacticForm() const
Definition Expr.h:5408
bool hadArrayRangeDesignator() const
Definition Expr.h:5419
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition Expr.h:5337
SourceLocation getRBraceLoc() const
Definition Expr.h:5398
const Expr * getInit(unsigned Init) const
Definition Expr.h:5289
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition Expr.h:1538
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:4914
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
Definition ExprCXX.h:4931
LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl()
Definition ExprCXX.h:4954
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition Expr.h:2801
SourceLocation getRBracketLoc() const
Definition Expr.h:2853
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition Expr.h:3300
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
Definition Expr.h:3489
SourceLocation getOperatorLoc() const
Definition Expr.h:3482
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name,...
Definition Expr.h:3402
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition Expr.h:3383
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition Expr.h:3524
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
Definition Expr.h:3397
Expr * getBase() const
Definition Expr.h:3377
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition Expr.h:3465
bool hadMultipleCandidates() const
Returns true if this member expression refers to a method that was resolved from an overloaded set ha...
Definition Expr.h:3504
bool isArrow() const
Definition Expr.h:3484
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Definition Expr.h:3387
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition Decl.h:339
Represents a place-holder for an object not to be initialized by anything.
Definition Expr.h:5813
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:5395
SourceLocation getColonLoc(unsigned I) const
Gets the location of the first ':' in the range for the given iterator definition.
Definition Expr.cpp:5389
SourceLocation getRParenLoc() const
Definition ExprOpenMP.h:245
IteratorRange getIteratorRange(unsigned I)
Gets the iterator range for the given iterator.
Definition Expr.cpp:5366
OMPIteratorHelperData & getHelper(unsigned I)
Fetches helper data for the specified iteration space.
Definition Expr.cpp:5405
SourceLocation getAssignLoc(unsigned I) const
Gets the location of '=' for the given iterator definition.
Definition Expr.cpp:5383
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:5362
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:2529
Expr * getIndexExpr(unsigned Idx)
Definition Expr.h:2588
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition Expr.h:2562
const OffsetOfNode & getComponent(unsigned Idx) const
Definition Expr.h:2576
TypeSourceInfo * getTypeSourceInfo() const
Definition Expr.h:2569
unsigned getNumExpressions() const
Definition Expr.h:2600
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
Definition Expr.h:2566
unsigned getNumComponents() const
Definition Expr.h:2584
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
Definition Expr.h:2481
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition Expr.h:2487
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:2508
@ Array
An index into an array.
Definition Expr.h:2428
@ Identifier
A field in a dependent type, known only by its name.
Definition Expr.h:2432
@ Field
A field.
Definition Expr.h:2430
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Definition Expr.h:2435
Kind getKind() const
Determine what kind of offsetof node this is.
Definition Expr.h:2477
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
Definition Expr.h:2497
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition Expr.h:1180
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition Expr.h:1230
SourceLocation getLocation() const
Retrieve the location of this expression.
Definition Expr.h:1202
bool isUnique() const
Definition Expr.h:1238
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:2092
SourceLocation getLocation() const
Definition Expr.h:2109
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:3122
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition ExprCXX.h:4276
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
Definition ExprCXX.h:3229
UnresolvedSetImpl::iterator decls_iterator
Definition ExprCXX.h:3213
decls_iterator decls_begin() const
Definition ExprCXX.h:3215
unsigned getNumDecls() const
Gets the number of declarations in the unresolved set.
Definition ExprCXX.h:3226
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
Definition ExprCXX.h:3244
TemplateArgumentLoc * getTrailingTemplateArgumentLoc()
Return the optional template arguments.
Definition ExprCXX.h:4286
bool hasTemplateKWAndArgsInfo() const
Definition ExprCXX.h:3166
decls_iterator decls_end() const
Definition ExprCXX.h:3218
DeclarationName getName() const
Gets the name looked up.
Definition ExprCXX.h:3232
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition ExprCXX.h:4357
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition ExprCXX.h:4386
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
Definition ExprCXX.h:4393
SourceLocation getEllipsisLoc() const
Determine the location of the 'sizeof' keyword.
Definition ExprCXX.h:4607
Expr * getIndexExpr() const
Definition ExprCXX.h:4622
ArrayRef< Expr * > getExpressions() const
Return the trailing expressions, regardless of the expansion.
Definition ExprCXX.h:4640
SourceLocation getRSquareLoc() const
Determine the location of the right parenthesis.
Definition ExprCXX.h:4613
Expr * getPackIdExpression() const
Definition ExprCXX.h:4618
ParenExpr - This represents a parenthesized expression, e.g.
Definition Expr.h:2184
SourceLocation getLParen() const
Get the location of the left parentheses '('.
Definition Expr.h:2209
const Expr * getSubExpr() const
Definition Expr.h:2201
bool isProducedByFoldExpansion() const
Definition Expr.h:2226
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
Definition Expr.h:2213
ArrayRef< Expr * > exprs()
Definition Expr.h:6059
unsigned getNumExprs() const
Return the number of expressions in this paren list.
Definition Expr.h:6046
SourceLocation getLParenLoc() const
Definition Expr.h:6061
SourceLocation getRParenLoc() const
Definition Expr.h:6062
[C99 6.4.2.2] - A predefined identifier such as func.
Definition Expr.h:2007
bool isTransparent() const
Definition Expr.h:2046
PredefinedIdentKind getIdentKind() const
Definition Expr.h:2042
SourceLocation getLocation() const
Definition Expr.h:2048
StringLiteral * getFunctionName()
Definition Expr.h:2051
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition Expr.h:6692
semantics_iterator semantics_end()
Definition Expr.h:6757
unsigned getResultExprIndex() const
Return the index of the result-bearing expression into the semantics expressions, or PseudoObjectExpr...
Definition Expr.h:6734
semantics_iterator semantics_begin()
Definition Expr.h:6753
Expr *const * semantics_iterator
Definition Expr.h:6751
unsigned getNumSemanticExprs() const
Definition Expr.h:6749
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Definition Expr.h:6729
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition Expr.h:7364
SourceLocation getEndLoc() const
Definition Expr.h:7383
child_range children()
Definition Expr.h:7377
SourceLocation getBeginLoc() const
Definition Expr.h:7382
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:2157
SourceLocation getLParenLocation() const
Definition Expr.h:2158
TypeSourceInfo * getTypeSourceInfo()
Definition Expr.h:2145
SourceLocation getRParenLocation() const
Definition Expr.h:2159
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition Expr.h:4579
SourceLocation getBuiltinLoc() const
Definition Expr.h:4596
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
Definition Expr.h:4612
SourceLocation getRParenLoc() const
Definition Expr.h:4599
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
Definition Expr.h:4618
Represents an expression that computes the length of a parameter pack.
Definition ExprCXX.h:4435
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
Definition ExprCXX.h:4520
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition ExprCXX.h:4525
unsigned getPackLength() const
Retrieve the length of the parameter pack.
Definition ExprCXX.h:4509
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Definition Expr.h:4953
SourceLocation getBeginLoc() const
Definition Expr.h:4998
const DeclContext * getParentContext() const
If the SourceLocExpr has been resolved return the subexpression representing the resolved value.
Definition Expr.h:4994
SourceLocation getEndLoc() const
Definition Expr.h:4999
SourceLocIdentKind getIdentKind() const
Definition Expr.h:4973
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition Expr.h:4531
CompoundStmt * getSubStmt()
Definition Expr.h:4548
unsigned getTemplateDepth() const
Definition Expr.h:4560
SourceLocation getRParenLoc() const
Definition Expr.h:4557
SourceLocation getLParenLoc() const
Definition Expr.h:4555
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:1801
SourceLocation getStrTokenLoc(unsigned TokNum) const
Get one of the string literal token.
Definition Expr.h:1947
bool isPascal() const
Definition Expr.h:1924
unsigned getLength() const
Definition Expr.h:1911
StringLiteralKind getKind() const
Definition Expr.h:1914
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
Definition Expr.h:1877
unsigned getByteLength() const
Definition Expr.h:1910
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
Definition Expr.h:1942
unsigned getCharByteWidth() const
Definition Expr.h:1912
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition ExprCXX.h:4658
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition ExprCXX.h:4703
UnsignedOrNone getPackIndex() const
Definition ExprCXX.h:4709
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4707
SourceLocation getNameLoc() const
Definition ExprCXX.h:4693
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition ExprCXX.h:4748
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:4796
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition ExprCXX.h:4782
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4786
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:2890
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition ExprCXX.h:2955
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition ExprCXX.h:2952
const APValue & getAPValue() const
Definition ExprCXX.h:2946
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition Expr.h:2627
SourceLocation getRParenLoc() const
Definition Expr.h:2703
SourceLocation getOperatorLoc() const
Definition Expr.h:2700
TypeSourceInfo * getArgumentTypeInfo() const
Definition Expr.h:2673
UnaryExprOrTypeTrait getKind() const
Definition Expr.h:2659
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition Expr.h:2246
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition Expr.h:2291
Expr * getSubExpr() const
Definition Expr.h:2287
Opcode getOpcode() const
Definition Expr.h:2282
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition Expr.h:2383
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:2386
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition Expr.h:2300
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition ExprCXX.h:3384
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
Definition ExprCXX.h:3458
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition ExprCXX.h:3453
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition ExprCXX.h:4120
QualType getBaseType() const
Definition ExprCXX.h:4202
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:4212
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:4215
bool hasUnresolvedUsing() const
Determine whether the lookup results contain an unresolved using declaration.
Definition ExprCXX.h:4206
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:4193
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:4893
TypeSourceInfo * getWrittenTypeInfo() const
Definition Expr.h:4917
SourceLocation getBuiltinLoc() const
Definition Expr.h:4920
SourceLocation getRParenLoc() const
Definition Expr.h:4923
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
Definition Expr.h:4914
const Expr * getSubExpr() const
Definition Expr.h:4909
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