clang 19.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"
21#include "clang/Lex/Token.h"
22#include "clang/Sema/DeclSpec.h"
24#include "llvm/Bitstream/BitstreamWriter.h"
25using namespace clang;
26
27//===----------------------------------------------------------------------===//
28// Statement/expression serialization
29//===----------------------------------------------------------------------===//
30
31namespace clang {
32
33 class ASTStmtWriter : public StmtVisitor<ASTStmtWriter, void> {
34 ASTWriter &Writer;
35 ASTRecordWriter Record;
36
38 unsigned AbbrevToUse;
39
40 /// A helper that can help us to write a packed bit across function
41 /// calls. For example, we may write seperate bits in seperate functions:
42 ///
43 /// void VisitA(A* a) {
44 /// Record.push_back(a->isSomething());
45 /// }
46 ///
47 /// void Visitb(B *b) {
48 /// VisitA(b);
49 /// Record.push_back(b->isAnother());
50 /// }
51 ///
52 /// In such cases, it'll be better if we can pack these 2 bits. We achieve
53 /// this by writing a zero value in `VisitA` and recorded that first and add
54 /// the new bit to the recorded value.
55 class PakedBitsWriter {
56 public:
57 PakedBitsWriter(ASTRecordWriter &Record) : RecordRef(Record) {}
58 ~PakedBitsWriter() { assert(!CurrentIndex); }
59
60 void addBit(bool Value) {
61 assert(CurrentIndex && "Writing Bits without recording first!");
62 PackingBits.addBit(Value);
63 }
64 void addBits(uint32_t Value, uint32_t BitsWidth) {
65 assert(CurrentIndex && "Writing Bits without recording first!");
66 PackingBits.addBits(Value, BitsWidth);
67 }
68
69 void writeBits() {
70 if (!CurrentIndex)
71 return;
72
73 RecordRef[*CurrentIndex] = (uint32_t)PackingBits;
74 CurrentIndex = std::nullopt;
75 PackingBits.reset(0);
76 }
77
78 void updateBits() {
79 writeBits();
80
81 CurrentIndex = RecordRef.size();
82 RecordRef.push_back(0);
83 }
84
85 private:
86 BitsPacker PackingBits;
87 ASTRecordWriter &RecordRef;
88 std::optional<unsigned> CurrentIndex;
89 };
90
91 PakedBitsWriter CurrentPackingBits;
92
93 public:
95 : Writer(Writer), Record(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
129}
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::VisitContinueStmt(ContinueStmt *S) {
314 VisitStmt(S);
315 Record.AddSourceLocation(S->getContinueLoc());
317}
318
319void ASTStmtWriter::VisitBreakStmt(BreakStmt *S) {
320 VisitStmt(S);
321 Record.AddSourceLocation(S->getBreakLoc());
323}
324
325void ASTStmtWriter::VisitReturnStmt(ReturnStmt *S) {
326 VisitStmt(S);
327
328 bool HasNRVOCandidate = S->getNRVOCandidate() != nullptr;
329 Record.push_back(HasNRVOCandidate);
330
331 Record.AddStmt(S->getRetValue());
332 if (HasNRVOCandidate)
333 Record.AddDeclRef(S->getNRVOCandidate());
334
335 Record.AddSourceLocation(S->getReturnLoc());
337}
338
339void ASTStmtWriter::VisitDeclStmt(DeclStmt *S) {
340 VisitStmt(S);
341 Record.AddSourceLocation(S->getBeginLoc());
342 Record.AddSourceLocation(S->getEndLoc());
343 DeclGroupRef DG = S->getDeclGroup();
344 for (DeclGroupRef::iterator D = DG.begin(), DEnd = DG.end(); D != DEnd; ++D)
345 Record.AddDeclRef(*D);
347}
348
349void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) {
350 VisitStmt(S);
351 Record.push_back(S->getNumOutputs());
352 Record.push_back(S->getNumInputs());
353 Record.push_back(S->getNumClobbers());
354 Record.AddSourceLocation(S->getAsmLoc());
355 Record.push_back(S->isVolatile());
356 Record.push_back(S->isSimple());
357}
358
359void ASTStmtWriter::VisitGCCAsmStmt(GCCAsmStmt *S) {
360 VisitAsmStmt(S);
361 Record.push_back(S->getNumLabels());
362 Record.AddSourceLocation(S->getRParenLoc());
363 Record.AddStmt(S->getAsmString());
364
365 // Outputs
366 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
367 Record.AddIdentifierRef(S->getOutputIdentifier(I));
368 Record.AddStmt(S->getOutputConstraintLiteral(I));
369 Record.AddStmt(S->getOutputExpr(I));
370 }
371
372 // Inputs
373 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
374 Record.AddIdentifierRef(S->getInputIdentifier(I));
375 Record.AddStmt(S->getInputConstraintLiteral(I));
376 Record.AddStmt(S->getInputExpr(I));
377 }
378
379 // Clobbers
380 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
381 Record.AddStmt(S->getClobberStringLiteral(I));
382
383 // Labels
384 for (unsigned I = 0, N = S->getNumLabels(); I != N; ++I) {
385 Record.AddIdentifierRef(S->getLabelIdentifier(I));
386 Record.AddStmt(S->getLabelExpr(I));
387 }
388
390}
391
392void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) {
393 VisitAsmStmt(S);
394 Record.AddSourceLocation(S->getLBraceLoc());
395 Record.AddSourceLocation(S->getEndLoc());
396 Record.push_back(S->getNumAsmToks());
397 Record.AddString(S->getAsmString());
398
399 // Tokens
400 for (unsigned I = 0, N = S->getNumAsmToks(); I != N; ++I) {
401 // FIXME: Move this to ASTRecordWriter?
402 Writer.AddToken(S->getAsmToks()[I], Record.getRecordData());
403 }
404
405 // Clobbers
406 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) {
407 Record.AddString(S->getClobber(I));
408 }
409
410 // Outputs
411 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
412 Record.AddStmt(S->getOutputExpr(I));
413 Record.AddString(S->getOutputConstraint(I));
414 }
415
416 // Inputs
417 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
418 Record.AddStmt(S->getInputExpr(I));
419 Record.AddString(S->getInputConstraint(I));
420 }
421
423}
424
425void ASTStmtWriter::VisitCoroutineBodyStmt(CoroutineBodyStmt *CoroStmt) {
426 VisitStmt(CoroStmt);
427 Record.push_back(CoroStmt->getParamMoves().size());
428 for (Stmt *S : CoroStmt->children())
429 Record.AddStmt(S);
431}
432
433void ASTStmtWriter::VisitCoreturnStmt(CoreturnStmt *S) {
434 VisitStmt(S);
435 Record.AddSourceLocation(S->getKeywordLoc());
436 Record.AddStmt(S->getOperand());
437 Record.AddStmt(S->getPromiseCall());
438 Record.push_back(S->isImplicit());
440}
441
442void ASTStmtWriter::VisitCoroutineSuspendExpr(CoroutineSuspendExpr *E) {
443 VisitExpr(E);
444 Record.AddSourceLocation(E->getKeywordLoc());
445 for (Stmt *S : E->children())
446 Record.AddStmt(S);
447 Record.AddStmt(E->getOpaqueValue());
448}
449
450void ASTStmtWriter::VisitCoawaitExpr(CoawaitExpr *E) {
451 VisitCoroutineSuspendExpr(E);
452 Record.push_back(E->isImplicit());
454}
455
456void ASTStmtWriter::VisitCoyieldExpr(CoyieldExpr *E) {
457 VisitCoroutineSuspendExpr(E);
459}
460
461void ASTStmtWriter::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
462 VisitExpr(E);
463 Record.AddSourceLocation(E->getKeywordLoc());
464 for (Stmt *S : E->children())
465 Record.AddStmt(S);
467}
468
469static void
471 const ASTConstraintSatisfaction &Satisfaction) {
472 Record.push_back(Satisfaction.IsSatisfied);
473 Record.push_back(Satisfaction.ContainsErrors);
474 if (!Satisfaction.IsSatisfied) {
475 Record.push_back(Satisfaction.NumRecords);
476 for (const auto &DetailRecord : Satisfaction) {
477 Record.AddStmt(const_cast<Expr *>(DetailRecord.first));
478 auto *E = DetailRecord.second.dyn_cast<Expr *>();
479 Record.push_back(E == nullptr);
480 if (E)
481 Record.AddStmt(E);
482 else {
483 auto *Diag = DetailRecord.second.get<std::pair<SourceLocation,
484 StringRef> *>();
485 Record.AddSourceLocation(Diag->first);
486 Record.AddString(Diag->second);
487 }
488 }
489 }
490}
491
492static void
494 ASTRecordWriter &Record,
496 Record.AddString(D->SubstitutedEntity);
497 Record.AddSourceLocation(D->DiagLoc);
498 Record.AddString(D->DiagMessage);
499}
500
501void ASTStmtWriter::VisitConceptSpecializationExpr(
503 VisitExpr(E);
505 const ConceptReference *CR = E->getConceptReference();
506 Record.push_back(CR != nullptr);
507 if (CR)
508 Record.AddConceptReference(CR);
509 if (!E->isValueDependent())
511
513}
514
515void ASTStmtWriter::VisitRequiresExpr(RequiresExpr *E) {
516 VisitExpr(E);
517 Record.push_back(E->getLocalParameters().size());
518 Record.push_back(E->getRequirements().size());
519 Record.AddSourceLocation(E->RequiresExprBits.RequiresKWLoc);
520 Record.push_back(E->RequiresExprBits.IsSatisfied);
521 Record.AddDeclRef(E->getBody());
522 for (ParmVarDecl *P : E->getLocalParameters())
523 Record.AddDeclRef(P);
524 for (concepts::Requirement *R : E->getRequirements()) {
525 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(R)) {
527 Record.push_back(TypeReq->Status);
529 addSubstitutionDiagnostic(Record, TypeReq->getSubstitutionDiagnostic());
530 else
531 Record.AddTypeSourceInfo(TypeReq->getType());
532 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(R)) {
533 Record.push_back(ExprReq->getKind());
534 Record.push_back(ExprReq->Status);
535 if (ExprReq->isExprSubstitutionFailure()) {
537 ExprReq->Value.get<concepts::Requirement::SubstitutionDiagnostic *>());
538 } else
539 Record.AddStmt(ExprReq->Value.get<Expr *>());
540 if (ExprReq->getKind() == concepts::Requirement::RK_Compound) {
541 Record.AddSourceLocation(ExprReq->NoexceptLoc);
542 const auto &RetReq = ExprReq->getReturnTypeRequirement();
543 if (RetReq.isSubstitutionFailure()) {
544 Record.push_back(2);
545 addSubstitutionDiagnostic(Record, RetReq.getSubstitutionDiagnostic());
546 } else if (RetReq.isTypeConstraint()) {
547 Record.push_back(1);
549 RetReq.getTypeConstraintTemplateParameterList());
550 if (ExprReq->Status >=
552 Record.AddStmt(
553 ExprReq->getReturnTypeRequirementSubstitutedConstraintExpr());
554 } else {
555 assert(RetReq.isEmpty());
556 Record.push_back(0);
557 }
558 }
559 } else {
560 auto *NestedReq = cast<concepts::NestedRequirement>(R);
562 Record.push_back(NestedReq->hasInvalidConstraint());
563 if (NestedReq->hasInvalidConstraint()) {
564 Record.AddString(NestedReq->getInvalidConstraintEntity());
565 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
566 } else {
567 Record.AddStmt(NestedReq->getConstraintExpr());
568 if (!NestedReq->isDependent())
569 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
570 }
571 }
572 }
573 Record.AddSourceLocation(E->getLParenLoc());
574 Record.AddSourceLocation(E->getRParenLoc());
575 Record.AddSourceLocation(E->getEndLoc());
576
578}
579
580
581void ASTStmtWriter::VisitCapturedStmt(CapturedStmt *S) {
582 VisitStmt(S);
583 // NumCaptures
584 Record.push_back(std::distance(S->capture_begin(), S->capture_end()));
585
586 // CapturedDecl and captured region kind
587 Record.AddDeclRef(S->getCapturedDecl());
588 Record.push_back(S->getCapturedRegionKind());
589
590 Record.AddDeclRef(S->getCapturedRecordDecl());
591
592 // Capture inits
593 for (auto *I : S->capture_inits())
594 Record.AddStmt(I);
595
596 // Body
597 Record.AddStmt(S->getCapturedStmt());
598
599 // Captures
600 for (const auto &I : S->captures()) {
601 if (I.capturesThis() || I.capturesVariableArrayType())
602 Record.AddDeclRef(nullptr);
603 else
604 Record.AddDeclRef(I.getCapturedVar());
605 Record.push_back(I.getCaptureKind());
606 Record.AddSourceLocation(I.getLocation());
607 }
608
610}
611
612void ASTStmtWriter::VisitExpr(Expr *E) {
613 VisitStmt(E);
614
615 CurrentPackingBits.updateBits();
616 CurrentPackingBits.addBits(E->getDependence(), /*BitsWidth=*/5);
617 CurrentPackingBits.addBits(E->getValueKind(), /*BitsWidth=*/2);
618 CurrentPackingBits.addBits(E->getObjectKind(), /*BitsWidth=*/3);
619
620 Record.AddTypeRef(E->getType());
621}
622
623void ASTStmtWriter::VisitConstantExpr(ConstantExpr *E) {
624 VisitExpr(E);
625 Record.push_back(E->ConstantExprBits.ResultKind);
626
627 Record.push_back(E->ConstantExprBits.APValueKind);
628 Record.push_back(E->ConstantExprBits.IsUnsigned);
629 Record.push_back(E->ConstantExprBits.BitWidth);
630 // HasCleanup not serialized since we can just query the APValue.
631 Record.push_back(E->ConstantExprBits.IsImmediateInvocation);
632
633 switch (E->getResultStorageKind()) {
635 break;
637 Record.push_back(E->Int64Result());
638 break;
640 Record.AddAPValue(E->APValueResult());
641 break;
642 }
643
644 Record.AddStmt(E->getSubExpr());
646}
647
648void ASTStmtWriter::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *E) {
649 VisitExpr(E);
650
651 Record.AddSourceLocation(E->getLocation());
655
657}
658
659void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
660 VisitExpr(E);
661
662 bool HasFunctionName = E->getFunctionName() != nullptr;
663 Record.push_back(HasFunctionName);
664 Record.push_back(
665 llvm::to_underlying(E->getIdentKind())); // FIXME: stable encoding
666 Record.push_back(E->isTransparent());
667 Record.AddSourceLocation(E->getLocation());
668 if (HasFunctionName)
669 Record.AddStmt(E->getFunctionName());
671}
672
673void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
674 VisitExpr(E);
675
676 CurrentPackingBits.updateBits();
677
678 CurrentPackingBits.addBit(E->hadMultipleCandidates());
679 CurrentPackingBits.addBit(E->refersToEnclosingVariableOrCapture());
680 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
681 CurrentPackingBits.addBit(E->isImmediateEscalating());
682 CurrentPackingBits.addBit(E->getDecl() != E->getFoundDecl());
683 CurrentPackingBits.addBit(E->hasQualifier());
684 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
685
686 if (E->hasTemplateKWAndArgsInfo()) {
687 unsigned NumTemplateArgs = E->getNumTemplateArgs();
688 Record.push_back(NumTemplateArgs);
689 }
690
692
693 if ((!E->hasTemplateKWAndArgsInfo()) && (!E->hasQualifier()) &&
694 (E->getDecl() == E->getFoundDecl()) &&
696 AbbrevToUse = Writer.getDeclRefExprAbbrev();
697 }
698
699 if (E->hasQualifier())
701
702 if (E->getDecl() != E->getFoundDecl())
703 Record.AddDeclRef(E->getFoundDecl());
704
706 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
707 E->getTrailingObjects<TemplateArgumentLoc>());
708
709 Record.AddDeclRef(E->getDecl());
710 Record.AddSourceLocation(E->getLocation());
711 Record.AddDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
713}
714
715void ASTStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
716 VisitExpr(E);
717 Record.AddSourceLocation(E->getLocation());
718 Record.AddAPInt(E->getValue());
719
720 if (E->getValue().getBitWidth() == 32) {
721 AbbrevToUse = Writer.getIntegerLiteralAbbrev();
722 }
723
725}
726
727void ASTStmtWriter::VisitFixedPointLiteral(FixedPointLiteral *E) {
728 VisitExpr(E);
729 Record.AddSourceLocation(E->getLocation());
730 Record.push_back(E->getScale());
731 Record.AddAPInt(E->getValue());
733}
734
735void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
736 VisitExpr(E);
737 Record.push_back(E->getRawSemantics());
738 Record.push_back(E->isExact());
739 Record.AddAPFloat(E->getValue());
740 Record.AddSourceLocation(E->getLocation());
742}
743
744void ASTStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
745 VisitExpr(E);
746 Record.AddStmt(E->getSubExpr());
748}
749
750void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
751 VisitExpr(E);
752
753 // Store the various bits of data of StringLiteral.
754 Record.push_back(E->getNumConcatenated());
755 Record.push_back(E->getLength());
756 Record.push_back(E->getCharByteWidth());
757 Record.push_back(llvm::to_underlying(E->getKind()));
758 Record.push_back(E->isPascal());
759
760 // Store the trailing array of SourceLocation.
761 for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
762 Record.AddSourceLocation(E->getStrTokenLoc(I));
763
764 // Store the trailing array of char holding the string data.
765 StringRef StrData = E->getBytes();
766 for (unsigned I = 0, N = E->getByteLength(); I != N; ++I)
767 Record.push_back(StrData[I]);
768
770}
771
772void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
773 VisitExpr(E);
774 Record.push_back(E->getValue());
775 Record.AddSourceLocation(E->getLocation());
776 Record.push_back(llvm::to_underlying(E->getKind()));
777
778 AbbrevToUse = Writer.getCharacterLiteralAbbrev();
779
781}
782
783void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
784 VisitExpr(E);
785 Record.AddSourceLocation(E->getLParen());
786 Record.AddSourceLocation(E->getRParen());
787 Record.AddStmt(E->getSubExpr());
789}
790
791void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
792 VisitExpr(E);
793 Record.push_back(E->getNumExprs());
794 for (auto *SubStmt : E->exprs())
795 Record.AddStmt(SubStmt);
796 Record.AddSourceLocation(E->getLParenLoc());
797 Record.AddSourceLocation(E->getRParenLoc());
799}
800
801void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
802 VisitExpr(E);
803 bool HasFPFeatures = E->hasStoredFPFeatures();
804 // Write this first for easy access when deserializing, as they affect the
805 // size of the UnaryOperator.
806 CurrentPackingBits.addBit(HasFPFeatures);
807 Record.AddStmt(E->getSubExpr());
808 CurrentPackingBits.addBits(E->getOpcode(),
809 /*Width=*/5); // FIXME: stable encoding
811 CurrentPackingBits.addBit(E->canOverflow());
812
813 if (HasFPFeatures)
816}
817
818void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
819 VisitExpr(E);
820 Record.push_back(E->getNumComponents());
821 Record.push_back(E->getNumExpressions());
823 Record.AddSourceLocation(E->getRParenLoc());
825 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
826 const OffsetOfNode &ON = E->getComponent(I);
827 Record.push_back(ON.getKind()); // FIXME: Stable encoding
830 switch (ON.getKind()) {
832 Record.push_back(ON.getArrayExprIndex());
833 break;
834
836 Record.AddDeclRef(ON.getField());
837 break;
838
840 Record.AddIdentifierRef(ON.getFieldName());
841 break;
842
844 Record.AddCXXBaseSpecifier(*ON.getBase());
845 break;
846 }
847 }
848 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
849 Record.AddStmt(E->getIndexExpr(I));
851}
852
853void ASTStmtWriter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
854 VisitExpr(E);
855 Record.push_back(E->getKind());
856 if (E->isArgumentType())
858 else {
859 Record.push_back(0);
860 Record.AddStmt(E->getArgumentExpr());
861 }
863 Record.AddSourceLocation(E->getRParenLoc());
865}
866
867void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
868 VisitExpr(E);
869 Record.AddStmt(E->getLHS());
870 Record.AddStmt(E->getRHS());
873}
874
875void ASTStmtWriter::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
876 VisitExpr(E);
877 Record.AddStmt(E->getBase());
878 Record.AddStmt(E->getRowIdx());
879 Record.AddStmt(E->getColumnIdx());
882}
883
884void ASTStmtWriter::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) {
885 VisitExpr(E);
886 Record.AddStmt(E->getBase());
887 Record.AddStmt(E->getLowerBound());
888 Record.AddStmt(E->getLength());
889 Record.AddStmt(E->getStride());
894}
895
896void ASTStmtWriter::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
897 VisitExpr(E);
898 Record.push_back(E->getDimensions().size());
899 Record.AddStmt(E->getBase());
900 for (Expr *Dim : E->getDimensions())
901 Record.AddStmt(Dim);
902 for (SourceRange SR : E->getBracketsRanges())
903 Record.AddSourceRange(SR);
904 Record.AddSourceLocation(E->getLParenLoc());
905 Record.AddSourceLocation(E->getRParenLoc());
907}
908
909void ASTStmtWriter::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
910 VisitExpr(E);
911 Record.push_back(E->numOfIterators());
913 Record.AddSourceLocation(E->getLParenLoc());
914 Record.AddSourceLocation(E->getRParenLoc());
915 for (unsigned I = 0, End = E->numOfIterators(); I < End; ++I) {
916 Record.AddDeclRef(E->getIteratorDecl(I));
917 Record.AddSourceLocation(E->getAssignLoc(I));
919 Record.AddStmt(Range.Begin);
920 Record.AddStmt(Range.End);
921 Record.AddStmt(Range.Step);
922 Record.AddSourceLocation(E->getColonLoc(I));
923 if (Range.Step)
925 // Serialize helpers
927 Record.AddDeclRef(HD.CounterVD);
928 Record.AddStmt(HD.Upper);
929 Record.AddStmt(HD.Update);
930 Record.AddStmt(HD.CounterUpdate);
931 }
933}
934
935void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
936 VisitExpr(E);
937
938 Record.push_back(E->getNumArgs());
939 CurrentPackingBits.updateBits();
940 CurrentPackingBits.addBit(static_cast<bool>(E->getADLCallKind()));
941 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
942
943 Record.AddSourceLocation(E->getRParenLoc());
944 Record.AddStmt(E->getCallee());
945 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
946 Arg != ArgEnd; ++Arg)
947 Record.AddStmt(*Arg);
948
949 if (E->hasStoredFPFeatures())
951
952 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
953 E->getStmtClass() == Stmt::CallExprClass)
954 AbbrevToUse = Writer.getCallExprAbbrev();
955
957}
958
959void ASTStmtWriter::VisitRecoveryExpr(RecoveryExpr *E) {
960 VisitExpr(E);
961 Record.push_back(std::distance(E->children().begin(), E->children().end()));
962 Record.AddSourceLocation(E->getBeginLoc());
963 Record.AddSourceLocation(E->getEndLoc());
964 for (Stmt *Child : E->children())
965 Record.AddStmt(Child);
967}
968
969void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
970 VisitExpr(E);
971
972 bool HasQualifier = E->hasQualifier();
973 bool HasFoundDecl =
974 E->hasQualifierOrFoundDecl() &&
975 (E->getFoundDecl().getDecl() != E->getMemberDecl() ||
977 bool HasTemplateInfo = E->hasTemplateKWAndArgsInfo();
978 unsigned NumTemplateArgs = E->getNumTemplateArgs();
979
980 // Write these first for easy access when deserializing, as they affect the
981 // size of the MemberExpr.
982 CurrentPackingBits.updateBits();
983 CurrentPackingBits.addBit(HasQualifier);
984 CurrentPackingBits.addBit(HasFoundDecl);
985 CurrentPackingBits.addBit(HasTemplateInfo);
986 Record.push_back(NumTemplateArgs);
987
988 Record.AddStmt(E->getBase());
989 Record.AddDeclRef(E->getMemberDecl());
990 Record.AddDeclarationNameLoc(E->MemberDNLoc,
991 E->getMemberDecl()->getDeclName());
992 Record.AddSourceLocation(E->getMemberLoc());
993 CurrentPackingBits.addBit(E->isArrow());
994 CurrentPackingBits.addBit(E->hadMultipleCandidates());
995 CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
997
998 if (HasFoundDecl) {
999 DeclAccessPair FoundDecl = E->getFoundDecl();
1000 Record.AddDeclRef(FoundDecl.getDecl());
1001 CurrentPackingBits.addBits(FoundDecl.getAccess(), /*BitWidth=*/2);
1002 }
1003
1004 if (HasQualifier)
1006
1007 if (HasTemplateInfo)
1008 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1009 E->getTrailingObjects<TemplateArgumentLoc>());
1010
1012}
1013
1014void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
1015 VisitExpr(E);
1016 Record.AddStmt(E->getBase());
1018 Record.AddSourceLocation(E->getOpLoc());
1019 Record.push_back(E->isArrow());
1021}
1022
1023void ASTStmtWriter::
1024VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
1025 VisitExpr(E);
1026 Record.AddStmt(E->getSubExpr());
1027 Record.push_back(E->shouldCopy());
1029}
1030
1031void ASTStmtWriter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
1032 VisitExplicitCastExpr(E);
1033 Record.AddSourceLocation(E->getLParenLoc());
1035 Record.push_back(E->getBridgeKind()); // FIXME: Stable encoding
1037}
1038
1039void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
1040 VisitExpr(E);
1041
1042 Record.push_back(E->path_size());
1043 CurrentPackingBits.updateBits();
1044 // 7 bits should be enough to store the casting kinds.
1045 CurrentPackingBits.addBits(E->getCastKind(), /*Width=*/7);
1046 CurrentPackingBits.addBit(E->hasStoredFPFeatures());
1047 Record.AddStmt(E->getSubExpr());
1048
1050 PI = E->path_begin(), PE = E->path_end(); PI != PE; ++PI)
1051 Record.AddCXXBaseSpecifier(**PI);
1052
1053 if (E->hasStoredFPFeatures())
1054 Record.push_back(E->getFPFeatures().getAsOpaqueInt());
1055}
1056
1057void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
1058 VisitExpr(E);
1059
1060 // Write this first for easy access when deserializing, as they affect the
1061 // size of the UnaryOperator.
1062 CurrentPackingBits.updateBits();
1063 CurrentPackingBits.addBits(E->getOpcode(), /*Width=*/6);
1064 bool HasFPFeatures = E->hasStoredFPFeatures();
1065 CurrentPackingBits.addBit(HasFPFeatures);
1066 Record.AddStmt(E->getLHS());
1067 Record.AddStmt(E->getRHS());
1068 Record.AddSourceLocation(E->getOperatorLoc());
1069 if (HasFPFeatures)
1071
1072 if (!HasFPFeatures && E->getValueKind() == VK_PRValue &&
1073 E->getObjectKind() == OK_Ordinary)
1074 AbbrevToUse = Writer.getBinaryOperatorAbbrev();
1075
1077}
1078
1079void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
1080 VisitBinaryOperator(E);
1081 Record.AddTypeRef(E->getComputationLHSType());
1083
1084 if (!E->hasStoredFPFeatures() && E->getValueKind() == VK_PRValue &&
1085 E->getObjectKind() == OK_Ordinary)
1086 AbbrevToUse = Writer.getCompoundAssignOperatorAbbrev();
1087
1089}
1090
1091void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
1092 VisitExpr(E);
1093 Record.AddStmt(E->getCond());
1094 Record.AddStmt(E->getLHS());
1095 Record.AddStmt(E->getRHS());
1096 Record.AddSourceLocation(E->getQuestionLoc());
1097 Record.AddSourceLocation(E->getColonLoc());
1099}
1100
1101void
1102ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1103 VisitExpr(E);
1104 Record.AddStmt(E->getOpaqueValue());
1105 Record.AddStmt(E->getCommon());
1106 Record.AddStmt(E->getCond());
1107 Record.AddStmt(E->getTrueExpr());
1108 Record.AddStmt(E->getFalseExpr());
1109 Record.AddSourceLocation(E->getQuestionLoc());
1110 Record.AddSourceLocation(E->getColonLoc());
1112}
1113
1114void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1115 VisitCastExpr(E);
1116 CurrentPackingBits.addBit(E->isPartOfExplicitCast());
1117
1118 if (E->path_size() == 0 && !E->hasStoredFPFeatures())
1119 AbbrevToUse = Writer.getExprImplicitCastAbbrev();
1120
1122}
1123
1124void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1125 VisitCastExpr(E);
1127}
1128
1129void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
1130 VisitExplicitCastExpr(E);
1131 Record.AddSourceLocation(E->getLParenLoc());
1132 Record.AddSourceLocation(E->getRParenLoc());
1134}
1135
1136void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1137 VisitExpr(E);
1138 Record.AddSourceLocation(E->getLParenLoc());
1140 Record.AddStmt(E->getInitializer());
1141 Record.push_back(E->isFileScope());
1143}
1144
1145void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1146 VisitExpr(E);
1147 Record.AddStmt(E->getBase());
1148 Record.AddIdentifierRef(&E->getAccessor());
1149 Record.AddSourceLocation(E->getAccessorLoc());
1151}
1152
1153void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
1154 VisitExpr(E);
1155 // NOTE: only add the (possibly null) syntactic form.
1156 // No need to serialize the isSemanticForm flag and the semantic form.
1157 Record.AddStmt(E->getSyntacticForm());
1158 Record.AddSourceLocation(E->getLBraceLoc());
1159 Record.AddSourceLocation(E->getRBraceLoc());
1160 bool isArrayFiller = E->ArrayFillerOrUnionFieldInit.is<Expr*>();
1161 Record.push_back(isArrayFiller);
1162 if (isArrayFiller)
1163 Record.AddStmt(E->getArrayFiller());
1164 else
1167 Record.push_back(E->getNumInits());
1168 if (isArrayFiller) {
1169 // ArrayFiller may have filled "holes" due to designated initializer.
1170 // Replace them by 0 to indicate that the filler goes in that place.
1171 Expr *filler = E->getArrayFiller();
1172 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1173 Record.AddStmt(E->getInit(I) != filler ? E->getInit(I) : nullptr);
1174 } else {
1175 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1176 Record.AddStmt(E->getInit(I));
1177 }
1179}
1180
1181void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1182 VisitExpr(E);
1183 Record.push_back(E->getNumSubExprs());
1184 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1185 Record.AddStmt(E->getSubExpr(I));
1187 Record.push_back(E->usesGNUSyntax());
1188 for (const DesignatedInitExpr::Designator &D : E->designators()) {
1189 if (D.isFieldDesignator()) {
1190 if (FieldDecl *Field = D.getFieldDecl()) {
1192 Record.AddDeclRef(Field);
1193 } else {
1195 Record.AddIdentifierRef(D.getFieldName());
1196 }
1197 Record.AddSourceLocation(D.getDotLoc());
1198 Record.AddSourceLocation(D.getFieldLoc());
1199 } else if (D.isArrayDesignator()) {
1201 Record.push_back(D.getArrayIndex());
1202 Record.AddSourceLocation(D.getLBracketLoc());
1203 Record.AddSourceLocation(D.getRBracketLoc());
1204 } else {
1205 assert(D.isArrayRangeDesignator() && "Unknown designator");
1207 Record.push_back(D.getArrayIndex());
1208 Record.AddSourceLocation(D.getLBracketLoc());
1209 Record.AddSourceLocation(D.getEllipsisLoc());
1210 Record.AddSourceLocation(D.getRBracketLoc());
1211 }
1212 }
1214}
1215
1216void ASTStmtWriter::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1217 VisitExpr(E);
1218 Record.AddStmt(E->getBase());
1219 Record.AddStmt(E->getUpdater());
1221}
1222
1223void ASTStmtWriter::VisitNoInitExpr(NoInitExpr *E) {
1224 VisitExpr(E);
1226}
1227
1228void ASTStmtWriter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1229 VisitExpr(E);
1230 Record.AddStmt(E->SubExprs[0]);
1231 Record.AddStmt(E->SubExprs[1]);
1233}
1234
1235void ASTStmtWriter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1236 VisitExpr(E);
1238}
1239
1240void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1241 VisitExpr(E);
1243}
1244
1245void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
1246 VisitExpr(E);
1247 Record.AddStmt(E->getSubExpr());
1249 Record.AddSourceLocation(E->getBuiltinLoc());
1250 Record.AddSourceLocation(E->getRParenLoc());
1251 Record.push_back(E->isMicrosoftABI());
1253}
1254
1255void ASTStmtWriter::VisitSourceLocExpr(SourceLocExpr *E) {
1256 VisitExpr(E);
1257 Record.AddDeclRef(cast_or_null<Decl>(E->getParentContext()));
1258 Record.AddSourceLocation(E->getBeginLoc());
1259 Record.AddSourceLocation(E->getEndLoc());
1260 Record.push_back(llvm::to_underlying(E->getIdentKind()));
1262}
1263
1264void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
1265 VisitExpr(E);
1266 Record.AddSourceLocation(E->getAmpAmpLoc());
1267 Record.AddSourceLocation(E->getLabelLoc());
1268 Record.AddDeclRef(E->getLabel());
1270}
1271
1272void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
1273 VisitExpr(E);
1274 Record.AddStmt(E->getSubStmt());
1275 Record.AddSourceLocation(E->getLParenLoc());
1276 Record.AddSourceLocation(E->getRParenLoc());
1277 Record.push_back(E->getTemplateDepth());
1279}
1280
1281void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
1282 VisitExpr(E);
1283 Record.AddStmt(E->getCond());
1284 Record.AddStmt(E->getLHS());
1285 Record.AddStmt(E->getRHS());
1286 Record.AddSourceLocation(E->getBuiltinLoc());
1287 Record.AddSourceLocation(E->getRParenLoc());
1288 Record.push_back(E->isConditionDependent() ? false : E->isConditionTrue());
1290}
1291
1292void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
1293 VisitExpr(E);
1296}
1297
1298void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1299 VisitExpr(E);
1300 Record.push_back(E->getNumSubExprs());
1301 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1302 Record.AddStmt(E->getExpr(I));
1303 Record.AddSourceLocation(E->getBuiltinLoc());
1304 Record.AddSourceLocation(E->getRParenLoc());
1306}
1307
1308void ASTStmtWriter::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1309 VisitExpr(E);
1310 Record.AddSourceLocation(E->getBuiltinLoc());
1311 Record.AddSourceLocation(E->getRParenLoc());
1313 Record.AddStmt(E->getSrcExpr());
1315}
1316
1317void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
1318 VisitExpr(E);
1319 Record.AddDeclRef(E->getBlockDecl());
1321}
1322
1323void ASTStmtWriter::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1324 VisitExpr(E);
1325
1326 Record.push_back(E->getNumAssocs());
1327 Record.push_back(E->isExprPredicate());
1328 Record.push_back(E->ResultIndex);
1329 Record.AddSourceLocation(E->getGenericLoc());
1330 Record.AddSourceLocation(E->getDefaultLoc());
1331 Record.AddSourceLocation(E->getRParenLoc());
1332
1333 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1334 // Add 1 to account for the controlling expression which is the first
1335 // expression in the trailing array of Stmt *. This is not needed for
1336 // the trailing array of TypeSourceInfo *.
1337 for (unsigned I = 0, N = E->getNumAssocs() + 1; I < N; ++I)
1338 Record.AddStmt(Stmts[I]);
1339
1340 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1341 for (unsigned I = 0, N = E->getNumAssocs(); I < N; ++I)
1342 Record.AddTypeSourceInfo(TSIs[I]);
1343
1345}
1346
1347void ASTStmtWriter::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1348 VisitExpr(E);
1349 Record.push_back(E->getNumSemanticExprs());
1350
1351 // Push the result index. Currently, this needs to exactly match
1352 // the encoding used internally for ResultIndex.
1353 unsigned result = E->getResultExprIndex();
1354 result = (result == PseudoObjectExpr::NoResult ? 0 : result + 1);
1355 Record.push_back(result);
1356
1357 Record.AddStmt(E->getSyntacticForm());
1359 i = E->semantics_begin(), e = E->semantics_end(); i != e; ++i) {
1360 Record.AddStmt(*i);
1361 }
1363}
1364
1365void ASTStmtWriter::VisitAtomicExpr(AtomicExpr *E) {
1366 VisitExpr(E);
1367 Record.push_back(E->getOp());
1368 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1369 Record.AddStmt(E->getSubExprs()[I]);
1370 Record.AddSourceLocation(E->getBuiltinLoc());
1371 Record.AddSourceLocation(E->getRParenLoc());
1373}
1374
1375//===----------------------------------------------------------------------===//
1376// Objective-C Expressions and Statements.
1377//===----------------------------------------------------------------------===//
1378
1379void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1380 VisitExpr(E);
1381 Record.AddStmt(E->getString());
1382 Record.AddSourceLocation(E->getAtLoc());
1384}
1385
1386void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1387 VisitExpr(E);
1388 Record.AddStmt(E->getSubExpr());
1389 Record.AddDeclRef(E->getBoxingMethod());
1390 Record.AddSourceRange(E->getSourceRange());
1392}
1393
1394void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1395 VisitExpr(E);
1396 Record.push_back(E->getNumElements());
1397 for (unsigned i = 0; i < E->getNumElements(); i++)
1398 Record.AddStmt(E->getElement(i));
1400 Record.AddSourceRange(E->getSourceRange());
1402}
1403
1404void ASTStmtWriter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1405 VisitExpr(E);
1406 Record.push_back(E->getNumElements());
1407 Record.push_back(E->HasPackExpansions);
1408 for (unsigned i = 0; i < E->getNumElements(); i++) {
1410 Record.AddStmt(Element.Key);
1411 Record.AddStmt(Element.Value);
1412 if (E->HasPackExpansions) {
1413 Record.AddSourceLocation(Element.EllipsisLoc);
1414 unsigned NumExpansions = 0;
1415 if (Element.NumExpansions)
1416 NumExpansions = *Element.NumExpansions + 1;
1417 Record.push_back(NumExpansions);
1418 }
1419 }
1420
1422 Record.AddSourceRange(E->getSourceRange());
1424}
1425
1426void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1427 VisitExpr(E);
1429 Record.AddSourceLocation(E->getAtLoc());
1430 Record.AddSourceLocation(E->getRParenLoc());
1432}
1433
1434void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1435 VisitExpr(E);
1436 Record.AddSelectorRef(E->getSelector());
1437 Record.AddSourceLocation(E->getAtLoc());
1438 Record.AddSourceLocation(E->getRParenLoc());
1440}
1441
1442void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1443 VisitExpr(E);
1444 Record.AddDeclRef(E->getProtocol());
1445 Record.AddSourceLocation(E->getAtLoc());
1446 Record.AddSourceLocation(E->ProtoLoc);
1447 Record.AddSourceLocation(E->getRParenLoc());
1449}
1450
1451void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1452 VisitExpr(E);
1453 Record.AddDeclRef(E->getDecl());
1454 Record.AddSourceLocation(E->getLocation());
1455 Record.AddSourceLocation(E->getOpLoc());
1456 Record.AddStmt(E->getBase());
1457 Record.push_back(E->isArrow());
1458 Record.push_back(E->isFreeIvar());
1460}
1461
1462void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1463 VisitExpr(E);
1464 Record.push_back(E->SetterAndMethodRefFlags.getInt());
1465 Record.push_back(E->isImplicitProperty());
1466 if (E->isImplicitProperty()) {
1469 } else {
1470 Record.AddDeclRef(E->getExplicitProperty());
1471 }
1472 Record.AddSourceLocation(E->getLocation());
1474 if (E->isObjectReceiver()) {
1475 Record.push_back(0);
1476 Record.AddStmt(E->getBase());
1477 } else if (E->isSuperReceiver()) {
1478 Record.push_back(1);
1479 Record.AddTypeRef(E->getSuperReceiverType());
1480 } else {
1481 Record.push_back(2);
1482 Record.AddDeclRef(E->getClassReceiver());
1483 }
1484
1486}
1487
1488void ASTStmtWriter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1489 VisitExpr(E);
1490 Record.AddSourceLocation(E->getRBracket());
1491 Record.AddStmt(E->getBaseExpr());
1492 Record.AddStmt(E->getKeyExpr());
1493 Record.AddDeclRef(E->getAtIndexMethodDecl());
1494 Record.AddDeclRef(E->setAtIndexMethodDecl());
1495
1497}
1498
1499void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1500 VisitExpr(E);
1501 Record.push_back(E->getNumArgs());
1502 Record.push_back(E->getNumStoredSelLocs());
1503 Record.push_back(E->SelLocsKind);
1504 Record.push_back(E->isDelegateInitCall());
1505 Record.push_back(E->IsImplicit);
1506 Record.push_back((unsigned)E->getReceiverKind()); // FIXME: stable encoding
1507 switch (E->getReceiverKind()) {
1509 Record.AddStmt(E->getInstanceReceiver());
1510 break;
1511
1514 break;
1515
1518 Record.AddTypeRef(E->getSuperType());
1519 Record.AddSourceLocation(E->getSuperLoc());
1520 break;
1521 }
1522
1523 if (E->getMethodDecl()) {
1524 Record.push_back(1);
1525 Record.AddDeclRef(E->getMethodDecl());
1526 } else {
1527 Record.push_back(0);
1528 Record.AddSelectorRef(E->getSelector());
1529 }
1530
1531 Record.AddSourceLocation(E->getLeftLoc());
1532 Record.AddSourceLocation(E->getRightLoc());
1533
1534 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
1535 Arg != ArgEnd; ++Arg)
1536 Record.AddStmt(*Arg);
1537
1538 SourceLocation *Locs = E->getStoredSelLocs();
1539 for (unsigned i = 0, e = E->getNumStoredSelLocs(); i != e; ++i)
1540 Record.AddSourceLocation(Locs[i]);
1541
1543}
1544
1545void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1546 VisitStmt(S);
1547 Record.AddStmt(S->getElement());
1548 Record.AddStmt(S->getCollection());
1549 Record.AddStmt(S->getBody());
1550 Record.AddSourceLocation(S->getForLoc());
1551 Record.AddSourceLocation(S->getRParenLoc());
1553}
1554
1555void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1556 VisitStmt(S);
1557 Record.AddStmt(S->getCatchBody());
1558 Record.AddDeclRef(S->getCatchParamDecl());
1559 Record.AddSourceLocation(S->getAtCatchLoc());
1560 Record.AddSourceLocation(S->getRParenLoc());
1562}
1563
1564void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1565 VisitStmt(S);
1566 Record.AddStmt(S->getFinallyBody());
1567 Record.AddSourceLocation(S->getAtFinallyLoc());
1569}
1570
1571void ASTStmtWriter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1572 VisitStmt(S); // FIXME: no test coverage.
1573 Record.AddStmt(S->getSubStmt());
1574 Record.AddSourceLocation(S->getAtLoc());
1576}
1577
1578void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1579 VisitStmt(S);
1580 Record.push_back(S->getNumCatchStmts());
1581 Record.push_back(S->getFinallyStmt() != nullptr);
1582 Record.AddStmt(S->getTryBody());
1583 for (ObjCAtCatchStmt *C : S->catch_stmts())
1584 Record.AddStmt(C);
1585 if (S->getFinallyStmt())
1586 Record.AddStmt(S->getFinallyStmt());
1587 Record.AddSourceLocation(S->getAtTryLoc());
1589}
1590
1591void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1592 VisitStmt(S); // FIXME: no test coverage.
1593 Record.AddStmt(S->getSynchExpr());
1594 Record.AddStmt(S->getSynchBody());
1595 Record.AddSourceLocation(S->getAtSynchronizedLoc());
1597}
1598
1599void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1600 VisitStmt(S); // FIXME: no test coverage.
1601 Record.AddStmt(S->getThrowExpr());
1602 Record.AddSourceLocation(S->getThrowLoc());
1604}
1605
1606void ASTStmtWriter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1607 VisitExpr(E);
1608 Record.push_back(E->getValue());
1609 Record.AddSourceLocation(E->getLocation());
1611}
1612
1613void ASTStmtWriter::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1614 VisitExpr(E);
1615 Record.AddSourceRange(E->getSourceRange());
1616 Record.AddVersionTuple(E->getVersion());
1618}
1619
1620//===----------------------------------------------------------------------===//
1621// C++ Expressions and Statements.
1622//===----------------------------------------------------------------------===//
1623
1624void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
1625 VisitStmt(S);
1626 Record.AddSourceLocation(S->getCatchLoc());
1627 Record.AddDeclRef(S->getExceptionDecl());
1628 Record.AddStmt(S->getHandlerBlock());
1630}
1631
1632void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
1633 VisitStmt(S);
1634 Record.push_back(S->getNumHandlers());
1635 Record.AddSourceLocation(S->getTryLoc());
1636 Record.AddStmt(S->getTryBlock());
1637 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1638 Record.AddStmt(S->getHandler(i));
1640}
1641
1642void ASTStmtWriter::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1643 VisitStmt(S);
1644 Record.AddSourceLocation(S->getForLoc());
1645 Record.AddSourceLocation(S->getCoawaitLoc());
1646 Record.AddSourceLocation(S->getColonLoc());
1647 Record.AddSourceLocation(S->getRParenLoc());
1648 Record.AddStmt(S->getInit());
1649 Record.AddStmt(S->getRangeStmt());
1650 Record.AddStmt(S->getBeginStmt());
1651 Record.AddStmt(S->getEndStmt());
1652 Record.AddStmt(S->getCond());
1653 Record.AddStmt(S->getInc());
1654 Record.AddStmt(S->getLoopVarStmt());
1655 Record.AddStmt(S->getBody());
1657}
1658
1659void ASTStmtWriter::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1660 VisitStmt(S);
1661 Record.AddSourceLocation(S->getKeywordLoc());
1662 Record.push_back(S->isIfExists());
1663 Record.AddNestedNameSpecifierLoc(S->getQualifierLoc());
1664 Record.AddDeclarationNameInfo(S->getNameInfo());
1665 Record.AddStmt(S->getSubStmt());
1667}
1668
1669void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1670 VisitCallExpr(E);
1671 Record.push_back(E->getOperator());
1672 Record.AddSourceRange(E->Range);
1673
1674 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()))
1675 AbbrevToUse = Writer.getCXXOperatorCallExprAbbrev();
1676
1678}
1679
1680void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1681 VisitCallExpr(E);
1682
1683 if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()))
1684 AbbrevToUse = Writer.getCXXMemberCallExprAbbrev();
1685
1687}
1688
1689void ASTStmtWriter::VisitCXXRewrittenBinaryOperator(
1691 VisitExpr(E);
1692 Record.push_back(E->isReversed());
1693 Record.AddStmt(E->getSemanticForm());
1695}
1696
1697void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
1698 VisitExpr(E);
1699
1700 Record.push_back(E->getNumArgs());
1701 Record.push_back(E->isElidable());
1702 Record.push_back(E->hadMultipleCandidates());
1703 Record.push_back(E->isListInitialization());
1706 Record.push_back(
1707 llvm::to_underlying(E->getConstructionKind())); // FIXME: stable encoding
1708 Record.push_back(E->isImmediateEscalating());
1709 Record.AddSourceLocation(E->getLocation());
1710 Record.AddDeclRef(E->getConstructor());
1712
1713 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1714 Record.AddStmt(E->getArg(I));
1715
1717}
1718
1719void ASTStmtWriter::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1720 VisitExpr(E);
1721 Record.AddDeclRef(E->getConstructor());
1722 Record.AddSourceLocation(E->getLocation());
1723 Record.push_back(E->constructsVBase());
1724 Record.push_back(E->inheritedFromVBase());
1726}
1727
1728void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1729 VisitCXXConstructExpr(E);
1732}
1733
1734void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) {
1735 VisitExpr(E);
1736 Record.push_back(E->LambdaExprBits.NumCaptures);
1737 Record.AddSourceRange(E->IntroducerRange);
1738 Record.push_back(E->LambdaExprBits.CaptureDefault); // FIXME: stable encoding
1739 Record.AddSourceLocation(E->CaptureDefaultLoc);
1740 Record.push_back(E->LambdaExprBits.ExplicitParams);
1741 Record.push_back(E->LambdaExprBits.ExplicitResultType);
1742 Record.AddSourceLocation(E->ClosingBrace);
1743
1744 // Add capture initializers.
1746 CEnd = E->capture_init_end();
1747 C != CEnd; ++C) {
1748 Record.AddStmt(*C);
1749 }
1750
1751 // Don't serialize the body. It belongs to the call operator declaration.
1752 // LambdaExpr only stores a copy of the Stmt *.
1753
1755}
1756
1757void ASTStmtWriter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1758 VisitExpr(E);
1759 Record.AddStmt(E->getSubExpr());
1761}
1762
1763void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1764 VisitExplicitCastExpr(E);
1766 CurrentPackingBits.addBit(E->getAngleBrackets().isValid());
1767 if (E->getAngleBrackets().isValid())
1768 Record.AddSourceRange(E->getAngleBrackets());
1769}
1770
1771void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1772 VisitCXXNamedCastExpr(E);
1774}
1775
1776void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1777 VisitCXXNamedCastExpr(E);
1779}
1780
1781void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1782 VisitCXXNamedCastExpr(E);
1784}
1785
1786void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1787 VisitCXXNamedCastExpr(E);
1789}
1790
1791void ASTStmtWriter::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1792 VisitCXXNamedCastExpr(E);
1794}
1795
1796void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1797 VisitExplicitCastExpr(E);
1798 Record.AddSourceLocation(E->getLParenLoc());
1799 Record.AddSourceLocation(E->getRParenLoc());
1801}
1802
1803void ASTStmtWriter::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1804 VisitExplicitCastExpr(E);
1805 Record.AddSourceLocation(E->getBeginLoc());
1806 Record.AddSourceLocation(E->getEndLoc());
1808}
1809
1810void ASTStmtWriter::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1811 VisitCallExpr(E);
1812 Record.AddSourceLocation(E->UDSuffixLoc);
1814}
1815
1816void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1817 VisitExpr(E);
1818 Record.push_back(E->getValue());
1819 Record.AddSourceLocation(E->getLocation());
1821}
1822
1823void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1824 VisitExpr(E);
1825 Record.AddSourceLocation(E->getLocation());
1827}
1828
1829void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1830 VisitExpr(E);
1831 Record.AddSourceRange(E->getSourceRange());
1832 if (E->isTypeOperand()) {
1835 } else {
1836 Record.AddStmt(E->getExprOperand());
1838 }
1839}
1840
1841void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
1842 VisitExpr(E);
1843 Record.AddSourceLocation(E->getLocation());
1844 Record.push_back(E->isImplicit());
1845
1847}
1848
1849void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
1850 VisitExpr(E);
1851 Record.AddSourceLocation(E->getThrowLoc());
1852 Record.AddStmt(E->getSubExpr());
1855}
1856
1857void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1858 VisitExpr(E);
1859 Record.AddDeclRef(E->getParam());
1860 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1862 Record.push_back(E->hasRewrittenInit());
1863 if (E->hasRewrittenInit())
1864 Record.AddStmt(E->getRewrittenExpr());
1866}
1867
1868void ASTStmtWriter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1869 VisitExpr(E);
1870 Record.push_back(E->hasRewrittenInit());
1871 Record.AddDeclRef(E->getField());
1872 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1873 Record.AddSourceLocation(E->getExprLoc());
1874 if (E->hasRewrittenInit())
1875 Record.AddStmt(E->getRewrittenExpr());
1877}
1878
1879void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1880 VisitExpr(E);
1881 Record.AddCXXTemporary(E->getTemporary());
1882 Record.AddStmt(E->getSubExpr());
1884}
1885
1886void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1887 VisitExpr(E);
1889 Record.AddSourceLocation(E->getRParenLoc());
1891}
1892
1893void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
1894 VisitExpr(E);
1895
1896 Record.push_back(E->isArray());
1897 Record.push_back(E->hasInitializer());
1898 Record.push_back(E->getNumPlacementArgs());
1899 Record.push_back(E->isParenTypeId());
1900
1901 Record.push_back(E->isGlobalNew());
1902 Record.push_back(E->passAlignment());
1904 Record.push_back(E->CXXNewExprBits.HasInitializer);
1905 Record.push_back(E->CXXNewExprBits.StoredInitializationStyle);
1906
1907 Record.AddDeclRef(E->getOperatorNew());
1908 Record.AddDeclRef(E->getOperatorDelete());
1910 if (E->isParenTypeId())
1911 Record.AddSourceRange(E->getTypeIdParens());
1912 Record.AddSourceRange(E->getSourceRange());
1914
1915 for (CXXNewExpr::arg_iterator I = E->raw_arg_begin(), N = E->raw_arg_end();
1916 I != N; ++I)
1917 Record.AddStmt(*I);
1918
1920}
1921
1922void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1923 VisitExpr(E);
1924 Record.push_back(E->isGlobalDelete());
1925 Record.push_back(E->isArrayForm());
1926 Record.push_back(E->isArrayFormAsWritten());
1928 Record.AddDeclRef(E->getOperatorDelete());
1929 Record.AddStmt(E->getArgument());
1930 Record.AddSourceLocation(E->getBeginLoc());
1931
1933}
1934
1935void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1936 VisitExpr(E);
1937
1938 Record.AddStmt(E->getBase());
1939 Record.push_back(E->isArrow());
1940 Record.AddSourceLocation(E->getOperatorLoc());
1944 Record.AddSourceLocation(E->getTildeLoc());
1945
1946 // PseudoDestructorTypeStorage.
1950 else
1952
1954}
1955
1956void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) {
1957 VisitExpr(E);
1958 Record.push_back(E->getNumObjects());
1959 for (auto &Obj : E->getObjects()) {
1960 if (auto *BD = Obj.dyn_cast<BlockDecl *>()) {
1962 Record.AddDeclRef(BD);
1963 } else if (auto *CLE = Obj.dyn_cast<CompoundLiteralExpr *>()) {
1965 Record.AddStmt(CLE);
1966 }
1967 }
1968
1970 Record.AddStmt(E->getSubExpr());
1972}
1973
1974void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
1976 VisitExpr(E);
1977
1978 // Don't emit anything here (or if you do you will have to update
1979 // the corresponding deserialization function).
1980 Record.push_back(E->getNumTemplateArgs());
1981 CurrentPackingBits.updateBits();
1982 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
1983 CurrentPackingBits.addBit(E->hasFirstQualifierFoundInScope());
1984
1985 if (E->hasTemplateKWAndArgsInfo()) {
1986 const ASTTemplateKWAndArgsInfo &ArgInfo =
1987 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
1989 E->getTrailingObjects<TemplateArgumentLoc>());
1990 }
1991
1992 CurrentPackingBits.addBit(E->isArrow());
1993
1994 Record.AddTypeRef(E->getBaseType());
1996 CurrentPackingBits.addBit(!E->isImplicitAccess());
1997 if (!E->isImplicitAccess())
1998 Record.AddStmt(E->getBase());
1999
2000 Record.AddSourceLocation(E->getOperatorLoc());
2001
2002 if (E->hasFirstQualifierFoundInScope())
2004
2005 Record.AddDeclarationNameInfo(E->MemberNameInfo);
2007}
2008
2009void
2010ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
2011 VisitExpr(E);
2012
2013 // Don't emit anything here, HasTemplateKWAndArgsInfo must be
2014 // emitted first.
2015 CurrentPackingBits.addBit(
2016 E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
2017
2018 if (E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo) {
2019 const ASTTemplateKWAndArgsInfo &ArgInfo =
2020 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
2021 // 16 bits should be enought to store the number of args
2022 CurrentPackingBits.addBits(ArgInfo.NumTemplateArgs, /*Width=*/16);
2024 E->getTrailingObjects<TemplateArgumentLoc>());
2025 }
2026
2028 Record.AddDeclarationNameInfo(E->NameInfo);
2030}
2031
2032void
2033ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
2034 VisitExpr(E);
2035 Record.push_back(E->getNumArgs());
2037 ArgI = E->arg_begin(), ArgE = E->arg_end(); ArgI != ArgE; ++ArgI)
2038 Record.AddStmt(*ArgI);
2040 Record.AddSourceLocation(E->getLParenLoc());
2041 Record.AddSourceLocation(E->getRParenLoc());
2042 Record.push_back(E->isListInitialization());
2044}
2045
2046void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
2047 VisitExpr(E);
2048
2049 Record.push_back(E->getNumDecls());
2050
2051 CurrentPackingBits.updateBits();
2052 CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
2053 if (E->hasTemplateKWAndArgsInfo()) {
2054 const ASTTemplateKWAndArgsInfo &ArgInfo =
2056 Record.push_back(ArgInfo.NumTemplateArgs);
2058 }
2059
2061 OvE = E->decls_end();
2062 OvI != OvE; ++OvI) {
2063 Record.AddDeclRef(OvI.getDecl());
2064 Record.push_back(OvI.getAccess());
2065 }
2066
2069}
2070
2071void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
2072 VisitOverloadExpr(E);
2073 CurrentPackingBits.addBit(E->isArrow());
2074 CurrentPackingBits.addBit(E->hasUnresolvedUsing());
2075 CurrentPackingBits.addBit(!E->isImplicitAccess());
2076 if (!E->isImplicitAccess())
2077 Record.AddStmt(E->getBase());
2078
2079 Record.AddSourceLocation(E->getOperatorLoc());
2080
2081 Record.AddTypeRef(E->getBaseType());
2083}
2084
2085void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
2086 VisitOverloadExpr(E);
2087 CurrentPackingBits.addBit(E->requiresADL());
2088 CurrentPackingBits.addBit(E->isOverloaded());
2089 Record.AddDeclRef(E->getNamingClass());
2091}
2092
2093void ASTStmtWriter::VisitTypeTraitExpr(TypeTraitExpr *E) {
2094 VisitExpr(E);
2095 Record.push_back(E->TypeTraitExprBits.NumArgs);
2096 Record.push_back(E->TypeTraitExprBits.Kind); // FIXME: Stable encoding
2097 Record.push_back(E->TypeTraitExprBits.Value);
2098 Record.AddSourceRange(E->getSourceRange());
2099 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
2100 Record.AddTypeSourceInfo(E->getArg(I));
2102}
2103
2104void ASTStmtWriter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2105 VisitExpr(E);
2106 Record.push_back(E->getTrait());
2107 Record.push_back(E->getValue());
2108 Record.AddSourceRange(E->getSourceRange());
2110 Record.AddStmt(E->getDimensionExpression());
2112}
2113
2114void ASTStmtWriter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2115 VisitExpr(E);
2116 Record.push_back(E->getTrait());
2117 Record.push_back(E->getValue());
2118 Record.AddSourceRange(E->getSourceRange());
2119 Record.AddStmt(E->getQueriedExpression());
2121}
2122
2123void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2124 VisitExpr(E);
2125 Record.push_back(E->getValue());
2126 Record.AddSourceRange(E->getSourceRange());
2127 Record.AddStmt(E->getOperand());
2129}
2130
2131void ASTStmtWriter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2132 VisitExpr(E);
2133 Record.AddSourceLocation(E->getEllipsisLoc());
2134 Record.push_back(E->NumExpansions);
2135 Record.AddStmt(E->getPattern());
2137}
2138
2139void ASTStmtWriter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2140 VisitExpr(E);
2141 Record.push_back(E->isPartiallySubstituted() ? E->getPartialArguments().size()
2142 : 0);
2143 Record.AddSourceLocation(E->OperatorLoc);
2144 Record.AddSourceLocation(E->PackLoc);
2145 Record.AddSourceLocation(E->RParenLoc);
2146 Record.AddDeclRef(E->Pack);
2147 if (E->isPartiallySubstituted()) {
2148 for (const auto &TA : E->getPartialArguments())
2149 Record.AddTemplateArgument(TA);
2150 } else if (!E->isValueDependent()) {
2151 Record.push_back(E->getPackLength());
2152 }
2154}
2155
2156void ASTStmtWriter::VisitPackIndexingExpr(PackIndexingExpr *E) {
2157 VisitExpr(E);
2158 Record.push_back(E->TransformedExpressions);
2159 Record.AddSourceLocation(E->getEllipsisLoc());
2160 Record.AddSourceLocation(E->getRSquareLoc());
2161 Record.AddStmt(E->getPackIdExpression());
2162 Record.AddStmt(E->getIndexExpr());
2163 Record.push_back(E->TransformedExpressions);
2164 for (Expr *Sub : E->getExpressions())
2165 Record.AddStmt(Sub);
2167}
2168
2169void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
2171 VisitExpr(E);
2172 Record.AddDeclRef(E->getAssociatedDecl());
2173 CurrentPackingBits.addBit(E->isReferenceParameter());
2174 CurrentPackingBits.addBits(E->getIndex(), /*Width=*/12);
2175 CurrentPackingBits.addBit((bool)E->getPackIndex());
2176 if (auto PackIndex = E->getPackIndex())
2177 Record.push_back(*PackIndex + 1);
2178
2179 Record.AddSourceLocation(E->getNameLoc());
2180 Record.AddStmt(E->getReplacement());
2182}
2183
2184void ASTStmtWriter::VisitSubstNonTypeTemplateParmPackExpr(
2186 VisitExpr(E);
2187 Record.AddDeclRef(E->getAssociatedDecl());
2188 Record.push_back(E->getIndex());
2192}
2193
2194void ASTStmtWriter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2195 VisitExpr(E);
2196 Record.push_back(E->getNumExpansions());
2197 Record.AddDeclRef(E->getParameterPack());
2199 for (FunctionParmPackExpr::iterator I = E->begin(), End = E->end();
2200 I != End; ++I)
2201 Record.AddDeclRef(*I);
2203}
2204
2205void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2206 VisitExpr(E);
2207 Record.push_back(static_cast<bool>(E->getLifetimeExtendedTemporaryDecl()));
2210 else
2211 Record.AddStmt(E->getSubExpr());
2213}
2214
2215void ASTStmtWriter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2216 VisitExpr(E);
2217 Record.AddSourceLocation(E->LParenLoc);
2218 Record.AddSourceLocation(E->EllipsisLoc);
2219 Record.AddSourceLocation(E->RParenLoc);
2220 Record.push_back(E->NumExpansions);
2221 Record.AddStmt(E->SubExprs[0]);
2222 Record.AddStmt(E->SubExprs[1]);
2223 Record.AddStmt(E->SubExprs[2]);
2224 Record.push_back(E->Opcode);
2226}
2227
2228void ASTStmtWriter::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2229 VisitExpr(E);
2230 ArrayRef<Expr *> InitExprs = E->getInitExprs();
2231 Record.push_back(InitExprs.size());
2232 Record.push_back(E->getUserSpecifiedInitExprs().size());
2233 Record.AddSourceLocation(E->getInitLoc());
2234 Record.AddSourceLocation(E->getBeginLoc());
2235 Record.AddSourceLocation(E->getEndLoc());
2236 for (Expr *InitExpr : E->getInitExprs())
2237 Record.AddStmt(InitExpr);
2238 Expr *ArrayFiller = E->getArrayFiller();
2239 FieldDecl *UnionField = E->getInitializedFieldInUnion();
2240 bool HasArrayFillerOrUnionDecl = ArrayFiller || UnionField;
2241 Record.push_back(HasArrayFillerOrUnionDecl);
2242 if (HasArrayFillerOrUnionDecl) {
2243 Record.push_back(static_cast<bool>(ArrayFiller));
2244 if (ArrayFiller)
2245 Record.AddStmt(ArrayFiller);
2246 else
2247 Record.AddDeclRef(UnionField);
2248 }
2250}
2251
2252void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2253 VisitExpr(E);
2254 Record.AddStmt(E->getSourceExpr());
2255 Record.AddSourceLocation(E->getLocation());
2256 Record.push_back(E->isUnique());
2258}
2259
2260void ASTStmtWriter::VisitTypoExpr(TypoExpr *E) {
2261 VisitExpr(E);
2262 // TODO: Figure out sane writer behavior for a TypoExpr, if necessary
2263 llvm_unreachable("Cannot write TypoExpr nodes");
2264}
2265
2266//===----------------------------------------------------------------------===//
2267// CUDA Expressions and Statements.
2268//===----------------------------------------------------------------------===//
2269
2270void ASTStmtWriter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2271 VisitCallExpr(E);
2272 Record.AddStmt(E->getConfig());
2274}
2275
2276//===----------------------------------------------------------------------===//
2277// OpenCL Expressions and Statements.
2278//===----------------------------------------------------------------------===//
2279void ASTStmtWriter::VisitAsTypeExpr(AsTypeExpr *E) {
2280 VisitExpr(E);
2281 Record.AddSourceLocation(E->getBuiltinLoc());
2282 Record.AddSourceLocation(E->getRParenLoc());
2283 Record.AddStmt(E->getSrcExpr());
2285}
2286
2287//===----------------------------------------------------------------------===//
2288// Microsoft Expressions and Statements.
2289//===----------------------------------------------------------------------===//
2290void ASTStmtWriter::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2291 VisitExpr(E);
2292 Record.push_back(E->isArrow());
2293 Record.AddStmt(E->getBaseExpr());
2295 Record.AddSourceLocation(E->getMemberLoc());
2296 Record.AddDeclRef(E->getPropertyDecl());
2298}
2299
2300void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2301 VisitExpr(E);
2302 Record.AddStmt(E->getBase());
2303 Record.AddStmt(E->getIdx());
2304 Record.AddSourceLocation(E->getRBracketLoc());
2306}
2307
2308void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2309 VisitExpr(E);
2310 Record.AddSourceRange(E->getSourceRange());
2311 Record.AddDeclRef(E->getGuidDecl());
2312 if (E->isTypeOperand()) {
2315 } else {
2316 Record.AddStmt(E->getExprOperand());
2318 }
2319}
2320
2321void ASTStmtWriter::VisitSEHExceptStmt(SEHExceptStmt *S) {
2322 VisitStmt(S);
2323 Record.AddSourceLocation(S->getExceptLoc());
2324 Record.AddStmt(S->getFilterExpr());
2325 Record.AddStmt(S->getBlock());
2327}
2328
2329void ASTStmtWriter::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2330 VisitStmt(S);
2331 Record.AddSourceLocation(S->getFinallyLoc());
2332 Record.AddStmt(S->getBlock());
2334}
2335
2336void ASTStmtWriter::VisitSEHTryStmt(SEHTryStmt *S) {
2337 VisitStmt(S);
2338 Record.push_back(S->getIsCXXTry());
2339 Record.AddSourceLocation(S->getTryLoc());
2340 Record.AddStmt(S->getTryBlock());
2341 Record.AddStmt(S->getHandler());
2343}
2344
2345void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2346 VisitStmt(S);
2347 Record.AddSourceLocation(S->getLeaveLoc());
2349}
2350
2351//===----------------------------------------------------------------------===//
2352// OpenMP Directives.
2353//===----------------------------------------------------------------------===//
2354
2355void ASTStmtWriter::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2356 VisitStmt(S);
2357 for (Stmt *SubStmt : S->SubStmts)
2358 Record.AddStmt(SubStmt);
2360}
2361
2362void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2363 Record.writeOMPChildren(E->Data);
2364 Record.AddSourceLocation(E->getBeginLoc());
2365 Record.AddSourceLocation(E->getEndLoc());
2366 Record.writeEnum(E->getMappedDirective());
2367}
2368
2369void ASTStmtWriter::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2370 VisitStmt(D);
2371 Record.writeUInt32(D->getLoopsNumber());
2372 VisitOMPExecutableDirective(D);
2373}
2374
2375void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) {
2376 VisitOMPLoopBasedDirective(D);
2377}
2378
2379void ASTStmtWriter::VisitOMPMetaDirective(OMPMetaDirective *D) {
2380 VisitStmt(D);
2381 Record.push_back(D->getNumClauses());
2382 VisitOMPExecutableDirective(D);
2384}
2385
2386void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) {
2387 VisitStmt(D);
2388 VisitOMPExecutableDirective(D);
2389 Record.writeBool(D->hasCancel());
2391}
2392
2393void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) {
2394 VisitOMPLoopDirective(D);
2396}
2397
2398void ASTStmtWriter::VisitOMPLoopTransformationDirective(
2400 VisitOMPLoopBasedDirective(D);
2401 Record.writeUInt32(D->getNumGeneratedLoops());
2402}
2403
2404void ASTStmtWriter::VisitOMPTileDirective(OMPTileDirective *D) {
2405 VisitOMPLoopTransformationDirective(D);
2407}
2408
2409void ASTStmtWriter::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2410 VisitOMPLoopTransformationDirective(D);
2412}
2413
2414void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) {
2415 VisitOMPLoopDirective(D);
2416 Record.writeBool(D->hasCancel());
2418}
2419
2420void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2421 VisitOMPLoopDirective(D);
2423}
2424
2425void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2426 VisitStmt(D);
2427 VisitOMPExecutableDirective(D);
2428 Record.writeBool(D->hasCancel());
2430}
2431
2432void ASTStmtWriter::VisitOMPSectionDirective(OMPSectionDirective *D) {
2433 VisitStmt(D);
2434 VisitOMPExecutableDirective(D);
2435 Record.writeBool(D->hasCancel());
2437}
2438
2439void ASTStmtWriter::VisitOMPScopeDirective(OMPScopeDirective *D) {
2440 VisitStmt(D);
2441 VisitOMPExecutableDirective(D);
2443}
2444
2445void ASTStmtWriter::VisitOMPSingleDirective(OMPSingleDirective *D) {
2446 VisitStmt(D);
2447 VisitOMPExecutableDirective(D);
2449}
2450
2451void ASTStmtWriter::VisitOMPMasterDirective(OMPMasterDirective *D) {
2452 VisitStmt(D);
2453 VisitOMPExecutableDirective(D);
2455}
2456
2457void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2458 VisitStmt(D);
2459 VisitOMPExecutableDirective(D);
2462}
2463
2464void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2465 VisitOMPLoopDirective(D);
2466 Record.writeBool(D->hasCancel());
2468}
2469
2470void ASTStmtWriter::VisitOMPParallelForSimdDirective(
2472 VisitOMPLoopDirective(D);
2474}
2475
2476void ASTStmtWriter::VisitOMPParallelMasterDirective(
2478 VisitStmt(D);
2479 VisitOMPExecutableDirective(D);
2481}
2482
2483void ASTStmtWriter::VisitOMPParallelMaskedDirective(
2485 VisitStmt(D);
2486 VisitOMPExecutableDirective(D);
2488}
2489
2490void ASTStmtWriter::VisitOMPParallelSectionsDirective(
2492 VisitStmt(D);
2493 VisitOMPExecutableDirective(D);
2494 Record.writeBool(D->hasCancel());
2496}
2497
2498void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) {
2499 VisitStmt(D);
2500 VisitOMPExecutableDirective(D);
2501 Record.writeBool(D->hasCancel());
2503}
2504
2505void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2506 VisitStmt(D);
2507 VisitOMPExecutableDirective(D);
2508 Record.writeBool(D->isXLHSInRHSPart());
2509 Record.writeBool(D->isPostfixUpdate());
2510 Record.writeBool(D->isFailOnly());
2512}
2513
2514void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) {
2515 VisitStmt(D);
2516 VisitOMPExecutableDirective(D);
2518}
2519
2520void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2521 VisitStmt(D);
2522 VisitOMPExecutableDirective(D);
2524}
2525
2526void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
2528 VisitStmt(D);
2529 VisitOMPExecutableDirective(D);
2531}
2532
2533void ASTStmtWriter::VisitOMPTargetExitDataDirective(
2535 VisitStmt(D);
2536 VisitOMPExecutableDirective(D);
2538}
2539
2540void ASTStmtWriter::VisitOMPTargetParallelDirective(
2542 VisitStmt(D);
2543 VisitOMPExecutableDirective(D);
2544 Record.writeBool(D->hasCancel());
2546}
2547
2548void ASTStmtWriter::VisitOMPTargetParallelForDirective(
2550 VisitOMPLoopDirective(D);
2551 Record.writeBool(D->hasCancel());
2553}
2554
2555void ASTStmtWriter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2556 VisitStmt(D);
2557 VisitOMPExecutableDirective(D);
2559}
2560
2561void ASTStmtWriter::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2562 VisitStmt(D);
2563 VisitOMPExecutableDirective(D);
2565}
2566
2567void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2568 VisitStmt(D);
2569 Record.push_back(D->getNumClauses());
2570 VisitOMPExecutableDirective(D);
2572}
2573
2574void ASTStmtWriter::VisitOMPErrorDirective(OMPErrorDirective *D) {
2575 VisitStmt(D);
2576 Record.push_back(D->getNumClauses());
2577 VisitOMPExecutableDirective(D);
2579}
2580
2581void ASTStmtWriter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2582 VisitStmt(D);
2583 VisitOMPExecutableDirective(D);
2585}
2586
2587void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) {
2588 VisitStmt(D);
2589 VisitOMPExecutableDirective(D);
2591}
2592
2593void ASTStmtWriter::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2594 VisitStmt(D);
2595 VisitOMPExecutableDirective(D);
2597}
2598
2599void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
2600 VisitStmt(D);
2601 VisitOMPExecutableDirective(D);
2603}
2604
2605void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2606 VisitStmt(D);
2607 VisitOMPExecutableDirective(D);
2609}
2610
2611void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2612 VisitStmt(D);
2613 VisitOMPExecutableDirective(D);
2615}
2616
2617void ASTStmtWriter::VisitOMPCancellationPointDirective(
2619 VisitStmt(D);
2620 VisitOMPExecutableDirective(D);
2621 Record.writeEnum(D->getCancelRegion());
2623}
2624
2625void ASTStmtWriter::VisitOMPCancelDirective(OMPCancelDirective *D) {
2626 VisitStmt(D);
2627 VisitOMPExecutableDirective(D);
2628 Record.writeEnum(D->getCancelRegion());
2630}
2631
2632void ASTStmtWriter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2633 VisitOMPLoopDirective(D);
2634 Record.writeBool(D->hasCancel());
2636}
2637
2638void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2639 VisitOMPLoopDirective(D);
2641}
2642
2643void ASTStmtWriter::VisitOMPMasterTaskLoopDirective(
2645 VisitOMPLoopDirective(D);
2646 Record.writeBool(D->hasCancel());
2648}
2649
2650void ASTStmtWriter::VisitOMPMaskedTaskLoopDirective(
2652 VisitOMPLoopDirective(D);
2653 Record.writeBool(D->hasCancel());
2655}
2656
2657void ASTStmtWriter::VisitOMPMasterTaskLoopSimdDirective(
2659 VisitOMPLoopDirective(D);
2661}
2662
2663void ASTStmtWriter::VisitOMPMaskedTaskLoopSimdDirective(
2665 VisitOMPLoopDirective(D);
2667}
2668
2669void ASTStmtWriter::VisitOMPParallelMasterTaskLoopDirective(
2671 VisitOMPLoopDirective(D);
2672 Record.writeBool(D->hasCancel());
2674}
2675
2676void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopDirective(
2678 VisitOMPLoopDirective(D);
2679 Record.writeBool(D->hasCancel());
2681}
2682
2683void ASTStmtWriter::VisitOMPParallelMasterTaskLoopSimdDirective(
2685 VisitOMPLoopDirective(D);
2687}
2688
2689void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopSimdDirective(
2691 VisitOMPLoopDirective(D);
2693}
2694
2695void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2696 VisitOMPLoopDirective(D);
2698}
2699
2700void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2701 VisitStmt(D);
2702 VisitOMPExecutableDirective(D);
2704}
2705
2706void ASTStmtWriter::VisitOMPDistributeParallelForDirective(
2708 VisitOMPLoopDirective(D);
2709 Record.writeBool(D->hasCancel());
2711}
2712
2713void ASTStmtWriter::VisitOMPDistributeParallelForSimdDirective(
2715 VisitOMPLoopDirective(D);
2717}
2718
2719void ASTStmtWriter::VisitOMPDistributeSimdDirective(
2721 VisitOMPLoopDirective(D);
2723}
2724
2725void ASTStmtWriter::VisitOMPTargetParallelForSimdDirective(
2727 VisitOMPLoopDirective(D);
2729}
2730
2731void ASTStmtWriter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2732 VisitOMPLoopDirective(D);
2734}
2735
2736void ASTStmtWriter::VisitOMPTeamsDistributeDirective(
2738 VisitOMPLoopDirective(D);
2740}
2741
2742void ASTStmtWriter::VisitOMPTeamsDistributeSimdDirective(
2744 VisitOMPLoopDirective(D);
2746}
2747
2748void ASTStmtWriter::VisitOMPTeamsDistributeParallelForSimdDirective(
2750 VisitOMPLoopDirective(D);
2752}
2753
2754void ASTStmtWriter::VisitOMPTeamsDistributeParallelForDirective(
2756 VisitOMPLoopDirective(D);
2757 Record.writeBool(D->hasCancel());
2759}
2760
2761void ASTStmtWriter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2762 VisitStmt(D);
2763 VisitOMPExecutableDirective(D);
2765}
2766
2767void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective(
2769 VisitOMPLoopDirective(D);
2771}
2772
2773void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective(
2775 VisitOMPLoopDirective(D);
2776 Record.writeBool(D->hasCancel());
2778}
2779
2780void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2782 VisitOMPLoopDirective(D);
2783 Code = serialization::
2785}
2786
2787void ASTStmtWriter::VisitOMPTargetTeamsDistributeSimdDirective(
2789 VisitOMPLoopDirective(D);
2791}
2792
2793void ASTStmtWriter::VisitOMPInteropDirective(OMPInteropDirective *D) {
2794 VisitStmt(D);
2795 VisitOMPExecutableDirective(D);
2797}
2798
2799void ASTStmtWriter::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2800 VisitStmt(D);
2801 VisitOMPExecutableDirective(D);
2804}
2805
2806void ASTStmtWriter::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2807 VisitStmt(D);
2808 VisitOMPExecutableDirective(D);
2810}
2811
2812void ASTStmtWriter::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2813 VisitOMPLoopDirective(D);
2815}
2816
2817void ASTStmtWriter::VisitOMPTeamsGenericLoopDirective(
2819 VisitOMPLoopDirective(D);
2821}
2822
2823void ASTStmtWriter::VisitOMPTargetTeamsGenericLoopDirective(
2825 VisitOMPLoopDirective(D);
2827}
2828
2829void ASTStmtWriter::VisitOMPParallelGenericLoopDirective(
2831 VisitOMPLoopDirective(D);
2833}
2834
2835void ASTStmtWriter::VisitOMPTargetParallelGenericLoopDirective(
2837 VisitOMPLoopDirective(D);
2839}
2840
2841//===----------------------------------------------------------------------===//
2842// OpenACC Constructs/Directives.
2843//===----------------------------------------------------------------------===//
2844void ASTStmtWriter::VisitOpenACCConstructStmt(OpenACCConstructStmt *S) {
2845 Record.writeEnum(S->Kind);
2846 Record.AddSourceRange(S->Range);
2847 // TODO OpenACC: Serialize Clauses.
2848}
2849
2850void ASTStmtWriter::VisitOpenACCAssociatedStmtConstruct(
2852 VisitOpenACCConstructStmt(S);
2853 Record.AddStmt(S->getAssociatedStmt());
2854}
2855
2856void ASTStmtWriter::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
2857 VisitStmt(S);
2858 VisitOpenACCConstructStmt(S);
2860}
2861
2862//===----------------------------------------------------------------------===//
2863// ASTWriter Implementation
2864//===----------------------------------------------------------------------===//
2865
2867 assert(!SwitchCaseIDs.contains(S) && "SwitchCase recorded twice");
2868 unsigned NextID = SwitchCaseIDs.size();
2869 SwitchCaseIDs[S] = NextID;
2870 return NextID;
2871}
2872
2874 assert(SwitchCaseIDs.contains(S) && "SwitchCase hasn't been seen yet");
2875 return SwitchCaseIDs[S];
2876}
2877
2879 SwitchCaseIDs.clear();
2880}
2881
2882/// Write the given substatement or subexpression to the
2883/// bitstream.
2884void ASTWriter::WriteSubStmt(Stmt *S) {
2885 RecordData Record;
2886 ASTStmtWriter Writer(*this, Record);
2887 ++NumStatements;
2888
2889 if (!S) {
2890 Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
2891 return;
2892 }
2893
2894 llvm::DenseMap<Stmt *, uint64_t>::iterator I = SubStmtEntries.find(S);
2895 if (I != SubStmtEntries.end()) {
2896 Record.push_back(I->second);
2897 Stream.EmitRecord(serialization::STMT_REF_PTR, Record);
2898 return;
2899 }
2900
2901#ifndef NDEBUG
2902 assert(!ParentStmts.count(S) && "There is a Stmt cycle!");
2903
2904 struct ParentStmtInserterRAII {
2905 Stmt *S;
2906 llvm::DenseSet<Stmt *> &ParentStmts;
2907
2908 ParentStmtInserterRAII(Stmt *S, llvm::DenseSet<Stmt *> &ParentStmts)
2909 : S(S), ParentStmts(ParentStmts) {
2910 ParentStmts.insert(S);
2911 }
2912 ~ParentStmtInserterRAII() {
2913 ParentStmts.erase(S);
2914 }
2915 };
2916
2917 ParentStmtInserterRAII ParentStmtInserter(S, ParentStmts);
2918#endif
2919
2920 Writer.Visit(S);
2921
2922 uint64_t Offset = Writer.Emit();
2923 SubStmtEntries[S] = Offset;
2924}
2925
2926/// Flush all of the statements that have been added to the
2927/// queue via AddStmt().
2928void ASTRecordWriter::FlushStmts() {
2929 // We expect to be the only consumer of the two temporary statement maps,
2930 // assert that they are empty.
2931 assert(Writer->SubStmtEntries.empty() && "unexpected entries in sub-stmt map");
2932 assert(Writer->ParentStmts.empty() && "unexpected entries in parent stmt map");
2933
2934 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
2935 Writer->WriteSubStmt(StmtsToEmit[I]);
2936
2937 assert(N == StmtsToEmit.size() && "record modified while being written!");
2938
2939 // Note that we are at the end of a full expression. Any
2940 // expression records that follow this one are part of a different
2941 // expression.
2942 Writer->Stream.EmitRecord(serialization::STMT_STOP, ArrayRef<uint32_t>());
2943
2944 Writer->SubStmtEntries.clear();
2945 Writer->ParentStmts.clear();
2946 }
2947
2948 StmtsToEmit.clear();
2949}
2950
2951void ASTRecordWriter::FlushSubStmts() {
2952 // For a nested statement, write out the substatements in reverse order (so
2953 // that a simple stack machine can be used when loading), and don't emit a
2954 // STMT_STOP after each one.
2955 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
2956 Writer->WriteSubStmt(StmtsToEmit[N - I - 1]);
2957 assert(N == StmtsToEmit.size() && "record modified while being written!");
2958 }
2959
2960 StmtsToEmit.clear();
2961}
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::APInt getValue() const
An object for streaming information to a record.
void AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo)
Definition: ASTWriter.cpp:5867
void AddCXXTemporary(const CXXTemporary *Temp)
Emit a CXXTemporary.
Definition: ASTWriter.cpp:5632
void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Emit a C++ base specifier.
Definition: ASTWriter.cpp:5983
ASTWriter::RecordDataImpl & getRecordData() const
Extract the underlying record storage.
void writeBool(bool Value)
void AddAPValue(const APValue &Value)
Emit an APvalue.
void AddIdentifierRef(const IdentifierInfo *II)
Emit a reference to an identifier.
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
void AddSelectorRef(Selector S)
Emit a Selector (which is a smart pointer reference).
Definition: ASTWriter.cpp:5609
void AddSourceRange(SourceRange Range, LocSeq *Seq=nullptr)
Emit a source range.
void AddTypeRef(QualType T)
Emit a reference to a type.
void AddSourceLocation(SourceLocation Loc, LocSeq *Seq=nullptr)
Emit a source location.
void push_back(uint64_t N)
Minimal vector-like interface.
void AddTemplateParameterList(const TemplateParameterList *TemplateParams)
Emit a template parameter list.
Definition: ASTWriter.cpp:5935
void AddTemplateArgument(const TemplateArgument &Arg)
Emit a template argument.
void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc, DeclarationName Name)
Definition: ASTWriter.cpp:5840
void AddAPFloat(const llvm::APFloat &Value)
Emit a floating-point value.
Definition: ASTWriter.cpp:5563
void AddTypeSourceInfo(TypeSourceInfo *TInfo)
Emits a reference to a declarator info.
Definition: ASTWriter.cpp:5678
void writeUInt32(uint32_t Value)
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
void writeOMPChildren(OMPChildren *Data)
Writes data related to the OpenMP directives.
Definition: ASTWriter.cpp:7363
void AddConceptReference(const ConceptReference *CR)
Definition: ASTWriter.cpp:473
void AddVersionTuple(const VersionTuple &Version)
Emit a version tuple.
void AddString(StringRef Str)
Emit a string.
void AddAPInt(const llvm::APInt &Value)
Emit an integral value.
void AddAttributes(ArrayRef< const Attr * > Attrs)
Emit a list of attributes.
Definition: ASTWriter.cpp:4495
void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg)
Emits a template argument location.
Definition: ASTWriter.cpp:5665
void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Emit a nested name specifier with source-location information.
Definition: ASTWriter.cpp:5881
void AddTemplateKWAndArgsInfo(const ASTTemplateKWAndArgsInfo &ArgInfo, const TemplateArgumentLoc *Args)
ASTStmtWriter(const ASTStmtWriter &)=delete
ASTStmtWriter & operator=(const ASTStmtWriter &)=delete
ASTStmtWriter(ASTWriter &Writer, ASTWriter::RecordData &Record)
void VisitStmt(Stmt *S)
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:86
unsigned getBinaryOperatorAbbrev() const
Definition: ASTWriter.h:778
unsigned getExprImplicitCastAbbrev() const
Definition: ASTWriter.h:777
unsigned getSwitchCaseID(SwitchCase *S)
Retrieve the ID for the given switch-case statement.
unsigned getDeclRefExprAbbrev() const
Definition: ASTWriter.h:774
unsigned getCXXOperatorCallExprAbbrev()
Definition: ASTWriter.h:783
unsigned getCXXMemberCallExprAbbrev()
Definition: ASTWriter.h:784
unsigned getCompoundAssignOperatorAbbrev() const
Definition: ASTWriter.h:779
unsigned RecordSwitchCaseID(SwitchCase *S)
Record an ID for the given switch-case statement.
unsigned getCharacterLiteralAbbrev() const
Definition: ASTWriter.h:775
unsigned getCompoundStmtAbbrev() const
Definition: ASTWriter.h:786
void AddToken(const Token &Tok, RecordDataImpl &Record)
Emit a token.
Definition: ASTWriter.cpp:4501
SmallVector< uint64_t, 64 > RecordData
Definition: ASTWriter.h:91
unsigned getCallExprAbbrev() const
Definition: ASTWriter.h:782
unsigned getIntegerLiteralAbbrev() const
Definition: ASTWriter.h:776
SourceLocation getColonLoc() const
Definition: Expr.h:4152
SourceLocation getQuestionLoc() const
Definition: Expr.h:4151
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4321
SourceLocation getAmpAmpLoc() const
Definition: Expr.h:4336
SourceLocation getLabelLoc() const
Definition: Expr.h:4338
LabelDecl * getLabel() const
Definition: Expr.h:4344
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5547
Represents a loop initializing the elements of an array.
Definition: Expr.h:5494
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2652
SourceLocation getRBracketLoc() const
Definition: Expr.h:2700
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
Definition: Expr.h:2681
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition: ExprCXX.h:2836
uint64_t getValue() const
Definition: ExprCXX.h:2882
ArrayTypeTrait getTrait() const
Definition: ExprCXX.h:2876
Expr * getDimensionExpression() const
Definition: ExprCXX.h:2884
TypeSourceInfo * getQueriedTypeSourceInfo() const
Definition: ExprCXX.h:2880
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:6217
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:6236
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_astype token.
Definition: Expr.h:6239
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition: Expr.h:6242
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition: Stmt.h:3098
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6420
Expr ** getSubExprs()
Definition: Expr.h:6497
SourceLocation getRParenLoc() const
Definition: Expr.h:6525
static unsigned getNumSubExprs(AtomicOp Op)
Determine the number of arguments the specified atomic builtin should have.
Definition: Expr.cpp:4927
AtomicOp getOp() const
Definition: Expr.h:6484
SourceLocation getBuiltinLoc() const
Definition: Expr.h:6524
Represents an attribute applied to a statement.
Definition: Stmt.h:2078
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:4224
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
Definition: Expr.h:4278
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition: Expr.h:4262
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value.
Definition: Expr.h:4266
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
Definition: Expr.h:4271
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Definition: Expr.h:4259
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3823
Expr * getLHS() const
Definition: Expr.h:3872
SourceLocation getOperatorLoc() const
Definition: Expr.h:3864
bool hasStoredFPFeatures() const
Definition: Expr.h:4007
Expr * getRHS() const
Definition: Expr.h:3874
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition: Expr.h:4010
Opcode getOpcode() const
Definition: Expr.h:3867
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
Definition: ASTWriter.h:878
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4455
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:6156
const BlockDecl * getBlockDecl() const
Definition: Expr.h:6168
BreakStmt - This represents a break.
Definition: Stmt.h:2978
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:5230
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.h:5249
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:5248
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition: Expr.h:3754
SourceLocation getRParenLoc() const
Definition: Expr.h:3789
SourceLocation getLParenLoc() const
Definition: Expr.h:3786
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:231
const CallExpr * getConfig() const
Definition: ExprCXX.h:257
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Definition: ExprCXX.h:601
Represents a base class of a C++ class.
Definition: DeclCXX.h:146
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1475
CXXTemporary * getTemporary()
Definition: ExprCXX.h:1493
const Expr * getSubExpr() const
Definition: ExprCXX.h:1497
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:720
bool getValue() const
Definition: ExprCXX.h:737
SourceLocation getLocation() const
Definition: ExprCXX.h:743
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:28
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:563
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1530
SourceRange getParenOrBraceRange() const
Definition: ExprCXX.h:1698
bool isElidable() const
Whether this construction is elidable.
Definition: ExprCXX.h:1599
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1.
Definition: ExprCXX.h:1604
Expr * getArg(unsigned Arg)
Return the specified argument.
Definition: ExprCXX.h:1673
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition: ExprCXX.h:1623
bool isImmediateEscalating() const
Definition: ExprCXX.h:1688
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called.
Definition: ExprCXX.h:1632
SourceLocation getLocation() const
Definition: ExprCXX.h:1595
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition: ExprCXX.h:1593
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition: ExprCXX.h:1612
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Definition: ExprCXX.h:1670
CXXConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition: ExprCXX.h:1641
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1254
SourceLocation getUsedLocation() const
Retrieve the location where this default argument was actually used.
Definition: ExprCXX.h:1328
const ParmVarDecl * getParam() const
Definition: ExprCXX.h:1296
const DeclContext * getUsedContext() const
Definition: ExprCXX.h:1324
bool hasRewrittenInit() const
Definition: ExprCXX.h:1299
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1361
const DeclContext * getUsedContext() const
Definition: ExprCXX.h:1418
const Expr * getRewrittenExpr() const
Retrieve the initializing expression with evaluated immediate calls, if any.
Definition: ExprCXX.h:1406
bool hasRewrittenInit() const
Definition: ExprCXX.h:1390
FieldDecl * getField()
Get the field whose initializer will be used.
Definition: ExprCXX.h:1395
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2481
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2520
bool isArrayForm() const
Definition: ExprCXX.h:2507
SourceLocation getBeginLoc() const
Definition: ExprCXX.h:2531
bool isGlobalDelete() const
Definition: ExprCXX.h:2506
Expr * getArgument()
Definition: ExprCXX.h:2522
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition: ExprCXX.h:2516
bool isArrayFormAsWritten() const
Definition: ExprCXX.h:2508
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3645
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition: ExprCXX.h:3748
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition: ExprCXX.h:3751
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: ExprCXX.h:3843
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:3775
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition: ExprCXX.h:3739
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information.
Definition: ExprCXX.h:3762
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition: ExprCXX.h:3731
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:478
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4791
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Definition: StmtCXX.h:135
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Definition: ExprCXX.h:1801
SourceLocation getLParenLoc() const
Definition: ExprCXX.h:1838
SourceLocation getRParenLoc() const
Definition: ExprCXX.h:1840
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1721
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition: ExprCXX.h:1762
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
Definition: ExprCXX.h:1758
SourceLocation getLocation() const LLVM_READONLY
Definition: ExprCXX.h:1774
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
Definition: ExprCXX.h:1772
Represents a call to a member function that may be written either with member call syntax (e....
Definition: ExprCXX.h:176
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:372
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
Definition: ExprCXX.h:403
SourceRange getAngleBrackets() const LLVM_READONLY
Definition: ExprCXX.h:410
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
Definition: ExprCXX.h:406
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition: ExprCXX.h:2224
bool isArray() const
Definition: ExprCXX.h:2332
SourceRange getDirectInitRange() const
Definition: ExprCXX.h:2464
bool hasInitializer() const
Whether this new-expression has any initializer at all.
Definition: ExprCXX.h:2388
bool passAlignment() const
Indicates whether the required alignment should be implicitly passed to the allocation function.
Definition: ExprCXX.h:2415
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2329
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:2362
TypeSourceInfo * getAllocatedTypeSourceInfo() const
Definition: ExprCXX.h:2306
SourceRange getSourceRange() const
Definition: ExprCXX.h:2465
SourceRange getTypeIdParens() const
Definition: ExprCXX.h:2380
bool isParenTypeId() const
Definition: ExprCXX.h:2379
raw_arg_iterator raw_arg_end()
Definition: ExprCXX.h:2451
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition: ExprCXX.h:2420
raw_arg_iterator raw_arg_begin()
Definition: ExprCXX.h:2450
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:2327
bool isGlobalNew() const
Definition: ExprCXX.h:2385
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:4088
bool getValue() const
Definition: ExprCXX.h:4111
Expr * getOperand() const
Definition: ExprCXX.h:4105
SourceRange getSourceRange() const
Definition: ExprCXX.h:4109
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:765
SourceLocation getLocation() const
Definition: ExprCXX.h:779
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:81
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Definition: ExprCXX.h:111
Represents a list-initialization with parenthesis.
Definition: ExprCXX.h:4913
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.h:4971
SourceLocation getInitLoc() const LLVM_READONLY
Definition: ExprCXX.h:4973
ArrayRef< Expr * > getUserSpecifiedInitExprs()
Definition: ExprCXX.h:4961
ArrayRef< Expr * > getInitExprs()
Definition: ExprCXX.h:4953
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:4969
FieldDecl * getInitializedFieldInUnion()
Definition: ExprCXX.h:4993
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2600
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Definition: ExprCXX.h:2694
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise,...
Definition: ExprCXX.h:2664
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition: ExprCXX.h:2678
IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
Definition: ExprCXX.h:2701
SourceLocation getTildeLoc() const
Retrieve the location of the '~'.
Definition: ExprCXX.h:2685
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information.
Definition: ExprCXX.h:2653
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
Definition: ExprCXX.h:2709
SourceLocation getColonColonLoc() const
Retrieve the location of the '::' in a qualified pseudo-destructor expression.
Definition: ExprCXX.h:2682
SourceLocation getOperatorLoc() const
Retrieve the location of the '.' or '->' operator.
Definition: ExprCXX.h:2667
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:523
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:283
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
Definition: ExprCXX.h:301
bool isReversed() const
Determine whether this expression was rewritten in reverse form.
Definition: ExprCXX.h:319
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type.
Definition: ExprCXX.h:2165
TypeSourceInfo * getTypeSourceInfo() const
Definition: ExprCXX.h:2184
SourceLocation getRParenLoc() const
Definition: ExprCXX.h:2188
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:433
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:797
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1869
TypeSourceInfo * getTypeSourceInfo() const
Definition: ExprCXX.h:1898
Represents the this expression in C++.
Definition: ExprCXX.h:1148
bool isImplicit() const
Definition: ExprCXX.h:1170
SourceLocation getLocation() const
Definition: ExprCXX.h:1164
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1192
const Expr * getSubExpr() const
Definition: ExprCXX.h:1212
SourceLocation getThrowLoc() const
Definition: ExprCXX.h:1215
bool isThrownVariableInScope() const
Determines whether the variable thrown by this expression (if any!) is within the innermost try block...
Definition: ExprCXX.h:1222
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:69
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:845
bool isTypeOperand() const
Definition: ExprCXX.h:881
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:888
Expr * getExprOperand() const
Definition: ExprCXX.h:892
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprCXX.h:899
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3519
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
Definition: ExprCXX.h:3563
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition: ExprCXX.h:3574
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
Definition: ExprCXX.h:3557
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
Definition: ExprCXX.h:3568
unsigned getNumArgs() const
Retrieve the number of arguments.
Definition: ExprCXX.h:3577
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:1062
Expr * getExprOperand() const
Definition: ExprCXX.h:1103
MSGuidDecl * getGuidDecl() const
Definition: ExprCXX.h:1108
bool isTypeOperand() const
Definition: ExprCXX.h:1092
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:1099
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprCXX.h:1112
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2808
bool hasStoredFPFeatures() const
Definition: Expr.h:2970
arg_iterator arg_begin()
Definition: Expr.h:3052
arg_iterator arg_end()
Definition: Expr.h:3055
ADLCallKind getADLCallKind() const
Definition: Expr.h:2962
Expr * getCallee()
Definition: Expr.h:2958
FPOptionsOverride getFPFeatures() const
Definition: Expr.h:3090
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: Expr.h:2986
SourceLocation getRParenLoc() const
Definition: Expr.h:3118
This captures a statement into a function.
Definition: Stmt.h:3755
CaseStmt - Represent a case statement.
Definition: Stmt.h:1799
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3478
path_iterator path_begin()
Definition: Expr.h:3548
unsigned path_size() const
Definition: Expr.h:3547
CastKind getCastKind() const
Definition: Expr.h:3522
bool hasStoredFPFeatures() const
Definition: Expr.h:3565
path_iterator path_end()
Definition: Expr.h:3549
FPOptionsOverride getFPFeatures() const
Definition: Expr.h:3581
Expr * getSubExpr()
Definition: Expr.h:3528
SourceLocation getLocation() const
Definition: Expr.h:1602
unsigned getValue() const
Definition: Expr.h:1610
CharacterLiteralKind getKind() const
Definition: Expr.h:1603
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4541
SourceLocation getBuiltinLoc() const
Definition: Expr.h:4588
Expr * getLHS() const
Definition: Expr.h:4583
bool isConditionDependent() const
Definition: Expr.h:4571
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
Definition: Expr.h:4564
Expr * getRHS() const
Definition: Expr.h:4585
SourceLocation getRParenLoc() const
Definition: Expr.h:4591
Expr * getCond() const
Definition: Expr.h:4581
Represents a 'co_await' expression.
Definition: ExprCXX.h:5123
bool isImplicit() const
Definition: ExprCXX.h:5145
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4071
QualType getComputationLHSType() const
Definition: Expr.h:4105
QualType getComputationResultType() const
Definition: Expr.h:4108
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3408
SourceLocation getLParenLoc() const
Definition: Expr.h:3438
bool isFileScope() const
Definition: Expr.h:3435
const Expr * getInitializer() const
Definition: Expr.h:3431
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:3441
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1604
A reference to a concept and its template args, as it appears in the code.
Definition: ASTConcept.h:128
Represents the specialization of a concept - evaluates to a prvalue of type bool.
Definition: ExprConcepts.h:42
ConceptReference * getConceptReference() const
Definition: ExprConcepts.h:85
const ImplicitConceptSpecializationDecl * getSpecializationDecl() const
Definition: ExprConcepts.h:116
const ASTConstraintSatisfaction & getSatisfaction() const
Get elaborated satisfaction info about the template arguments' satisfaction of the named concept.
Definition: ExprConcepts.h:133
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:4162
Expr * getLHS() const
Definition: Expr.h:4196
Expr * getCond() const
getCond - Return the expression representing the condition for the ?: operator.
Definition: Expr.h:4185
Expr * getRHS() const
Definition: Expr.h:4197
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:1072
ConstantResultStorageKind getResultStorageKind() const
Definition: Expr.h:1141
ContinueStmt - This represents a continue.
Definition: Stmt.h:2948
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4482
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition: Expr.h:4516
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_convertvector token.
Definition: Expr.h:4513
TypeSourceInfo * getTypeSourceInfo() const
getTypeSourceInfo - Return the destination type.
Definition: Expr.h:4505
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:4502
Represents a 'co_return' statement in the C++ Coroutines TS.
Definition: StmtCXX.h:473
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:5030
SourceLocation getKeywordLoc() const
Definition: ExprCXX.h:5100
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition: ExprCXX.h:5081
child_range children()
Definition: ExprCXX.h:5108
Represents a 'co_yield' expression.
Definition: ExprCXX.h:5204
A POD class for pairing a NamedDecl* with an access specifier.
NamedDecl * getDecl() const
AccessSpecifier getAccess() const
iterator begin()
Definition: DeclGroup.h:99
iterator end()
Definition: DeclGroup.h:105
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1260
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:1429
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition: Expr.h:1365
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
Definition: Expr.h:1458
bool hasTemplateKWAndArgsInfo() const
Definition: Expr.h:1375
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier,...
Definition: Expr.h:1343
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name,...
Definition: Expr.h:1347
ValueDecl * getDecl()
Definition: Expr.h:1328
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition: Expr.h:1452
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
Definition: Expr.h:1441
SourceLocation getLocation() const
Definition: Expr.h:1336
bool isImmediateEscalating() const
Definition: Expr.h:1462
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition: Stmt.h:1495
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:85
AccessSpecifier getAccess() const
Definition: DeclBase.h:512
NameKind
The kind of the name stored in this DeclarationName.
NameKind getNameKind() const
Determine what kind of name this is.
Represents a 'co_await' expression while the type of the promise is dependent.
Definition: ExprCXX.h:5155
SourceLocation getKeywordLoc() const
Definition: ExprCXX.h:5184
child_range children()
Definition: ExprCXX.h:5192
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3285
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
Definition: ExprCXX.h:3333
Represents a single C99 designator.
Definition: Expr.h:5118
Represents a C99 designated initializer expression.
Definition: Expr.h:5075
Expr * getSubExpr(unsigned Idx) const
Definition: Expr.h:5357
llvm::MutableArrayRef< Designator > designators()
Definition: Expr.h:5308
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
Definition: Expr.h:5339
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the '=' that precedes the initializer value itself, if present.
Definition: Expr.h:5330
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression,...
Definition: Expr.h:5355
Expr * getBase() const
Definition: Expr.h:5459
InitListExpr * getUpdater() const
Definition: Expr.h:5462
DoStmt - This represents a 'do/while' stmt.
Definition: Stmt.h:2723
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3713
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Definition: Expr.h:3735
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:3436
bool cleanupsHaveSideEffects() const
Definition: ExprCXX.h:3471
ArrayRef< CleanupObject > getObjects() const
Definition: ExprCXX.h:3460
unsigned getNumObjects() const
Definition: ExprCXX.h:3464
This represents one expression.
Definition: Expr.h:110
bool isValueDependent() const
Determines whether the value of this expression depends on.
Definition: Expr.h:175
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Definition: Expr.h:437
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Definition: Expr.h:444
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition: Expr.cpp:274
QualType getType() const
Definition: Expr.h:142
ExprDependence getDependence() const
Definition: Expr.h:162
An expression trait intrinsic.
Definition: ExprCXX.h:2907
Expr * getQueriedExpression() const
Definition: ExprCXX.h:2946
ExpressionTrait getTrait() const
Definition: ExprCXX.h:2944
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:6096
SourceLocation getAccessorLoc() const
Definition: Expr.h:6120
const Expr * getBase() const
Definition: Expr.h:6113
IdentifierInfo & getAccessor() const
Definition: Expr.h:6117
storage_type getAsOpaqueInt() const
Definition: LangOptions.h:931
Represents a member of a struct/union/class.
Definition: Decl.h:3025
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition: Expr.h:1562
unsigned getScale() const
Definition: Expr.h:1566
SourceLocation getLocation() const
Definition: Expr.h:1688
llvm::APFloatBase::Semantics getRawSemantics() const
Get a raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE,...
Definition: Expr.h:1657
llvm::APFloat getValue() const
Definition: Expr.h:1647
bool isExact() const
Definition: Expr.h:1680
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition: Stmt.h:2779
const Expr * getSubExpr() const
Definition: Expr.h:1052
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4599
VarDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition: ExprCXX.h:4626
iterator end() const
Definition: ExprCXX.h:4635
VarDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition: ExprCXX.h:4633
unsigned getNumExpansions() const
Get the number of parameters in this parameter pack.
Definition: ExprCXX.h:4638
SourceLocation getParameterPackLocation() const
Get the location of the parameter pack.
Definition: ExprCXX.h:4629
iterator begin() const
Definition: ExprCXX.h:4634
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:3257
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4616
SourceLocation getTokenLocation() const
getTokenLocation - The location of the __null token.
Definition: Expr.h:4630
Represents a C11 generic selection.
Definition: Expr.h:5708
unsigned getNumAssocs() const
The number of association expressions.
Definition: Expr.h:5948
bool isExprPredicate() const
Whether this generic selection uses an expression as its controlling argument.
Definition: Expr.h:5964
SourceLocation getGenericLoc() const
Definition: Expr.h:6061
SourceLocation getRParenLoc() const
Definition: Expr.h:6065
SourceLocation getDefaultLoc() const
Definition: Expr.h:6064
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2860
IfStmt - This represents an if/then/else.
Definition: Stmt.h:2136
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
Definition: Expr.h:1712
const Expr * getSubExpr() const
Definition: Expr.h:1724
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3638
bool isPartOfExplicitCast() const
Definition: Expr.h:3669
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5583
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2899
Describes an C or C++ initializer list.
Definition: Expr.h:4830
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition: Expr.h:4949
unsigned getNumInits() const
Definition: Expr.h:4860
SourceLocation getLBraceLoc() const
Definition: Expr.h:4984
InitListExpr * getSyntacticForm() const
Definition: Expr.h:4996
bool hadArrayRangeDesignator() const
Definition: Expr.h:5007
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition: Expr.h:4924
SourceLocation getRBraceLoc() const
Definition: Expr.h:4986
const Expr * getInit(unsigned Init) const
Definition: Expr.h:4876
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition: Expr.h:1520
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:2029
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1938
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Definition: ExprCXX.h:2076
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition: ExprCXX.h:2064
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3480
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
Definition: StmtCXX.h:253
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:929
NestedNameSpecifierLoc getQualifierLoc() const
Definition: ExprCXX.h:986
bool isArrow() const
Definition: ExprCXX.h:984
MSPropertyDecl * getPropertyDecl() const
Definition: ExprCXX.h:983
Expr * getBaseExpr() const
Definition: ExprCXX.h:982
SourceLocation getMemberLoc() const
Definition: ExprCXX.h:985
MS property subscript expression.
Definition: ExprCXX.h:1000
SourceLocation getRBracketLoc() const
Definition: ExprCXX.h:1037
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition: ExprCXX.h:4679
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
Definition: ExprCXX.h:4696
LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl()
Definition: ExprCXX.h:4719
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition: Expr.h:2730
SourceLocation getRBracketLoc() const
Definition: Expr.h:2782
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3171
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
Definition: Expr.h:3356
SourceLocation getOperatorLoc() const
Definition: Expr.h:3349
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name,...
Definition: Expr.h:3269
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:3250
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why? This is only meaningful if the named memb...
Definition: Expr.h:3391
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
Definition: Expr.h:3264
Expr * getBase() const
Definition: Expr.h:3244
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:3332
bool hadMultipleCandidates() const
Returns true if this member expression refers to a method that was resolved from an overloaded set ha...
Definition: Expr.h:3371
bool isArrow() const
Definition: Expr.h:3351
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Definition: Expr.h:3254
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:315
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:5403
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1567
OpenMP 5.0 [2.1.5, Array Sections].
Definition: ExprOpenMP.h:56
Expr * getLength()
Get length of array section.
Definition: ExprOpenMP.h:102
Expr * getStride()
Get stride of array section.
Definition: ExprOpenMP.h:108
SourceLocation getColonLocFirst() const
Definition: ExprOpenMP.h:118
SourceLocation getColonLocSecond() const
Definition: ExprOpenMP.h:121
Expr * getBase()
An array section can be written only as Base[LowerBound:Length].
Definition: ExprOpenMP.h:85
SourceLocation getRBracketLoc() const
Definition: ExprOpenMP.h:124
Expr * getLowerBound()
Get lower bound of array section.
Definition: ExprOpenMP.h:94
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
Definition: ExprOpenMP.h:148
Expr * getBase()
Fetches base expression of array shaping expression.
Definition: ExprOpenMP.h:214
SourceLocation getLParenLoc() const
Definition: ExprOpenMP.h:192
ArrayRef< Expr * > getDimensions() const
Fetches the dimensions for array shaping expression.
Definition: ExprOpenMP.h:204
SourceLocation getRParenLoc() const
Definition: ExprOpenMP.h:195
ArrayRef< SourceRange > getBracketsRanges() const
Fetches source ranges for the brackets os the array shaping expression.
Definition: ExprOpenMP.h:209
This represents '#pragma omp atomic' directive.
Definition: StmtOpenMP.h:2963
bool isXLHSInRHSPart() const
Return true if helper update expression has form 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' and...
Definition: StmtOpenMP.h:3112
bool isFailOnly() const
Return true if 'v' is updated only when the condition is evaluated false (compare capture only).
Definition: StmtOpenMP.h:3118
bool isPostfixUpdate() const
Return true if 'v' expression must be updated to original value of 'x', false if 'v' must be updated ...
Definition: StmtOpenMP.h:3115
This represents '#pragma omp barrier' directive.
Definition: StmtOpenMP.h:2641
This represents '#pragma omp cancel' directive.
Definition: StmtOpenMP.h:3671
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
Definition: StmtOpenMP.h:3715
This represents '#pragma omp cancellation point' directive.
Definition: StmtOpenMP.h:3613
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
Definition: StmtOpenMP.h:3657
Representation of an OpenMP canonical loop.
Definition: StmtOpenMP.h:142
This represents '#pragma omp critical' directive.
Definition: StmtOpenMP.h:2092
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
Definition: StmtOpenMP.h:2147
This represents '#pragma omp depobj' directive.
Definition: StmtOpenMP.h:2857
This represents '#pragma omp dispatch' directive.
Definition: StmtOpenMP.h:5827
SourceLocation getTargetCallLoc() const
Return location of target-call.
Definition: StmtOpenMP.h:5878
This represents '#pragma omp distribute' directive.
Definition: StmtOpenMP.h:4441
This represents '#pragma omp distribute parallel for' composite directive.
Definition: StmtOpenMP.h:4564
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:4644
This represents '#pragma omp distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:4660
This represents '#pragma omp distribute simd' composite directive.
Definition: StmtOpenMP.h:4725
This represents '#pragma omp error' directive.
Definition: StmtOpenMP.h:6302
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:266
SourceLocation getBeginLoc() const
Returns starting location of directive kind.
Definition: StmtOpenMP.h:502
unsigned getNumClauses() const
Get number of clauses.
Definition: StmtOpenMP.h:518
OMPChildren * Data
Data, associated with the directive.
Definition: StmtOpenMP.h:295
OpenMPDirectiveKind getMappedDirective() const
Definition: StmtOpenMP.h:615
SourceLocation getEndLoc() const
Returns ending location of directive.
Definition: StmtOpenMP.h:504
This represents '#pragma omp flush' directive.
Definition: StmtOpenMP.h:2805
This represents '#pragma omp for' directive.
Definition: StmtOpenMP.h:1649
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:1724
This represents '#pragma omp for simd' directive.
Definition: StmtOpenMP.h:1740
This represents '#pragma omp loop' directive.
Definition: StmtOpenMP.h:5982
This represents '#pragma omp interop' directive.
Definition: StmtOpenMP.h:5774
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition: ExprOpenMP.h:275
SourceLocation getLParenLoc() const
Definition: ExprOpenMP.h:366
SourceLocation getSecondColonLoc(unsigned I) const
Gets the location of the second ':' (if any) in the range for the given iteratori definition.
Definition: Expr.cpp:5210
SourceLocation getColonLoc(unsigned I) const
Gets the location of the first ':' in the range for the given iterator definition.
Definition: Expr.cpp:5204
SourceLocation getRParenLoc() const
Definition: ExprOpenMP.h:369
IteratorRange getIteratorRange(unsigned I)
Gets the iterator range for the given iterator.
Definition: Expr.cpp:5181
OMPIteratorHelperData & getHelper(unsigned I)
Fetches helper data for the specified iteration space.
Definition: Expr.cpp:5220
SourceLocation getAssignLoc(unsigned I) const
Gets the location of '=' for the given iterator definition.
Definition: Expr.cpp:5198
SourceLocation getIteratorKwLoc() const
Definition: ExprOpenMP.h:372
unsigned numOfIterators() const
Returns number of iterator definitions.
Definition: ExprOpenMP.h:399
Decl * getIteratorDecl(unsigned I)
Gets the iterator declaration for the given iterator.
Definition: Expr.cpp:5177
The base class for all loop-based directives, including loop transformation directives.
Definition: StmtOpenMP.h:698
unsigned getLoopsNumber() const
Get number of collapsed loops.
Definition: StmtOpenMP.h:892
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc....
Definition: StmtOpenMP.h:1018
The base class for all loop transformation directives.
Definition: StmtOpenMP.h:975
unsigned getNumGeneratedLoops() const
Return the number of loops generated by this loop transformation.
Definition: StmtOpenMP.h:997
This represents '#pragma omp masked' directive.
Definition: StmtOpenMP.h:5892
This represents '#pragma omp masked taskloop' directive.
Definition: StmtOpenMP.h:3946
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:4006
This represents '#pragma omp masked taskloop simd' directive.
Definition: StmtOpenMP.h:4087
This represents '#pragma omp master' directive.
Definition: StmtOpenMP.h:2044
This represents '#pragma omp master taskloop' directive.
Definition: StmtOpenMP.h:3870
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:3930
This represents '#pragma omp master taskloop simd' directive.
Definition: StmtOpenMP.h:4022
This represents '#pragma omp metadirective' directive.
Definition: StmtOpenMP.h:5943
This represents '#pragma omp ordered' directive.
Definition: StmtOpenMP.h:2909
This represents '#pragma omp parallel' directive.
Definition: StmtOpenMP.h:627
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:689
This represents '#pragma omp parallel for' directive.
Definition: StmtOpenMP.h:2163
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:2243
This represents '#pragma omp parallel for simd' directive.
Definition: StmtOpenMP.h:2260
This represents '#pragma omp parallel loop' directive.
Definition: StmtOpenMP.h:6175
This represents '#pragma omp parallel masked' directive.
Definition: StmtOpenMP.h:2388
This represents '#pragma omp parallel masked taskloop' directive.
Definition: StmtOpenMP.h:4231
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:4292
This represents '#pragma omp parallel masked taskloop simd' directive.
Definition: StmtOpenMP.h:4376
This represents '#pragma omp parallel master' directive.
Definition: StmtOpenMP.h:2325
This represents '#pragma omp parallel master taskloop' directive.
Definition: StmtOpenMP.h:4153
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:4214
This represents '#pragma omp parallel master taskloop simd' directive.
Definition: StmtOpenMP.h:4309
This represents '#pragma omp parallel sections' directive.
Definition: StmtOpenMP.h:2452
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:2518
This represents '#pragma omp scan' directive.
Definition: StmtOpenMP.h:5721
This represents '#pragma omp scope' directive.
Definition: StmtOpenMP.h:1941
This represents '#pragma omp section' directive.
Definition: StmtOpenMP.h:1880
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:1927
This represents '#pragma omp sections' directive.
Definition: StmtOpenMP.h:1803
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:1867
This represents '#pragma omp simd' directive.
Definition: StmtOpenMP.h:1585
This represents '#pragma omp single' directive.
Definition: StmtOpenMP.h:1993
This represents '#pragma omp target data' directive.
Definition: StmtOpenMP.h:3222
This represents '#pragma omp target' directive.
Definition: StmtOpenMP.h:3168
This represents '#pragma omp target enter data' directive.
Definition: StmtOpenMP.h:3276
This represents '#pragma omp target exit data' directive.
Definition: StmtOpenMP.h:3331
This represents '#pragma omp target parallel' directive.
Definition: StmtOpenMP.h:3385
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:3449
This represents '#pragma omp target parallel for' directive.
Definition: StmtOpenMP.h:3465
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:3545
This represents '#pragma omp target parallel for simd' directive.
Definition: StmtOpenMP.h:4791
This represents '#pragma omp target parallel loop' directive.
Definition: StmtOpenMP.h:6240
This represents '#pragma omp target simd' directive.
Definition: StmtOpenMP.h:4858
This represents '#pragma omp target teams' directive.
Definition: StmtOpenMP.h:5216
This represents '#pragma omp target teams distribute' combined directive.
Definition: StmtOpenMP.h:5272
This represents '#pragma omp target teams distribute parallel for' combined directive.
Definition: StmtOpenMP.h:5339
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:5419
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
Definition: StmtOpenMP.h:5437
This represents '#pragma omp target teams distribute simd' combined directive.
Definition: StmtOpenMP.h:5507
This represents '#pragma omp target teams loop' directive.
Definition: StmtOpenMP.h:6109
This represents '#pragma omp target update' directive.
Definition: StmtOpenMP.h:4508
This represents '#pragma omp task' directive.
Definition: StmtOpenMP.h:2533
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:2582
This represents '#pragma omp taskloop' directive.
Definition: StmtOpenMP.h:3731
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:3788
This represents '#pragma omp taskloop simd' directive.
Definition: StmtOpenMP.h:3804
This represents '#pragma omp taskgroup' directive.
Definition: StmtOpenMP.h:2738
This represents '#pragma omp taskwait' directive.
Definition: StmtOpenMP.h:2687
This represents '#pragma omp taskyield' directive.
Definition: StmtOpenMP.h:2595
This represents '#pragma omp teams' directive.
Definition: StmtOpenMP.h:3560
This represents '#pragma omp teams distribute' directive.
Definition: StmtOpenMP.h:4923
This represents '#pragma omp teams distribute parallel for' composite directive.
Definition: StmtOpenMP.h:5123
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:5201
This represents '#pragma omp teams distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:5057
This represents '#pragma omp teams distribute simd' combined directive.
Definition: StmtOpenMP.h:4989
This represents '#pragma omp teams loop' directive.
Definition: StmtOpenMP.h:6044
This represents the '#pragma omp tile' loop transformation directive.
Definition: StmtOpenMP.h:5565
This represents the '#pragma omp unroll' loop transformation directive.
Definition: StmtOpenMP.h:5647
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Definition: ExprObjC.h:191
Expr * getElement(unsigned Index)
getElement - Return the Element at the specified index.
Definition: ExprObjC.h:231
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c array literal.
Definition: ExprObjC.h:228
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprObjC.h:217
ObjCMethodDecl * getArrayWithObjectsMethod() const
Definition: ExprObjC.h:240
Represents Objective-C's @catch statement.
Definition: StmtObjC.h:77
Represents Objective-C's @finally statement.
Definition: StmtObjC.h:127
Represents Objective-C's @synchronized statement.
Definition: StmtObjC.h:303
Represents Objective-C's @throw statement.
Definition: StmtObjC.h:358
Represents Objective-C's @try ... @catch ... @finally statement.
Definition: StmtObjC.h:167
Represents Objective-C's @autoreleasepool Statement.
Definition: StmtObjC.h:394
A runtime availability query.
Definition: ExprObjC.h:1696
SourceRange getSourceRange() const
Definition: ExprObjC.h:1715
VersionTuple getVersion() const
Definition: ExprObjC.h:1719
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:87
SourceLocation getLocation() const
Definition: ExprObjC.h:106
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:127
Expr * getSubExpr()
Definition: ExprObjC.h:143
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprObjC.h:161
ObjCMethodDecl * getBoxingMethod() const
Definition: ExprObjC.h:146
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
Definition: ExprObjC.h:1636
SourceLocation getLParenLoc() const
Definition: ExprObjC.h:1659
SourceLocation getBridgeKeywordLoc() const
The location of the bridge keyword.
Definition: ExprObjC.h:1670
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
Definition: ExprObjC.h:1662
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:309
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
Definition: ExprObjC.h:360
ObjCMethodDecl * getDictWithObjectsMethod() const
Definition: ExprObjC.h:377
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
Definition: ExprObjC.h:362
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprObjC.h:383
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:410
TypeSourceInfo * getEncodedTypeSourceInfo() const
Definition: ExprObjC.h:431
SourceLocation getRParenLoc() const
Definition: ExprObjC.h:426
SourceLocation getAtLoc() const
Definition: ExprObjC.h:424
Represents Objective-C's collection statement.
Definition: StmtObjC.h:23
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1575
bool shouldCopy() const
shouldCopy - True if we should do the 'copy' part of the copy-restore.
Definition: ExprObjC.h:1603
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
Definition: ExprObjC.h:1491
SourceLocation getIsaMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
Definition: ExprObjC.h:1523
SourceLocation getOpLoc() const
Definition: ExprObjC.h:1526
Expr * getBase() const
Definition: ExprObjC.h:1516
bool isArrow() const
Definition: ExprObjC.h:1518
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:549
SourceLocation getLocation() const
Definition: ExprObjC.h:592
SourceLocation getOpLoc() const
Definition: ExprObjC.h:600
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:579
bool isArrow() const
Definition: ExprObjC.h:587
bool isFreeIvar() const
Definition: ExprObjC.h:588
const Expr * getBase() const
Definition: ExprObjC.h:583
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:945
bool isDelegateInitCall() const
isDelegateInitCall - Answers whether this message send has been tagged as a "delegate init call",...
Definition: ExprObjC.h:1413
SourceLocation getLeftLoc() const
Definition: ExprObjC.h:1416
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Definition: ExprObjC.h:1260
SourceLocation getSuperLoc() const
Retrieve the location of the 'super' keyword for a class or instance message to 'super',...
Definition: ExprObjC.h:1301
Selector getSelector() const
Definition: ExprObjC.cpp:293
@ SuperInstance
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:959
@ Instance
The receiver is an object instance.
Definition: ExprObjC.h:953
@ SuperClass
The receiver is a superclass.
Definition: ExprObjC.h:956
@ Class
The receiver is a class.
Definition: ExprObjC.h:950
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:1288
QualType getSuperType() const
Retrieve the type referred to by 'super'.
Definition: ExprObjC.h:1336
const ObjCMethodDecl * getMethodDecl() const
Definition: ExprObjC.h:1356
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1234
arg_iterator arg_begin()
Definition: ExprObjC.h:1470
SourceLocation getRightLoc() const
Definition: ExprObjC.h:1417
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver.
Definition: ExprObjC.h:1382
arg_iterator arg_end()
Definition: ExprObjC.h:1472
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:617
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:706
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:711
SourceLocation getReceiverLocation() const
Definition: ExprObjC.h:764
const Expr * getBase() const
Definition: ExprObjC.h:755
bool isObjectReceiver() const
Definition: ExprObjC.h:774
QualType getSuperReceiverType() const
Definition: ExprObjC.h:766
bool isImplicitProperty() const
Definition: ExprObjC.h:703
ObjCMethodDecl * getImplicitPropertySetter() const
Definition: ExprObjC.h:716
ObjCInterfaceDecl * getClassReceiver() const
Definition: ExprObjC.h:770
SourceLocation getLocation() const
Definition: ExprObjC.h:762
bool isSuperReceiver() const
Definition: ExprObjC.h:775
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:505
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:522
SourceLocation getRParenLoc() const
Definition: ExprObjC.h:527
SourceLocation getAtLoc() const
Definition: ExprObjC.h:526
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:455
SourceLocation getRParenLoc() const
Definition: ExprObjC.h:473
Selector getSelector() const
Definition: ExprObjC.h:469
SourceLocation getAtLoc() const
Definition: ExprObjC.h:472
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:51
SourceLocation getAtLoc() const
Definition: ExprObjC.h:68
StringLiteral * getString()
Definition: ExprObjC.h:64
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:844
Expr * getKeyExpr() const
Definition: ExprObjC.h:886
Expr * getBaseExpr() const
Definition: ExprObjC.h:883
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition: ExprObjC.h:889
SourceLocation getRBracket() const
Definition: ExprObjC.h:874
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition: ExprObjC.h:893
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Definition: Expr.h:2453
Expr * getIndexExpr(unsigned Idx)
Definition: Expr.h:2514
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition: Expr.h:2486
const OffsetOfNode & getComponent(unsigned Idx) const
Definition: Expr.h:2500
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:2493
unsigned getNumExpressions() const
Definition: Expr.h:2529
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
Definition: Expr.h:2490
unsigned getNumComponents() const
Definition: Expr.h:2510
Helper class for OffsetOfExpr.
Definition: Expr.h:2347
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
Definition: Expr.h:2405
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition: Expr.h:2411
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition: Expr.cpp:1669
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this offsetof node.
Definition: Expr.h:2432
@ Array
An index into an array.
Definition: Expr.h:2352
@ Identifier
A field in a dependent type, known only by its name.
Definition: Expr.h:2356
@ Field
A field.
Definition: Expr.h:2354
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Definition: Expr.h:2359
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:2401
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
Definition: Expr.h:2421
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition: Expr.h:1168
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition: Expr.h:1218
SourceLocation getLocation() const
Retrieve the location of this expression.
Definition: Expr.h:1190
bool isUnique() const
Definition: Expr.h:1226
This is a base class for any OpenACC statement-level constructs that have an associated statement.
Definition: StmtOpenACC.h:63
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
Definition: StmtOpenACC.h:104
This is the base class for an OpenACC statement-level construct, other construct types are expected t...
Definition: StmtOpenACC.h:23
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Definition: ExprCXX.h:2966
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition: ExprCXX.h:4061
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
Definition: ExprCXX.h:3072
decls_iterator decls_begin() const
Definition: ExprCXX.h:3058
unsigned getNumDecls() const
Gets the number of declarations in the unresolved set.
Definition: ExprCXX.h:3069
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
Definition: ExprCXX.h:3087
TemplateArgumentLoc * getTrailingTemplateArgumentLoc()
Return the optional template arguments.
Definition: ExprCXX.h:4071
bool hasTemplateKWAndArgsInfo() const
Definition: ExprCXX.h:3010
decls_iterator decls_end() const
Definition: ExprCXX.h:3061
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:4142
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition: ExprCXX.h:4171
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
Definition: ExprCXX.h:4178
SourceLocation getEllipsisLoc() const
Determine the location of the 'sizeof' keyword.
Definition: ExprCXX.h:4385
Expr * getIndexExpr() const
Definition: ExprCXX.h:4400
ArrayRef< Expr * > getExpressions() const
Definition: ExprCXX.h:4417
SourceLocation getRSquareLoc() const
Determine the location of the right parenthesis.
Definition: ExprCXX.h:4391
Expr * getPackIdExpression() const
Definition: ExprCXX.h:4396
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:2118
SourceLocation getLParen() const
Get the location of the left parentheses '('.
Definition: Expr.h:2141
const Expr * getSubExpr() const
Definition: Expr.h:2133
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
Definition: Expr.h:2145
ArrayRef< Expr * > exprs()
Definition: Expr.h:5651
unsigned getNumExprs() const
Return the number of expressions in this paren list.
Definition: Expr.h:5636
SourceLocation getLParenLoc() const
Definition: Expr.h:5653
SourceLocation getRParenLoc() const
Definition: Expr.h:5654
Represents a parameter to a function.
Definition: Decl.h:1749
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1975
bool isTransparent() const
Definition: Expr.h:2014
PredefinedIdentKind getIdentKind() const
Definition: Expr.h:2010
SourceLocation getLocation() const
Definition: Expr.h:2016
StringLiteral * getFunctionName()
Definition: Expr.h:2019
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:6288
semantics_iterator semantics_end()
Definition: Expr.h:6360
unsigned getResultExprIndex() const
Return the index of the result-bearing expression into the semantics expressions, or PseudoObjectExpr...
Definition: Expr.h:6335
semantics_iterator semantics_begin()
Definition: Expr.h:6354
Expr *const * semantics_iterator
Definition: Expr.h:6352
unsigned getNumSemanticExprs() const
Definition: Expr.h:6350
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Definition: Expr.h:6330
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition: Expr.h:6623
SourceLocation getEndLoc() const
Definition: Expr.h:6645
child_range children()
Definition: Expr.h:6639
SourceLocation getBeginLoc() const
Definition: Expr.h:6644
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:510
SourceLocation getLParenLoc() const
Definition: ExprConcepts.h:578
SourceLocation getRParenLoc() const
Definition: ExprConcepts.h:579
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprConcepts.h:589
RequiresExprBodyDecl * getBody() const
Definition: ExprConcepts.h:554
ArrayRef< concepts::Requirement * > getRequirements() const
Definition: ExprConcepts.h:556
ArrayRef< ParmVarDecl * > getLocalParameters() const
Definition: ExprConcepts.h:550
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Definition: Stmt.h:3017
Represents a __leave statement.
Definition: Stmt.h:3716
SourceLocation getLocation() const
Definition: Expr.h:2091
SourceLocation getLParenLocation() const
Definition: Expr.h:2092
TypeSourceInfo * getTypeSourceInfo()
Definition: Expr.h:2079
SourceLocation getRParenLocation() const
Definition: Expr.h:2093
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:4414
SourceLocation getBuiltinLoc() const
Definition: Expr.h:4432
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
Definition: Expr.h:4448
SourceLocation getRParenLoc() const
Definition: Expr.h:4435
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
Definition: Expr.h:4454
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4220
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
Definition: ExprCXX.h:4306
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition: ExprCXX.h:4311
unsigned getPackLength() const
Retrieve the length of the parameter pack.
Definition: ExprCXX.h:4295
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Definition: Expr.h:4710
SourceLocation getBeginLoc() const
Definition: Expr.h:4755
const DeclContext * getParentContext() const
If the SourceLocExpr has been resolved return the subexpression representing the resolved value.
Definition: Expr.h:4751
SourceLocation getEndLoc() const
Definition: Expr.h:4756
SourceLocIdentKind getIdentKind() const
Definition: Expr.h:4730
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
bool isValid() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:4366
CompoundStmt * getSubStmt()
Definition: Expr.h:4383
unsigned getTemplateDepth() const
Definition: Expr.h:4395
SourceLocation getRParenLoc() const
Definition: Expr.h:4392
SourceLocation getLParenLoc() const
Definition: Expr.h:4390
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:185
Stmt - This represents one statement.
Definition: Stmt.h:84
LambdaExprBitfields LambdaExprBits
Definition: Stmt.h:1261
StmtClass getStmtClass() const
Definition: Stmt.h:1356
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:326
TypeTraitExprBitfields TypeTraitExprBits
Definition: Stmt.h:1250
CXXNewExprBitfields CXXNewExprBits
Definition: Stmt.h:1248
ConstantExprBitfields ConstantExprBits
Definition: Stmt.h:1216
RequiresExprBitfields RequiresExprBits
Definition: Stmt.h:1262
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition: Stmt.h:1251
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1773
SourceLocation getStrTokenLoc(unsigned TokNum) const
Get one of the string literal token.
Definition: Expr.h:1915
bool isPascal() const
Definition: Expr.h:1892
unsigned getLength() const
Definition: Expr.h:1879
StringLiteralKind getKind() const
Definition: Expr.h:1882
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
Definition: Expr.h:1858
unsigned getByteLength() const
Definition: Expr.h:1878
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
Definition: Expr.h:1910
unsigned getCharByteWidth() const
Definition: Expr.h:1880
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:4435
std::optional< unsigned > getPackIndex() const
Definition: ExprCXX.h:4483
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition: ExprCXX.h:4477
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition: ExprCXX.h:4481
SourceLocation getNameLoc() const
Definition: ExprCXX.h:4467
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:4520
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
Definition: ExprCXX.cpp:1730
SourceLocation getParameterPackLocation() const
Retrieve the location of the parameter pack name.
Definition: ExprCXX.h:4560
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition: ExprCXX.h:4550
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition: ExprCXX.h:4554
SwitchStmt - This represents a 'switch' stmt.
Definition: Stmt.h:2386
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:524
A container of type source information.
Definition: Type.h:6872
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2751
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition: ExprCXX.h:2801
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition: ExprCXX.h:2798
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:6568
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition: Expr.h:2556
SourceLocation getRParenLoc() const
Definition: Expr.h:2632
SourceLocation getOperatorLoc() const
Definition: Expr.h:2629
bool isArgumentType() const
Definition: Expr.h:2598
TypeSourceInfo * getArgumentTypeInfo() const
Definition: Expr.h:2602
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2588
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition: Expr.h:2171
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition: Expr.h:2220
Expr * getSubExpr() const
Definition: Expr.h:2216
Opcode getOpcode() const
Definition: Expr.h:2211
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition: Expr.h:2312
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition: Expr.h:2315
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition: Expr.h:2229
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3163
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
Definition: ExprCXX.h:3239
bool isOverloaded() const
True if this lookup is overloaded.
Definition: ExprCXX.h:3234
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition: ExprCXX.h:3231
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition: ExprCXX.h:3905
QualType getBaseType() const
Definition: ExprCXX.h:3987
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition: ExprCXX.h:3997
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition: ExprCXX.h:4000
bool hasUnresolvedUsing() const
Determine whether the lookup results contain an unresolved using declaration.
Definition: ExprCXX.h:3991
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition: ExprCXX.h:3978
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:1579
The iterator over UnresolvedSets.
Definition: UnresolvedSet.h:35
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Definition: ExprCXX.h:637
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:4650
TypeSourceInfo * getWrittenTypeInfo() const
Definition: Expr.h:4674
SourceLocation getBuiltinLoc() const
Definition: Expr.h:4677
SourceLocation getRParenLoc() const
Definition: Expr.h:4680
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
Definition: Expr.h:4671
const Expr * getSubExpr() const
Definition: Expr.h:4666
WhileStmt - This represents a 'while' stmt.
Definition: Stmt.h:2582
A static requirement that can be used in a requires-expression to check properties of types and expre...
Definition: ExprConcepts.h:168
StmtCode
Record codes for each kind of statement or expression.
Definition: ASTBitCodes.h:1539
@ EXPR_DESIGNATED_INIT
A DesignatedInitExpr record.
Definition: ASTBitCodes.h:1686
@ EXPR_COMPOUND_LITERAL
A CompoundLiteralExpr record.
Definition: ASTBitCodes.h:1677
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1979
@ EXPR_OBJC_IVAR_REF_EXPR
An ObjCIvarRefExpr record.
Definition: ASTBitCodes.h:1761
@ EXPR_MEMBER
A MemberExpr record.
Definition: ASTBitCodes.h:1659
@ EXPR_CXX_TEMPORARY_OBJECT
A CXXTemporaryObjectExpr record.
Definition: ASTBitCodes.h:1835
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1990
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
Definition: ASTBitCodes.h:1665
@ EXPR_CXX_STATIC_CAST
A CXXStaticCastExpr record.
Definition: ASTBitCodes.h:1838
@ EXPR_OBJC_STRING_LITERAL
An ObjCStringLiteral record.
Definition: ASTBitCodes.h:1745
@ EXPR_VA_ARG
A VAArgExpr record.
Definition: ASTBitCodes.h:1704
@ STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1984
@ EXPR_OBJC_ISA
An ObjCIsa Expr record.
Definition: ASTBitCodes.h:1776
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
Definition: ASTBitCodes.h:1820
@ STMT_OBJC_AT_TRY
An ObjCAtTryStmt record.
Definition: ASTBitCodes.h:1791
@ STMT_DO
A DoStmt record.
Definition: ASTBitCodes.h:1578
@ STMT_OBJC_CATCH
An ObjCAtCatchStmt record.
Definition: ASTBitCodes.h:1785
@ STMT_IF
An IfStmt record.
Definition: ASTBitCodes.h:1569
@ EXPR_STRING_LITERAL
A StringLiteral record.
Definition: ASTBitCodes.h:1629
@ EXPR_OBJC_AVAILABILITY_CHECK
An ObjCAvailabilityCheckExpr record.
Definition: ASTBitCodes.h:1806
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_DIRECTIVE
Definition: ASTBitCodes.h:1974
@ EXPR_PSEUDO_OBJECT
A PseudoObjectExpr record.
Definition: ASTBitCodes.h:1734
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1989
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1671
@ STMT_CAPTURED
A CapturedStmt record.
Definition: ASTBitCodes.h:1602
@ STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1981
@ STMT_GCCASM
A GCC-style AsmStmt record.
Definition: ASTBitCodes.h:1605
@ EXPR_IMAGINARY_LITERAL
An ImaginaryLiteral record.
Definition: ASTBitCodes.h:1626
@ STMT_WHILE
A WhileStmt record.
Definition: ASTBitCodes.h:1575
@ EXPR_CONVERT_VECTOR
A ConvertVectorExpr record.
Definition: ASTBitCodes.h:1725
@ EXPR_OBJC_SUBSCRIPT_REF_EXPR
An ObjCSubscriptRefExpr record.
Definition: ASTBitCodes.h:1767
@ EXPR_STMT
A StmtExpr record.
Definition: ASTBitCodes.h:1710
@ STMT_OMP_PARALLEL_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:1999
@ EXPR_CXX_REINTERPRET_CAST
A CXXReinterpretCastExpr record.
Definition: ASTBitCodes.h:1844
@ EXPR_DESIGNATED_INIT_UPDATE
A DesignatedInitUpdateExpr record.
Definition: ASTBitCodes.h:1689
@ STMT_OBJC_AT_SYNCHRONIZED
An ObjCAtSynchronizedStmt record.
Definition: ASTBitCodes.h:1794
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1978
@ EXPR_BUILTIN_BIT_CAST
A BuiltinBitCastExpr record.
Definition: ASTBitCodes.h:1856