clang 23.0.0git
ASTWriterStmt.cpp
Go to the documentation of this file.
1//===--- ASTWriterStmt.cpp - Statement and Expression Serialization -------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// Implements serialization for Statements and Expressions.
11///
12//===----------------------------------------------------------------------===//
13
16#include "clang/AST/DeclCXX.h"
17#include "clang/AST/DeclObjC.h"
23#include "llvm/Bitstream/BitstreamWriter.h"
24using namespace clang;
25
26//===----------------------------------------------------------------------===//
27// Statement/expression serialization
28//===----------------------------------------------------------------------===//
29
30namespace clang {
31
32 class ASTStmtWriter : public StmtVisitor<ASTStmtWriter, void> {
33 ASTWriter &Writer;
34 ASTRecordWriter Record;
35
37 unsigned AbbrevToUse;
38
39 /// A helper that can help us to write a packed bit across function
40 /// calls. For example, we may write separate bits in separate functions:
41 ///
42 /// void VisitA(A* a) {
43 /// Record.push_back(a->isSomething());
44 /// }
45 ///
46 /// void Visitb(B *b) {
47 /// VisitA(b);
48 /// Record.push_back(b->isAnother());
49 /// }
50 ///
51 /// In such cases, it'll be better if we can pack these 2 bits. We achieve
52 /// this by writing a zero value in `VisitA` and recorded that first and add
53 /// the new bit to the recorded value.
54 class PakedBitsWriter {
55 public:
56 PakedBitsWriter(ASTRecordWriter &Record) : RecordRef(Record) {}
57 ~PakedBitsWriter() { assert(!CurrentIndex); }
58
59 void addBit(bool Value) {
60 assert(CurrentIndex && "Writing Bits without recording first!");
61 PackingBits.addBit(Value);
62 }
63 void addBits(uint32_t Value, uint32_t BitsWidth) {
64 assert(CurrentIndex && "Writing Bits without recording first!");
65 PackingBits.addBits(Value, BitsWidth);
66 }
67
68 void writeBits() {
69 if (!CurrentIndex)
70 return;
71
72 RecordRef[*CurrentIndex] = (uint32_t)PackingBits;
73 CurrentIndex = std::nullopt;
74 PackingBits.reset(0);
75 }
76
77 void updateBits() {
78 writeBits();
79
80 CurrentIndex = RecordRef.size();
81 RecordRef.push_back(0);
82 }
83
84 private:
85 BitsPacker PackingBits;
86 ASTRecordWriter &RecordRef;
87 std::optional<unsigned> CurrentIndex;
88 };
89
90 PakedBitsWriter CurrentPackingBits;
91
92 public:
95 : Writer(Writer), Record(Context, Writer, Record),
96 Code(serialization::STMT_NULL_PTR), AbbrevToUse(0),
97 CurrentPackingBits(this->Record) {}
98
99 ASTStmtWriter(const ASTStmtWriter&) = delete;
101
102 uint64_t Emit() {
103 CurrentPackingBits.writeBits();
104 assert(Code != serialization::STMT_NULL_PTR &&
105 "unhandled sub-statement writing AST file");
106 return Record.EmitStmt(Code, AbbrevToUse);
107 }
108
110 const TemplateArgumentLoc *Args);
111
112 void VisitStmt(Stmt *S);
113#define STMT(Type, Base) \
114 void Visit##Type(Type *);
115#include "clang/AST/StmtNodes.inc"
116 };
117}
118
120 const ASTTemplateKWAndArgsInfo &ArgInfo, const TemplateArgumentLoc *Args) {
121 Record.AddSourceLocation(ArgInfo.TemplateKWLoc);
122 Record.AddSourceLocation(ArgInfo.LAngleLoc);
123 Record.AddSourceLocation(ArgInfo.RAngleLoc);
124 for (unsigned i = 0; i != ArgInfo.NumTemplateArgs; ++i)
125 Record.AddTemplateArgumentLoc(Args[i]);
126}
127
130
131void ASTStmtWriter::VisitNullStmt(NullStmt *S) {
132 VisitStmt(S);
133 Record.AddSourceLocation(S->getSemiLoc());
134 Record.push_back(S->NullStmtBits.HasLeadingEmptyMacro);
136}
137
138void ASTStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
139 VisitStmt(S);
140
141 Record.push_back(S->size());
142 Record.push_back(S->hasStoredFPFeatures());
143
144 for (auto *CS : S->body())
145 Record.AddStmt(CS);
146 if (S->hasStoredFPFeatures())
147 Record.push_back(S->getStoredFPFeatures().getAsOpaqueInt());
148 Record.AddSourceLocation(S->getLBracLoc());
149 Record.AddSourceLocation(S->getRBracLoc());
150
151 if (!S->hasStoredFPFeatures())
152 AbbrevToUse = Writer.getCompoundStmtAbbrev();
153
155}
156
157void ASTStmtWriter::VisitSwitchCase(SwitchCase *S) {
158 VisitStmt(S);
159 Record.push_back(Writer.getSwitchCaseID(S));
160 Record.AddSourceLocation(S->getKeywordLoc());
161 Record.AddSourceLocation(S->getColonLoc());
162}
163
164void ASTStmtWriter::VisitCaseStmt(CaseStmt *S) {
165 VisitSwitchCase(S);
166 Record.push_back(S->caseStmtIsGNURange());
167 Record.AddStmt(S->getLHS());
168 Record.AddStmt(S->getSubStmt());
169 if (S->caseStmtIsGNURange()) {
170 Record.AddStmt(S->getRHS());
171 Record.AddSourceLocation(S->getEllipsisLoc());
172 }
174}
175
176void ASTStmtWriter::VisitDefaultStmt(DefaultStmt *S) {
177 VisitSwitchCase(S);
178 Record.AddStmt(S->getSubStmt());
180}
181
182void ASTStmtWriter::VisitLabelStmt(LabelStmt *S) {
183 VisitStmt(S);
184 Record.push_back(S->isSideEntry());
185 Record.AddDeclRef(S->getDecl());
186 Record.AddStmt(S->getSubStmt());
187 Record.AddSourceLocation(S->getIdentLoc());
189}
190
191void ASTStmtWriter::VisitAttributedStmt(AttributedStmt *S) {
192 VisitStmt(S);
193 Record.push_back(S->getAttrs().size());
194 Record.AddAttributes(S->getAttrs());
195 Record.AddStmt(S->getSubStmt());
196 Record.AddSourceLocation(S->getAttrLoc());
198}
199
200void ASTStmtWriter::VisitIfStmt(IfStmt *S) {
201 VisitStmt(S);
202
203 bool HasElse = S->getElse() != nullptr;
204 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
205 bool HasInit = S->getInit() != nullptr;
206
207 CurrentPackingBits.updateBits();
208
209 CurrentPackingBits.addBit(HasElse);
210 CurrentPackingBits.addBit(HasVar);
211 CurrentPackingBits.addBit(HasInit);
212 Record.push_back(static_cast<uint64_t>(S->getStatementKind()));
213 Record.AddStmt(S->getCond());
214 Record.AddStmt(S->getThen());
215 if (HasElse)
216 Record.AddStmt(S->getElse());
217 if (HasVar)
218 Record.AddStmt(S->getConditionVariableDeclStmt());
219 if (HasInit)
220 Record.AddStmt(S->getInit());
221
222 Record.AddSourceLocation(S->getIfLoc());
223 Record.AddSourceLocation(S->getLParenLoc());
224 Record.AddSourceLocation(S->getRParenLoc());
225 if (HasElse)
226 Record.AddSourceLocation(S->getElseLoc());
227
229}
230
231void ASTStmtWriter::VisitSwitchStmt(SwitchStmt *S) {
232 VisitStmt(S);
233
234 bool HasInit = S->getInit() != nullptr;
235 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
236 Record.push_back(HasInit);
237 Record.push_back(HasVar);
238 Record.push_back(S->isAllEnumCasesCovered());
239
240 Record.AddStmt(S->getCond());
241 Record.AddStmt(S->getBody());
242 if (HasInit)
243 Record.AddStmt(S->getInit());
244 if (HasVar)
245 Record.AddStmt(S->getConditionVariableDeclStmt());
246
247 Record.AddSourceLocation(S->getSwitchLoc());
248 Record.AddSourceLocation(S->getLParenLoc());
249 Record.AddSourceLocation(S->getRParenLoc());
250
251 for (SwitchCase *SC = S->getSwitchCaseList(); SC;
252 SC = SC->getNextSwitchCase())
253 Record.push_back(Writer.RecordSwitchCaseID(SC));
255}
256
257void ASTStmtWriter::VisitWhileStmt(WhileStmt *S) {
258 VisitStmt(S);
259
260 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
261 Record.push_back(HasVar);
262
263 Record.AddStmt(S->getCond());
264 Record.AddStmt(S->getBody());
265 if (HasVar)
266 Record.AddStmt(S->getConditionVariableDeclStmt());
267
268 Record.AddSourceLocation(S->getWhileLoc());
269 Record.AddSourceLocation(S->getLParenLoc());
270 Record.AddSourceLocation(S->getRParenLoc());
272}
273
274void ASTStmtWriter::VisitDoStmt(DoStmt *S) {
275 VisitStmt(S);
276 Record.AddStmt(S->getCond());
277 Record.AddStmt(S->getBody());
278 Record.AddSourceLocation(S->getDoLoc());
279 Record.AddSourceLocation(S->getWhileLoc());
280 Record.AddSourceLocation(S->getRParenLoc());
282}
283
284void ASTStmtWriter::VisitForStmt(ForStmt *S) {
285 VisitStmt(S);
286 Record.AddStmt(S->getInit());
287 Record.AddStmt(S->getCond());
288 Record.AddStmt(S->getConditionVariableDeclStmt());
289 Record.AddStmt(S->getInc());
290 Record.AddStmt(S->getBody());
291 Record.AddSourceLocation(S->getForLoc());
292 Record.AddSourceLocation(S->getLParenLoc());
293 Record.AddSourceLocation(S->getRParenLoc());
295}
296
297void ASTStmtWriter::VisitGotoStmt(GotoStmt *S) {
298 VisitStmt(S);
299 Record.AddDeclRef(S->getLabel());
300 Record.AddSourceLocation(S->getGotoLoc());
301 Record.AddSourceLocation(S->getLabelLoc());
303}
304
305void ASTStmtWriter::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
306 VisitStmt(S);
307 Record.AddSourceLocation(S->getGotoLoc());
308 Record.AddSourceLocation(S->getStarLoc());
309 Record.AddStmt(S->getTarget());
311}
312
313void ASTStmtWriter::VisitLoopControlStmt(LoopControlStmt *S) {
314 VisitStmt(S);
315 Record.AddSourceLocation(S->getKwLoc());
316 Record.push_back(S->hasLabelTarget());
317 if (S->hasLabelTarget()) {
318 Record.AddDeclRef(S->getLabelDecl());
319 Record.AddSourceLocation(S->getLabelLoc());
320 }
321}
322
323void ASTStmtWriter::VisitContinueStmt(ContinueStmt *S) {
324 VisitLoopControlStmt(S);
326}
327
328void ASTStmtWriter::VisitBreakStmt(BreakStmt *S) {
329 VisitLoopControlStmt(S);
331}
332
333void ASTStmtWriter::VisitDeferStmt(DeferStmt *S) {
334 VisitStmt(S);
335 Record.AddSourceLocation(S->getDeferLoc());
336 Record.AddStmt(S->getBody());
338}
339
340void ASTStmtWriter::VisitReturnStmt(ReturnStmt *S) {
341 VisitStmt(S);
342
343 bool HasNRVOCandidate = S->getNRVOCandidate() != nullptr;
344 Record.push_back(HasNRVOCandidate);
345
346 Record.AddStmt(S->getRetValue());
347 if (HasNRVOCandidate)
348 Record.AddDeclRef(S->getNRVOCandidate());
349
350 Record.AddSourceLocation(S->getReturnLoc());
352}
353
354void ASTStmtWriter::VisitDeclStmt(DeclStmt *S) {
355 VisitStmt(S);
356 Record.AddSourceLocation(S->getBeginLoc());
357 Record.AddSourceLocation(S->getEndLoc());
358 DeclGroupRef DG = S->getDeclGroup();
359 for (DeclGroupRef::iterator D = DG.begin(), DEnd = DG.end(); D != DEnd; ++D)
360 Record.AddDeclRef(*D);
362}
363
364void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) {
365 VisitStmt(S);
366 Record.push_back(S->getNumOutputs());
367 Record.push_back(S->getNumInputs());
368 Record.push_back(S->getNumClobbers());
369 Record.AddSourceLocation(S->getAsmLoc());
370 Record.push_back(S->isVolatile());
371 Record.push_back(S->isSimple());
372}
373
374void ASTStmtWriter::VisitGCCAsmStmt(GCCAsmStmt *S) {
375 VisitAsmStmt(S);
376 Record.push_back(S->getNumLabels());
377 Record.AddSourceLocation(S->getRParenLoc());
378 Record.AddStmt(S->getAsmStringExpr());
379
380 // Outputs
381 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
382 Record.AddIdentifierRef(S->getOutputIdentifier(I));
383 Record.AddStmt(S->getOutputConstraintExpr(I));
384 Record.AddStmt(S->getOutputExpr(I));
385 }
386
387 // Inputs
388 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
389 Record.AddIdentifierRef(S->getInputIdentifier(I));
390 Record.AddStmt(S->getInputConstraintExpr(I));
391 Record.AddStmt(S->getInputExpr(I));
392 }
393
394 // Clobbers
395 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
396 Record.AddStmt(S->getClobberExpr(I));
397
398 // Labels
399 for (unsigned I = 0, N = S->getNumLabels(); I != N; ++I) {
400 Record.AddIdentifierRef(S->getLabelIdentifier(I));
401 Record.AddStmt(S->getLabelExpr(I));
402 }
403
405}
406
407void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) {
408 VisitAsmStmt(S);
409 Record.AddSourceLocation(S->getLBraceLoc());
410 Record.AddSourceLocation(S->getEndLoc());
411 Record.push_back(S->getNumAsmToks());
412 Record.AddString(S->getAsmString());
413
414 // Tokens
415 for (unsigned I = 0, N = S->getNumAsmToks(); I != N; ++I) {
416 // FIXME: Move this to ASTRecordWriter?
417 Writer.AddToken(S->getAsmToks()[I], Record.getRecordData());
418 }
419
420 // Clobbers
421 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) {
422 Record.AddString(S->getClobber(I));
423 }
424
425 // Outputs
426 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
427 Record.AddStmt(S->getOutputExpr(I));
428 Record.AddString(S->getOutputConstraint(I));
429 }
430
431 // Inputs
432 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
433 Record.AddStmt(S->getInputExpr(I));
434 Record.AddString(S->getInputConstraint(I));
435 }
436
438}
439
440void ASTStmtWriter::VisitCoroutineBodyStmt(CoroutineBodyStmt *CoroStmt) {
441 VisitStmt(CoroStmt);
442 Record.push_back(CoroStmt->getParamMoves().size());
443 for (Stmt *S : CoroStmt->children())
444 Record.AddStmt(S);
446}
447
448void ASTStmtWriter::VisitCoreturnStmt(CoreturnStmt *S) {
449 VisitStmt(S);
450 Record.AddSourceLocation(S->getKeywordLoc());
451 Record.AddStmt(S->getOperand());
452 Record.AddStmt(S->getPromiseCall());
453 Record.push_back(S->isImplicit());
455}
456
457void ASTStmtWriter::VisitCoroutineSuspendExpr(CoroutineSuspendExpr *E) {
458 VisitExpr(E);
459 Record.AddSourceLocation(E->getKeywordLoc());
460 for (Stmt *S : E->children())
461 Record.AddStmt(S);
462 Record.AddStmt(E->getOpaqueValue());
463}
464
465void ASTStmtWriter::VisitCoawaitExpr(CoawaitExpr *E) {
466 VisitCoroutineSuspendExpr(E);
467 Record.push_back(E->isImplicit());
469}
470
471void ASTStmtWriter::VisitCoyieldExpr(CoyieldExpr *E) {
472 VisitCoroutineSuspendExpr(E);
474}
475
476void ASTStmtWriter::VisitCXXReflectExpr(CXXReflectExpr *E) {
477 // TODO(Reflection): Implement this.
478 assert(false && "not implemented yet");
479}
480
481void ASTStmtWriter::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
482 VisitExpr(E);
483 Record.AddSourceLocation(E->getKeywordLoc());
484 for (Stmt *S : E->children())
485 Record.AddStmt(S);
487}
488
489static void
491 const ASTConstraintSatisfaction &Satisfaction) {
492 Record.push_back(Satisfaction.IsSatisfied);
493 Record.push_back(Satisfaction.ContainsErrors);
494 if (!Satisfaction.IsSatisfied) {
495 Record.push_back(Satisfaction.NumRecords);
496 for (const auto &DetailRecord : Satisfaction) {
497 if (auto *Diag = dyn_cast<const ConstraintSubstitutionDiagnostic *>(
498 DetailRecord)) {
499 Record.push_back(/*Kind=*/0);
500 Record.AddSourceLocation(Diag->first);
501 Record.AddString(Diag->second);
502 continue;
503 }
504 if (auto *E = dyn_cast<const Expr *>(DetailRecord)) {
505 Record.push_back(/*Kind=*/1);
506 Record.AddStmt(const_cast<Expr *>(E));
507 } else {
508 Record.push_back(/*Kind=*/2);
509 auto *CR = cast<const ConceptReference *>(DetailRecord);
510 Record.AddConceptReference(CR);
511 }
512 }
513 }
514}
515
516static void
520 Record.AddString(D->SubstitutedEntity);
521 Record.AddSourceLocation(D->DiagLoc);
522 Record.AddString(D->DiagMessage);
523}
524
525void ASTStmtWriter::VisitConceptSpecializationExpr(
527 VisitExpr(E);
528 Record.AddDeclRef(E->getSpecializationDecl());
529 const ConceptReference *CR = E->getConceptReference();
530 Record.push_back(CR != nullptr);
531 if (CR)
532 Record.AddConceptReference(CR);
533 if (!E->isValueDependent())
535
537}
538
539void ASTStmtWriter::VisitRequiresExpr(RequiresExpr *E) {
540 VisitExpr(E);
541 Record.push_back(E->getLocalParameters().size());
542 Record.push_back(E->getRequirements().size());
543 Record.AddSourceLocation(E->RequiresExprBits.RequiresKWLoc);
544 Record.push_back(E->RequiresExprBits.IsSatisfied);
545 Record.AddDeclRef(E->getBody());
546 for (ParmVarDecl *P : E->getLocalParameters())
547 Record.AddDeclRef(P);
548 for (concepts::Requirement *R : E->getRequirements()) {
549 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(R)) {
550 Record.push_back(concepts::Requirement::RK_Type);
551 Record.push_back(TypeReq->Status);
553 addSubstitutionDiagnostic(Record, TypeReq->getSubstitutionDiagnostic());
554 else
555 Record.AddTypeSourceInfo(TypeReq->getType());
556 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(R)) {
557 Record.push_back(ExprReq->getKind());
558 Record.push_back(ExprReq->Status);
559 if (ExprReq->isExprSubstitutionFailure()) {
562 ExprReq->Value));
563 } else
564 Record.AddStmt(cast<Expr *>(ExprReq->Value));
565 if (ExprReq->getKind() == concepts::Requirement::RK_Compound) {
566 Record.AddSourceLocation(ExprReq->NoexceptLoc);
567 const auto &RetReq = ExprReq->getReturnTypeRequirement();
568 if (RetReq.isSubstitutionFailure()) {
569 Record.push_back(2);
570 addSubstitutionDiagnostic(Record, RetReq.getSubstitutionDiagnostic());
571 } else if (RetReq.isTypeConstraint()) {
572 Record.push_back(1);
573 Record.AddTemplateParameterList(
574 RetReq.getTypeConstraintTemplateParameterList());
575 if (ExprReq->Status >=
577 Record.AddStmt(
578 ExprReq->getReturnTypeRequirementSubstitutedConstraintExpr());
579 } else {
580 assert(RetReq.isEmpty());
581 Record.push_back(0);
582 }
583 }
584 } else {
585 auto *NestedReq = cast<concepts::NestedRequirement>(R);
586 Record.push_back(concepts::Requirement::RK_Nested);
587 Record.push_back(NestedReq->hasInvalidConstraint());
588 if (NestedReq->hasInvalidConstraint()) {
589 Record.AddString(NestedReq->getInvalidConstraintEntity());
590 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
591 } else {
592 Record.AddStmt(NestedReq->getConstraintExpr());
593 if (!NestedReq->isDependent())
594 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
595 }
596 }
597 }
598 Record.AddSourceLocation(E->getLParenLoc());
599 Record.AddSourceLocation(E->getRParenLoc());
600 Record.AddSourceLocation(E->getEndLoc());
601
603}
604
605
606void ASTStmtWriter::VisitCapturedStmt(CapturedStmt *S) {
607 VisitStmt(S);
608 // NumCaptures
609 Record.push_back(std::distance(S->capture_begin(), S->capture_end()));
610
611 // CapturedDecl and captured region kind
612 Record.AddDeclRef(S->getCapturedDecl());
613 Record.push_back(S->getCapturedRegionKind());
614
615 Record.AddDeclRef(S->getCapturedRecordDecl());
616
617 // Capture inits
618 for (auto *I : S->capture_inits())
619 Record.AddStmt(I);
620
621 // Body
622 Record.AddStmt(S->getCapturedStmt());
623
624 // Captures
625 for (const auto &I : S->captures()) {
626 if (I.capturesThis() || I.capturesVariableArrayType())
627 Record.AddDeclRef(nullptr);
628 else
629 Record.AddDeclRef(I.getCapturedVar());
630 Record.push_back(I.getCaptureKind());
631 Record.AddSourceLocation(I.getLocation());
632 }
633
635}
636
637void ASTStmtWriter::VisitSYCLKernelCallStmt(SYCLKernelCallStmt *S) {
638 VisitStmt(S);
639 Record.AddStmt(S->getOriginalStmt());
640 Record.AddStmt(S->getKernelLaunchStmt());
641 Record.AddDeclRef(S->getOutlinedFunctionDecl());
642
644}
645
646void ASTStmtWriter::VisitExpr(Expr *E) {
647 VisitStmt(E);
648
649 CurrentPackingBits.updateBits();
650 CurrentPackingBits.addBits(E->getDependence(), /*BitsWidth=*/5);
651 CurrentPackingBits.addBits(E->getValueKind(), /*BitsWidth=*/2);
652 CurrentPackingBits.addBits(E->getObjectKind(), /*BitsWidth=*/3);
653
654 Record.AddTypeRef(E->getType());
655}
656
657void ASTStmtWriter::VisitConstantExpr(ConstantExpr *E) {
658 VisitExpr(E);
659 Record.push_back(E->ConstantExprBits.ResultKind);
660
661 Record.push_back(E->ConstantExprBits.APValueKind);
662 Record.push_back(E->ConstantExprBits.IsUnsigned);
663 Record.push_back(E->ConstantExprBits.BitWidth);
664 // HasCleanup not serialized since we can just query the APValue.
665 Record.push_back(E->ConstantExprBits.IsImmediateInvocation);
666
667 switch (E->getResultStorageKind()) {
669 break;
671 Record.push_back(E->Int64Result());
672 break;
674 Record.AddAPValue(E->APValueResult());
675 break;
676 }
677
678 Record.AddStmt(E->getSubExpr());
680}
681
682void ASTStmtWriter::VisitOpenACCAsteriskSizeExpr(OpenACCAsteriskSizeExpr *E) {
683 VisitExpr(E);
684 Record.AddSourceLocation(E->getLocation());
686}
687
688void ASTStmtWriter::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *E) {
689 VisitExpr(E);
690
691 Record.AddSourceLocation(E->getLocation());
692 Record.AddSourceLocation(E->getLParenLocation());
693 Record.AddSourceLocation(E->getRParenLocation());
694 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
695
697}
698
699void ASTStmtWriter::VisitUnresolvedSYCLKernelCallStmt(
701 VisitStmt(S);
702
703 Record.AddStmt(S->getOriginalStmt());
704 Record.AddStmt(S->getKernelLaunchIdExpr());
705
707}
708
709void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
710 VisitExpr(E);
711
712 bool HasFunctionName = E->getFunctionName() != nullptr;
713 Record.push_back(HasFunctionName);
714 Record.push_back(
715 llvm::to_underlying(E->getIdentKind())); // FIXME: stable encoding
716 Record.push_back(E->isTransparent());
717 Record.AddSourceLocation(E->getLocation());
718 if (HasFunctionName)
719 Record.AddStmt(E->getFunctionName());
721}
722
723void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
724 VisitExpr(E);
725
726 CurrentPackingBits.updateBits();
727
728 CurrentPackingBits.addBit(E->hadMultipleCandidates());
729 CurrentPackingBits.addBit(E->refersToEnclosingVariableOrCapture());
730 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
731 CurrentPackingBits.addBit(E->isImmediateEscalating());
732 CurrentPackingBits.addBit(E->getDecl() != E->getFoundDecl());
733 CurrentPackingBits.addBit(E->hasQualifier());
734 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
735
736 if (E->hasTemplateKWAndArgsInfo()) {
737 unsigned NumTemplateArgs = E->getNumTemplateArgs();
738 Record.push_back(NumTemplateArgs);
739 }
740
741 DeclarationName::NameKind nk = (E->getDecl()->getDeclName().getNameKind());
742
743 if ((!E->hasTemplateKWAndArgsInfo()) && (!E->hasQualifier()) &&
744 (E->getDecl() == E->getFoundDecl()) &&
746 AbbrevToUse = Writer.getDeclRefExprAbbrev();
747 }
748
749 if (E->hasQualifier())
750 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
751
752 if (E->getDecl() != E->getFoundDecl())
753 Record.AddDeclRef(E->getFoundDecl());
754
756 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
757 E->getTrailingObjects<TemplateArgumentLoc>());
758
759 Record.AddDeclRef(E->getDecl());
760 Record.AddSourceLocation(E->getLocation());
761 Record.AddDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
763}
764
765void ASTStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
766 VisitExpr(E);
767 Record.AddSourceLocation(E->getLocation());
768 Record.AddAPInt(E->getValue());
769
770 if (E->getBitWidth() == 32) {
771 AbbrevToUse = Writer.getIntegerLiteralAbbrev();
772 }
773
775}
776
777void ASTStmtWriter::VisitFixedPointLiteral(FixedPointLiteral *E) {
778 VisitExpr(E);
779 Record.AddSourceLocation(E->getLocation());
780 Record.push_back(E->getScale());
781 Record.AddAPInt(E->getValue());
783}
784
785void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
786 VisitExpr(E);
787 Record.push_back(E->getRawSemantics());
788 Record.push_back(E->isExact());
789 Record.AddAPFloat(E->getValue());
790 Record.AddSourceLocation(E->getLocation());
792}
793
794void ASTStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
795 VisitExpr(E);
796 Record.AddStmt(E->getSubExpr());
798}
799
800void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
801 VisitExpr(E);
802
803 // Store the various bits of data of StringLiteral.
804 Record.push_back(E->getNumConcatenated());
805 Record.push_back(E->getLength());
806 Record.push_back(E->getCharByteWidth());
807 Record.push_back(llvm::to_underlying(E->getKind()));
808 Record.push_back(E->isPascal());
809
810 // Store the trailing array of SourceLocation.
811 for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
812 Record.AddSourceLocation(E->getStrTokenLoc(I));
813
814 // Store the trailing array of char holding the string data.
815 StringRef StrData = E->getBytes();
816 for (unsigned I = 0, N = E->getByteLength(); I != N; ++I)
817 Record.push_back(StrData[I]);
818
820}
821
822void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
823 VisitExpr(E);
824 Record.push_back(E->getValue());
825 Record.AddSourceLocation(E->getLocation());
826 Record.push_back(llvm::to_underlying(E->getKind()));
827
828 AbbrevToUse = Writer.getCharacterLiteralAbbrev();
829
831}
832
833void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
834 VisitExpr(E);
835 Record.push_back(E->isProducedByFoldExpansion());
836 Record.AddSourceLocation(E->getLParen());
837 Record.AddSourceLocation(E->getRParen());
838 Record.AddStmt(E->getSubExpr());
840}
841
842void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
843 VisitExpr(E);
844 Record.push_back(E->getNumExprs());
845 for (auto *SubStmt : E->exprs())
846 Record.AddStmt(SubStmt);
847 Record.AddSourceLocation(E->getLParenLoc());
848 Record.AddSourceLocation(E->getRParenLoc());
850}
851
852void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
853 VisitExpr(E);
854 bool HasFPFeatures = E->hasStoredFPFeatures();
855 // Write this first for easy access when deserializing, as they affect the
856 // size of the UnaryOperator.
857 CurrentPackingBits.addBit(HasFPFeatures);
858 Record.AddStmt(E->getSubExpr());
859 CurrentPackingBits.addBits(E->getOpcode(),
860 /*Width=*/5); // FIXME: stable encoding
861 Record.AddSourceLocation(E->getOperatorLoc());
862 CurrentPackingBits.addBit(E->canOverflow());
863
864 if (HasFPFeatures)
865 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
867}
868
869void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
870 VisitExpr(E);
871 Record.push_back(E->getNumComponents());
872 Record.push_back(E->getNumExpressions());
873 Record.AddSourceLocation(E->getOperatorLoc());
874 Record.AddSourceLocation(E->getRParenLoc());
875 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
876 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
877 const OffsetOfNode &ON = E->getComponent(I);
878 Record.push_back(ON.getKind()); // FIXME: Stable encoding
879 Record.AddSourceLocation(ON.getSourceRange().getBegin());
880 Record.AddSourceLocation(ON.getSourceRange().getEnd());
881 switch (ON.getKind()) {
883 Record.push_back(ON.getArrayExprIndex());
884 break;
885
887 Record.AddDeclRef(ON.getField());
888 break;
889
891 Record.AddIdentifierRef(ON.getFieldName());
892 break;
893
895 Record.AddCXXBaseSpecifier(*ON.getBase());
896 break;
897 }
898 }
899 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
900 Record.AddStmt(E->getIndexExpr(I));
902}
903
904void ASTStmtWriter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
905 VisitExpr(E);
906 Record.push_back(E->getKind());
907 if (E->isArgumentType())
908 Record.AddTypeSourceInfo(E->getArgumentTypeInfo());
909 else {
910 Record.push_back(0);
911 Record.AddStmt(E->getArgumentExpr());
912 }
913 Record.AddSourceLocation(E->getOperatorLoc());
914 Record.AddSourceLocation(E->getRParenLoc());
916}
917
918void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
919 VisitExpr(E);
920 Record.AddStmt(E->getLHS());
921 Record.AddStmt(E->getRHS());
922 Record.AddSourceLocation(E->getRBracketLoc());
924}
925
926void ASTStmtWriter::VisitMatrixSingleSubscriptExpr(
928 VisitExpr(E);
929 Record.AddStmt(E->getBase());
930 Record.AddStmt(E->getRowIdx());
931 Record.AddSourceLocation(E->getRBracketLoc());
933}
934
935void ASTStmtWriter::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
936 VisitExpr(E);
937 Record.AddStmt(E->getBase());
938 Record.AddStmt(E->getRowIdx());
939 Record.AddStmt(E->getColumnIdx());
940 Record.AddSourceLocation(E->getRBracketLoc());
942}
943
944void ASTStmtWriter::VisitArraySectionExpr(ArraySectionExpr *E) {
945 VisitExpr(E);
946 Record.writeEnum(E->ASType);
947 Record.AddStmt(E->getBase());
948 Record.AddStmt(E->getLowerBound());
949 Record.AddStmt(E->getLength());
950 if (E->isOMPArraySection())
951 Record.AddStmt(E->getStride());
952 Record.AddSourceLocation(E->getColonLocFirst());
953
954 if (E->isOMPArraySection())
955 Record.AddSourceLocation(E->getColonLocSecond());
956
957 Record.AddSourceLocation(E->getRBracketLoc());
959}
960
961void ASTStmtWriter::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
962 VisitExpr(E);
963 Record.push_back(E->getDimensions().size());
964 Record.AddStmt(E->getBase());
965 for (Expr *Dim : E->getDimensions())
966 Record.AddStmt(Dim);
967 for (SourceRange SR : E->getBracketsRanges())
968 Record.AddSourceRange(SR);
969 Record.AddSourceLocation(E->getLParenLoc());
970 Record.AddSourceLocation(E->getRParenLoc());
972}
973
974void ASTStmtWriter::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
975 VisitExpr(E);
976 Record.push_back(E->numOfIterators());
977 Record.AddSourceLocation(E->getIteratorKwLoc());
978 Record.AddSourceLocation(E->getLParenLoc());
979 Record.AddSourceLocation(E->getRParenLoc());
980 for (unsigned I = 0, End = E->numOfIterators(); I < End; ++I) {
981 Record.AddDeclRef(E->getIteratorDecl(I));
982 Record.AddSourceLocation(E->getAssignLoc(I));
983 OMPIteratorExpr::IteratorRange Range = E->getIteratorRange(I);
984 Record.AddStmt(Range.Begin);
985 Record.AddStmt(Range.End);
986 Record.AddStmt(Range.Step);
987 Record.AddSourceLocation(E->getColonLoc(I));
988 if (Range.Step)
989 Record.AddSourceLocation(E->getSecondColonLoc(I));
990 // Serialize helpers
991 OMPIteratorHelperData &HD = E->getHelper(I);
992 Record.AddDeclRef(HD.CounterVD);
993 Record.AddStmt(HD.Upper);
994 Record.AddStmt(HD.Update);
995 Record.AddStmt(HD.CounterUpdate);
996 }
998}
999
1000void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
1001 VisitExpr(E);
1002
1003 Record.push_back(E->getNumArgs());
1004 CurrentPackingBits.updateBits();
1005 CurrentPackingBits.addBit(static_cast<bool>(E->getADLCallKind()));
1006 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
1007 CurrentPackingBits.addBit(E->isCoroElideSafe());
1008 CurrentPackingBits.addBit(E->usesMemberSyntax());
1009
1010 Record.AddSourceLocation(E->getRParenLoc());
1011 Record.AddStmt(E->getCallee());
1012 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
1013 Arg != ArgEnd; ++Arg)
1014 Record.AddStmt(*Arg);
1015
1016 if (E->hasStoredFPFeatures())
1017 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
1018
1019 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1020 !E->isCoroElideSafe() && !E->usesMemberSyntax() &&
1021 E->getStmtClass() == Stmt::CallExprClass)
1022 AbbrevToUse = Writer.getCallExprAbbrev();
1023
1025}
1026
1027void ASTStmtWriter::VisitRecoveryExpr(RecoveryExpr *E) {
1028 VisitExpr(E);
1029 Record.push_back(std::distance(E->children().begin(), E->children().end()));
1030 Record.AddSourceLocation(E->getBeginLoc());
1031 Record.AddSourceLocation(E->getEndLoc());
1032 for (Stmt *Child : E->children())
1033 Record.AddStmt(Child);
1035}
1036
1037void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
1038 VisitExpr(E);
1039
1040 bool HasQualifier = E->hasQualifier();
1041 bool HasFoundDecl = E->hasFoundDecl();
1042 bool HasTemplateInfo = E->hasTemplateKWAndArgsInfo();
1043 unsigned NumTemplateArgs = E->getNumTemplateArgs();
1044
1045 // Write these first for easy access when deserializing, as they affect the
1046 // size of the MemberExpr.
1047 CurrentPackingBits.updateBits();
1048 CurrentPackingBits.addBit(HasQualifier);
1049 CurrentPackingBits.addBit(HasFoundDecl);
1050 CurrentPackingBits.addBit(HasTemplateInfo);
1051 Record.push_back(NumTemplateArgs);
1052
1053 Record.AddStmt(E->getBase());
1054 Record.AddDeclRef(E->getMemberDecl());
1055 Record.AddDeclarationNameLoc(E->MemberDNLoc,
1056 E->getMemberDecl()->getDeclName());
1057 Record.AddSourceLocation(E->getMemberLoc());
1058 CurrentPackingBits.addBit(E->isArrow());
1059 CurrentPackingBits.addBit(E->hadMultipleCandidates());
1060 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
1061 Record.AddSourceLocation(E->getOperatorLoc());
1062
1063 if (HasQualifier)
1064 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
1065
1066 if (HasFoundDecl) {
1067 DeclAccessPair FoundDecl = E->getFoundDecl();
1068 Record.AddDeclRef(FoundDecl.getDecl());
1069 CurrentPackingBits.addBits(FoundDecl.getAccess(), /*BitWidth=*/2);
1070 }
1071
1072 if (HasTemplateInfo)
1073 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1074 E->getTrailingObjects<TemplateArgumentLoc>());
1075
1077}
1078
1079void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1080 VisitExpr(E);
1081 Record.AddStmt(E->getBase());
1082 Record.AddSourceLocation(E->getIsaMemberLoc());
1083 Record.AddSourceLocation(E->getOpLoc());
1084 Record.push_back(E->isArrow());
1086}
1087
1088void ASTStmtWriter::
1089VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1090 VisitExpr(E);
1091 Record.AddStmt(E->getSubExpr());
1092 Record.push_back(E->shouldCopy());
1094}
1095
1096void ASTStmtWriter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1097 VisitExplicitCastExpr(E);
1098 Record.AddSourceLocation(E->getLParenLoc());
1099 Record.AddSourceLocation(E->getBridgeKeywordLoc());
1100 Record.push_back(E->getBridgeKind()); // FIXME: Stable encoding
1102}
1103
1104void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
1105 VisitExpr(E);
1106
1107 Record.push_back(E->path_size());
1108 CurrentPackingBits.updateBits();
1109 // 7 bits should be enough to store the casting kinds.
1110 CurrentPackingBits.addBits(E->getCastKind(), /*Width=*/7);
1111 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
1112 Record.AddStmt(E->getSubExpr());
1113
1115 PI = E->path_begin(), PE = E->path_end(); PI != PE; ++PI)
1116 Record.AddCXXBaseSpecifier(**PI);
1117
1118 if (E->hasStoredFPFeatures())
1119 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
1120}
1121
1122void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
1123 VisitExpr(E);
1124
1125 // Write this first for easy access when deserializing, as they affect the
1126 // size of the UnaryOperator.
1127 CurrentPackingBits.updateBits();
1128 CurrentPackingBits.addBits(E->getOpcode(), /*Width=*/6);
1129 bool HasFPFeatures = E->hasStoredFPFeatures();
1130 CurrentPackingBits.addBit(HasFPFeatures);
1131 CurrentPackingBits.addBit(E->hasExcludedOverflowPattern());
1132 Record.AddStmt(E->getLHS());
1133 Record.AddStmt(E->getRHS());
1134 Record.AddSourceLocation(E->getOperatorLoc());
1135 if (HasFPFeatures)
1136 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1137
1138 if (!HasFPFeatures && E->getValueKind() == VK_PRValue &&
1139 E->getObjectKind() == OK_Ordinary)
1140 AbbrevToUse = Writer.getBinaryOperatorAbbrev();
1141
1143}
1144
1145void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1146 VisitBinaryOperator(E);
1147 Record.AddTypeRef(E->getComputationLHSType());
1148 Record.AddTypeRef(E->getComputationResultType());
1149
1150 if (!E->hasStoredFPFeatures() && E->getValueKind() == VK_PRValue &&
1151 E->getObjectKind() == OK_Ordinary)
1152 AbbrevToUse = Writer.getCompoundAssignOperatorAbbrev();
1153
1155}
1156
1157void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
1158 VisitExpr(E);
1159 Record.AddStmt(E->getCond());
1160 Record.AddStmt(E->getLHS());
1161 Record.AddStmt(E->getRHS());
1162 Record.AddSourceLocation(E->getQuestionLoc());
1163 Record.AddSourceLocation(E->getColonLoc());
1165}
1166
1167void
1168ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1169 VisitExpr(E);
1170 Record.AddStmt(E->getOpaqueValue());
1171 Record.AddStmt(E->getCommon());
1172 Record.AddStmt(E->getCond());
1173 Record.AddStmt(E->getTrueExpr());
1174 Record.AddStmt(E->getFalseExpr());
1175 Record.AddSourceLocation(E->getQuestionLoc());
1176 Record.AddSourceLocation(E->getColonLoc());
1178}
1179
1180void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1181 VisitCastExpr(E);
1182 CurrentPackingBits.addBit(E->isPartOfExplicitCast());
1183
1184 if (E->path_size() == 0 && !E->hasStoredFPFeatures())
1185 AbbrevToUse = Writer.getExprImplicitCastAbbrev();
1186
1188}
1189
1190void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1191 VisitCastExpr(E);
1192 Record.AddTypeSourceInfo(E->getTypeInfoAsWritten());
1193}
1194
1195void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
1196 VisitExplicitCastExpr(E);
1197 Record.AddSourceLocation(E->getLParenLoc());
1198 Record.AddSourceLocation(E->getRParenLoc());
1200}
1201
1202void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1203 VisitExpr(E);
1204 Record.AddSourceLocation(E->getLParenLoc());
1205 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1206 Record.AddStmt(E->getInitializer());
1207 Record.push_back(E->isFileScope());
1209}
1210
1211void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1212 VisitExpr(E);
1213 Record.AddStmt(E->getBase());
1214 Record.AddIdentifierRef(&E->getAccessor());
1215 Record.AddSourceLocation(E->getAccessorLoc());
1217}
1218
1219void ASTStmtWriter::VisitMatrixElementExpr(MatrixElementExpr *E) {
1220 VisitExpr(E);
1221 Record.AddStmt(E->getBase());
1222 Record.AddIdentifierRef(&E->getAccessor());
1223 Record.AddSourceLocation(E->getAccessorLoc());
1225}
1226
1227void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
1228 VisitExpr(E);
1229 // NOTE: only add the (possibly null) syntactic form.
1230 // No need to serialize the isSemanticForm flag and the semantic form.
1231 Record.AddStmt(E->getSyntacticForm());
1232 Record.AddSourceLocation(E->getLBraceLoc());
1233 Record.AddSourceLocation(E->getRBraceLoc());
1234 bool isArrayFiller = isa<Expr *>(E->ArrayFillerOrUnionFieldInit);
1235 Record.push_back(isArrayFiller);
1236 if (isArrayFiller)
1237 Record.AddStmt(E->getArrayFiller());
1238 else
1239 Record.AddDeclRef(E->getInitializedFieldInUnion());
1240 Record.push_back(E->hadArrayRangeDesignator());
1241 Record.push_back(E->getNumInits());
1242 if (isArrayFiller) {
1243 // ArrayFiller may have filled "holes" due to designated initializer.
1244 // Replace them by 0 to indicate that the filler goes in that place.
1245 Expr *filler = E->getArrayFiller();
1246 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1247 Record.AddStmt(E->getInit(I) != filler ? E->getInit(I) : nullptr);
1248 } else {
1249 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1250 Record.AddStmt(E->getInit(I));
1251 }
1253}
1254
1255void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1256 VisitExpr(E);
1257 Record.push_back(E->getNumSubExprs());
1258 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1259 Record.AddStmt(E->getSubExpr(I));
1260 Record.AddSourceLocation(E->getEqualOrColonLoc());
1261 Record.push_back(E->usesGNUSyntax());
1262 for (const DesignatedInitExpr::Designator &D : E->designators()) {
1263 if (D.isFieldDesignator()) {
1264 if (FieldDecl *Field = D.getFieldDecl()) {
1265 Record.push_back(serialization::DESIG_FIELD_DECL);
1266 Record.AddDeclRef(Field);
1267 } else {
1268 Record.push_back(serialization::DESIG_FIELD_NAME);
1269 Record.AddIdentifierRef(D.getFieldName());
1270 }
1271 Record.AddSourceLocation(D.getDotLoc());
1272 Record.AddSourceLocation(D.getFieldLoc());
1273 } else if (D.isArrayDesignator()) {
1274 Record.push_back(serialization::DESIG_ARRAY);
1275 Record.push_back(D.getArrayIndex());
1276 Record.AddSourceLocation(D.getLBracketLoc());
1277 Record.AddSourceLocation(D.getRBracketLoc());
1278 } else {
1279 assert(D.isArrayRangeDesignator() && "Unknown designator");
1280 Record.push_back(serialization::DESIG_ARRAY_RANGE);
1281 Record.push_back(D.getArrayIndex());
1282 Record.AddSourceLocation(D.getLBracketLoc());
1283 Record.AddSourceLocation(D.getEllipsisLoc());
1284 Record.AddSourceLocation(D.getRBracketLoc());
1285 }
1286 }
1288}
1289
1290void ASTStmtWriter::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1291 VisitExpr(E);
1292 Record.AddStmt(E->getBase());
1293 Record.AddStmt(E->getUpdater());
1295}
1296
1297void ASTStmtWriter::VisitNoInitExpr(NoInitExpr *E) {
1298 VisitExpr(E);
1300}
1301
1302void ASTStmtWriter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1303 VisitExpr(E);
1304 Record.AddStmt(E->SubExprs[0]);
1305 Record.AddStmt(E->SubExprs[1]);
1307}
1308
1309void ASTStmtWriter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1310 VisitExpr(E);
1312}
1313
1314void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1315 VisitExpr(E);
1317}
1318
1319void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
1320 VisitExpr(E);
1321 Record.AddStmt(E->getSubExpr());
1322 Record.AddTypeSourceInfo(E->getWrittenTypeInfo());
1323 Record.AddSourceLocation(E->getBuiltinLoc());
1324 Record.AddSourceLocation(E->getRParenLoc());
1325 Record.push_back(E->isMicrosoftABI());
1327}
1328
1329void ASTStmtWriter::VisitSourceLocExpr(SourceLocExpr *E) {
1330 VisitExpr(E);
1331 Record.AddDeclRef(cast_or_null<Decl>(E->getParentContext()));
1332 Record.AddSourceLocation(E->getBeginLoc());
1333 Record.AddSourceLocation(E->getEndLoc());
1334 Record.push_back(llvm::to_underlying(E->getIdentKind()));
1336}
1337
1338void ASTStmtWriter::VisitEmbedExpr(EmbedExpr *E) {
1339 VisitExpr(E);
1340 Record.AddSourceLocation(E->getBeginLoc());
1341 Record.AddSourceLocation(E->getEndLoc());
1342 Record.AddStmt(E->getDataStringLiteral());
1343 Record.writeUInt32(E->getStartingElementPos());
1344 Record.writeUInt32(E->getDataElementCount());
1346}
1347
1348void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
1349 VisitExpr(E);
1350 Record.AddSourceLocation(E->getAmpAmpLoc());
1351 Record.AddSourceLocation(E->getLabelLoc());
1352 Record.AddDeclRef(E->getLabel());
1354}
1355
1356void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
1357 VisitExpr(E);
1358 Record.AddStmt(E->getSubStmt());
1359 Record.AddSourceLocation(E->getLParenLoc());
1360 Record.AddSourceLocation(E->getRParenLoc());
1361 Record.push_back(E->getTemplateDepth());
1363}
1364
1365void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
1366 VisitExpr(E);
1367 Record.AddStmt(E->getCond());
1368 Record.AddStmt(E->getLHS());
1369 Record.AddStmt(E->getRHS());
1370 Record.AddSourceLocation(E->getBuiltinLoc());
1371 Record.AddSourceLocation(E->getRParenLoc());
1372 Record.push_back(E->isConditionDependent() ? false : E->isConditionTrue());
1374}
1375
1376void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
1377 VisitExpr(E);
1378 Record.AddSourceLocation(E->getTokenLocation());
1380}
1381
1382void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1383 VisitExpr(E);
1384 Record.push_back(E->getNumSubExprs());
1385 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1386 Record.AddStmt(E->getExpr(I));
1387 Record.AddSourceLocation(E->getBuiltinLoc());
1388 Record.AddSourceLocation(E->getRParenLoc());
1390}
1391
1392void ASTStmtWriter::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1393 VisitExpr(E);
1394 bool HasFPFeatures = E->hasStoredFPFeatures();
1395 CurrentPackingBits.addBit(HasFPFeatures);
1396 Record.AddSourceLocation(E->getBuiltinLoc());
1397 Record.AddSourceLocation(E->getRParenLoc());
1398 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1399 Record.AddStmt(E->getSrcExpr());
1401 if (HasFPFeatures)
1402 Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
1403}
1404
1405void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
1406 VisitExpr(E);
1407 Record.AddDeclRef(E->getBlockDecl());
1409}
1410
1411void ASTStmtWriter::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1412 VisitExpr(E);
1413
1414 Record.push_back(E->getNumAssocs());
1415 Record.push_back(E->isExprPredicate());
1416 Record.push_back(E->ResultIndex);
1417 Record.AddSourceLocation(E->getGenericLoc());
1418 Record.AddSourceLocation(E->getDefaultLoc());
1419 Record.AddSourceLocation(E->getRParenLoc());
1420
1421 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1422 // Add 1 to account for the controlling expression which is the first
1423 // expression in the trailing array of Stmt *. This is not needed for
1424 // the trailing array of TypeSourceInfo *.
1425 for (unsigned I = 0, N = E->getNumAssocs() + 1; I < N; ++I)
1426 Record.AddStmt(Stmts[I]);
1427
1428 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1429 for (unsigned I = 0, N = E->getNumAssocs(); I < N; ++I)
1430 Record.AddTypeSourceInfo(TSIs[I]);
1431
1433}
1434
1435void ASTStmtWriter::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1436 VisitExpr(E);
1437 Record.push_back(E->getNumSemanticExprs());
1438
1439 // Push the result index. Currently, this needs to exactly match
1440 // the encoding used internally for ResultIndex.
1441 unsigned result = E->getResultExprIndex();
1442 result = (result == PseudoObjectExpr::NoResult ? 0 : result + 1);
1443 Record.push_back(result);
1444
1445 Record.AddStmt(E->getSyntacticForm());
1447 i = E->semantics_begin(), e = E->semantics_end(); i != e; ++i) {
1448 Record.AddStmt(*i);
1449 }
1451}
1452
1453void ASTStmtWriter::VisitAtomicExpr(AtomicExpr *E) {
1454 VisitExpr(E);
1455 Record.push_back(E->getOp());
1456 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1457 Record.AddStmt(E->getSubExprs()[I]);
1458 Record.AddSourceLocation(E->getBuiltinLoc());
1459 Record.AddSourceLocation(E->getRParenLoc());
1461}
1462
1463//===----------------------------------------------------------------------===//
1464// Objective-C Expressions and Statements.
1465//===----------------------------------------------------------------------===//
1466
1467void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1468 VisitExpr(E);
1469 Record.AddStmt(E->getString());
1470 Record.AddSourceLocation(E->getAtLoc());
1472}
1473
1474void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1475 VisitExpr(E);
1476 Record.AddStmt(E->getSubExpr());
1477 Record.AddDeclRef(E->getBoxingMethod());
1478 Record.AddSourceRange(E->getSourceRange());
1480}
1481
1482void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1483 VisitExpr(E);
1484 Record.push_back(E->getNumElements());
1485 for (unsigned i = 0; i < E->getNumElements(); i++)
1486 Record.AddStmt(E->getElement(i));
1487 Record.AddDeclRef(E->getArrayWithObjectsMethod());
1488 Record.AddSourceRange(E->getSourceRange());
1490}
1491
1492void ASTStmtWriter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1493 VisitExpr(E);
1494 Record.push_back(E->getNumElements());
1495 Record.push_back(E->HasPackExpansions);
1496 for (unsigned i = 0; i < E->getNumElements(); i++) {
1497 ObjCDictionaryElement Element = E->getKeyValueElement(i);
1498 Record.AddStmt(Element.Key);
1499 Record.AddStmt(Element.Value);
1500 if (E->HasPackExpansions) {
1501 Record.AddSourceLocation(Element.EllipsisLoc);
1502 unsigned NumExpansions = 0;
1503 if (Element.NumExpansions)
1504 NumExpansions = *Element.NumExpansions + 1;
1505 Record.push_back(NumExpansions);
1506 }
1507 }
1508
1509 Record.AddDeclRef(E->getDictWithObjectsMethod());
1510 Record.AddSourceRange(E->getSourceRange());
1512}
1513
1514void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1515 VisitExpr(E);
1516 Record.AddTypeSourceInfo(E->getEncodedTypeSourceInfo());
1517 Record.AddSourceLocation(E->getAtLoc());
1518 Record.AddSourceLocation(E->getRParenLoc());
1520}
1521
1522void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1523 VisitExpr(E);
1524 Record.AddSelectorRef(E->getSelector());
1525 Record.AddSourceLocation(E->getAtLoc());
1526 Record.AddSourceLocation(E->getRParenLoc());
1528}
1529
1530void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1531 VisitExpr(E);
1532 Record.AddDeclRef(E->getProtocol());
1533 Record.AddSourceLocation(E->getAtLoc());
1534 Record.AddSourceLocation(E->ProtoLoc);
1535 Record.AddSourceLocation(E->getRParenLoc());
1537}
1538
1539void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1540 VisitExpr(E);
1541 Record.AddDeclRef(E->getDecl());
1542 Record.AddSourceLocation(E->getLocation());
1543 Record.AddSourceLocation(E->getOpLoc());
1544 Record.AddStmt(E->getBase());
1545 Record.push_back(E->isArrow());
1546 Record.push_back(E->isFreeIvar());
1548}
1549
1550void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1551 VisitExpr(E);
1552 Record.push_back(E->SetterAndMethodRefFlags.getInt());
1553 Record.push_back(E->isImplicitProperty());
1554 if (E->isImplicitProperty()) {
1555 Record.AddDeclRef(E->getImplicitPropertyGetter());
1556 Record.AddDeclRef(E->getImplicitPropertySetter());
1557 } else {
1558 Record.AddDeclRef(E->getExplicitProperty());
1559 }
1560 Record.AddSourceLocation(E->getLocation());
1561 Record.AddSourceLocation(E->getReceiverLocation());
1562 if (E->isObjectReceiver()) {
1563 Record.push_back(0);
1564 Record.AddStmt(E->getBase());
1565 } else if (E->isSuperReceiver()) {
1566 Record.push_back(1);
1567 Record.AddTypeRef(E->getSuperReceiverType());
1568 } else {
1569 Record.push_back(2);
1570 Record.AddDeclRef(E->getClassReceiver());
1571 }
1572
1574}
1575
1576void ASTStmtWriter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1577 VisitExpr(E);
1578 Record.AddSourceLocation(E->getRBracket());
1579 Record.AddStmt(E->getBaseExpr());
1580 Record.AddStmt(E->getKeyExpr());
1581 Record.AddDeclRef(E->getAtIndexMethodDecl());
1582 Record.AddDeclRef(E->setAtIndexMethodDecl());
1583
1585}
1586
1587void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1588 VisitExpr(E);
1589 Record.push_back(E->getNumArgs());
1590 Record.push_back(E->getNumStoredSelLocs());
1591 Record.push_back(E->SelLocsKind);
1592 Record.push_back(E->isDelegateInitCall());
1593 Record.push_back(E->IsImplicit);
1594 Record.push_back((unsigned)E->getReceiverKind()); // FIXME: stable encoding
1595 switch (E->getReceiverKind()) {
1597 Record.AddStmt(E->getInstanceReceiver());
1598 break;
1599
1601 Record.AddTypeSourceInfo(E->getClassReceiverTypeInfo());
1602 break;
1603
1606 Record.AddTypeRef(E->getSuperType());
1607 Record.AddSourceLocation(E->getSuperLoc());
1608 break;
1609 }
1610
1611 if (E->getMethodDecl()) {
1612 Record.push_back(1);
1613 Record.AddDeclRef(E->getMethodDecl());
1614 } else {
1615 Record.push_back(0);
1616 Record.AddSelectorRef(E->getSelector());
1617 }
1618
1619 Record.AddSourceLocation(E->getLeftLoc());
1620 Record.AddSourceLocation(E->getRightLoc());
1621
1622 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
1623 Arg != ArgEnd; ++Arg)
1624 Record.AddStmt(*Arg);
1625
1626 SourceLocation *Locs = E->getStoredSelLocs();
1627 for (unsigned i = 0, e = E->getNumStoredSelLocs(); i != e; ++i)
1628 Record.AddSourceLocation(Locs[i]);
1629
1631}
1632
1633void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1634 VisitStmt(S);
1635 Record.AddStmt(S->getElement());
1636 Record.AddStmt(S->getCollection());
1637 Record.AddStmt(S->getBody());
1638 Record.AddSourceLocation(S->getForLoc());
1639 Record.AddSourceLocation(S->getRParenLoc());
1641}
1642
1643void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1644 VisitStmt(S);
1645 Record.AddStmt(S->getCatchBody());
1646 Record.AddDeclRef(S->getCatchParamDecl());
1647 Record.AddSourceLocation(S->getAtCatchLoc());
1648 Record.AddSourceLocation(S->getRParenLoc());
1650}
1651
1652void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1653 VisitStmt(S);
1654 Record.AddStmt(S->getFinallyBody());
1655 Record.AddSourceLocation(S->getAtFinallyLoc());
1657}
1658
1659void ASTStmtWriter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1660 VisitStmt(S); // FIXME: no test coverage.
1661 Record.AddStmt(S->getSubStmt());
1662 Record.AddSourceLocation(S->getAtLoc());
1664}
1665
1666void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1667 VisitStmt(S);
1668 Record.push_back(S->getNumCatchStmts());
1669 Record.push_back(S->getFinallyStmt() != nullptr);
1670 Record.AddStmt(S->getTryBody());
1671 for (ObjCAtCatchStmt *C : S->catch_stmts())
1672 Record.AddStmt(C);
1673 if (S->getFinallyStmt())
1674 Record.AddStmt(S->getFinallyStmt());
1675 Record.AddSourceLocation(S->getAtTryLoc());
1677}
1678
1679void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1680 VisitStmt(S); // FIXME: no test coverage.
1681 Record.AddStmt(S->getSynchExpr());
1682 Record.AddStmt(S->getSynchBody());
1683 Record.AddSourceLocation(S->getAtSynchronizedLoc());
1685}
1686
1687void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1688 VisitStmt(S); // FIXME: no test coverage.
1689 Record.AddStmt(S->getThrowExpr());
1690 Record.AddSourceLocation(S->getThrowLoc());
1692}
1693
1694void ASTStmtWriter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1695 VisitExpr(E);
1696 Record.push_back(E->getValue());
1697 Record.AddSourceLocation(E->getLocation());
1699}
1700
1701void ASTStmtWriter::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1702 VisitExpr(E);
1703 Record.AddSourceRange(E->getSourceRange());
1704 Record.AddVersionTuple(E->getVersion());
1706}
1707
1708//===----------------------------------------------------------------------===//
1709// C++ Expressions and Statements.
1710//===----------------------------------------------------------------------===//
1711
1712void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
1713 VisitStmt(S);
1714 Record.AddSourceLocation(S->getCatchLoc());
1715 Record.AddDeclRef(S->getExceptionDecl());
1716 Record.AddStmt(S->getHandlerBlock());
1718}
1719
1720void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
1721 VisitStmt(S);
1722 Record.push_back(S->getNumHandlers());
1723 Record.AddSourceLocation(S->getTryLoc());
1724 Record.AddStmt(S->getTryBlock());
1725 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1726 Record.AddStmt(S->getHandler(i));
1728}
1729
1730void ASTStmtWriter::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1731 VisitStmt(S);
1732 Record.AddSourceLocation(S->getForLoc());
1733 Record.AddSourceLocation(S->getCoawaitLoc());
1734 Record.AddSourceLocation(S->getColonLoc());
1735 Record.AddSourceLocation(S->getRParenLoc());
1736 Record.AddStmt(S->getInit());
1737 Record.AddStmt(S->getRangeStmt());
1738 Record.AddStmt(S->getBeginStmt());
1739 Record.AddStmt(S->getEndStmt());
1740 Record.AddStmt(S->getCond());
1741 Record.AddStmt(S->getInc());
1742 Record.AddStmt(S->getLoopVarStmt());
1743 Record.AddStmt(S->getBody());
1745}
1746
1747void ASTStmtWriter::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1748 VisitStmt(S);
1749 Record.AddSourceLocation(S->getKeywordLoc());
1750 Record.push_back(S->isIfExists());
1751 Record.AddNestedNameSpecifierLoc(S->getQualifierLoc());
1752 Record.AddDeclarationNameInfo(S->getNameInfo());
1753 Record.AddStmt(S->getSubStmt());
1755}
1756
1757void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1758 VisitCallExpr(E);
1759 Record.push_back(E->getOperator());
1760 Record.AddSourceLocation(E->BeginLoc);
1761
1762 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1763 !E->isCoroElideSafe() && !E->usesMemberSyntax())
1764 AbbrevToUse = Writer.getCXXOperatorCallExprAbbrev();
1765
1767}
1768
1769void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1770 VisitCallExpr(E);
1771
1772 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
1773 !E->isCoroElideSafe() && !E->usesMemberSyntax())
1774 AbbrevToUse = Writer.getCXXMemberCallExprAbbrev();
1775
1777}
1778
1779void ASTStmtWriter::VisitCXXRewrittenBinaryOperator(
1781 VisitExpr(E);
1782 Record.push_back(E->isReversed());
1783 Record.AddStmt(E->getSemanticForm());
1785}
1786
1787void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
1788 VisitExpr(E);
1789
1790 Record.push_back(E->getNumArgs());
1791 Record.push_back(E->isElidable());
1792 Record.push_back(E->hadMultipleCandidates());
1793 Record.push_back(E->isListInitialization());
1794 Record.push_back(E->isStdInitListInitialization());
1795 Record.push_back(E->requiresZeroInitialization());
1796 Record.push_back(
1797 llvm::to_underlying(E->getConstructionKind())); // FIXME: stable encoding
1798 Record.push_back(E->isImmediateEscalating());
1799 Record.AddSourceLocation(E->getLocation());
1800 Record.AddDeclRef(E->getConstructor());
1801 Record.AddSourceRange(E->getParenOrBraceRange());
1802
1803 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1804 Record.AddStmt(E->getArg(I));
1805
1807}
1808
1809void ASTStmtWriter::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1810 VisitExpr(E);
1811 Record.AddDeclRef(E->getConstructor());
1812 Record.AddSourceLocation(E->getLocation());
1813 Record.push_back(E->constructsVBase());
1814 Record.push_back(E->inheritedFromVBase());
1816}
1817
1818void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1819 VisitCXXConstructExpr(E);
1820 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1822}
1823
1824void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) {
1825 VisitExpr(E);
1826 Record.push_back(E->LambdaExprBits.NumCaptures);
1827 Record.AddSourceRange(E->IntroducerRange);
1828 Record.push_back(E->LambdaExprBits.CaptureDefault); // FIXME: stable encoding
1829 Record.AddSourceLocation(E->CaptureDefaultLoc);
1830 Record.push_back(E->LambdaExprBits.ExplicitParams);
1831 Record.push_back(E->LambdaExprBits.ExplicitResultType);
1832 Record.AddSourceLocation(E->ClosingBrace);
1833
1834 // Add capture initializers.
1836 CEnd = E->capture_init_end();
1837 C != CEnd; ++C) {
1838 Record.AddStmt(*C);
1839 }
1840
1841 // Don't serialize the body. It belongs to the call operator declaration.
1842 // LambdaExpr only stores a copy of the Stmt *.
1843
1845}
1846
1847void ASTStmtWriter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1848 VisitExpr(E);
1849 Record.AddStmt(E->getSubExpr());
1851}
1852
1853void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1854 VisitExplicitCastExpr(E);
1855 Record.AddSourceRange(SourceRange(E->getOperatorLoc(), E->getRParenLoc()));
1856 CurrentPackingBits.addBit(E->getAngleBrackets().isValid());
1857 if (E->getAngleBrackets().isValid())
1858 Record.AddSourceRange(E->getAngleBrackets());
1859}
1860
1861void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1862 VisitCXXNamedCastExpr(E);
1864}
1865
1866void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1867 VisitCXXNamedCastExpr(E);
1869}
1870
1871void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1872 VisitCXXNamedCastExpr(E);
1874}
1875
1876void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1877 VisitCXXNamedCastExpr(E);
1879}
1880
1881void ASTStmtWriter::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1882 VisitCXXNamedCastExpr(E);
1884}
1885
1886void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1887 VisitExplicitCastExpr(E);
1888 Record.AddSourceLocation(E->getLParenLoc());
1889 Record.AddSourceLocation(E->getRParenLoc());
1891}
1892
1893void ASTStmtWriter::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1894 VisitExplicitCastExpr(E);
1895 Record.AddSourceLocation(E->getBeginLoc());
1896 Record.AddSourceLocation(E->getEndLoc());
1898}
1899
1900void ASTStmtWriter::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1901 VisitCallExpr(E);
1902 Record.AddSourceLocation(E->UDSuffixLoc);
1904}
1905
1906void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1907 VisitExpr(E);
1908 Record.push_back(E->getValue());
1909 Record.AddSourceLocation(E->getLocation());
1911}
1912
1913void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1914 VisitExpr(E);
1915 Record.AddSourceLocation(E->getLocation());
1917}
1918
1919void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1920 VisitExpr(E);
1921 Record.AddSourceRange(E->getSourceRange());
1922 if (E->isTypeOperand()) {
1923 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
1925 } else {
1926 Record.AddStmt(E->getExprOperand());
1928 }
1929}
1930
1931void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
1932 VisitExpr(E);
1933 Record.AddSourceLocation(E->getLocation());
1934 Record.push_back(E->isImplicit());
1936
1938}
1939
1940void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
1941 VisitExpr(E);
1942 Record.AddSourceLocation(E->getThrowLoc());
1943 Record.AddStmt(E->getSubExpr());
1944 Record.push_back(E->isThrownVariableInScope());
1946}
1947
1948void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1949 VisitExpr(E);
1950 Record.AddDeclRef(E->getParam());
1951 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1952 Record.AddSourceLocation(E->getUsedLocation());
1953 Record.push_back(E->hasRewrittenInit());
1954 if (E->hasRewrittenInit())
1955 Record.AddStmt(E->getRewrittenExpr());
1957}
1958
1959void ASTStmtWriter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1960 VisitExpr(E);
1961 Record.push_back(E->hasRewrittenInit());
1962 Record.AddDeclRef(E->getField());
1963 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1964 Record.AddSourceLocation(E->getExprLoc());
1965 if (E->hasRewrittenInit())
1966 Record.AddStmt(E->getRewrittenExpr());
1968}
1969
1970void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1971 VisitExpr(E);
1972 Record.AddCXXTemporary(E->getTemporary());
1973 Record.AddStmt(E->getSubExpr());
1975}
1976
1977void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1978 VisitExpr(E);
1979 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
1980 Record.AddSourceLocation(E->getRParenLoc());
1982}
1983
1984void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
1985 VisitExpr(E);
1986
1987 Record.push_back(E->isArray());
1988 Record.push_back(E->hasInitializer());
1989 Record.push_back(E->getNumPlacementArgs());
1990 Record.push_back(E->isParenTypeId());
1991
1992 Record.push_back(E->isGlobalNew());
1993 ImplicitAllocationParameters IAP = E->implicitAllocationParameters();
1994 Record.push_back(isAlignedAllocation(IAP.PassAlignment));
1995 Record.push_back(isTypeAwareAllocation(IAP.PassTypeIdentity));
1996 Record.push_back(E->doesUsualArrayDeleteWantSize());
1997 Record.push_back(E->CXXNewExprBits.HasInitializer);
1998 Record.push_back(E->CXXNewExprBits.StoredInitializationStyle);
1999
2000 Record.AddDeclRef(E->getOperatorNew());
2001 Record.AddDeclRef(E->getOperatorDelete());
2002 Record.AddTypeSourceInfo(E->getAllocatedTypeSourceInfo());
2003 if (E->isParenTypeId())
2004 Record.AddSourceRange(E->getTypeIdParens());
2005 Record.AddSourceRange(E->getSourceRange());
2006 Record.AddSourceRange(E->getDirectInitRange());
2007
2008 for (CXXNewExpr::arg_iterator I = E->raw_arg_begin(), N = E->raw_arg_end();
2009 I != N; ++I)
2010 Record.AddStmt(*I);
2011
2013}
2014
2015void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
2016 VisitExpr(E);
2017 Record.push_back(E->isGlobalDelete());
2018 Record.push_back(E->isArrayForm());
2019 Record.push_back(E->isArrayFormAsWritten());
2020 Record.push_back(E->doesUsualArrayDeleteWantSize());
2021 Record.AddDeclRef(E->getOperatorDelete());
2022 Record.AddStmt(E->getArgument());
2023 Record.AddSourceLocation(E->getBeginLoc());
2024
2026}
2027
2028void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
2029 VisitExpr(E);
2030
2031 Record.AddStmt(E->getBase());
2032 Record.push_back(E->isArrow());
2033 Record.AddSourceLocation(E->getOperatorLoc());
2034 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2035 Record.AddTypeSourceInfo(E->getScopeTypeInfo());
2036 Record.AddSourceLocation(E->getColonColonLoc());
2037 Record.AddSourceLocation(E->getTildeLoc());
2038
2039 // PseudoDestructorTypeStorage.
2040 Record.AddIdentifierRef(E->getDestroyedTypeIdentifier());
2042 Record.AddSourceLocation(E->getDestroyedTypeLoc());
2043 else
2044 Record.AddTypeSourceInfo(E->getDestroyedTypeInfo());
2045
2047}
2048
2049void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) {
2050 VisitExpr(E);
2051 Record.push_back(E->getNumObjects());
2052 for (auto &Obj : E->getObjects()) {
2053 if (auto *BD = Obj.dyn_cast<BlockDecl *>()) {
2054 Record.push_back(serialization::COK_Block);
2055 Record.AddDeclRef(BD);
2056 } else if (auto *CLE = Obj.dyn_cast<CompoundLiteralExpr *>()) {
2057 Record.push_back(serialization::COK_CompoundLiteral);
2058 Record.AddStmt(CLE);
2059 }
2060 }
2061
2062 Record.push_back(E->cleanupsHaveSideEffects());
2063 Record.AddStmt(E->getSubExpr());
2065}
2066
2067void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
2069 VisitExpr(E);
2070
2071 // Don't emit anything here (or if you do you will have to update
2072 // the corresponding deserialization function).
2073 Record.push_back(E->getNumTemplateArgs());
2074 CurrentPackingBits.updateBits();
2075 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2076 CurrentPackingBits.addBit(E->hasFirstQualifierFoundInScope());
2077
2078 if (E->hasTemplateKWAndArgsInfo()) {
2079 const ASTTemplateKWAndArgsInfo &ArgInfo =
2080 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2082 E->getTrailingObjects<TemplateArgumentLoc>());
2083 }
2084
2085 CurrentPackingBits.addBit(E->isArrow());
2086
2087 Record.AddTypeRef(E->getBaseType());
2088 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2089 CurrentPackingBits.addBit(!E->isImplicitAccess());
2090 if (!E->isImplicitAccess())
2091 Record.AddStmt(E->getBase());
2092
2093 Record.AddSourceLocation(E->getOperatorLoc());
2094
2095 if (E->hasFirstQualifierFoundInScope())
2096 Record.AddDeclRef(E->getFirstQualifierFoundInScope());
2097
2098 Record.AddDeclarationNameInfo(E->MemberNameInfo);
2100}
2101
2102void
2103ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2104 VisitExpr(E);
2105
2106 // Don't emit anything here, HasTemplateKWAndArgsInfo must be
2107 // emitted first.
2108 CurrentPackingBits.addBit(
2109 E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
2110
2111 if (E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo) {
2112 const ASTTemplateKWAndArgsInfo &ArgInfo =
2113 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2114 // 16 bits should be enought to store the number of args
2115 CurrentPackingBits.addBits(ArgInfo.NumTemplateArgs, /*Width=*/16);
2117 E->getTrailingObjects<TemplateArgumentLoc>());
2118 }
2119
2120 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2121 Record.AddDeclarationNameInfo(E->NameInfo);
2123}
2124
2125void
2126ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2127 VisitExpr(E);
2128 Record.push_back(E->getNumArgs());
2130 ArgI = E->arg_begin(), ArgE = E->arg_end(); ArgI != ArgE; ++ArgI)
2131 Record.AddStmt(*ArgI);
2132 Record.AddTypeSourceInfo(E->getTypeSourceInfo());
2133 Record.AddSourceLocation(E->getLParenLoc());
2134 Record.AddSourceLocation(E->getRParenLoc());
2135 Record.push_back(E->isListInitialization());
2137}
2138
2139void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
2140 VisitExpr(E);
2141
2142 Record.push_back(E->getNumDecls());
2143
2144 CurrentPackingBits.updateBits();
2145 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2146 if (E->hasTemplateKWAndArgsInfo()) {
2147 const ASTTemplateKWAndArgsInfo &ArgInfo =
2149 Record.push_back(ArgInfo.NumTemplateArgs);
2151 }
2152
2154 OvE = E->decls_end();
2155 OvI != OvE; ++OvI) {
2156 Record.AddDeclRef(OvI.getDecl());
2157 Record.push_back(OvI.getAccess());
2158 }
2159
2160 Record.AddDeclarationNameInfo(E->getNameInfo());
2161 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2162}
2163
2164void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2165 VisitOverloadExpr(E);
2166 CurrentPackingBits.addBit(E->isArrow());
2167 CurrentPackingBits.addBit(E->hasUnresolvedUsing());
2168 CurrentPackingBits.addBit(!E->isImplicitAccess());
2169 if (!E->isImplicitAccess())
2170 Record.AddStmt(E->getBase());
2171
2172 Record.AddSourceLocation(E->getOperatorLoc());
2173
2174 Record.AddTypeRef(E->getBaseType());
2176}
2177
2178void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2179 VisitOverloadExpr(E);
2180 CurrentPackingBits.addBit(E->requiresADL());
2181 Record.AddDeclRef(E->getNamingClass());
2183
2184 if (Writer.isWritingStdCXXNamedModules() && Writer.getChain()) {
2185 // Referencing all the possible declarations to make sure the change get
2186 // propagted.
2187 DeclarationName Name = E->getName();
2188 for (auto *Found :
2189 Record.getASTContext().getTranslationUnitDecl()->lookup(Name))
2190 if (Found->isFromASTFile())
2191 Writer.GetDeclRef(Found);
2192
2193 llvm::SmallVector<NamespaceDecl *> ExternalNSs;
2194 Writer.getChain()->ReadKnownNamespaces(ExternalNSs);
2195 for (auto *NS : ExternalNSs)
2196 for (auto *Found : NS->lookup(Name))
2197 Writer.GetDeclRef(Found);
2198 }
2199}
2200
2201void ASTStmtWriter::VisitTypeTraitExpr(TypeTraitExpr *E) {
2202 VisitExpr(E);
2203 Record.push_back(E->TypeTraitExprBits.IsBooleanTypeTrait);
2204 Record.push_back(E->TypeTraitExprBits.NumArgs);
2205 Record.push_back(E->TypeTraitExprBits.Kind); // FIXME: Stable encoding
2206
2207 if (E->TypeTraitExprBits.IsBooleanTypeTrait)
2208 Record.push_back(E->TypeTraitExprBits.Value);
2209 else
2210 Record.AddAPValue(E->getAPValue());
2211
2212 Record.AddSourceRange(E->getSourceRange());
2213 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2214 Record.AddTypeSourceInfo(E->getArg(I));
2216}
2217
2218void ASTStmtWriter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2219 VisitExpr(E);
2220 Record.push_back(E->getTrait());
2221 Record.push_back(E->getValue());
2222 Record.AddSourceRange(E->getSourceRange());
2223 Record.AddTypeSourceInfo(E->getQueriedTypeSourceInfo());
2224 Record.AddStmt(E->getDimensionExpression());
2226}
2227
2228void ASTStmtWriter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2229 VisitExpr(E);
2230 Record.push_back(E->getTrait());
2231 Record.push_back(E->getValue());
2232 Record.AddSourceRange(E->getSourceRange());
2233 Record.AddStmt(E->getQueriedExpression());
2235}
2236
2237void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2238 VisitExpr(E);
2239 Record.push_back(E->getValue());
2240 Record.AddSourceRange(E->getSourceRange());
2241 Record.AddStmt(E->getOperand());
2243}
2244
2245void ASTStmtWriter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2246 VisitExpr(E);
2247 Record.AddSourceLocation(E->getEllipsisLoc());
2248 Record.push_back(E->NumExpansions);
2249 Record.AddStmt(E->getPattern());
2251}
2252
2253void ASTStmtWriter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2254 VisitExpr(E);
2255 Record.push_back(E->isPartiallySubstituted() ? E->getPartialArguments().size()
2256 : 0);
2257 Record.AddSourceLocation(E->OperatorLoc);
2258 Record.AddSourceLocation(E->PackLoc);
2259 Record.AddSourceLocation(E->RParenLoc);
2260 Record.AddDeclRef(E->Pack);
2261 if (E->isPartiallySubstituted()) {
2262 for (const auto &TA : E->getPartialArguments())
2263 Record.AddTemplateArgument(TA);
2264 } else if (!E->isValueDependent()) {
2265 Record.push_back(E->getPackLength());
2266 }
2268}
2269
2270void ASTStmtWriter::VisitPackIndexingExpr(PackIndexingExpr *E) {
2271 VisitExpr(E);
2272 Record.push_back(E->PackIndexingExprBits.TransformedExpressions);
2273 Record.push_back(E->PackIndexingExprBits.FullySubstituted);
2274 Record.AddSourceLocation(E->getEllipsisLoc());
2275 Record.AddSourceLocation(E->getRSquareLoc());
2276 Record.AddStmt(E->getPackIdExpression());
2277 Record.AddStmt(E->getIndexExpr());
2278 for (Expr *Sub : E->getExpressions())
2279 Record.AddStmt(Sub);
2281}
2282
2283void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
2285 VisitExpr(E);
2286 Record.AddDeclRef(E->getAssociatedDecl());
2287 CurrentPackingBits.addBit(E->isReferenceParameter());
2288 CurrentPackingBits.addBits(E->getIndex(), /*Width=*/12);
2289 Record.writeUnsignedOrNone(E->getPackIndex());
2290 CurrentPackingBits.addBit(E->getFinal());
2291
2292 Record.AddSourceLocation(E->getNameLoc());
2293 Record.AddStmt(E->getReplacement());
2295}
2296
2297void ASTStmtWriter::VisitSubstNonTypeTemplateParmPackExpr(
2299 VisitExpr(E);
2300 Record.AddDeclRef(E->getAssociatedDecl());
2301 CurrentPackingBits.addBit(E->getFinal());
2302 Record.push_back(E->getIndex());
2303 Record.AddTemplateArgument(E->getArgumentPack());
2304 Record.AddSourceLocation(E->getParameterPackLocation());
2306}
2307
2308void ASTStmtWriter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2309 VisitExpr(E);
2310 Record.push_back(E->getNumExpansions());
2311 Record.AddDeclRef(E->getParameterPack());
2312 Record.AddSourceLocation(E->getParameterPackLocation());
2313 for (FunctionParmPackExpr::iterator I = E->begin(), End = E->end();
2314 I != End; ++I)
2315 Record.AddDeclRef(*I);
2317}
2318
2319void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2320 VisitExpr(E);
2321 Record.push_back(static_cast<bool>(E->getLifetimeExtendedTemporaryDecl()));
2323 Record.AddDeclRef(E->getLifetimeExtendedTemporaryDecl());
2324 else
2325 Record.AddStmt(E->getSubExpr());
2327}
2328
2329void ASTStmtWriter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2330 VisitExpr(E);
2331 Record.AddSourceLocation(E->LParenLoc);
2332 Record.AddSourceLocation(E->EllipsisLoc);
2333 Record.AddSourceLocation(E->RParenLoc);
2334 Record.push_back(E->NumExpansions.toInternalRepresentation());
2335 Record.AddStmt(E->SubExprs[0]);
2336 Record.AddStmt(E->SubExprs[1]);
2337 Record.AddStmt(E->SubExprs[2]);
2338 Record.push_back(E->CXXFoldExprBits.Opcode);
2340}
2341
2342void ASTStmtWriter::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2343 VisitExpr(E);
2344 ArrayRef<Expr *> InitExprs = E->getInitExprs();
2345 Record.push_back(InitExprs.size());
2346 Record.push_back(E->getUserSpecifiedInitExprs().size());
2347 Record.AddSourceLocation(E->getInitLoc());
2348 Record.AddSourceLocation(E->getBeginLoc());
2349 Record.AddSourceLocation(E->getEndLoc());
2350 for (Expr *InitExpr : E->getInitExprs())
2351 Record.AddStmt(InitExpr);
2352 Expr *ArrayFiller = E->getArrayFiller();
2353 FieldDecl *UnionField = E->getInitializedFieldInUnion();
2354 bool HasArrayFillerOrUnionDecl = ArrayFiller || UnionField;
2355 Record.push_back(HasArrayFillerOrUnionDecl);
2356 if (HasArrayFillerOrUnionDecl) {
2357 Record.push_back(static_cast<bool>(ArrayFiller));
2358 if (ArrayFiller)
2359 Record.AddStmt(ArrayFiller);
2360 else
2361 Record.AddDeclRef(UnionField);
2362 }
2364}
2365
2366void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2367 VisitExpr(E);
2368 Record.AddStmt(E->getSourceExpr());
2369 Record.AddSourceLocation(E->getLocation());
2370 Record.push_back(E->isUnique());
2372}
2373
2374//===----------------------------------------------------------------------===//
2375// CUDA Expressions and Statements.
2376//===----------------------------------------------------------------------===//
2377
2378void ASTStmtWriter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2379 VisitCallExpr(E);
2380 Record.AddStmt(E->getConfig());
2382}
2383
2384//===----------------------------------------------------------------------===//
2385// OpenCL Expressions and Statements.
2386//===----------------------------------------------------------------------===//
2387void ASTStmtWriter::VisitAsTypeExpr(AsTypeExpr *E) {
2388 VisitExpr(E);
2389 Record.AddSourceLocation(E->getBuiltinLoc());
2390 Record.AddSourceLocation(E->getRParenLoc());
2391 Record.AddStmt(E->getSrcExpr());
2393}
2394
2395//===----------------------------------------------------------------------===//
2396// Microsoft Expressions and Statements.
2397//===----------------------------------------------------------------------===//
2398void ASTStmtWriter::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2399 VisitExpr(E);
2400 Record.push_back(E->isArrow());
2401 Record.AddStmt(E->getBaseExpr());
2402 Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
2403 Record.AddSourceLocation(E->getMemberLoc());
2404 Record.AddDeclRef(E->getPropertyDecl());
2406}
2407
2408void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2409 VisitExpr(E);
2410 Record.AddStmt(E->getBase());
2411 Record.AddStmt(E->getIdx());
2412 Record.AddSourceLocation(E->getRBracketLoc());
2414}
2415
2416void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2417 VisitExpr(E);
2418 Record.AddSourceRange(E->getSourceRange());
2419 Record.AddDeclRef(E->getGuidDecl());
2420 if (E->isTypeOperand()) {
2421 Record.AddTypeSourceInfo(E->getTypeOperandSourceInfo());
2423 } else {
2424 Record.AddStmt(E->getExprOperand());
2426 }
2427}
2428
2429void ASTStmtWriter::VisitSEHExceptStmt(SEHExceptStmt *S) {
2430 VisitStmt(S);
2431 Record.AddSourceLocation(S->getExceptLoc());
2432 Record.AddStmt(S->getFilterExpr());
2433 Record.AddStmt(S->getBlock());
2435}
2436
2437void ASTStmtWriter::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2438 VisitStmt(S);
2439 Record.AddSourceLocation(S->getFinallyLoc());
2440 Record.AddStmt(S->getBlock());
2442}
2443
2444void ASTStmtWriter::VisitSEHTryStmt(SEHTryStmt *S) {
2445 VisitStmt(S);
2446 Record.push_back(S->getIsCXXTry());
2447 Record.AddSourceLocation(S->getTryLoc());
2448 Record.AddStmt(S->getTryBlock());
2449 Record.AddStmt(S->getHandler());
2451}
2452
2453void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2454 VisitStmt(S);
2455 Record.AddSourceLocation(S->getLeaveLoc());
2457}
2458
2459//===----------------------------------------------------------------------===//
2460// OpenMP Directives.
2461//===----------------------------------------------------------------------===//
2462
2463void ASTStmtWriter::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2464 VisitStmt(S);
2465 for (Stmt *SubStmt : S->SubStmts)
2466 Record.AddStmt(SubStmt);
2468}
2469
2470void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2471 Record.writeOMPChildren(E->Data);
2472 Record.AddSourceLocation(E->getBeginLoc());
2473 Record.AddSourceLocation(E->getEndLoc());
2474}
2475
2476void ASTStmtWriter::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2477 VisitStmt(D);
2478 Record.writeUInt32(D->getLoopsNumber());
2479 VisitOMPExecutableDirective(D);
2480}
2481
2482void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) {
2483 VisitOMPLoopBasedDirective(D);
2484}
2485
2486void ASTStmtWriter::VisitOMPMetaDirective(OMPMetaDirective *D) {
2487 VisitStmt(D);
2488 Record.push_back(D->getNumClauses());
2489 VisitOMPExecutableDirective(D);
2491}
2492
2493void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) {
2494 VisitStmt(D);
2495 VisitOMPExecutableDirective(D);
2496 Record.writeBool(D->hasCancel());
2498}
2499
2500void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) {
2501 VisitOMPLoopDirective(D);
2503}
2504
2505void ASTStmtWriter::VisitOMPCanonicalLoopNestTransformationDirective(
2506 OMPCanonicalLoopNestTransformationDirective *D) {
2507 VisitOMPLoopBasedDirective(D);
2508 Record.writeUInt32(D->getNumGeneratedTopLevelLoops());
2509}
2510
2511void ASTStmtWriter::VisitOMPTileDirective(OMPTileDirective *D) {
2512 VisitOMPCanonicalLoopNestTransformationDirective(D);
2514}
2515
2516void ASTStmtWriter::VisitOMPStripeDirective(OMPStripeDirective *D) {
2517 VisitOMPCanonicalLoopNestTransformationDirective(D);
2519}
2520
2521void ASTStmtWriter::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2522 VisitOMPCanonicalLoopNestTransformationDirective(D);
2524}
2525
2526void ASTStmtWriter::VisitOMPReverseDirective(OMPReverseDirective *D) {
2527 VisitOMPCanonicalLoopNestTransformationDirective(D);
2529}
2530
2531void ASTStmtWriter::VisitOMPInterchangeDirective(OMPInterchangeDirective *D) {
2532 VisitOMPCanonicalLoopNestTransformationDirective(D);
2534}
2535
2536void ASTStmtWriter::VisitOMPCanonicalLoopSequenceTransformationDirective(
2537 OMPCanonicalLoopSequenceTransformationDirective *D) {
2538 VisitStmt(D);
2539 VisitOMPExecutableDirective(D);
2540 Record.writeUInt32(D->getNumGeneratedTopLevelLoops());
2541}
2542
2543void ASTStmtWriter::VisitOMPFuseDirective(OMPFuseDirective *D) {
2544 VisitOMPCanonicalLoopSequenceTransformationDirective(D);
2546}
2547
2548void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) {
2549 VisitOMPLoopDirective(D);
2550 Record.writeBool(D->hasCancel());
2552}
2553
2554void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2555 VisitOMPLoopDirective(D);
2557}
2558
2559void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2560 VisitStmt(D);
2561 VisitOMPExecutableDirective(D);
2562 Record.writeBool(D->hasCancel());
2564}
2565
2566void ASTStmtWriter::VisitOMPSectionDirective(OMPSectionDirective *D) {
2567 VisitStmt(D);
2568 VisitOMPExecutableDirective(D);
2569 Record.writeBool(D->hasCancel());
2571}
2572
2573void ASTStmtWriter::VisitOMPScopeDirective(OMPScopeDirective *D) {
2574 VisitStmt(D);
2575 VisitOMPExecutableDirective(D);
2577}
2578
2579void ASTStmtWriter::VisitOMPSingleDirective(OMPSingleDirective *D) {
2580 VisitStmt(D);
2581 VisitOMPExecutableDirective(D);
2583}
2584
2585void ASTStmtWriter::VisitOMPMasterDirective(OMPMasterDirective *D) {
2586 VisitStmt(D);
2587 VisitOMPExecutableDirective(D);
2589}
2590
2591void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2592 VisitStmt(D);
2593 VisitOMPExecutableDirective(D);
2594 Record.AddDeclarationNameInfo(D->getDirectiveName());
2596}
2597
2598void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2599 VisitOMPLoopDirective(D);
2600 Record.writeBool(D->hasCancel());
2602}
2603
2604void ASTStmtWriter::VisitOMPParallelForSimdDirective(
2605 OMPParallelForSimdDirective *D) {
2606 VisitOMPLoopDirective(D);
2608}
2609
2610void ASTStmtWriter::VisitOMPParallelMasterDirective(
2611 OMPParallelMasterDirective *D) {
2612 VisitStmt(D);
2613 VisitOMPExecutableDirective(D);
2615}
2616
2617void ASTStmtWriter::VisitOMPParallelMaskedDirective(
2618 OMPParallelMaskedDirective *D) {
2619 VisitStmt(D);
2620 VisitOMPExecutableDirective(D);
2622}
2623
2624void ASTStmtWriter::VisitOMPParallelSectionsDirective(
2625 OMPParallelSectionsDirective *D) {
2626 VisitStmt(D);
2627 VisitOMPExecutableDirective(D);
2628 Record.writeBool(D->hasCancel());
2630}
2631
2632void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) {
2633 VisitStmt(D);
2634 VisitOMPExecutableDirective(D);
2635 Record.writeBool(D->hasCancel());
2637}
2638
2639void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2640 VisitStmt(D);
2641 VisitOMPExecutableDirective(D);
2642 Record.writeBool(D->isXLHSInRHSPart());
2643 Record.writeBool(D->isPostfixUpdate());
2644 Record.writeBool(D->isFailOnly());
2646}
2647
2648void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) {
2649 VisitStmt(D);
2650 VisitOMPExecutableDirective(D);
2652}
2653
2654void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2655 VisitStmt(D);
2656 VisitOMPExecutableDirective(D);
2658}
2659
2660void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
2661 OMPTargetEnterDataDirective *D) {
2662 VisitStmt(D);
2663 VisitOMPExecutableDirective(D);
2665}
2666
2667void ASTStmtWriter::VisitOMPTargetExitDataDirective(
2668 OMPTargetExitDataDirective *D) {
2669 VisitStmt(D);
2670 VisitOMPExecutableDirective(D);
2672}
2673
2674void ASTStmtWriter::VisitOMPTargetParallelDirective(
2675 OMPTargetParallelDirective *D) {
2676 VisitStmt(D);
2677 VisitOMPExecutableDirective(D);
2678 Record.writeBool(D->hasCancel());
2680}
2681
2682void ASTStmtWriter::VisitOMPTargetParallelForDirective(
2683 OMPTargetParallelForDirective *D) {
2684 VisitOMPLoopDirective(D);
2685 Record.writeBool(D->hasCancel());
2687}
2688
2689void ASTStmtWriter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2690 VisitStmt(D);
2691 VisitOMPExecutableDirective(D);
2693}
2694
2695void ASTStmtWriter::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2696 VisitStmt(D);
2697 VisitOMPExecutableDirective(D);
2699}
2700
2701void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2702 VisitStmt(D);
2703 Record.push_back(D->getNumClauses());
2704 VisitOMPExecutableDirective(D);
2706}
2707
2708void ASTStmtWriter::VisitOMPAssumeDirective(OMPAssumeDirective *D) {
2709 VisitStmt(D);
2710 VisitOMPExecutableDirective(D);
2712}
2713
2714void ASTStmtWriter::VisitOMPErrorDirective(OMPErrorDirective *D) {
2715 VisitStmt(D);
2716 Record.push_back(D->getNumClauses());
2717 VisitOMPExecutableDirective(D);
2719}
2720
2721void ASTStmtWriter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2722 VisitStmt(D);
2723 VisitOMPExecutableDirective(D);
2725}
2726
2727void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) {
2728 VisitStmt(D);
2729 VisitOMPExecutableDirective(D);
2731}
2732
2733void ASTStmtWriter::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2734 VisitStmt(D);
2735 VisitOMPExecutableDirective(D);
2737}
2738
2739void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
2740 VisitStmt(D);
2741 VisitOMPExecutableDirective(D);
2743}
2744
2745void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2746 VisitStmt(D);
2747 VisitOMPExecutableDirective(D);
2749}
2750
2751void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2752 VisitStmt(D);
2753 VisitOMPExecutableDirective(D);
2755}
2756
2757void ASTStmtWriter::VisitOMPCancellationPointDirective(
2758 OMPCancellationPointDirective *D) {
2759 VisitStmt(D);
2760 VisitOMPExecutableDirective(D);
2761 Record.writeEnum(D->getCancelRegion());
2763}
2764
2765void ASTStmtWriter::VisitOMPCancelDirective(OMPCancelDirective *D) {
2766 VisitStmt(D);
2767 VisitOMPExecutableDirective(D);
2768 Record.writeEnum(D->getCancelRegion());
2770}
2771
2772void ASTStmtWriter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2773 VisitOMPLoopDirective(D);
2774 Record.writeBool(D->hasCancel());
2776}
2777
2778void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2779 VisitOMPLoopDirective(D);
2781}
2782
2783void ASTStmtWriter::VisitOMPMasterTaskLoopDirective(
2784 OMPMasterTaskLoopDirective *D) {
2785 VisitOMPLoopDirective(D);
2786 Record.writeBool(D->hasCancel());
2788}
2789
2790void ASTStmtWriter::VisitOMPMaskedTaskLoopDirective(
2791 OMPMaskedTaskLoopDirective *D) {
2792 VisitOMPLoopDirective(D);
2793 Record.writeBool(D->hasCancel());
2795}
2796
2797void ASTStmtWriter::VisitOMPMasterTaskLoopSimdDirective(
2798 OMPMasterTaskLoopSimdDirective *D) {
2799 VisitOMPLoopDirective(D);
2801}
2802
2803void ASTStmtWriter::VisitOMPMaskedTaskLoopSimdDirective(
2804 OMPMaskedTaskLoopSimdDirective *D) {
2805 VisitOMPLoopDirective(D);
2807}
2808
2809void ASTStmtWriter::VisitOMPParallelMasterTaskLoopDirective(
2810 OMPParallelMasterTaskLoopDirective *D) {
2811 VisitOMPLoopDirective(D);
2812 Record.writeBool(D->hasCancel());
2814}
2815
2816void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopDirective(
2817 OMPParallelMaskedTaskLoopDirective *D) {
2818 VisitOMPLoopDirective(D);
2819 Record.writeBool(D->hasCancel());
2821}
2822
2823void ASTStmtWriter::VisitOMPParallelMasterTaskLoopSimdDirective(
2824 OMPParallelMasterTaskLoopSimdDirective *D) {
2825 VisitOMPLoopDirective(D);
2827}
2828
2829void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopSimdDirective(
2830 OMPParallelMaskedTaskLoopSimdDirective *D) {
2831 VisitOMPLoopDirective(D);
2833}
2834
2835void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2836 VisitOMPLoopDirective(D);
2838}
2839
2840void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2841 VisitStmt(D);
2842 VisitOMPExecutableDirective(D);
2844}
2845
2846void ASTStmtWriter::VisitOMPDistributeParallelForDirective(
2847 OMPDistributeParallelForDirective *D) {
2848 VisitOMPLoopDirective(D);
2849 Record.writeBool(D->hasCancel());
2851}
2852
2853void ASTStmtWriter::VisitOMPDistributeParallelForSimdDirective(
2854 OMPDistributeParallelForSimdDirective *D) {
2855 VisitOMPLoopDirective(D);
2857}
2858
2859void ASTStmtWriter::VisitOMPDistributeSimdDirective(
2860 OMPDistributeSimdDirective *D) {
2861 VisitOMPLoopDirective(D);
2863}
2864
2865void ASTStmtWriter::VisitOMPTargetParallelForSimdDirective(
2866 OMPTargetParallelForSimdDirective *D) {
2867 VisitOMPLoopDirective(D);
2869}
2870
2871void ASTStmtWriter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2872 VisitOMPLoopDirective(D);
2874}
2875
2876void ASTStmtWriter::VisitOMPTeamsDistributeDirective(
2877 OMPTeamsDistributeDirective *D) {
2878 VisitOMPLoopDirective(D);
2880}
2881
2882void ASTStmtWriter::VisitOMPTeamsDistributeSimdDirective(
2883 OMPTeamsDistributeSimdDirective *D) {
2884 VisitOMPLoopDirective(D);
2886}
2887
2888void ASTStmtWriter::VisitOMPTeamsDistributeParallelForSimdDirective(
2889 OMPTeamsDistributeParallelForSimdDirective *D) {
2890 VisitOMPLoopDirective(D);
2892}
2893
2894void ASTStmtWriter::VisitOMPTeamsDistributeParallelForDirective(
2895 OMPTeamsDistributeParallelForDirective *D) {
2896 VisitOMPLoopDirective(D);
2897 Record.writeBool(D->hasCancel());
2899}
2900
2901void ASTStmtWriter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2902 VisitStmt(D);
2903 VisitOMPExecutableDirective(D);
2905}
2906
2907void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective(
2908 OMPTargetTeamsDistributeDirective *D) {
2909 VisitOMPLoopDirective(D);
2911}
2912
2913void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective(
2914 OMPTargetTeamsDistributeParallelForDirective *D) {
2915 VisitOMPLoopDirective(D);
2916 Record.writeBool(D->hasCancel());
2918}
2919
2920void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2921 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
2922 VisitOMPLoopDirective(D);
2923 Code = serialization::
2924 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE;
2925}
2926
2927void ASTStmtWriter::VisitOMPTargetTeamsDistributeSimdDirective(
2928 OMPTargetTeamsDistributeSimdDirective *D) {
2929 VisitOMPLoopDirective(D);
2931}
2932
2933void ASTStmtWriter::VisitOMPInteropDirective(OMPInteropDirective *D) {
2934 VisitStmt(D);
2935 VisitOMPExecutableDirective(D);
2937}
2938
2939void ASTStmtWriter::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2940 VisitStmt(D);
2941 VisitOMPExecutableDirective(D);
2942 Record.AddSourceLocation(D->getTargetCallLoc());
2944}
2945
2946void ASTStmtWriter::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2947 VisitStmt(D);
2948 VisitOMPExecutableDirective(D);
2950}
2951
2952void ASTStmtWriter::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2953 VisitOMPLoopDirective(D);
2955}
2956
2957void ASTStmtWriter::VisitOMPTeamsGenericLoopDirective(
2958 OMPTeamsGenericLoopDirective *D) {
2959 VisitOMPLoopDirective(D);
2961}
2962
2963void ASTStmtWriter::VisitOMPTargetTeamsGenericLoopDirective(
2964 OMPTargetTeamsGenericLoopDirective *D) {
2965 VisitOMPLoopDirective(D);
2966 Record.writeBool(D->canBeParallelFor());
2968}
2969
2970void ASTStmtWriter::VisitOMPParallelGenericLoopDirective(
2971 OMPParallelGenericLoopDirective *D) {
2972 VisitOMPLoopDirective(D);
2974}
2975
2976void ASTStmtWriter::VisitOMPTargetParallelGenericLoopDirective(
2977 OMPTargetParallelGenericLoopDirective *D) {
2978 VisitOMPLoopDirective(D);
2980}
2981
2982//===----------------------------------------------------------------------===//
2983// OpenACC Constructs/Directives.
2984//===----------------------------------------------------------------------===//
2985void ASTStmtWriter::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2986 Record.push_back(S->clauses().size());
2987 Record.writeEnum(S->Kind);
2988 Record.AddSourceRange(S->Range);
2989 Record.AddSourceLocation(S->DirectiveLoc);
2990 Record.writeOpenACCClauseList(S->clauses());
2991}
2992
2993void ASTStmtWriter::VisitOpenACCAssociatedStmtConstruct(
2995 VisitOpenACCConstructStmt(S);
2996 Record.AddStmt(S->getAssociatedStmt());
2997}
2998
2999void ASTStmtWriter::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
3000 VisitStmt(S);
3001 VisitOpenACCAssociatedStmtConstruct(S);
3003}
3004
3005void ASTStmtWriter::VisitOpenACCLoopConstruct(OpenACCLoopConstruct *S) {
3006 VisitStmt(S);
3007 VisitOpenACCAssociatedStmtConstruct(S);
3008 Record.writeEnum(S->getParentComputeConstructKind());
3010}
3011
3012void ASTStmtWriter::VisitOpenACCCombinedConstruct(OpenACCCombinedConstruct *S) {
3013 VisitStmt(S);
3014 VisitOpenACCAssociatedStmtConstruct(S);
3016}
3017
3018void ASTStmtWriter::VisitOpenACCDataConstruct(OpenACCDataConstruct *S) {
3019 VisitStmt(S);
3020 VisitOpenACCAssociatedStmtConstruct(S);
3022}
3023
3024void ASTStmtWriter::VisitOpenACCEnterDataConstruct(
3025 OpenACCEnterDataConstruct *S) {
3026 VisitStmt(S);
3027 VisitOpenACCConstructStmt(S);
3029}
3030
3031void ASTStmtWriter::VisitOpenACCExitDataConstruct(OpenACCExitDataConstruct *S) {
3032 VisitStmt(S);
3033 VisitOpenACCConstructStmt(S);
3035}
3036
3037void ASTStmtWriter::VisitOpenACCInitConstruct(OpenACCInitConstruct *S) {
3038 VisitStmt(S);
3039 VisitOpenACCConstructStmt(S);
3041}
3042
3043void ASTStmtWriter::VisitOpenACCShutdownConstruct(OpenACCShutdownConstruct *S) {
3044 VisitStmt(S);
3045 VisitOpenACCConstructStmt(S);
3047}
3048
3049void ASTStmtWriter::VisitOpenACCSetConstruct(OpenACCSetConstruct *S) {
3050 VisitStmt(S);
3051 VisitOpenACCConstructStmt(S);
3053}
3054
3055void ASTStmtWriter::VisitOpenACCUpdateConstruct(OpenACCUpdateConstruct *S) {
3056 VisitStmt(S);
3057 VisitOpenACCConstructStmt(S);
3059}
3060
3061void ASTStmtWriter::VisitOpenACCHostDataConstruct(OpenACCHostDataConstruct *S) {
3062 VisitStmt(S);
3063 VisitOpenACCAssociatedStmtConstruct(S);
3065}
3066
3067void ASTStmtWriter::VisitOpenACCWaitConstruct(OpenACCWaitConstruct *S) {
3068 VisitStmt(S);
3069 Record.push_back(S->getExprs().size());
3070 VisitOpenACCConstructStmt(S);
3071 Record.AddSourceLocation(S->LParenLoc);
3072 Record.AddSourceLocation(S->RParenLoc);
3073 Record.AddSourceLocation(S->QueuesLoc);
3074
3075 for(Expr *E : S->getExprs())
3076 Record.AddStmt(E);
3077
3079}
3080
3081void ASTStmtWriter::VisitOpenACCAtomicConstruct(OpenACCAtomicConstruct *S) {
3082 VisitStmt(S);
3083 VisitOpenACCConstructStmt(S);
3084 Record.writeEnum(S->getAtomicKind());
3085 Record.AddStmt(S->getAssociatedStmt());
3086
3088}
3089
3090void ASTStmtWriter::VisitOpenACCCacheConstruct(OpenACCCacheConstruct *S) {
3091 VisitStmt(S);
3092 Record.push_back(S->getVarList().size());
3093 VisitOpenACCConstructStmt(S);
3094 Record.AddSourceRange(S->ParensLoc);
3095 Record.AddSourceLocation(S->ReadOnlyLoc);
3096
3097 for (Expr *E : S->getVarList())
3098 Record.AddStmt(E);
3100}
3101
3102//===----------------------------------------------------------------------===//
3103// HLSL Constructs/Directives.
3104//===----------------------------------------------------------------------===//
3105
3106void ASTStmtWriter::VisitHLSLOutArgExpr(HLSLOutArgExpr *S) {
3107 VisitExpr(S);
3108 Record.AddStmt(S->getOpaqueArgLValue());
3109 Record.AddStmt(S->getCastedTemporary());
3110 Record.AddStmt(S->getWritebackCast());
3111 Record.writeBool(S->isInOut());
3113}
3114
3115//===----------------------------------------------------------------------===//
3116// ASTWriter Implementation
3117//===----------------------------------------------------------------------===//
3118
3120 assert(!SwitchCaseIDs.contains(S) && "SwitchCase recorded twice");
3121 unsigned NextID = SwitchCaseIDs.size();
3122 SwitchCaseIDs[S] = NextID;
3123 return NextID;
3124}
3125
3127 assert(SwitchCaseIDs.contains(S) && "SwitchCase hasn't been seen yet");
3128 return SwitchCaseIDs[S];
3129}
3130
3132 SwitchCaseIDs.clear();
3133}
3134
3135/// Write the given substatement or subexpression to the
3136/// bitstream.
3137void ASTWriter::WriteSubStmt(ASTContext &Context, Stmt *S) {
3139 ASTStmtWriter Writer(Context, *this, Record);
3140 ++NumStatements;
3141
3142 if (!S) {
3143 Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
3144 return;
3145 }
3146
3147 llvm::DenseMap<Stmt *, uint64_t>::iterator I = SubStmtEntries.find(S);
3148 if (I != SubStmtEntries.end()) {
3149 Record.push_back(I->second);
3150 Stream.EmitRecord(serialization::STMT_REF_PTR, Record);
3151 return;
3152 }
3153
3154#ifndef NDEBUG
3155 assert(!ParentStmts.count(S) && "There is a Stmt cycle!");
3156
3157 struct ParentStmtInserterRAII {
3158 Stmt *S;
3159 llvm::DenseSet<Stmt *> &ParentStmts;
3160
3161 ParentStmtInserterRAII(Stmt *S, llvm::DenseSet<Stmt *> &ParentStmts)
3162 : S(S), ParentStmts(ParentStmts) {
3163 ParentStmts.insert(S);
3164 }
3165 ~ParentStmtInserterRAII() {
3166 ParentStmts.erase(S);
3167 }
3168 };
3169
3170 ParentStmtInserterRAII ParentStmtInserter(S, ParentStmts);
3171#endif
3172
3173 Writer.Visit(S);
3174
3175 uint64_t Offset = Writer.Emit();
3176 SubStmtEntries[S] = Offset;
3177}
3178
3179/// Flush all of the statements that have been added to the
3180/// queue via AddStmt().
3181void ASTRecordWriter::FlushStmts() {
3182 // We expect to be the only consumer of the two temporary statement maps,
3183 // assert that they are empty.
3184 assert(Writer->SubStmtEntries.empty() && "unexpected entries in sub-stmt map");
3185 assert(Writer->ParentStmts.empty() && "unexpected entries in parent stmt map");
3186
3187 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3188 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[I]);
3189
3190 assert(N == StmtsToEmit.size() && "record modified while being written!");
3191
3192 // Note that we are at the end of a full expression. Any
3193 // expression records that follow this one are part of a different
3194 // expression.
3195 Writer->Stream.EmitRecord(serialization::STMT_STOP, ArrayRef<uint32_t>());
3196
3197 Writer->SubStmtEntries.clear();
3198 Writer->ParentStmts.clear();
3199 }
3200
3201 StmtsToEmit.clear();
3202}
3203
3204void ASTRecordWriter::FlushSubStmts() {
3205 // For a nested statement, write out the substatements in reverse order (so
3206 // that a simple stack machine can be used when loading), and don't emit a
3207 // STMT_STOP after each one.
3208 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
3209 Writer->WriteSubStmt(getASTContext(), StmtsToEmit[N - I - 1]);
3210 assert(N == StmtsToEmit.size() && "record modified while being written!");
3211 }
3212
3213 StmtsToEmit.clear();
3214}
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:226
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:906
SmallVector< uint64_t, 64 > RecordData
Definition ASTWriter.h:102
SourceLocation getColonLoc() const
Definition Expr.h:4384
SourceLocation getQuestionLoc() const
Definition Expr.h:4383
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition Expr.h:4553
SourceLocation getAmpAmpLoc() const
Definition Expr.h:4568
SourceLocation getLabelLoc() const
Definition Expr.h:4570
LabelDecl * getLabel() const
Definition Expr.h:4576
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition Expr.h:6024
Represents a loop initializing the elements of an array.
Definition Expr.h:5971
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition Expr.h:7218
SourceLocation getRBracketLoc() const
Definition Expr.h:7333
Expr * getBase()
Get base of the array section.
Definition Expr.h:7296
Expr * getLength()
Get length of array section.
Definition Expr.h:7306
bool isOMPArraySection() const
Definition Expr.h:7292
Expr * getStride()
Get stride of array section.
Definition Expr.h:7310
SourceLocation getColonLocSecond() const
Definition Expr.h:7328
Expr * getLowerBound()
Get lower bound of array section.
Definition Expr.h:7300
SourceLocation getColonLocFirst() const
Definition Expr.h:7327
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition Expr.h:2724
SourceLocation getRBracketLoc() const
Definition Expr.h:2772
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
Definition Expr.h:2753
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition ExprCXX.h:2997
uint64_t getValue() const
Definition ExprCXX.h:3045
ArrayTypeTrait getTrait() const
Definition ExprCXX.h:3037
Expr * getDimensionExpression() const
Definition ExprCXX.h:3047
TypeSourceInfo * getQueriedTypeSourceInfo() const
Definition ExprCXX.h:3043
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition Expr.h:6732
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition Expr.h:6751
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_astype token.
Definition Expr.h:6754
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition Expr.h:6757
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition Stmt.h:3269
bool isVolatile() const
Definition Stmt.h:3305
SourceLocation getAsmLoc() const
Definition Stmt.h:3299
unsigned getNumClobbers() const
Definition Stmt.h:3360
unsigned getNumOutputs() const
Definition Stmt.h:3328
unsigned getNumInputs() const
Definition Stmt.h:3350
bool isSimple() const
Definition Stmt.h:3302
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition Expr.h:6927
Expr ** getSubExprs()
Definition Expr.h:7002
SourceLocation getRParenLoc() const
Definition Expr.h:7056
static unsigned getNumSubExprs(AtomicOp Op)
Determine the number of arguments the specified atomic builtin should have.
Definition Expr.cpp:5250
AtomicOp getOp() const
Definition Expr.h:6990
SourceLocation getBuiltinLoc() const
Definition Expr.h:7055
Represents an attribute applied to a statement.
Definition Stmt.h:2195
Stmt * getSubStmt()
Definition Stmt.h:2231
SourceLocation getAttrLoc() const
Definition Stmt.h:2226
ArrayRef< const Attr * > getAttrs() const
Definition Stmt.h:2227
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition Expr.h:4456
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condition evaluates to false; ...
Definition Expr.h:4510
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition Expr.h:4494
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value.
Definition Expr.h:4498
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
Definition Expr.h:4503
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Definition Expr.h:4491
A builtin binary operation expression such as "x + y" or "x <= y".
Definition Expr.h:4041
Expr * getLHS() const
Definition Expr.h:4091
SourceLocation getOperatorLoc() const
Definition Expr.h:4083
bool hasStoredFPFeatures() const
Definition Expr.h:4226
Expr * getRHS() const
Definition Expr.h:4093
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:4238
Opcode getOpcode() const
Definition Expr.h:4086
bool hasExcludedOverflowPattern() const
Definition Expr.h:4233
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
Definition ASTWriter.h:1080
void addBit(bool Value)
Definition ASTWriter.h:1100
void addBits(uint32_t Value, uint32_t BitsWidth)
Definition ASTWriter.h:1101
void reset(uint32_t Value)
Definition ASTWriter.h:1095
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition Expr.h:6671
const BlockDecl * getBlockDecl() const
Definition Expr.h:6683
BreakStmt - This represents a break.
Definition Stmt.h:3127
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition ExprCXX.h:5477
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5496
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5495
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition Expr.h:3972
SourceLocation getRParenLoc() const
Definition Expr.h:4007
SourceLocation getLParenLoc() const
Definition Expr.h:4004
Represents a call to a CUDA kernel function.
Definition ExprCXX.h:235
const CallExpr * getConfig() const
Definition ExprCXX.h:261
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Definition ExprCXX.h:605
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:724
bool getValue() const
Definition ExprCXX.h:741
SourceLocation getLocation() const
Definition ExprCXX.h:747
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:567
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:2627
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2666
bool isArrayForm() const
Definition ExprCXX.h:2653
SourceLocation getBeginLoc() const
Definition ExprCXX.h:2677
bool isGlobalDelete() const
Definition ExprCXX.h:2652
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2662
bool isArrayFormAsWritten() const
Definition ExprCXX.h:2654
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition ExprCXX.h:3871
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:3970
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:3973
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition ExprCXX.h:4065
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:3997
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:3961
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information.
Definition ExprCXX.h:3984
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition ExprCXX.h:3953
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition ExprCXX.h:482
Represents a folding of a pack over an operator.
Definition ExprCXX.h:5033
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:1832
SourceLocation getLParenLoc() const
Definition ExprCXX.h:1869
SourceLocation getRParenLoc() const
Definition ExprCXX.h:1871
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition ExprCXX.h:1752
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition ExprCXX.h:1793
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
Definition ExprCXX.h:1789
SourceLocation getLocation() const LLVM_READONLY
Definition ExprCXX.h:1805
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
Definition ExprCXX.h:1803
Represents a call to a member function that may be written either with member call syntax (e....
Definition ExprCXX.h:180
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition ExprCXX.h:376
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
Definition ExprCXX.h:407
SourceRange getAngleBrackets() const LLVM_READONLY
Definition ExprCXX.h:414
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
Definition ExprCXX.h:410
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition ExprCXX.h:2356
bool isArray() const
Definition ExprCXX.h:2465
SourceRange getDirectInitRange() const
Definition ExprCXX.h:2610
ExprIterator arg_iterator
Definition ExprCXX.h:2570
ImplicitAllocationParameters implicitAllocationParameters() const
Provides the full set of information about expected implicit parameters in this call.
Definition ExprCXX.h:2563
bool hasInitializer() const
Whether this new-expression has any initializer at all.
Definition ExprCXX.h:2525
FunctionDecl * getOperatorDelete() const
Definition ExprCXX.h:2462
unsigned getNumPlacementArgs() const
Definition ExprCXX.h:2495
TypeSourceInfo * getAllocatedTypeSourceInfo() const
Definition ExprCXX.h:2439
SourceRange getSourceRange() const
Definition ExprCXX.h:2611
SourceRange getTypeIdParens() const
Definition ExprCXX.h:2517
bool isParenTypeId() const
Definition ExprCXX.h:2516
raw_arg_iterator raw_arg_end()
Definition ExprCXX.h:2597
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition ExprCXX.h:2557
raw_arg_iterator raw_arg_begin()
Definition ExprCXX.h:2596
FunctionDecl * getOperatorNew() const
Definition ExprCXX.h:2460
bool isGlobalNew() const
Definition ExprCXX.h:2522
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition ExprCXX.h:4310
bool getValue() const
Definition ExprCXX.h:4333
Expr * getOperand() const
Definition ExprCXX.h:4327
SourceRange getSourceRange() const
Definition ExprCXX.h:4331
The null pointer literal (C++11 [lex.nullptr])
Definition ExprCXX.h:769
SourceLocation getLocation() const
Definition ExprCXX.h:783
A call to an overloaded operator written using operator syntax.
Definition ExprCXX.h:85
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Definition ExprCXX.h:115
Represents a list-initialization with parenthesis.
Definition ExprCXX.h:5142
SourceLocation getEndLoc() const LLVM_READONLY
Definition ExprCXX.h:5198
SourceLocation getInitLoc() const LLVM_READONLY
Definition ExprCXX.h:5200
MutableArrayRef< Expr * > getInitExprs()
Definition ExprCXX.h:5182
ArrayRef< Expr * > getUserSpecifiedInitExprs()
Definition ExprCXX.h:5188
SourceLocation getBeginLoc() const LLVM_READONLY
Definition ExprCXX.h:5196
FieldDecl * getInitializedFieldInUnion()
Definition ExprCXX.h:5220
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition ExprCXX.h:2746
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Definition ExprCXX.h:2840
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise,...
Definition ExprCXX.h:2810
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2824
SourceLocation getTildeLoc() const
Retrieve the location of the '~'.
Definition ExprCXX.h:2831
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information.
Definition ExprCXX.h:2799
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
Definition ExprCXX.h:2855
SourceLocation getColonColonLoc() const
Retrieve the location of the '::' in a qualified pseudo-destructor expression.
Definition ExprCXX.h:2828
SourceLocation getOperatorLoc() const
Retrieve the location of the '.' or '->' operator.
Definition ExprCXX.h:2813
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:2847
Represents a C++26 reflect expression [expr.reflect].
Definition ExprCXX.h:5509
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition ExprCXX.h:527
A rewritten comparison expression that was originally written using operator syntax.
Definition ExprCXX.h:287
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
Definition ExprCXX.h:305
bool isReversed() const
Determine whether this expression was rewritten in reverse form.
Definition ExprCXX.h:323
An expression "T()" which creates an rvalue of a non-class type T.
Definition ExprCXX.h:2197
TypeSourceInfo * getTypeSourceInfo() const
Definition ExprCXX.h:2216
SourceLocation getRParenLoc() const
Definition ExprCXX.h:2220
A C++ static_cast expression (C++ [expr.static.cast]).
Definition ExprCXX.h:437
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition ExprCXX.h:801
Represents a C++ functional cast expression that builds a temporary object.
Definition ExprCXX.h:1900
TypeSourceInfo * getTypeSourceInfo() const
Definition ExprCXX.h:1929
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:849
bool isTypeOperand() const
Definition ExprCXX.h:885
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition ExprCXX.h:892
Expr * getExprOperand() const
Definition ExprCXX.h:896
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprCXX.h:903
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition ExprCXX.h:3745
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
Definition ExprCXX.h:3789
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition ExprCXX.h:3800
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
Definition ExprCXX.h:3783
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
Definition ExprCXX.h:3794
unsigned getNumArgs() const
Retrieve the number of arguments.
Definition ExprCXX.h:3803
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:2946
bool hasStoredFPFeatures() const
Definition Expr.h:3105
bool usesMemberSyntax() const
Definition Expr.h:3107
ExprIterator arg_iterator
Definition Expr.h:3193
arg_iterator arg_begin()
Definition Expr.h:3203
arg_iterator arg_end()
Definition Expr.h:3206
ADLCallKind getADLCallKind() const
Definition Expr.h:3097
Expr * getCallee()
Definition Expr.h:3093
FPOptionsOverride getFPFeatures() const
Definition Expr.h:3245
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition Expr.h:3137
bool isCoroElideSafe() const
Definition Expr.h:3120
SourceLocation getRParenLoc() const
Definition Expr.h:3277
This captures a statement into a function.
Definition Stmt.h:3929
capture_init_range capture_inits()
Definition Stmt.h:4097
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition Stmt.cpp:1493
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
Definition Stmt.h:4080
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Definition Stmt.h:4050
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition Stmt.h:4033
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
Definition Stmt.h:4075
capture_range captures()
Definition Stmt.h:4067
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
Definition Stmt.cpp:1508
CaseStmt - Represent a case statement.
Definition Stmt.h:1912
Stmt * getSubStmt()
Definition Stmt.h:2025
Expr * getLHS()
Definition Stmt.h:1995
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ... RHS, which is a GNU extension.
Definition Stmt.h:1975
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
Definition Stmt.h:1981
Expr * getRHS()
Definition Stmt.h:2007
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition Expr.h:3679
path_iterator path_begin()
Definition Expr.h:3749
unsigned path_size() const
Definition Expr.h:3748
CastKind getCastKind() const
Definition Expr.h:3723
bool hasStoredFPFeatures() const
Definition Expr.h:3778
path_iterator path_end()
Definition Expr.h:3750
CXXBaseSpecifier ** path_iterator
Definition Expr.h:3745
FPOptionsOverride getFPFeatures() const
Definition Expr.h:3799
Expr * getSubExpr()
Definition Expr.h:3729
SourceLocation getLocation() const
Definition Expr.h:1624
unsigned getValue() const
Definition Expr.h:1632
CharacterLiteralKind getKind() const
Definition Expr.h:1625
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition Expr.h:4851
SourceLocation getBuiltinLoc() const
Definition Expr.h:4898
Expr * getLHS() const
Definition Expr.h:4893
bool isConditionDependent() const
Definition Expr.h:4881
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
Definition Expr.h:4874
Expr * getRHS() const
Definition Expr.h:4895
SourceLocation getRParenLoc() const
Definition Expr.h:4901
Expr * getCond() const
Definition Expr.h:4891
Represents a 'co_await' expression.
Definition ExprCXX.h:5370
bool isImplicit() const
Definition ExprCXX.h:5392
CompoundAssignOperator - For compound assignments (e.g.
Definition Expr.h:4303
QualType getComputationLHSType() const
Definition Expr.h:4337
QualType getComputationResultType() const
Definition Expr.h:4340
CompoundLiteralExpr - [C99 6.5.2.5].
Definition Expr.h:3608
SourceLocation getLParenLoc() const
Definition Expr.h:3643
bool isFileScope() const
Definition Expr.h:3640
const Expr * getInitializer() const
Definition Expr.h:3636
TypeSourceInfo * getTypeSourceInfo() const
Definition Expr.h:3646
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition Stmt.h:1732
unsigned size() const
Definition Stmt.h:1777
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
Definition Stmt.h:1782
body_range body()
Definition Stmt.h:1795
SourceLocation getLBracLoc() const
Definition Stmt.h:1849
bool hasStoredFPFeatures() const
Definition Stmt.h:1779
SourceLocation getRBracLoc() const
Definition Stmt.h:1850
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:4394
Expr * getLHS() const
Definition Expr.h:4428
Expr * getCond() const
getCond - Return the expression representing the condition for the ?
Definition Expr.h:4417
Expr * getRHS() const
Definition Expr.h:4429
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition Expr.h:1085
ConstantResultStorageKind getResultStorageKind() const
Definition Expr.h:1154
ContinueStmt - This represents a continue.
Definition Stmt.h:3111
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition Expr.h:4722
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition Expr.h:4826
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_convertvector token.
Definition Expr.h:4823
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:4785
TypeSourceInfo * getTypeSourceInfo() const
getTypeSourceInfo - Return the destination type.
Definition Expr.h:4815
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition Expr.h:4780
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition Expr.h:4812
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:5256
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5347
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition ExprCXX.h:5310
Represents a 'co_yield' expression.
Definition ExprCXX.h:5451
NamedDecl * getDecl() const
AccessSpecifier getAccess() const
iterator begin()
Definition DeclGroup.h:95
A reference to a declared variable, function, enum, etc.
Definition Expr.h:1273
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition Expr.h:1448
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition Expr.h:1384
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
Definition Expr.h:1477
bool hasTemplateKWAndArgsInfo() const
Definition Expr.h:1394
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier,...
Definition Expr.h:1362
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name,...
Definition Expr.h:1366
ValueDecl * getDecl()
Definition Expr.h:1341
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition Expr.h:1471
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
Definition Expr.h:1460
SourceLocation getLocation() const
Definition Expr.h:1349
bool isImmediateEscalating() const
Definition Expr.h:1481
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition Stmt.h:1623
SourceLocation getEndLoc() const
Definition Stmt.h:1646
const DeclGroupRef getDeclGroup() const
Definition Stmt.h:1641
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:1649
NameKind
The kind of the name stored in this DeclarationName.
Stmt * getSubStmt()
Definition Stmt.h:2073
DeferStmt - This represents a deferred statement.
Definition Stmt.h:3228
Stmt * getBody()
Definition Stmt.h:3247
SourceLocation getDeferLoc() const
Definition Stmt.h:3242
Represents a 'co_await' expression while the type of the promise is dependent.
Definition ExprCXX.h:5402
SourceLocation getKeywordLoc() const
Definition ExprCXX.h:5431
A qualified reference to a name whose declaration cannot yet be resolved.
Definition ExprCXX.h:3511
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
Definition ExprCXX.h:3559
Represents a C99 designated initializer expression.
Definition Expr.h:5554
Expr * getSubExpr(unsigned Idx) const
Definition Expr.h:5836
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
Definition Expr.h:5818
MutableArrayRef< Designator > designators()
Definition Expr.h:5787
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the '=' that precedes the initializer value itself, if present.
Definition Expr.h:5809
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression,...
Definition Expr.h:5834
InitListExpr * getUpdater() const
Definition Expr.h:5939
DoStmt - This represents a 'do/while' stmt.
Definition Stmt.h:2824
Stmt * getBody()
Definition Stmt.h:2849
Expr * getCond()
Definition Stmt.h:2842
SourceLocation getWhileLoc() const
Definition Stmt.h:2855
SourceLocation getDoLoc() const
Definition Stmt.h:2853
SourceLocation getRParenLoc() const
Definition Stmt.h:2857
IdentifierInfo & getAccessor() const
Definition Expr.h:6584
const Expr * getBase() const
Definition Expr.h:6580
SourceLocation getAccessorLoc() const
Definition Expr.h:6587
Represents a reference to emded data.
Definition Expr.h:5129
unsigned getStartingElementPos() const
Definition Expr.h:5150
SourceLocation getEndLoc() const
Definition Expr.h:5144
StringLiteral * getDataStringLiteral() const
Definition Expr.h:5146
SourceLocation getBeginLoc() const
Definition Expr.h:5143
size_t getDataElementCount() const
Definition Expr.h:5151
ExplicitCastExpr - An explicit cast written in the source code.
Definition Expr.h:3931
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Definition Expr.h:3953
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition ExprCXX.h:3662
bool cleanupsHaveSideEffects() const
Definition ExprCXX.h:3697
ArrayRef< CleanupObject > getObjects() const
Definition ExprCXX.h:3686
unsigned getNumObjects() const
Definition ExprCXX.h:3690
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:447
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Definition Expr.h:454
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition Expr.cpp:277
QualType getType() const
Definition Expr.h:144
ExprDependence getDependence() const
Definition Expr.h:164
An expression trait intrinsic.
Definition ExprCXX.h:3070
Expr * getQueriedExpression() const
Definition ExprCXX.h:3109
ExpressionTrait getTrait() const
Definition ExprCXX.h:3105
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition Expr.h:6609
storage_type getAsOpaqueInt() const
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition Expr.h:1584
unsigned getScale() const
Definition Expr.h:1588
llvm::APInt getValue() const
Returns an internal integer representation of the literal.
Definition Expr.h:1578
SourceLocation getLocation() const
Definition Expr.h:1710
llvm::APFloatBase::Semantics getRawSemantics() const
Get a raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE,...
Definition Expr.h:1679
llvm::APFloat getValue() const
Definition Expr.h:1669
bool isExact() const
Definition Expr.h:1702
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition Stmt.h:2880
Stmt * getInit()
Definition Stmt.h:2895
SourceLocation getRParenLoc() const
Definition Stmt.h:2940
Stmt * getBody()
Definition Stmt.h:2924
Expr * getInc()
Definition Stmt.h:2923
SourceLocation getForLoc() const
Definition Stmt.h:2936
Expr * getCond()
Definition Stmt.h:2922
SourceLocation getLParenLoc() const
Definition Stmt.h:2938
DeclStmt * getConditionVariableDeclStmt()
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
Definition Stmt.h:2910
const Expr * getSubExpr() const
Definition Expr.h:1065
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Definition ExprCXX.h:4842
ValueDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition ExprCXX.h:4875
ValueDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition ExprCXX.h:4868
iterator end() const
Definition ExprCXX.h:4877
unsigned getNumExpansions() const
Get the number of parameters in this parameter pack.
Definition ExprCXX.h:4880
SourceLocation getParameterPackLocation() const
Get the location of the parameter pack.
Definition ExprCXX.h:4871
iterator begin() const
Definition ExprCXX.h:4876
This represents a GCC inline-assembly statement extension.
Definition Stmt.h:3438
unsigned getNumLabels() const
Definition Stmt.h:3588
SourceLocation getRParenLoc() const
Definition Stmt.h:3460
IdentifierInfo * getInputIdentifier(unsigned i) const
Definition Stmt.h:3553
const Expr * getOutputConstraintExpr(unsigned i) const
Definition Stmt.h:3540
IdentifierInfo * getLabelIdentifier(unsigned i) const
Definition Stmt.h:3592
const Expr * getInputConstraintExpr(unsigned i) const
Definition Stmt.h:3566
IdentifierInfo * getOutputIdentifier(unsigned i) const
Definition Stmt.h:3529
const Expr * getAsmStringExpr() const
Definition Stmt.h:3465
Expr * getOutputExpr(unsigned i)
Definition Stmt.cpp:582
Expr * getClobberExpr(unsigned i)
Definition Stmt.h:3645
Expr * getInputExpr(unsigned i)
Definition Stmt.cpp:593
AddrLabelExpr * getLabelExpr(unsigned i) const
Definition Stmt.cpp:601
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition Expr.h:4926
SourceLocation getTokenLocation() const
getTokenLocation - The location of the __null token.
Definition Expr.h:4940
Represents a C11 generic selection.
Definition Expr.h:6181
unsigned getNumAssocs() const
The number of association expressions.
Definition Expr.h:6423
bool isExprPredicate() const
Whether this generic selection uses an expression as its controlling argument.
Definition Expr.h:6439
SourceLocation getGenericLoc() const
Definition Expr.h:6536
SourceLocation getRParenLoc() const
Definition Expr.h:6540
SourceLocation getDefaultLoc() const
Definition Expr.h:6539
GotoStmt - This represents a direct goto.
Definition Stmt.h:2961
SourceLocation getLabelLoc() const
Definition Stmt.h:2979
SourceLocation getGotoLoc() const
Definition Stmt.h:2977
LabelDecl * getLabel() const
Definition Stmt.h:2974
This class represents temporary values used to represent inout and out arguments in HLSL.
Definition Expr.h:7396
const OpaqueValueExpr * getCastedTemporary() const
Definition Expr.h:7447
const OpaqueValueExpr * getOpaqueArgLValue() const
Definition Expr.h:7428
bool isInOut() const
returns true if the parameter is inout and false if the parameter is out.
Definition Expr.h:7455
const Expr * getWritebackCast() const
Definition Expr.h:7442
IfStmt - This represents an if/then/else.
Definition Stmt.h:2251
Stmt * getThen()
Definition Stmt.h:2340
SourceLocation getIfLoc() const
Definition Stmt.h:2417
IfStatementKind getStatementKind() const
Definition Stmt.h:2452
SourceLocation getElseLoc() const
Definition Stmt.h:2420
Stmt * getInit()
Definition Stmt.h:2401
SourceLocation getLParenLoc() const
Definition Stmt.h:2469
Expr * getCond()
Definition Stmt.h:2328
Stmt * getElse()
Definition Stmt.h:2349
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Definition Stmt.h:2384
SourceLocation getRParenLoc() const
Definition Stmt.h:2471
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
Definition Expr.h:1734
const Expr * getSubExpr() const
Definition Expr.h:1746
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition Expr.h:3856
bool isPartOfExplicitCast() const
Definition Expr.h:3887
Represents an implicitly-generated value initialization of an object of a given type.
Definition Expr.h:6060
IndirectGotoStmt - This represents an indirect goto.
Definition Stmt.h:3000
SourceLocation getGotoLoc() const
Definition Stmt.h:3016
SourceLocation getStarLoc() const
Definition Stmt.h:3018
Describes an C or C++ initializer list.
Definition Expr.h:5302
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition Expr.h:5428
unsigned getNumInits() const
Definition Expr.h:5332
SourceLocation getLBraceLoc() const
Definition Expr.h:5463
InitListExpr * getSyntacticForm() const
Definition Expr.h:5475
bool hadArrayRangeDesignator() const
Definition Expr.h:5486
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition Expr.h:5404
SourceLocation getRBraceLoc() const
Definition Expr.h:5465
const Expr * getInit(unsigned Init) const
Definition Expr.h:5356
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition Expr.h:1539
LabelStmt - Represents a label, which has a substatement.
Definition Stmt.h:2138
LabelDecl * getDecl() const
Definition Stmt.h:2156
bool isSideEntry() const
Definition Stmt.h:2185
Stmt * getSubStmt()
Definition Stmt.h:2160
SourceLocation getIdentLoc() const
Definition Stmt.h:2153
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition ExprCXX.h:1969
Expr ** capture_init_iterator
Iterator that walks over the capture initialization arguments.
Definition ExprCXX.h:2076
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Definition ExprCXX.h:2107
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition ExprCXX.h:2095
Base class for BreakStmt and ContinueStmt.
Definition Stmt.h:3049
SourceLocation getLabelLoc() const
Definition Stmt.h:3084
LabelDecl * getLabelDecl()
Definition Stmt.h:3087
SourceLocation getKwLoc() const
Definition Stmt.h:3074
bool hasLabelTarget() const
Definition Stmt.h:3082
This represents a Microsoft inline-assembly statement extension.
Definition Stmt.h:3657
Token * getAsmToks()
Definition Stmt.h:3688
Expr * getOutputExpr(unsigned i)
Definition Stmt.cpp:919
StringRef getAsmString() const
Definition Stmt.h:3691
SourceLocation getLBraceLoc() const
Definition Stmt.h:3680
SourceLocation getEndLoc() const
Definition Stmt.h:3682
StringRef getInputConstraint(unsigned i) const
Definition Stmt.h:3711
StringRef getOutputConstraint(unsigned i) const
Definition Stmt.h:3698
StringRef getClobber(unsigned i) const
Definition Stmt.h:3735
unsigned getNumAsmToks()
Definition Stmt.h:3687
Expr * getInputExpr(unsigned i)
Definition Stmt.cpp:923
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:937
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:4921
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
Definition ExprCXX.h:4938
LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl()
Definition ExprCXX.h:4961
MatrixSingleSubscriptExpr - Matrix single subscript expression for the MatrixType extension when you ...
Definition Expr.h:2798
SourceLocation getRBracketLoc() const
Definition Expr.h:2842
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition Expr.h:2868
SourceLocation getRBracketLoc() const
Definition Expr.h:2920
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition Expr.h:3367
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
Definition Expr.h:3556
SourceLocation getOperatorLoc() const
Definition Expr.h:3549
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name,...
Definition Expr.h:3469
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition Expr.h:3450
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition Expr.h:3591
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
Definition Expr.h:3464
Expr * getBase() const
Definition Expr.h:3444
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition Expr.h:3532
bool hadMultipleCandidates() const
Returns true if this member expression refers to a method that was resolved from an overloaded set ha...
Definition Expr.h:3571
bool isArrow() const
Definition Expr.h:3551
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Definition Expr.h:3454
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition Decl.h:340
Represents a place-holder for an object not to be initialized by anything.
Definition Expr.h:5880
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition Stmt.h:1695
SourceLocation getSemiLoc() const
Definition Stmt.h:1706
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:5564
SourceLocation getColonLoc(unsigned I) const
Gets the location of the first ':' in the range for the given iterator definition.
Definition Expr.cpp:5558
SourceLocation getRParenLoc() const
Definition ExprOpenMP.h:245
IteratorRange getIteratorRange(unsigned I)
Gets the iterator range for the given iterator.
Definition Expr.cpp:5535
OMPIteratorHelperData & getHelper(unsigned I)
Fetches helper data for the specified iteration space.
Definition Expr.cpp:5574
SourceLocation getAssignLoc(unsigned I) const
Gets the location of '=' for the given iterator definition.
Definition Expr.cpp:5552
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:5531
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Definition ExprObjC.h:192
Expr * getElement(unsigned Index)
getElement - Return the Element at the specified index.
Definition ExprObjC.h:230
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c array literal.
Definition ExprObjC.h:227
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprObjC.h:218
ObjCMethodDecl * getArrayWithObjectsMethod() const
Definition ExprObjC.h:239
Represents Objective-C's @catch statement.
Definition StmtObjC.h:77
const VarDecl * getCatchParamDecl() const
Definition StmtObjC.h:97
const Stmt * getCatchBody() const
Definition StmtObjC.h:93
SourceLocation getAtCatchLoc() const
Definition StmtObjC.h:105
SourceLocation getRParenLoc() const
Definition StmtObjC.h:107
Represents Objective-C's @finally statement.
Definition StmtObjC.h:127
const Stmt * getFinallyBody() const
Definition StmtObjC.h:139
SourceLocation getAtFinallyLoc() const
Definition StmtObjC.h:148
Represents Objective-C's @synchronized statement.
Definition StmtObjC.h:303
const Expr * getSynchExpr() const
Definition StmtObjC.h:331
const CompoundStmt * getSynchBody() const
Definition StmtObjC.h:323
SourceLocation getAtSynchronizedLoc() const
Definition StmtObjC.h:320
Represents Objective-C's @throw statement.
Definition StmtObjC.h:358
const Expr * getThrowExpr() const
Definition StmtObjC.h:370
SourceLocation getThrowLoc() const LLVM_READONLY
Definition StmtObjC.h:374
Represents Objective-C's @try ... @catch ... @finally statement.
Definition StmtObjC.h:167
const ObjCAtFinallyStmt * getFinallyStmt() const
Retrieve the @finally statement, if any.
Definition StmtObjC.h:241
unsigned getNumCatchStmts() const
Retrieve the number of @catch statements in this try-catch-finally block.
Definition StmtObjC.h:220
const Stmt * getTryBody() const
Retrieve the @try body.
Definition StmtObjC.h:214
SourceLocation getAtTryLoc() const
Retrieve the location of the @ in the @try.
Definition StmtObjC.h:210
catch_range catch_stmts()
Definition StmtObjC.h:282
Represents Objective-C's @autoreleasepool Statement.
Definition StmtObjC.h:394
SourceLocation getAtLoc() const
Definition StmtObjC.h:414
const Stmt * getSubStmt() const
Definition StmtObjC.h:405
A runtime availability query.
Definition ExprObjC.h:1700
SourceRange getSourceRange() const
Definition ExprObjC.h:1719
VersionTuple getVersion() const
Definition ExprObjC.h:1723
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition ExprObjC.h:88
SourceLocation getLocation() const
Definition ExprObjC.h:107
ObjCBoxedExpr - used for generalized expression boxing.
Definition ExprObjC.h:128
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprObjC.h:162
ObjCMethodDecl * getBoxingMethod() const
Definition ExprObjC.h:147
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
Definition ExprObjC.h:1640
SourceLocation getLParenLoc() const
Definition ExprObjC.h:1663
SourceLocation getBridgeKeywordLoc() const
The location of the bridge keyword.
Definition ExprObjC.h:1674
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
Definition ExprObjC.h:1666
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition ExprObjC.h:307
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
Definition ExprObjC.h:358
ObjCMethodDecl * getDictWithObjectsMethod() const
Definition ExprObjC.h:375
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
Definition ExprObjC.h:360
SourceRange getSourceRange() const LLVM_READONLY
Definition ExprObjC.h:381
ObjCEncodeExpr, used for @encode in Objective-C.
Definition ExprObjC.h:407
TypeSourceInfo * getEncodedTypeSourceInfo() const
Definition ExprObjC.h:428
SourceLocation getRParenLoc() const
Definition ExprObjC.h:423
SourceLocation getAtLoc() const
Definition ExprObjC.h:421
Represents Objective-C's collection statement.
Definition StmtObjC.h:23
SourceLocation getForLoc() const
Definition StmtObjC.h:52
SourceLocation getRParenLoc() const
Definition StmtObjC.h:54
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition ExprObjC.h:1579
bool shouldCopy() const
shouldCopy - True if we should do the 'copy' part of the copy-restore.
Definition ExprObjC.h:1607
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
Definition ExprObjC.h:1495
SourceLocation getIsaMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
Definition ExprObjC.h:1527
SourceLocation getOpLoc() const
Definition ExprObjC.h:1530
Expr * getBase() const
Definition ExprObjC.h:1520
bool isArrow() const
Definition ExprObjC.h:1522
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition ExprObjC.h:546
SourceLocation getLocation() const
Definition ExprObjC.h:589
SourceLocation getOpLoc() const
Definition ExprObjC.h:597
ObjCIvarDecl * getDecl()
Definition ExprObjC.h:576
bool isArrow() const
Definition ExprObjC.h:584
bool isFreeIvar() const
Definition ExprObjC.h:585
const Expr * getBase() const
Definition ExprObjC.h:580
An expression that sends a message to the given Objective-C object or class.
Definition ExprObjC.h:937
bool isDelegateInitCall() const
isDelegateInitCall - Answers whether this message send has been tagged as a "delegate init call",...
Definition ExprObjC.h:1418
SourceLocation getLeftLoc() const
Definition ExprObjC.h:1421
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Definition ExprObjC.h:1265
SourceLocation getSuperLoc() const
Retrieve the location of the 'super' keyword for a class or instance message to 'super',...
Definition ExprObjC.h:1306
Selector getSelector() const
Definition ExprObjC.cpp:289
@ SuperInstance
The receiver is the instance of the superclass object.
Definition ExprObjC.h:951
@ Instance
The receiver is an object instance.
Definition ExprObjC.h:945
@ SuperClass
The receiver is a superclass.
Definition ExprObjC.h:948
@ Class
The receiver is a class.
Definition ExprObjC.h:942
TypeSourceInfo * getClassReceiverTypeInfo() const
Returns a type-source information of a class message send, or nullptr if the message is not a class m...
Definition ExprObjC.h:1293
QualType getSuperType() const
Retrieve the type referred to by 'super'.
Definition ExprObjC.h:1341
const ObjCMethodDecl * getMethodDecl() const
Definition ExprObjC.h:1361
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition ExprObjC.h:1226
arg_iterator arg_begin()
Definition ExprObjC.h:1474
SourceLocation getRightLoc() const
Definition ExprObjC.h:1422
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver.
Definition ExprObjC.h:1387
arg_iterator arg_end()
Definition ExprObjC.h:1476
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition ExprObjC.h:614
ObjCPropertyDecl * getExplicitProperty() const
Definition ExprObjC.h:703
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition ExprObjC.h:708
SourceLocation getReceiverLocation() const
Definition ExprObjC.h:757
const Expr * getBase() const
Definition ExprObjC.h:752
bool isObjectReceiver() const
Definition ExprObjC.h:767
QualType getSuperReceiverType() const
Definition ExprObjC.h:759
bool isImplicitProperty() const
Definition ExprObjC.h:700
ObjCMethodDecl * getImplicitPropertySetter() const
Definition ExprObjC.h:713
ObjCInterfaceDecl * getClassReceiver() const
Definition ExprObjC.h:763
SourceLocation getLocation() const
Definition ExprObjC.h:755
bool isSuperReceiver() const
Definition ExprObjC.h:768
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition ExprObjC.h:502
ObjCProtocolDecl * getProtocol() const
Definition ExprObjC.h:519
SourceLocation getRParenLoc() const
Definition ExprObjC.h:524
SourceLocation getAtLoc() const
Definition ExprObjC.h:523
ObjCSelectorExpr used for @selector in Objective-C.
Definition ExprObjC.h:452
SourceLocation getRParenLoc() const
Definition ExprObjC.h:470
Selector getSelector() const
Definition ExprObjC.h:466
SourceLocation getAtLoc() const
Definition ExprObjC.h:469
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition ExprObjC.h:52
SourceLocation getAtLoc() const
Definition ExprObjC.h:69
StringLiteral * getString()
Definition ExprObjC.h:65
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition ExprObjC.h:836
Expr * getKeyExpr() const
Definition ExprObjC.h:878
Expr * getBaseExpr() const
Definition ExprObjC.h:875
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition ExprObjC.h:881
SourceLocation getRBracket() const
Definition ExprObjC.h:866
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition ExprObjC.h:885
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Definition Expr.h:2530
Expr * getIndexExpr(unsigned Idx)
Definition Expr.h:2589
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition Expr.h:2563
const OffsetOfNode & getComponent(unsigned Idx) const
Definition Expr.h:2577
TypeSourceInfo * getTypeSourceInfo() const
Definition Expr.h:2570
unsigned getNumExpressions() const
Definition Expr.h:2601
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
Definition Expr.h:2567
unsigned getNumComponents() const
Definition Expr.h:2585
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
Definition Expr.h:2482
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition Expr.h:2488
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition Expr.cpp:1688
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this offsetof node.
Definition Expr.h:2509
@ Array
An index into an array.
Definition Expr.h:2429
@ Identifier
A field in a dependent type, known only by its name.
Definition Expr.h:2433
@ Field
A field.
Definition Expr.h:2431
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Definition Expr.h:2436
Kind getKind() const
Determine what kind of offsetof node this is.
Definition Expr.h:2478
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
Definition Expr.h:2498
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition Expr.h:1181
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition Expr.h:1231
SourceLocation getLocation() const
Retrieve the location of this expression.
Definition Expr.h:1203
bool isUnique() const
Definition Expr.h:1239
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:2093
SourceLocation getLocation() const
Definition Expr.h:2110
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:3129
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition ExprCXX.h:4283
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
Definition ExprCXX.h:3236
UnresolvedSetImpl::iterator decls_iterator
Definition ExprCXX.h:3220
decls_iterator decls_begin() const
Definition ExprCXX.h:3222
unsigned getNumDecls() const
Gets the number of declarations in the unresolved set.
Definition ExprCXX.h:3233
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
Definition ExprCXX.h:3251
TemplateArgumentLoc * getTrailingTemplateArgumentLoc()
Return the optional template arguments.
Definition ExprCXX.h:4293
bool hasTemplateKWAndArgsInfo() const
Definition ExprCXX.h:3173
decls_iterator decls_end() const
Definition ExprCXX.h:3225
DeclarationName getName() const
Gets the name looked up.
Definition ExprCXX.h:3239
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition ExprCXX.h:4364
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition ExprCXX.h:4393
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
Definition ExprCXX.h:4400
SourceLocation getEllipsisLoc() const
Determine the location of the 'sizeof' keyword.
Definition ExprCXX.h:4614
Expr * getIndexExpr() const
Definition ExprCXX.h:4629
ArrayRef< Expr * > getExpressions() const
Return the trailing expressions, regardless of the expansion.
Definition ExprCXX.h:4647
SourceLocation getRSquareLoc() const
Determine the location of the right parenthesis.
Definition ExprCXX.h:4620
Expr * getPackIdExpression() const
Definition ExprCXX.h:4625
ParenExpr - This represents a parenthesized expression, e.g.
Definition Expr.h:2185
SourceLocation getLParen() const
Get the location of the left parentheses '('.
Definition Expr.h:2210
const Expr * getSubExpr() const
Definition Expr.h:2202
bool isProducedByFoldExpansion() const
Definition Expr.h:2227
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
Definition Expr.h:2214
ArrayRef< Expr * > exprs()
Definition Expr.h:6126
unsigned getNumExprs() const
Return the number of expressions in this paren list.
Definition Expr.h:6113
SourceLocation getLParenLoc() const
Definition Expr.h:6128
SourceLocation getRParenLoc() const
Definition Expr.h:6129
[C99 6.4.2.2] - A predefined identifier such as func.
Definition Expr.h:2008
bool isTransparent() const
Definition Expr.h:2047
PredefinedIdentKind getIdentKind() const
Definition Expr.h:2043
SourceLocation getLocation() const
Definition Expr.h:2049
StringLiteral * getFunctionName()
Definition Expr.h:2052
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition Expr.h:6803
semantics_iterator semantics_end()
Definition Expr.h:6868
unsigned getResultExprIndex() const
Return the index of the result-bearing expression into the semantics expressions, or PseudoObjectExpr...
Definition Expr.h:6845
semantics_iterator semantics_begin()
Definition Expr.h:6864
Expr *const * semantics_iterator
Definition Expr.h:6862
unsigned getNumSemanticExprs() const
Definition Expr.h:6860
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Definition Expr.h:6840
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition Expr.h:7502
SourceLocation getEndLoc() const
Definition Expr.h:7521
child_range children()
Definition Expr.h:7515
SourceLocation getBeginLoc() const
Definition Expr.h:7520
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:3152
SourceLocation getReturnLoc() const
Definition Stmt.h:3201
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization.
Definition Stmt.h:3188
Expr * getRetValue()
Definition Stmt.h:3179
CompoundStmt * getBlock() const
Definition Stmt.h:3785
SourceLocation getExceptLoc() const
Definition Stmt.h:3778
Expr * getFilterExpr() const
Definition Stmt.h:3781
SourceLocation getFinallyLoc() const
Definition Stmt.h:3819
CompoundStmt * getBlock() const
Definition Stmt.h:3822
Represents a __leave statement.
Definition Stmt.h:3890
SourceLocation getLeaveLoc() const
Definition Stmt.h:3900
CompoundStmt * getTryBlock() const
Definition Stmt.h:3866
SourceLocation getTryLoc() const
Definition Stmt.h:3861
bool getIsCXXTry() const
Definition Stmt.h:3864
Stmt * getHandler() const
Definition Stmt.h:3870
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Definition StmtSYCL.h:36
CompoundStmt * getOriginalStmt()
Definition StmtSYCL.h:54
OutlinedFunctionDecl * getOutlinedFunctionDecl()
Definition StmtSYCL.h:66
SourceLocation getLocation() const
Definition Expr.h:2158
SourceLocation getLParenLocation() const
Definition Expr.h:2159
TypeSourceInfo * getTypeSourceInfo()
Definition Expr.h:2146
SourceLocation getRParenLocation() const
Definition Expr.h:2160
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition Expr.h:4646
SourceLocation getBuiltinLoc() const
Definition Expr.h:4663
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
Definition Expr.h:4679
SourceLocation getRParenLoc() const
Definition Expr.h:4666
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
Definition Expr.h:4685
Represents an expression that computes the length of a parameter pack.
Definition ExprCXX.h:4442
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
Definition ExprCXX.h:4527
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition ExprCXX.h:4532
unsigned getPackLength() const
Retrieve the length of the parameter pack.
Definition ExprCXX.h:4516
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Definition Expr.h:5020
SourceLocation getBeginLoc() const
Definition Expr.h:5065
const DeclContext * getParentContext() const
If the SourceLocExpr has been resolved return the subexpression representing the resolved value.
Definition Expr.h:5061
SourceLocation getEndLoc() const
Definition Expr.h:5066
SourceLocIdentKind getIdentKind() const
Definition Expr.h:5040
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition Expr.h:4598
CompoundStmt * getSubStmt()
Definition Expr.h:4615
unsigned getTemplateDepth() const
Definition Expr.h:4627
SourceLocation getRParenLoc() const
Definition Expr.h:4624
SourceLocation getLParenLoc() const
Definition Expr.h:4622
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
Definition Stmt.h:86
LambdaExprBitfields LambdaExprBits
Definition Stmt.h:1385
StmtClass getStmtClass() const
Definition Stmt.h:1485
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition Stmt.cpp:343
TypeTraitExprBitfields TypeTraitExprBits
Definition Stmt.h:1374
CXXNewExprBitfields CXXNewExprBits
Definition Stmt.h:1372
ConstantExprBitfields ConstantExprBits
Definition Stmt.h:1337
RequiresExprBitfields RequiresExprBits
Definition Stmt.h:1386
CXXFoldExprBitfields CXXFoldExprBits
Definition Stmt.h:1389
PackIndexingExprBitfields PackIndexingExprBits
Definition Stmt.h:1390
NullStmtBitfields NullStmtBits
Definition Stmt.h:1320
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition Stmt.h:1375
StringLiteral - This represents a string literal expression, e.g.
Definition Expr.h:1802
SourceLocation getStrTokenLoc(unsigned TokNum) const
Get one of the string literal token.
Definition Expr.h:1948
bool isPascal() const
Definition Expr.h:1925
unsigned getLength() const
Definition Expr.h:1912
StringLiteralKind getKind() const
Definition Expr.h:1915
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
Definition Expr.h:1878
unsigned getByteLength() const
Definition Expr.h:1911
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
Definition Expr.h:1943
unsigned getCharByteWidth() const
Definition Expr.h:1913
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition ExprCXX.h:4665
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition ExprCXX.h:4710
UnsignedOrNone getPackIndex() const
Definition ExprCXX.h:4716
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4714
SourceLocation getNameLoc() const
Definition ExprCXX.h:4700
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition ExprCXX.h:4755
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:4803
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition ExprCXX.h:4789
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition ExprCXX.h:4793
SourceLocation getKeywordLoc() const
Definition Stmt.h:1889
SourceLocation getColonLoc() const
Definition Stmt.h:1891
const SwitchCase * getNextSwitchCase() const
Definition Stmt.h:1885
SwitchStmt - This represents a 'switch' stmt.
Definition Stmt.h:2501
SourceLocation getSwitchLoc() const
Definition Stmt.h:2636
SourceLocation getLParenLoc() const
Definition Stmt.h:2638
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:2661
SourceLocation getRParenLoc() const
Definition Stmt.h:2640
Expr * getCond()
Definition Stmt.h:2564
Stmt * getBody()
Definition Stmt.h:2576
Stmt * getInit()
Definition Stmt.h:2581
SwitchCase * getSwitchCaseList()
Definition Stmt.h:2632
DeclStmt * getConditionVariableDeclStmt()
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Definition Stmt.h:2615
Location wrapper for a TemplateArgument.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition ExprCXX.h:2897
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition ExprCXX.h:2962
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition ExprCXX.h:2959
const APValue & getAPValue() const
Definition ExprCXX.h:2953
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition Expr.h:2628
SourceLocation getRParenLoc() const
Definition Expr.h:2704
SourceLocation getOperatorLoc() const
Definition Expr.h:2701
TypeSourceInfo * getArgumentTypeInfo() const
Definition Expr.h:2674
UnaryExprOrTypeTrait getKind() const
Definition Expr.h:2660
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition Expr.h:2247
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition Expr.h:2292
Expr * getSubExpr() const
Definition Expr.h:2288
Opcode getOpcode() const
Definition Expr.h:2283
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition Expr.h:2384
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition Expr.h:2387
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition Expr.h:2301
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition ExprCXX.h:3391
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
Definition ExprCXX.h:3465
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition ExprCXX.h:3460
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition ExprCXX.h:4127
QualType getBaseType() const
Definition ExprCXX.h:4209
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition ExprCXX.h:4219
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition ExprCXX.h:4222
bool hasUnresolvedUsing() const
Determine whether the lookup results contain an unresolved using declaration.
Definition ExprCXX.h:4213
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition ExprCXX.h:4200
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:641
Represents a call to the builtin function __builtin_va_arg.
Definition Expr.h:4960
TypeSourceInfo * getWrittenTypeInfo() const
Definition Expr.h:4984
SourceLocation getBuiltinLoc() const
Definition Expr.h:4987
SourceLocation getRParenLoc() const
Definition Expr.h:4990
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
Definition Expr.h:4981
const Expr * getSubExpr() const
Definition Expr.h:4976
WhileStmt - This represents a 'while' stmt.
Definition Stmt.h:2689
Expr * getCond()
Definition Stmt.h:2741
SourceLocation getWhileLoc() const
Definition Stmt.h:2794
SourceLocation getRParenLoc() const
Definition Stmt.h:2799
DeclStmt * getConditionVariableDeclStmt()
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Definition Stmt.h:2777
SourceLocation getLParenLoc() const
Definition Stmt.h:2797
Stmt * getBody()
Definition Stmt.h:2753
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_UNRESOLVED_SYCL_KERNEL_CALL
An UnresolvedSYCLKernelCallStmt 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.
@ EXPR_MATRIX_ELEMENT
A MatrixElementExpr 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:2266
bool isTypeAwareAllocation(TypeAwareAllocationMode Mode)
Definition ExprCXX.h:2254
@ 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:2308
TypeAwareAllocationMode PassTypeIdentity
Definition ExprCXX.h:2307
Expr * CounterUpdate
Updater for the internal counter: ++CounterVD;.
Definition ExprOpenMP.h:121
Expr * Upper
Normalized upper bound.
Definition ExprOpenMP.h:116
Expr * Update
Update expression for the originally specified iteration variable, calculated as VD = Begin + Counter...
Definition ExprOpenMP.h:119
VarDecl * CounterVD
Internal normalized counter.
Definition ExprOpenMP.h:113
Expr * Value
The value of the dictionary element.
Definition ExprObjC.h:265
SourceLocation EllipsisLoc
The location of the ellipsis, if this is a pack expansion.
Definition ExprObjC.h:268
UnsignedOrNone NumExpansions
The number of elements this pack expansion will expand to, if this is a pack expansion and is known.
Definition ExprObjC.h:272
Expr * Key
The key for the dictionary element.
Definition ExprObjC.h:262
constexpr unsigned toInternalRepresentation() const