clang 18.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 public:
42 : Writer(Writer), Record(Writer, Record),
43 Code(serialization::STMT_NULL_PTR), AbbrevToUse(0) {}
44
45 ASTStmtWriter(const ASTStmtWriter&) = delete;
47
48 uint64_t Emit() {
49 assert(Code != serialization::STMT_NULL_PTR &&
50 "unhandled sub-statement writing AST file");
51 return Record.EmitStmt(Code, AbbrevToUse);
52 }
53
55 const TemplateArgumentLoc *Args);
56
57 void VisitStmt(Stmt *S);
58#define STMT(Type, Base) \
59 void Visit##Type(Type *);
60#include "clang/AST/StmtNodes.inc"
61 };
62}
63
65 const ASTTemplateKWAndArgsInfo &ArgInfo, const TemplateArgumentLoc *Args) {
66 Record.AddSourceLocation(ArgInfo.TemplateKWLoc);
67 Record.AddSourceLocation(ArgInfo.LAngleLoc);
68 Record.AddSourceLocation(ArgInfo.RAngleLoc);
69 for (unsigned i = 0; i != ArgInfo.NumTemplateArgs; ++i)
70 Record.AddTemplateArgumentLoc(Args[i]);
71}
72
74}
75
76void ASTStmtWriter::VisitNullStmt(NullStmt *S) {
77 VisitStmt(S);
78 Record.AddSourceLocation(S->getSemiLoc());
79 Record.push_back(S->NullStmtBits.HasLeadingEmptyMacro);
81}
82
83void ASTStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
84 VisitStmt(S);
85 Record.push_back(S->size());
86 Record.push_back(S->hasStoredFPFeatures());
87 for (auto *CS : S->body())
88 Record.AddStmt(CS);
89 if (S->hasStoredFPFeatures())
90 Record.push_back(S->getStoredFPFeatures().getAsOpaqueInt());
91 Record.AddSourceLocation(S->getLBracLoc());
92 Record.AddSourceLocation(S->getRBracLoc());
94}
95
96void ASTStmtWriter::VisitSwitchCase(SwitchCase *S) {
97 VisitStmt(S);
98 Record.push_back(Writer.getSwitchCaseID(S));
99 Record.AddSourceLocation(S->getKeywordLoc());
100 Record.AddSourceLocation(S->getColonLoc());
101}
102
103void ASTStmtWriter::VisitCaseStmt(CaseStmt *S) {
104 VisitSwitchCase(S);
105 Record.push_back(S->caseStmtIsGNURange());
106 Record.AddStmt(S->getLHS());
107 Record.AddStmt(S->getSubStmt());
108 if (S->caseStmtIsGNURange()) {
109 Record.AddStmt(S->getRHS());
110 Record.AddSourceLocation(S->getEllipsisLoc());
111 }
113}
114
115void ASTStmtWriter::VisitDefaultStmt(DefaultStmt *S) {
116 VisitSwitchCase(S);
117 Record.AddStmt(S->getSubStmt());
119}
120
121void ASTStmtWriter::VisitLabelStmt(LabelStmt *S) {
122 VisitStmt(S);
123 Record.push_back(S->isSideEntry());
124 Record.AddDeclRef(S->getDecl());
125 Record.AddStmt(S->getSubStmt());
126 Record.AddSourceLocation(S->getIdentLoc());
128}
129
130void ASTStmtWriter::VisitAttributedStmt(AttributedStmt *S) {
131 VisitStmt(S);
132 Record.push_back(S->getAttrs().size());
133 Record.AddAttributes(S->getAttrs());
134 Record.AddStmt(S->getSubStmt());
135 Record.AddSourceLocation(S->getAttrLoc());
137}
138
139void ASTStmtWriter::VisitIfStmt(IfStmt *S) {
140 VisitStmt(S);
141
142 bool HasElse = S->getElse() != nullptr;
143 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
144 bool HasInit = S->getInit() != nullptr;
145
146 Record.push_back(HasElse);
147 Record.push_back(HasVar);
148 Record.push_back(HasInit);
149 Record.push_back(static_cast<uint64_t>(S->getStatementKind()));
150 Record.AddStmt(S->getCond());
151 Record.AddStmt(S->getThen());
152 if (HasElse)
153 Record.AddStmt(S->getElse());
154 if (HasVar)
155 Record.AddStmt(S->getConditionVariableDeclStmt());
156 if (HasInit)
157 Record.AddStmt(S->getInit());
158
159 Record.AddSourceLocation(S->getIfLoc());
160 Record.AddSourceLocation(S->getLParenLoc());
161 Record.AddSourceLocation(S->getRParenLoc());
162 if (HasElse)
163 Record.AddSourceLocation(S->getElseLoc());
164
166}
167
168void ASTStmtWriter::VisitSwitchStmt(SwitchStmt *S) {
169 VisitStmt(S);
170
171 bool HasInit = S->getInit() != nullptr;
172 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
173 Record.push_back(HasInit);
174 Record.push_back(HasVar);
175 Record.push_back(S->isAllEnumCasesCovered());
176
177 Record.AddStmt(S->getCond());
178 Record.AddStmt(S->getBody());
179 if (HasInit)
180 Record.AddStmt(S->getInit());
181 if (HasVar)
182 Record.AddStmt(S->getConditionVariableDeclStmt());
183
184 Record.AddSourceLocation(S->getSwitchLoc());
185 Record.AddSourceLocation(S->getLParenLoc());
186 Record.AddSourceLocation(S->getRParenLoc());
187
188 for (SwitchCase *SC = S->getSwitchCaseList(); SC;
189 SC = SC->getNextSwitchCase())
190 Record.push_back(Writer.RecordSwitchCaseID(SC));
192}
193
194void ASTStmtWriter::VisitWhileStmt(WhileStmt *S) {
195 VisitStmt(S);
196
197 bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
198 Record.push_back(HasVar);
199
200 Record.AddStmt(S->getCond());
201 Record.AddStmt(S->getBody());
202 if (HasVar)
203 Record.AddStmt(S->getConditionVariableDeclStmt());
204
205 Record.AddSourceLocation(S->getWhileLoc());
206 Record.AddSourceLocation(S->getLParenLoc());
207 Record.AddSourceLocation(S->getRParenLoc());
209}
210
211void ASTStmtWriter::VisitDoStmt(DoStmt *S) {
212 VisitStmt(S);
213 Record.AddStmt(S->getCond());
214 Record.AddStmt(S->getBody());
215 Record.AddSourceLocation(S->getDoLoc());
216 Record.AddSourceLocation(S->getWhileLoc());
217 Record.AddSourceLocation(S->getRParenLoc());
219}
220
221void ASTStmtWriter::VisitForStmt(ForStmt *S) {
222 VisitStmt(S);
223 Record.AddStmt(S->getInit());
224 Record.AddStmt(S->getCond());
225 Record.AddStmt(S->getConditionVariableDeclStmt());
226 Record.AddStmt(S->getInc());
227 Record.AddStmt(S->getBody());
228 Record.AddSourceLocation(S->getForLoc());
229 Record.AddSourceLocation(S->getLParenLoc());
230 Record.AddSourceLocation(S->getRParenLoc());
232}
233
234void ASTStmtWriter::VisitGotoStmt(GotoStmt *S) {
235 VisitStmt(S);
236 Record.AddDeclRef(S->getLabel());
237 Record.AddSourceLocation(S->getGotoLoc());
238 Record.AddSourceLocation(S->getLabelLoc());
240}
241
242void ASTStmtWriter::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
243 VisitStmt(S);
244 Record.AddSourceLocation(S->getGotoLoc());
245 Record.AddSourceLocation(S->getStarLoc());
246 Record.AddStmt(S->getTarget());
248}
249
250void ASTStmtWriter::VisitContinueStmt(ContinueStmt *S) {
251 VisitStmt(S);
252 Record.AddSourceLocation(S->getContinueLoc());
254}
255
256void ASTStmtWriter::VisitBreakStmt(BreakStmt *S) {
257 VisitStmt(S);
258 Record.AddSourceLocation(S->getBreakLoc());
260}
261
262void ASTStmtWriter::VisitReturnStmt(ReturnStmt *S) {
263 VisitStmt(S);
264
265 bool HasNRVOCandidate = S->getNRVOCandidate() != nullptr;
266 Record.push_back(HasNRVOCandidate);
267
268 Record.AddStmt(S->getRetValue());
269 if (HasNRVOCandidate)
270 Record.AddDeclRef(S->getNRVOCandidate());
271
272 Record.AddSourceLocation(S->getReturnLoc());
274}
275
276void ASTStmtWriter::VisitDeclStmt(DeclStmt *S) {
277 VisitStmt(S);
278 Record.AddSourceLocation(S->getBeginLoc());
279 Record.AddSourceLocation(S->getEndLoc());
280 DeclGroupRef DG = S->getDeclGroup();
281 for (DeclGroupRef::iterator D = DG.begin(), DEnd = DG.end(); D != DEnd; ++D)
282 Record.AddDeclRef(*D);
284}
285
286void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) {
287 VisitStmt(S);
288 Record.push_back(S->getNumOutputs());
289 Record.push_back(S->getNumInputs());
290 Record.push_back(S->getNumClobbers());
291 Record.AddSourceLocation(S->getAsmLoc());
292 Record.push_back(S->isVolatile());
293 Record.push_back(S->isSimple());
294}
295
296void ASTStmtWriter::VisitGCCAsmStmt(GCCAsmStmt *S) {
297 VisitAsmStmt(S);
298 Record.push_back(S->getNumLabels());
299 Record.AddSourceLocation(S->getRParenLoc());
300 Record.AddStmt(S->getAsmString());
301
302 // Outputs
303 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
304 Record.AddIdentifierRef(S->getOutputIdentifier(I));
305 Record.AddStmt(S->getOutputConstraintLiteral(I));
306 Record.AddStmt(S->getOutputExpr(I));
307 }
308
309 // Inputs
310 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
311 Record.AddIdentifierRef(S->getInputIdentifier(I));
312 Record.AddStmt(S->getInputConstraintLiteral(I));
313 Record.AddStmt(S->getInputExpr(I));
314 }
315
316 // Clobbers
317 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
318 Record.AddStmt(S->getClobberStringLiteral(I));
319
320 // Labels
321 for (unsigned I = 0, N = S->getNumLabels(); I != N; ++I) {
322 Record.AddIdentifierRef(S->getLabelIdentifier(I));
323 Record.AddStmt(S->getLabelExpr(I));
324 }
325
327}
328
329void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) {
330 VisitAsmStmt(S);
331 Record.AddSourceLocation(S->getLBraceLoc());
332 Record.AddSourceLocation(S->getEndLoc());
333 Record.push_back(S->getNumAsmToks());
334 Record.AddString(S->getAsmString());
335
336 // Tokens
337 for (unsigned I = 0, N = S->getNumAsmToks(); I != N; ++I) {
338 // FIXME: Move this to ASTRecordWriter?
339 Writer.AddToken(S->getAsmToks()[I], Record.getRecordData());
340 }
341
342 // Clobbers
343 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) {
344 Record.AddString(S->getClobber(I));
345 }
346
347 // Outputs
348 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
349 Record.AddStmt(S->getOutputExpr(I));
350 Record.AddString(S->getOutputConstraint(I));
351 }
352
353 // Inputs
354 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
355 Record.AddStmt(S->getInputExpr(I));
356 Record.AddString(S->getInputConstraint(I));
357 }
358
360}
361
362void ASTStmtWriter::VisitCoroutineBodyStmt(CoroutineBodyStmt *CoroStmt) {
363 VisitStmt(CoroStmt);
364 Record.push_back(CoroStmt->getParamMoves().size());
365 for (Stmt *S : CoroStmt->children())
366 Record.AddStmt(S);
368}
369
370void ASTStmtWriter::VisitCoreturnStmt(CoreturnStmt *S) {
371 VisitStmt(S);
372 Record.AddSourceLocation(S->getKeywordLoc());
373 Record.AddStmt(S->getOperand());
374 Record.AddStmt(S->getPromiseCall());
375 Record.push_back(S->isImplicit());
377}
378
379void ASTStmtWriter::VisitCoroutineSuspendExpr(CoroutineSuspendExpr *E) {
380 VisitExpr(E);
381 Record.AddSourceLocation(E->getKeywordLoc());
382 for (Stmt *S : E->children())
383 Record.AddStmt(S);
384 Record.AddStmt(E->getOpaqueValue());
385}
386
387void ASTStmtWriter::VisitCoawaitExpr(CoawaitExpr *E) {
388 VisitCoroutineSuspendExpr(E);
389 Record.push_back(E->isImplicit());
391}
392
393void ASTStmtWriter::VisitCoyieldExpr(CoyieldExpr *E) {
394 VisitCoroutineSuspendExpr(E);
396}
397
398void ASTStmtWriter::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
399 VisitExpr(E);
400 Record.AddSourceLocation(E->getKeywordLoc());
401 for (Stmt *S : E->children())
402 Record.AddStmt(S);
404}
405
406static void
408 const ASTConstraintSatisfaction &Satisfaction) {
409 Record.push_back(Satisfaction.IsSatisfied);
410 Record.push_back(Satisfaction.ContainsErrors);
411 if (!Satisfaction.IsSatisfied) {
412 Record.push_back(Satisfaction.NumRecords);
413 for (const auto &DetailRecord : Satisfaction) {
414 Record.AddStmt(const_cast<Expr *>(DetailRecord.first));
415 auto *E = DetailRecord.second.dyn_cast<Expr *>();
416 Record.push_back(E == nullptr);
417 if (E)
418 Record.AddStmt(E);
419 else {
420 auto *Diag = DetailRecord.second.get<std::pair<SourceLocation,
421 StringRef> *>();
422 Record.AddSourceLocation(Diag->first);
423 Record.AddString(Diag->second);
424 }
425 }
426 }
427}
428
429static void
431 ASTRecordWriter &Record,
433 Record.AddString(D->SubstitutedEntity);
434 Record.AddSourceLocation(D->DiagLoc);
435 Record.AddString(D->DiagMessage);
436}
437
438void ASTStmtWriter::VisitConceptSpecializationExpr(
440 VisitExpr(E);
442 const ConceptReference *CR = E->getConceptReference();
443 Record.push_back(CR != nullptr);
444 if (CR)
445 Record.AddConceptReference(CR);
446 if (!E->isValueDependent())
448
450}
451
452void ASTStmtWriter::VisitRequiresExpr(RequiresExpr *E) {
453 VisitExpr(E);
454 Record.push_back(E->getLocalParameters().size());
455 Record.push_back(E->getRequirements().size());
456 Record.AddSourceLocation(E->RequiresExprBits.RequiresKWLoc);
457 Record.push_back(E->RequiresExprBits.IsSatisfied);
458 Record.AddDeclRef(E->getBody());
459 for (ParmVarDecl *P : E->getLocalParameters())
460 Record.AddDeclRef(P);
461 for (concepts::Requirement *R : E->getRequirements()) {
462 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(R)) {
464 Record.push_back(TypeReq->Status);
466 addSubstitutionDiagnostic(Record, TypeReq->getSubstitutionDiagnostic());
467 else
468 Record.AddTypeSourceInfo(TypeReq->getType());
469 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(R)) {
470 Record.push_back(ExprReq->getKind());
471 Record.push_back(ExprReq->Status);
472 if (ExprReq->isExprSubstitutionFailure()) {
474 ExprReq->Value.get<concepts::Requirement::SubstitutionDiagnostic *>());
475 } else
476 Record.AddStmt(ExprReq->Value.get<Expr *>());
477 if (ExprReq->getKind() == concepts::Requirement::RK_Compound) {
478 Record.AddSourceLocation(ExprReq->NoexceptLoc);
479 const auto &RetReq = ExprReq->getReturnTypeRequirement();
480 if (RetReq.isSubstitutionFailure()) {
481 Record.push_back(2);
482 addSubstitutionDiagnostic(Record, RetReq.getSubstitutionDiagnostic());
483 } else if (RetReq.isTypeConstraint()) {
484 Record.push_back(1);
486 RetReq.getTypeConstraintTemplateParameterList());
487 if (ExprReq->Status >=
489 Record.AddStmt(
490 ExprReq->getReturnTypeRequirementSubstitutedConstraintExpr());
491 } else {
492 assert(RetReq.isEmpty());
493 Record.push_back(0);
494 }
495 }
496 } else {
497 auto *NestedReq = cast<concepts::NestedRequirement>(R);
499 Record.push_back(NestedReq->hasInvalidConstraint());
500 if (NestedReq->hasInvalidConstraint()) {
501 Record.AddString(NestedReq->getInvalidConstraintEntity());
502 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
503 } else {
504 Record.AddStmt(NestedReq->getConstraintExpr());
505 if (!NestedReq->isDependent())
506 addConstraintSatisfaction(Record, *NestedReq->Satisfaction);
507 }
508 }
509 }
510 Record.AddSourceLocation(E->getLParenLoc());
511 Record.AddSourceLocation(E->getRParenLoc());
512 Record.AddSourceLocation(E->getEndLoc());
513
515}
516
517
518void ASTStmtWriter::VisitCapturedStmt(CapturedStmt *S) {
519 VisitStmt(S);
520 // NumCaptures
521 Record.push_back(std::distance(S->capture_begin(), S->capture_end()));
522
523 // CapturedDecl and captured region kind
524 Record.AddDeclRef(S->getCapturedDecl());
525 Record.push_back(S->getCapturedRegionKind());
526
527 Record.AddDeclRef(S->getCapturedRecordDecl());
528
529 // Capture inits
530 for (auto *I : S->capture_inits())
531 Record.AddStmt(I);
532
533 // Body
534 Record.AddStmt(S->getCapturedStmt());
535
536 // Captures
537 for (const auto &I : S->captures()) {
538 if (I.capturesThis() || I.capturesVariableArrayType())
539 Record.AddDeclRef(nullptr);
540 else
541 Record.AddDeclRef(I.getCapturedVar());
542 Record.push_back(I.getCaptureKind());
543 Record.AddSourceLocation(I.getLocation());
544 }
545
547}
548
549void ASTStmtWriter::VisitExpr(Expr *E) {
550 VisitStmt(E);
551 Record.AddTypeRef(E->getType());
552 Record.push_back(E->getDependence());
553 Record.push_back(E->getValueKind());
554 Record.push_back(E->getObjectKind());
555}
556
557void ASTStmtWriter::VisitConstantExpr(ConstantExpr *E) {
558 VisitExpr(E);
559 Record.push_back(E->ConstantExprBits.ResultKind);
560
561 Record.push_back(E->ConstantExprBits.APValueKind);
562 Record.push_back(E->ConstantExprBits.IsUnsigned);
563 Record.push_back(E->ConstantExprBits.BitWidth);
564 // HasCleanup not serialized since we can just query the APValue.
565 Record.push_back(E->ConstantExprBits.IsImmediateInvocation);
566
567 switch (E->ConstantExprBits.ResultKind) {
569 break;
571 Record.push_back(E->Int64Result());
572 break;
574 Record.AddAPValue(E->APValueResult());
575 break;
576 default:
577 llvm_unreachable("unexpected ResultKind!");
578 }
579
580 Record.AddStmt(E->getSubExpr());
582}
583
584void ASTStmtWriter::VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *E) {
585 VisitExpr(E);
586
587 Record.AddSourceLocation(E->getLocation());
591
593}
594
595void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
596 VisitExpr(E);
597
598 bool HasFunctionName = E->getFunctionName() != nullptr;
599 Record.push_back(HasFunctionName);
600 Record.push_back(E->getIdentKind()); // FIXME: stable encoding
601 Record.push_back(E->isTransparent());
602 Record.AddSourceLocation(E->getLocation());
603 if (HasFunctionName)
604 Record.AddStmt(E->getFunctionName());
606}
607
608void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
609 VisitExpr(E);
610
611 Record.push_back(E->hasQualifier());
612 Record.push_back(E->getDecl() != E->getFoundDecl());
614 Record.push_back(E->hadMultipleCandidates());
616 Record.push_back(E->isNonOdrUse());
617 Record.push_back(E->isImmediateEscalating());
618
619 if (E->hasTemplateKWAndArgsInfo()) {
620 unsigned NumTemplateArgs = E->getNumTemplateArgs();
621 Record.push_back(NumTemplateArgs);
622 }
623
625
626 if ((!E->hasTemplateKWAndArgsInfo()) && (!E->hasQualifier()) &&
627 (E->getDecl() == E->getFoundDecl()) &&
630 !E->isImmediateEscalating()) {
631 AbbrevToUse = Writer.getDeclRefExprAbbrev();
632 }
633
634 if (E->hasQualifier())
636
637 if (E->getDecl() != E->getFoundDecl())
638 Record.AddDeclRef(E->getFoundDecl());
639
641 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
642 E->getTrailingObjects<TemplateArgumentLoc>());
643
644 Record.AddDeclRef(E->getDecl());
645 Record.AddSourceLocation(E->getLocation());
646 Record.AddDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
648}
649
650void ASTStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
651 VisitExpr(E);
652 Record.AddSourceLocation(E->getLocation());
653 Record.AddAPInt(E->getValue());
654
655 if (E->getValue().getBitWidth() == 32) {
656 AbbrevToUse = Writer.getIntegerLiteralAbbrev();
657 }
658
660}
661
662void ASTStmtWriter::VisitFixedPointLiteral(FixedPointLiteral *E) {
663 VisitExpr(E);
664 Record.AddSourceLocation(E->getLocation());
665 Record.push_back(E->getScale());
666 Record.AddAPInt(E->getValue());
668}
669
670void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
671 VisitExpr(E);
672 Record.push_back(E->getRawSemantics());
673 Record.push_back(E->isExact());
674 Record.AddAPFloat(E->getValue());
675 Record.AddSourceLocation(E->getLocation());
677}
678
679void ASTStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
680 VisitExpr(E);
681 Record.AddStmt(E->getSubExpr());
683}
684
685void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
686 VisitExpr(E);
687
688 // Store the various bits of data of StringLiteral.
689 Record.push_back(E->getNumConcatenated());
690 Record.push_back(E->getLength());
691 Record.push_back(E->getCharByteWidth());
692 Record.push_back(E->getKind());
693 Record.push_back(E->isPascal());
694
695 // Store the trailing array of SourceLocation.
696 for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
697 Record.AddSourceLocation(E->getStrTokenLoc(I));
698
699 // Store the trailing array of char holding the string data.
700 StringRef StrData = E->getBytes();
701 for (unsigned I = 0, N = E->getByteLength(); I != N; ++I)
702 Record.push_back(StrData[I]);
703
705}
706
707void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
708 VisitExpr(E);
709 Record.push_back(E->getValue());
710 Record.AddSourceLocation(E->getLocation());
711 Record.push_back(E->getKind());
712
713 AbbrevToUse = Writer.getCharacterLiteralAbbrev();
714
716}
717
718void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
719 VisitExpr(E);
720 Record.AddSourceLocation(E->getLParen());
721 Record.AddSourceLocation(E->getRParen());
722 Record.AddStmt(E->getSubExpr());
724}
725
726void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
727 VisitExpr(E);
728 Record.push_back(E->getNumExprs());
729 for (auto *SubStmt : E->exprs())
730 Record.AddStmt(SubStmt);
731 Record.AddSourceLocation(E->getLParenLoc());
732 Record.AddSourceLocation(E->getRParenLoc());
734}
735
736void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
737 VisitExpr(E);
738 bool HasFPFeatures = E->hasStoredFPFeatures();
739 // Write this first for easy access when deserializing, as they affect the
740 // size of the UnaryOperator.
741 Record.push_back(HasFPFeatures);
742 Record.AddStmt(E->getSubExpr());
743 Record.push_back(E->getOpcode()); // FIXME: stable encoding
745 Record.push_back(E->canOverflow());
746 if (HasFPFeatures)
749}
750
751void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
752 VisitExpr(E);
753 Record.push_back(E->getNumComponents());
754 Record.push_back(E->getNumExpressions());
756 Record.AddSourceLocation(E->getRParenLoc());
758 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
759 const OffsetOfNode &ON = E->getComponent(I);
760 Record.push_back(ON.getKind()); // FIXME: Stable encoding
763 switch (ON.getKind()) {
765 Record.push_back(ON.getArrayExprIndex());
766 break;
767
769 Record.AddDeclRef(ON.getField());
770 break;
771
773 Record.AddIdentifierRef(ON.getFieldName());
774 break;
775
777 Record.AddCXXBaseSpecifier(*ON.getBase());
778 break;
779 }
780 }
781 for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
782 Record.AddStmt(E->getIndexExpr(I));
784}
785
786void ASTStmtWriter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
787 VisitExpr(E);
788 Record.push_back(E->getKind());
789 if (E->isArgumentType())
791 else {
792 Record.push_back(0);
793 Record.AddStmt(E->getArgumentExpr());
794 }
796 Record.AddSourceLocation(E->getRParenLoc());
798}
799
800void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
801 VisitExpr(E);
802 Record.AddStmt(E->getLHS());
803 Record.AddStmt(E->getRHS());
806}
807
808void ASTStmtWriter::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *E) {
809 VisitExpr(E);
810 Record.AddStmt(E->getBase());
811 Record.AddStmt(E->getRowIdx());
812 Record.AddStmt(E->getColumnIdx());
815}
816
817void ASTStmtWriter::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) {
818 VisitExpr(E);
819 Record.AddStmt(E->getBase());
820 Record.AddStmt(E->getLowerBound());
821 Record.AddStmt(E->getLength());
822 Record.AddStmt(E->getStride());
827}
828
829void ASTStmtWriter::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *E) {
830 VisitExpr(E);
831 Record.push_back(E->getDimensions().size());
832 Record.AddStmt(E->getBase());
833 for (Expr *Dim : E->getDimensions())
834 Record.AddStmt(Dim);
835 for (SourceRange SR : E->getBracketsRanges())
836 Record.AddSourceRange(SR);
837 Record.AddSourceLocation(E->getLParenLoc());
838 Record.AddSourceLocation(E->getRParenLoc());
840}
841
842void ASTStmtWriter::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
843 VisitExpr(E);
844 Record.push_back(E->numOfIterators());
846 Record.AddSourceLocation(E->getLParenLoc());
847 Record.AddSourceLocation(E->getRParenLoc());
848 for (unsigned I = 0, End = E->numOfIterators(); I < End; ++I) {
849 Record.AddDeclRef(E->getIteratorDecl(I));
850 Record.AddSourceLocation(E->getAssignLoc(I));
852 Record.AddStmt(Range.Begin);
853 Record.AddStmt(Range.End);
854 Record.AddStmt(Range.Step);
855 Record.AddSourceLocation(E->getColonLoc(I));
856 if (Range.Step)
858 // Serialize helpers
860 Record.AddDeclRef(HD.CounterVD);
861 Record.AddStmt(HD.Upper);
862 Record.AddStmt(HD.Update);
863 Record.AddStmt(HD.CounterUpdate);
864 }
866}
867
868void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
869 VisitExpr(E);
870 Record.push_back(E->getNumArgs());
871 Record.push_back(E->hasStoredFPFeatures());
872 Record.AddSourceLocation(E->getRParenLoc());
873 Record.AddStmt(E->getCallee());
874 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
875 Arg != ArgEnd; ++Arg)
876 Record.AddStmt(*Arg);
877 Record.push_back(static_cast<unsigned>(E->getADLCallKind()));
878 if (E->hasStoredFPFeatures())
881}
882
883void ASTStmtWriter::VisitRecoveryExpr(RecoveryExpr *E) {
884 VisitExpr(E);
885 Record.push_back(std::distance(E->children().begin(), E->children().end()));
886 Record.AddSourceLocation(E->getBeginLoc());
887 Record.AddSourceLocation(E->getEndLoc());
888 for (Stmt *Child : E->children())
889 Record.AddStmt(Child);
891}
892
893void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
894 VisitExpr(E);
895
896 bool HasQualifier = E->hasQualifier();
897 bool HasFoundDecl =
898 E->hasQualifierOrFoundDecl() &&
899 (E->getFoundDecl().getDecl() != E->getMemberDecl() ||
901 bool HasTemplateInfo = E->hasTemplateKWAndArgsInfo();
902 unsigned NumTemplateArgs = E->getNumTemplateArgs();
903
904 // Write these first for easy access when deserializing, as they affect the
905 // size of the MemberExpr.
906 Record.push_back(HasQualifier);
907 Record.push_back(HasFoundDecl);
908 Record.push_back(HasTemplateInfo);
909 Record.push_back(NumTemplateArgs);
910
911 Record.AddStmt(E->getBase());
912 Record.AddDeclRef(E->getMemberDecl());
913 Record.AddDeclarationNameLoc(E->MemberDNLoc,
914 E->getMemberDecl()->getDeclName());
915 Record.AddSourceLocation(E->getMemberLoc());
916 Record.push_back(E->isArrow());
917 Record.push_back(E->hadMultipleCandidates());
918 Record.push_back(E->isNonOdrUse());
920
921 if (HasFoundDecl) {
922 DeclAccessPair FoundDecl = E->getFoundDecl();
923 Record.AddDeclRef(FoundDecl.getDecl());
924 Record.push_back(FoundDecl.getAccess());
925 }
926
927 if (HasQualifier)
929
930 if (HasTemplateInfo)
931 AddTemplateKWAndArgsInfo(*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
932 E->getTrailingObjects<TemplateArgumentLoc>());
933
935}
936
937void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
938 VisitExpr(E);
939 Record.AddStmt(E->getBase());
941 Record.AddSourceLocation(E->getOpLoc());
942 Record.push_back(E->isArrow());
944}
945
946void ASTStmtWriter::
947VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
948 VisitExpr(E);
949 Record.AddStmt(E->getSubExpr());
950 Record.push_back(E->shouldCopy());
952}
953
954void ASTStmtWriter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
955 VisitExplicitCastExpr(E);
956 Record.AddSourceLocation(E->getLParenLoc());
958 Record.push_back(E->getBridgeKind()); // FIXME: Stable encoding
960}
961
962void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
963 VisitExpr(E);
964 Record.push_back(E->path_size());
965 Record.push_back(E->hasStoredFPFeatures());
966 Record.AddStmt(E->getSubExpr());
967 Record.push_back(E->getCastKind()); // FIXME: stable encoding
968
970 PI = E->path_begin(), PE = E->path_end(); PI != PE; ++PI)
971 Record.AddCXXBaseSpecifier(**PI);
972
973 if (E->hasStoredFPFeatures())
975}
976
977void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
978 VisitExpr(E);
979 bool HasFPFeatures = E->hasStoredFPFeatures();
980 // Write this first for easy access when deserializing, as they affect the
981 // size of the UnaryOperator.
982 Record.push_back(HasFPFeatures);
983 Record.push_back(E->getOpcode()); // FIXME: stable encoding
984 Record.AddStmt(E->getLHS());
985 Record.AddStmt(E->getRHS());
987 if (HasFPFeatures)
990}
991
992void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
993 VisitBinaryOperator(E);
997}
998
999void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
1000 VisitExpr(E);
1001 Record.AddStmt(E->getCond());
1002 Record.AddStmt(E->getLHS());
1003 Record.AddStmt(E->getRHS());
1004 Record.AddSourceLocation(E->getQuestionLoc());
1005 Record.AddSourceLocation(E->getColonLoc());
1007}
1008
1009void
1010ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
1011 VisitExpr(E);
1012 Record.AddStmt(E->getOpaqueValue());
1013 Record.AddStmt(E->getCommon());
1014 Record.AddStmt(E->getCond());
1015 Record.AddStmt(E->getTrueExpr());
1016 Record.AddStmt(E->getFalseExpr());
1017 Record.AddSourceLocation(E->getQuestionLoc());
1018 Record.AddSourceLocation(E->getColonLoc());
1020}
1021
1022void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
1023 VisitCastExpr(E);
1024 Record.push_back(E->isPartOfExplicitCast());
1025
1026 if (E->path_size() == 0 && !E->hasStoredFPFeatures())
1027 AbbrevToUse = Writer.getExprImplicitCastAbbrev();
1028
1030}
1031
1032void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
1033 VisitCastExpr(E);
1035}
1036
1037void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
1038 VisitExplicitCastExpr(E);
1039 Record.AddSourceLocation(E->getLParenLoc());
1040 Record.AddSourceLocation(E->getRParenLoc());
1042}
1043
1044void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
1045 VisitExpr(E);
1046 Record.AddSourceLocation(E->getLParenLoc());
1048 Record.AddStmt(E->getInitializer());
1049 Record.push_back(E->isFileScope());
1051}
1052
1053void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
1054 VisitExpr(E);
1055 Record.AddStmt(E->getBase());
1056 Record.AddIdentifierRef(&E->getAccessor());
1057 Record.AddSourceLocation(E->getAccessorLoc());
1059}
1060
1061void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
1062 VisitExpr(E);
1063 // NOTE: only add the (possibly null) syntactic form.
1064 // No need to serialize the isSemanticForm flag and the semantic form.
1065 Record.AddStmt(E->getSyntacticForm());
1066 Record.AddSourceLocation(E->getLBraceLoc());
1067 Record.AddSourceLocation(E->getRBraceLoc());
1068 bool isArrayFiller = E->ArrayFillerOrUnionFieldInit.is<Expr*>();
1069 Record.push_back(isArrayFiller);
1070 if (isArrayFiller)
1071 Record.AddStmt(E->getArrayFiller());
1072 else
1075 Record.push_back(E->getNumInits());
1076 if (isArrayFiller) {
1077 // ArrayFiller may have filled "holes" due to designated initializer.
1078 // Replace them by 0 to indicate that the filler goes in that place.
1079 Expr *filler = E->getArrayFiller();
1080 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1081 Record.AddStmt(E->getInit(I) != filler ? E->getInit(I) : nullptr);
1082 } else {
1083 for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
1084 Record.AddStmt(E->getInit(I));
1085 }
1087}
1088
1089void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
1090 VisitExpr(E);
1091 Record.push_back(E->getNumSubExprs());
1092 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1093 Record.AddStmt(E->getSubExpr(I));
1095 Record.push_back(E->usesGNUSyntax());
1096 for (const DesignatedInitExpr::Designator &D : E->designators()) {
1097 if (D.isFieldDesignator()) {
1098 if (FieldDecl *Field = D.getFieldDecl()) {
1100 Record.AddDeclRef(Field);
1101 } else {
1103 Record.AddIdentifierRef(D.getFieldName());
1104 }
1105 Record.AddSourceLocation(D.getDotLoc());
1106 Record.AddSourceLocation(D.getFieldLoc());
1107 } else if (D.isArrayDesignator()) {
1109 Record.push_back(D.getArrayIndex());
1110 Record.AddSourceLocation(D.getLBracketLoc());
1111 Record.AddSourceLocation(D.getRBracketLoc());
1112 } else {
1113 assert(D.isArrayRangeDesignator() && "Unknown designator");
1115 Record.push_back(D.getArrayIndex());
1116 Record.AddSourceLocation(D.getLBracketLoc());
1117 Record.AddSourceLocation(D.getEllipsisLoc());
1118 Record.AddSourceLocation(D.getRBracketLoc());
1119 }
1120 }
1122}
1123
1124void ASTStmtWriter::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
1125 VisitExpr(E);
1126 Record.AddStmt(E->getBase());
1127 Record.AddStmt(E->getUpdater());
1129}
1130
1131void ASTStmtWriter::VisitNoInitExpr(NoInitExpr *E) {
1132 VisitExpr(E);
1134}
1135
1136void ASTStmtWriter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
1137 VisitExpr(E);
1138 Record.AddStmt(E->SubExprs[0]);
1139 Record.AddStmt(E->SubExprs[1]);
1141}
1142
1143void ASTStmtWriter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
1144 VisitExpr(E);
1146}
1147
1148void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
1149 VisitExpr(E);
1151}
1152
1153void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
1154 VisitExpr(E);
1155 Record.AddStmt(E->getSubExpr());
1157 Record.AddSourceLocation(E->getBuiltinLoc());
1158 Record.AddSourceLocation(E->getRParenLoc());
1159 Record.push_back(E->isMicrosoftABI());
1161}
1162
1163void ASTStmtWriter::VisitSourceLocExpr(SourceLocExpr *E) {
1164 VisitExpr(E);
1165 Record.AddDeclRef(cast_or_null<Decl>(E->getParentContext()));
1166 Record.AddSourceLocation(E->getBeginLoc());
1167 Record.AddSourceLocation(E->getEndLoc());
1168 Record.push_back(E->getIdentKind());
1170}
1171
1172void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
1173 VisitExpr(E);
1174 Record.AddSourceLocation(E->getAmpAmpLoc());
1175 Record.AddSourceLocation(E->getLabelLoc());
1176 Record.AddDeclRef(E->getLabel());
1178}
1179
1180void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
1181 VisitExpr(E);
1182 Record.AddStmt(E->getSubStmt());
1183 Record.AddSourceLocation(E->getLParenLoc());
1184 Record.AddSourceLocation(E->getRParenLoc());
1185 Record.push_back(E->getTemplateDepth());
1187}
1188
1189void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
1190 VisitExpr(E);
1191 Record.AddStmt(E->getCond());
1192 Record.AddStmt(E->getLHS());
1193 Record.AddStmt(E->getRHS());
1194 Record.AddSourceLocation(E->getBuiltinLoc());
1195 Record.AddSourceLocation(E->getRParenLoc());
1196 Record.push_back(E->isConditionDependent() ? false : E->isConditionTrue());
1198}
1199
1200void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
1201 VisitExpr(E);
1204}
1205
1206void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
1207 VisitExpr(E);
1208 Record.push_back(E->getNumSubExprs());
1209 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1210 Record.AddStmt(E->getExpr(I));
1211 Record.AddSourceLocation(E->getBuiltinLoc());
1212 Record.AddSourceLocation(E->getRParenLoc());
1214}
1215
1216void ASTStmtWriter::VisitConvertVectorExpr(ConvertVectorExpr *E) {
1217 VisitExpr(E);
1218 Record.AddSourceLocation(E->getBuiltinLoc());
1219 Record.AddSourceLocation(E->getRParenLoc());
1221 Record.AddStmt(E->getSrcExpr());
1223}
1224
1225void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
1226 VisitExpr(E);
1227 Record.AddDeclRef(E->getBlockDecl());
1229}
1230
1231void ASTStmtWriter::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
1232 VisitExpr(E);
1233
1234 Record.push_back(E->getNumAssocs());
1235 Record.push_back(E->isExprPredicate());
1236 Record.push_back(E->ResultIndex);
1237 Record.AddSourceLocation(E->getGenericLoc());
1238 Record.AddSourceLocation(E->getDefaultLoc());
1239 Record.AddSourceLocation(E->getRParenLoc());
1240
1241 Stmt **Stmts = E->getTrailingObjects<Stmt *>();
1242 // Add 1 to account for the controlling expression which is the first
1243 // expression in the trailing array of Stmt *. This is not needed for
1244 // the trailing array of TypeSourceInfo *.
1245 for (unsigned I = 0, N = E->getNumAssocs() + 1; I < N; ++I)
1246 Record.AddStmt(Stmts[I]);
1247
1248 TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
1249 for (unsigned I = 0, N = E->getNumAssocs(); I < N; ++I)
1250 Record.AddTypeSourceInfo(TSIs[I]);
1251
1253}
1254
1255void ASTStmtWriter::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
1256 VisitExpr(E);
1257 Record.push_back(E->getNumSemanticExprs());
1258
1259 // Push the result index. Currently, this needs to exactly match
1260 // the encoding used internally for ResultIndex.
1261 unsigned result = E->getResultExprIndex();
1262 result = (result == PseudoObjectExpr::NoResult ? 0 : result + 1);
1263 Record.push_back(result);
1264
1265 Record.AddStmt(E->getSyntacticForm());
1267 i = E->semantics_begin(), e = E->semantics_end(); i != e; ++i) {
1268 Record.AddStmt(*i);
1269 }
1271}
1272
1273void ASTStmtWriter::VisitAtomicExpr(AtomicExpr *E) {
1274 VisitExpr(E);
1275 Record.push_back(E->getOp());
1276 for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
1277 Record.AddStmt(E->getSubExprs()[I]);
1278 Record.AddSourceLocation(E->getBuiltinLoc());
1279 Record.AddSourceLocation(E->getRParenLoc());
1281}
1282
1283//===----------------------------------------------------------------------===//
1284// Objective-C Expressions and Statements.
1285//===----------------------------------------------------------------------===//
1286
1287void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
1288 VisitExpr(E);
1289 Record.AddStmt(E->getString());
1290 Record.AddSourceLocation(E->getAtLoc());
1292}
1293
1294void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
1295 VisitExpr(E);
1296 Record.AddStmt(E->getSubExpr());
1297 Record.AddDeclRef(E->getBoxingMethod());
1298 Record.AddSourceRange(E->getSourceRange());
1300}
1301
1302void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
1303 VisitExpr(E);
1304 Record.push_back(E->getNumElements());
1305 for (unsigned i = 0; i < E->getNumElements(); i++)
1306 Record.AddStmt(E->getElement(i));
1308 Record.AddSourceRange(E->getSourceRange());
1310}
1311
1312void ASTStmtWriter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
1313 VisitExpr(E);
1314 Record.push_back(E->getNumElements());
1315 Record.push_back(E->HasPackExpansions);
1316 for (unsigned i = 0; i < E->getNumElements(); i++) {
1318 Record.AddStmt(Element.Key);
1319 Record.AddStmt(Element.Value);
1320 if (E->HasPackExpansions) {
1321 Record.AddSourceLocation(Element.EllipsisLoc);
1322 unsigned NumExpansions = 0;
1323 if (Element.NumExpansions)
1324 NumExpansions = *Element.NumExpansions + 1;
1325 Record.push_back(NumExpansions);
1326 }
1327 }
1328
1330 Record.AddSourceRange(E->getSourceRange());
1332}
1333
1334void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1335 VisitExpr(E);
1337 Record.AddSourceLocation(E->getAtLoc());
1338 Record.AddSourceLocation(E->getRParenLoc());
1340}
1341
1342void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1343 VisitExpr(E);
1344 Record.AddSelectorRef(E->getSelector());
1345 Record.AddSourceLocation(E->getAtLoc());
1346 Record.AddSourceLocation(E->getRParenLoc());
1348}
1349
1350void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1351 VisitExpr(E);
1352 Record.AddDeclRef(E->getProtocol());
1353 Record.AddSourceLocation(E->getAtLoc());
1354 Record.AddSourceLocation(E->ProtoLoc);
1355 Record.AddSourceLocation(E->getRParenLoc());
1357}
1358
1359void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1360 VisitExpr(E);
1361 Record.AddDeclRef(E->getDecl());
1362 Record.AddSourceLocation(E->getLocation());
1363 Record.AddSourceLocation(E->getOpLoc());
1364 Record.AddStmt(E->getBase());
1365 Record.push_back(E->isArrow());
1366 Record.push_back(E->isFreeIvar());
1368}
1369
1370void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1371 VisitExpr(E);
1372 Record.push_back(E->SetterAndMethodRefFlags.getInt());
1373 Record.push_back(E->isImplicitProperty());
1374 if (E->isImplicitProperty()) {
1377 } else {
1378 Record.AddDeclRef(E->getExplicitProperty());
1379 }
1380 Record.AddSourceLocation(E->getLocation());
1382 if (E->isObjectReceiver()) {
1383 Record.push_back(0);
1384 Record.AddStmt(E->getBase());
1385 } else if (E->isSuperReceiver()) {
1386 Record.push_back(1);
1387 Record.AddTypeRef(E->getSuperReceiverType());
1388 } else {
1389 Record.push_back(2);
1390 Record.AddDeclRef(E->getClassReceiver());
1391 }
1392
1394}
1395
1396void ASTStmtWriter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1397 VisitExpr(E);
1398 Record.AddSourceLocation(E->getRBracket());
1399 Record.AddStmt(E->getBaseExpr());
1400 Record.AddStmt(E->getKeyExpr());
1401 Record.AddDeclRef(E->getAtIndexMethodDecl());
1402 Record.AddDeclRef(E->setAtIndexMethodDecl());
1403
1405}
1406
1407void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1408 VisitExpr(E);
1409 Record.push_back(E->getNumArgs());
1410 Record.push_back(E->getNumStoredSelLocs());
1411 Record.push_back(E->SelLocsKind);
1412 Record.push_back(E->isDelegateInitCall());
1413 Record.push_back(E->IsImplicit);
1414 Record.push_back((unsigned)E->getReceiverKind()); // FIXME: stable encoding
1415 switch (E->getReceiverKind()) {
1417 Record.AddStmt(E->getInstanceReceiver());
1418 break;
1419
1422 break;
1423
1426 Record.AddTypeRef(E->getSuperType());
1427 Record.AddSourceLocation(E->getSuperLoc());
1428 break;
1429 }
1430
1431 if (E->getMethodDecl()) {
1432 Record.push_back(1);
1433 Record.AddDeclRef(E->getMethodDecl());
1434 } else {
1435 Record.push_back(0);
1436 Record.AddSelectorRef(E->getSelector());
1437 }
1438
1439 Record.AddSourceLocation(E->getLeftLoc());
1440 Record.AddSourceLocation(E->getRightLoc());
1441
1442 for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
1443 Arg != ArgEnd; ++Arg)
1444 Record.AddStmt(*Arg);
1445
1446 SourceLocation *Locs = E->getStoredSelLocs();
1447 for (unsigned i = 0, e = E->getNumStoredSelLocs(); i != e; ++i)
1448 Record.AddSourceLocation(Locs[i]);
1449
1451}
1452
1453void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1454 VisitStmt(S);
1455 Record.AddStmt(S->getElement());
1456 Record.AddStmt(S->getCollection());
1457 Record.AddStmt(S->getBody());
1458 Record.AddSourceLocation(S->getForLoc());
1459 Record.AddSourceLocation(S->getRParenLoc());
1461}
1462
1463void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1464 VisitStmt(S);
1465 Record.AddStmt(S->getCatchBody());
1466 Record.AddDeclRef(S->getCatchParamDecl());
1467 Record.AddSourceLocation(S->getAtCatchLoc());
1468 Record.AddSourceLocation(S->getRParenLoc());
1470}
1471
1472void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1473 VisitStmt(S);
1474 Record.AddStmt(S->getFinallyBody());
1475 Record.AddSourceLocation(S->getAtFinallyLoc());
1477}
1478
1479void ASTStmtWriter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1480 VisitStmt(S); // FIXME: no test coverage.
1481 Record.AddStmt(S->getSubStmt());
1482 Record.AddSourceLocation(S->getAtLoc());
1484}
1485
1486void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1487 VisitStmt(S);
1488 Record.push_back(S->getNumCatchStmts());
1489 Record.push_back(S->getFinallyStmt() != nullptr);
1490 Record.AddStmt(S->getTryBody());
1491 for (ObjCAtCatchStmt *C : S->catch_stmts())
1492 Record.AddStmt(C);
1493 if (S->getFinallyStmt())
1494 Record.AddStmt(S->getFinallyStmt());
1495 Record.AddSourceLocation(S->getAtTryLoc());
1497}
1498
1499void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1500 VisitStmt(S); // FIXME: no test coverage.
1501 Record.AddStmt(S->getSynchExpr());
1502 Record.AddStmt(S->getSynchBody());
1503 Record.AddSourceLocation(S->getAtSynchronizedLoc());
1505}
1506
1507void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1508 VisitStmt(S); // FIXME: no test coverage.
1509 Record.AddStmt(S->getThrowExpr());
1510 Record.AddSourceLocation(S->getThrowLoc());
1512}
1513
1514void ASTStmtWriter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1515 VisitExpr(E);
1516 Record.push_back(E->getValue());
1517 Record.AddSourceLocation(E->getLocation());
1519}
1520
1521void ASTStmtWriter::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1522 VisitExpr(E);
1523 Record.AddSourceRange(E->getSourceRange());
1524 Record.AddVersionTuple(E->getVersion());
1526}
1527
1528//===----------------------------------------------------------------------===//
1529// C++ Expressions and Statements.
1530//===----------------------------------------------------------------------===//
1531
1532void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
1533 VisitStmt(S);
1534 Record.AddSourceLocation(S->getCatchLoc());
1535 Record.AddDeclRef(S->getExceptionDecl());
1536 Record.AddStmt(S->getHandlerBlock());
1538}
1539
1540void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
1541 VisitStmt(S);
1542 Record.push_back(S->getNumHandlers());
1543 Record.AddSourceLocation(S->getTryLoc());
1544 Record.AddStmt(S->getTryBlock());
1545 for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1546 Record.AddStmt(S->getHandler(i));
1548}
1549
1550void ASTStmtWriter::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1551 VisitStmt(S);
1552 Record.AddSourceLocation(S->getForLoc());
1553 Record.AddSourceLocation(S->getCoawaitLoc());
1554 Record.AddSourceLocation(S->getColonLoc());
1555 Record.AddSourceLocation(S->getRParenLoc());
1556 Record.AddStmt(S->getInit());
1557 Record.AddStmt(S->getRangeStmt());
1558 Record.AddStmt(S->getBeginStmt());
1559 Record.AddStmt(S->getEndStmt());
1560 Record.AddStmt(S->getCond());
1561 Record.AddStmt(S->getInc());
1562 Record.AddStmt(S->getLoopVarStmt());
1563 Record.AddStmt(S->getBody());
1565}
1566
1567void ASTStmtWriter::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1568 VisitStmt(S);
1569 Record.AddSourceLocation(S->getKeywordLoc());
1570 Record.push_back(S->isIfExists());
1571 Record.AddNestedNameSpecifierLoc(S->getQualifierLoc());
1572 Record.AddDeclarationNameInfo(S->getNameInfo());
1573 Record.AddStmt(S->getSubStmt());
1575}
1576
1577void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1578 VisitCallExpr(E);
1579 Record.push_back(E->getOperator());
1580 Record.AddSourceRange(E->Range);
1582}
1583
1584void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1585 VisitCallExpr(E);
1587}
1588
1589void ASTStmtWriter::VisitCXXRewrittenBinaryOperator(
1591 VisitExpr(E);
1592 Record.push_back(E->isReversed());
1593 Record.AddStmt(E->getSemanticForm());
1595}
1596
1597void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
1598 VisitExpr(E);
1599
1600 Record.push_back(E->getNumArgs());
1601 Record.push_back(E->isElidable());
1602 Record.push_back(E->hadMultipleCandidates());
1603 Record.push_back(E->isListInitialization());
1606 Record.push_back(E->getConstructionKind()); // FIXME: stable encoding
1607 Record.push_back(E->isImmediateEscalating());
1608 Record.AddSourceLocation(E->getLocation());
1609 Record.AddDeclRef(E->getConstructor());
1611
1612 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1613 Record.AddStmt(E->getArg(I));
1614
1616}
1617
1618void ASTStmtWriter::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1619 VisitExpr(E);
1620 Record.AddDeclRef(E->getConstructor());
1621 Record.AddSourceLocation(E->getLocation());
1622 Record.push_back(E->constructsVBase());
1623 Record.push_back(E->inheritedFromVBase());
1625}
1626
1627void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1628 VisitCXXConstructExpr(E);
1631}
1632
1633void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) {
1634 VisitExpr(E);
1635 Record.push_back(E->LambdaExprBits.NumCaptures);
1636 Record.AddSourceRange(E->IntroducerRange);
1637 Record.push_back(E->LambdaExprBits.CaptureDefault); // FIXME: stable encoding
1638 Record.AddSourceLocation(E->CaptureDefaultLoc);
1639 Record.push_back(E->LambdaExprBits.ExplicitParams);
1640 Record.push_back(E->LambdaExprBits.ExplicitResultType);
1641 Record.AddSourceLocation(E->ClosingBrace);
1642
1643 // Add capture initializers.
1645 CEnd = E->capture_init_end();
1646 C != CEnd; ++C) {
1647 Record.AddStmt(*C);
1648 }
1649
1650 // Don't serialize the body. It belongs to the call operator declaration.
1651 // LambdaExpr only stores a copy of the Stmt *.
1652
1654}
1655
1656void ASTStmtWriter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1657 VisitExpr(E);
1658 Record.AddStmt(E->getSubExpr());
1660}
1661
1662void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1663 VisitExplicitCastExpr(E);
1665 Record.AddSourceRange(E->getAngleBrackets());
1666}
1667
1668void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1669 VisitCXXNamedCastExpr(E);
1671}
1672
1673void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1674 VisitCXXNamedCastExpr(E);
1676}
1677
1678void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1679 VisitCXXNamedCastExpr(E);
1681}
1682
1683void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1684 VisitCXXNamedCastExpr(E);
1686}
1687
1688void ASTStmtWriter::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *E) {
1689 VisitCXXNamedCastExpr(E);
1691}
1692
1693void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1694 VisitExplicitCastExpr(E);
1695 Record.AddSourceLocation(E->getLParenLoc());
1696 Record.AddSourceLocation(E->getRParenLoc());
1698}
1699
1700void ASTStmtWriter::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
1701 VisitExplicitCastExpr(E);
1702 Record.AddSourceLocation(E->getBeginLoc());
1703 Record.AddSourceLocation(E->getEndLoc());
1705}
1706
1707void ASTStmtWriter::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1708 VisitCallExpr(E);
1709 Record.AddSourceLocation(E->UDSuffixLoc);
1711}
1712
1713void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1714 VisitExpr(E);
1715 Record.push_back(E->getValue());
1716 Record.AddSourceLocation(E->getLocation());
1718}
1719
1720void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1721 VisitExpr(E);
1722 Record.AddSourceLocation(E->getLocation());
1724}
1725
1726void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1727 VisitExpr(E);
1728 Record.AddSourceRange(E->getSourceRange());
1729 if (E->isTypeOperand()) {
1732 } else {
1733 Record.AddStmt(E->getExprOperand());
1735 }
1736}
1737
1738void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
1739 VisitExpr(E);
1740 Record.AddSourceLocation(E->getLocation());
1741 Record.push_back(E->isImplicit());
1743}
1744
1745void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
1746 VisitExpr(E);
1747 Record.AddSourceLocation(E->getThrowLoc());
1748 Record.AddStmt(E->getSubExpr());
1751}
1752
1753void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1754 VisitExpr(E);
1755 Record.AddDeclRef(E->getParam());
1756 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1758 Record.push_back(E->hasRewrittenInit());
1759 if (E->hasRewrittenInit())
1760 Record.AddStmt(E->getRewrittenExpr());
1762}
1763
1764void ASTStmtWriter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1765 VisitExpr(E);
1766 Record.push_back(E->hasRewrittenInit());
1767 Record.AddDeclRef(E->getField());
1768 Record.AddDeclRef(cast_or_null<Decl>(E->getUsedContext()));
1769 Record.AddSourceLocation(E->getExprLoc());
1770 if (E->hasRewrittenInit())
1771 Record.AddStmt(E->getRewrittenExpr());
1773}
1774
1775void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1776 VisitExpr(E);
1777 Record.AddCXXTemporary(E->getTemporary());
1778 Record.AddStmt(E->getSubExpr());
1780}
1781
1782void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1783 VisitExpr(E);
1785 Record.AddSourceLocation(E->getRParenLoc());
1787}
1788
1789void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
1790 VisitExpr(E);
1791
1792 Record.push_back(E->isArray());
1793 Record.push_back(E->hasInitializer());
1794 Record.push_back(E->getNumPlacementArgs());
1795 Record.push_back(E->isParenTypeId());
1796
1797 Record.push_back(E->isGlobalNew());
1798 Record.push_back(E->passAlignment());
1800 Record.push_back(E->CXXNewExprBits.StoredInitializationStyle);
1801
1802 Record.AddDeclRef(E->getOperatorNew());
1803 Record.AddDeclRef(E->getOperatorDelete());
1805 if (E->isParenTypeId())
1806 Record.AddSourceRange(E->getTypeIdParens());
1807 Record.AddSourceRange(E->getSourceRange());
1809
1810 for (CXXNewExpr::arg_iterator I = E->raw_arg_begin(), N = E->raw_arg_end();
1811 I != N; ++I)
1812 Record.AddStmt(*I);
1813
1815}
1816
1817void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1818 VisitExpr(E);
1819 Record.push_back(E->isGlobalDelete());
1820 Record.push_back(E->isArrayForm());
1821 Record.push_back(E->isArrayFormAsWritten());
1823 Record.AddDeclRef(E->getOperatorDelete());
1824 Record.AddStmt(E->getArgument());
1825 Record.AddSourceLocation(E->getBeginLoc());
1826
1828}
1829
1830void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1831 VisitExpr(E);
1832
1833 Record.AddStmt(E->getBase());
1834 Record.push_back(E->isArrow());
1835 Record.AddSourceLocation(E->getOperatorLoc());
1839 Record.AddSourceLocation(E->getTildeLoc());
1840
1841 // PseudoDestructorTypeStorage.
1845 else
1847
1849}
1850
1851void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) {
1852 VisitExpr(E);
1853 Record.push_back(E->getNumObjects());
1854 for (auto &Obj : E->getObjects()) {
1855 if (auto *BD = Obj.dyn_cast<BlockDecl *>()) {
1857 Record.AddDeclRef(BD);
1858 } else if (auto *CLE = Obj.dyn_cast<CompoundLiteralExpr *>()) {
1860 Record.AddStmt(CLE);
1861 }
1862 }
1863
1865 Record.AddStmt(E->getSubExpr());
1867}
1868
1869void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
1871 VisitExpr(E);
1872
1873 // Don't emit anything here (or if you do you will have to update
1874 // the corresponding deserialization function).
1875
1876 Record.push_back(E->hasTemplateKWAndArgsInfo());
1877 Record.push_back(E->getNumTemplateArgs());
1878 Record.push_back(E->hasFirstQualifierFoundInScope());
1879
1880 if (E->hasTemplateKWAndArgsInfo()) {
1881 const ASTTemplateKWAndArgsInfo &ArgInfo =
1882 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
1884 E->getTrailingObjects<TemplateArgumentLoc>());
1885 }
1886
1887 Record.push_back(E->isArrow());
1888 Record.AddSourceLocation(E->getOperatorLoc());
1889 Record.AddTypeRef(E->getBaseType());
1891 if (!E->isImplicitAccess())
1892 Record.AddStmt(E->getBase());
1893 else
1894 Record.AddStmt(nullptr);
1895
1896 if (E->hasFirstQualifierFoundInScope())
1898
1899 Record.AddDeclarationNameInfo(E->MemberNameInfo);
1901}
1902
1903void
1904ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
1905 VisitExpr(E);
1906
1907 // Don't emit anything here, HasTemplateKWAndArgsInfo must be
1908 // emitted first.
1909
1910 Record.push_back(E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
1911 if (E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo) {
1912 const ASTTemplateKWAndArgsInfo &ArgInfo =
1913 *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
1914 Record.push_back(ArgInfo.NumTemplateArgs);
1916 E->getTrailingObjects<TemplateArgumentLoc>());
1917 }
1918
1920 Record.AddDeclarationNameInfo(E->NameInfo);
1922}
1923
1924void
1925ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
1926 VisitExpr(E);
1927 Record.push_back(E->getNumArgs());
1929 ArgI = E->arg_begin(), ArgE = E->arg_end(); ArgI != ArgE; ++ArgI)
1930 Record.AddStmt(*ArgI);
1932 Record.AddSourceLocation(E->getLParenLoc());
1933 Record.AddSourceLocation(E->getRParenLoc());
1934 Record.push_back(E->isListInitialization());
1936}
1937
1938void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
1939 VisitExpr(E);
1940
1941 Record.push_back(E->getNumDecls());
1943 if (E->hasTemplateKWAndArgsInfo()) {
1944 const ASTTemplateKWAndArgsInfo &ArgInfo =
1946 Record.push_back(ArgInfo.NumTemplateArgs);
1948 }
1949
1951 OvE = E->decls_end();
1952 OvI != OvE; ++OvI) {
1953 Record.AddDeclRef(OvI.getDecl());
1954 Record.push_back(OvI.getAccess());
1955 }
1956
1959}
1960
1961void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
1962 VisitOverloadExpr(E);
1963 Record.push_back(E->isArrow());
1964 Record.push_back(E->hasUnresolvedUsing());
1965 Record.AddStmt(!E->isImplicitAccess() ? E->getBase() : nullptr);
1966 Record.AddTypeRef(E->getBaseType());
1967 Record.AddSourceLocation(E->getOperatorLoc());
1969}
1970
1971void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
1972 VisitOverloadExpr(E);
1973 Record.push_back(E->requiresADL());
1974 Record.push_back(E->isOverloaded());
1975 Record.AddDeclRef(E->getNamingClass());
1977}
1978
1979void ASTStmtWriter::VisitTypeTraitExpr(TypeTraitExpr *E) {
1980 VisitExpr(E);
1981 Record.push_back(E->TypeTraitExprBits.NumArgs);
1982 Record.push_back(E->TypeTraitExprBits.Kind); // FIXME: Stable encoding
1983 Record.push_back(E->TypeTraitExprBits.Value);
1984 Record.AddSourceRange(E->getSourceRange());
1985 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1986 Record.AddTypeSourceInfo(E->getArg(I));
1988}
1989
1990void ASTStmtWriter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
1991 VisitExpr(E);
1992 Record.push_back(E->getTrait());
1993 Record.push_back(E->getValue());
1994 Record.AddSourceRange(E->getSourceRange());
1996 Record.AddStmt(E->getDimensionExpression());
1998}
1999
2000void ASTStmtWriter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2001 VisitExpr(E);
2002 Record.push_back(E->getTrait());
2003 Record.push_back(E->getValue());
2004 Record.AddSourceRange(E->getSourceRange());
2005 Record.AddStmt(E->getQueriedExpression());
2007}
2008
2009void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2010 VisitExpr(E);
2011 Record.push_back(E->getValue());
2012 Record.AddSourceRange(E->getSourceRange());
2013 Record.AddStmt(E->getOperand());
2015}
2016
2017void ASTStmtWriter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2018 VisitExpr(E);
2019 Record.AddSourceLocation(E->getEllipsisLoc());
2020 Record.push_back(E->NumExpansions);
2021 Record.AddStmt(E->getPattern());
2023}
2024
2025void ASTStmtWriter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2026 VisitExpr(E);
2027 Record.push_back(E->isPartiallySubstituted() ? E->getPartialArguments().size()
2028 : 0);
2029 Record.AddSourceLocation(E->OperatorLoc);
2030 Record.AddSourceLocation(E->PackLoc);
2031 Record.AddSourceLocation(E->RParenLoc);
2032 Record.AddDeclRef(E->Pack);
2033 if (E->isPartiallySubstituted()) {
2034 for (const auto &TA : E->getPartialArguments())
2035 Record.AddTemplateArgument(TA);
2036 } else if (!E->isValueDependent()) {
2037 Record.push_back(E->getPackLength());
2038 }
2040}
2041
2042void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
2044 VisitExpr(E);
2045 Record.AddDeclRef(E->getAssociatedDecl());
2046 Record.push_back(E->isReferenceParameter());
2047 Record.push_back(E->getIndex());
2048 if (auto PackIndex = E->getPackIndex())
2049 Record.push_back(*PackIndex + 1);
2050 else
2051 Record.push_back(0);
2052 Record.AddSourceLocation(E->getNameLoc());
2053 Record.AddStmt(E->getReplacement());
2055}
2056
2057void ASTStmtWriter::VisitSubstNonTypeTemplateParmPackExpr(
2059 VisitExpr(E);
2060 Record.AddDeclRef(E->getAssociatedDecl());
2061 Record.push_back(E->getIndex());
2065}
2066
2067void ASTStmtWriter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2068 VisitExpr(E);
2069 Record.push_back(E->getNumExpansions());
2070 Record.AddDeclRef(E->getParameterPack());
2072 for (FunctionParmPackExpr::iterator I = E->begin(), End = E->end();
2073 I != End; ++I)
2074 Record.AddDeclRef(*I);
2076}
2077
2078void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
2079 VisitExpr(E);
2080 Record.push_back(static_cast<bool>(E->getLifetimeExtendedTemporaryDecl()));
2083 else
2084 Record.AddStmt(E->getSubExpr());
2086}
2087
2088void ASTStmtWriter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2089 VisitExpr(E);
2090 Record.AddSourceLocation(E->LParenLoc);
2091 Record.AddSourceLocation(E->EllipsisLoc);
2092 Record.AddSourceLocation(E->RParenLoc);
2093 Record.push_back(E->NumExpansions);
2094 Record.AddStmt(E->SubExprs[0]);
2095 Record.AddStmt(E->SubExprs[1]);
2096 Record.AddStmt(E->SubExprs[2]);
2097 Record.push_back(E->Opcode);
2099}
2100
2101void ASTStmtWriter::VisitCXXParenListInitExpr(CXXParenListInitExpr *E) {
2102 VisitExpr(E);
2103 ArrayRef<Expr *> InitExprs = E->getInitExprs();
2104 Record.push_back(InitExprs.size());
2105 Record.push_back(E->getUserSpecifiedInitExprs().size());
2106 Record.AddSourceLocation(E->getInitLoc());
2107 Record.AddSourceLocation(E->getBeginLoc());
2108 Record.AddSourceLocation(E->getEndLoc());
2109 for (Expr *InitExpr : E->getInitExprs())
2110 Record.AddStmt(InitExpr);
2111 Expr *ArrayFiller = E->getArrayFiller();
2112 FieldDecl *UnionField = E->getInitializedFieldInUnion();
2113 bool HasArrayFillerOrUnionDecl = ArrayFiller || UnionField;
2114 Record.push_back(HasArrayFillerOrUnionDecl);
2115 if (HasArrayFillerOrUnionDecl) {
2116 Record.push_back(static_cast<bool>(ArrayFiller));
2117 if (ArrayFiller)
2118 Record.AddStmt(ArrayFiller);
2119 else
2120 Record.AddDeclRef(UnionField);
2121 }
2123}
2124
2125void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
2126 VisitExpr(E);
2127 Record.AddStmt(E->getSourceExpr());
2128 Record.AddSourceLocation(E->getLocation());
2129 Record.push_back(E->isUnique());
2131}
2132
2133void ASTStmtWriter::VisitTypoExpr(TypoExpr *E) {
2134 VisitExpr(E);
2135 // TODO: Figure out sane writer behavior for a TypoExpr, if necessary
2136 llvm_unreachable("Cannot write TypoExpr nodes");
2137}
2138
2139//===----------------------------------------------------------------------===//
2140// CUDA Expressions and Statements.
2141//===----------------------------------------------------------------------===//
2142
2143void ASTStmtWriter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
2144 VisitCallExpr(E);
2145 Record.AddStmt(E->getConfig());
2147}
2148
2149//===----------------------------------------------------------------------===//
2150// OpenCL Expressions and Statements.
2151//===----------------------------------------------------------------------===//
2152void ASTStmtWriter::VisitAsTypeExpr(AsTypeExpr *E) {
2153 VisitExpr(E);
2154 Record.AddSourceLocation(E->getBuiltinLoc());
2155 Record.AddSourceLocation(E->getRParenLoc());
2156 Record.AddStmt(E->getSrcExpr());
2158}
2159
2160//===----------------------------------------------------------------------===//
2161// Microsoft Expressions and Statements.
2162//===----------------------------------------------------------------------===//
2163void ASTStmtWriter::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
2164 VisitExpr(E);
2165 Record.push_back(E->isArrow());
2166 Record.AddStmt(E->getBaseExpr());
2168 Record.AddSourceLocation(E->getMemberLoc());
2169 Record.AddDeclRef(E->getPropertyDecl());
2171}
2172
2173void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
2174 VisitExpr(E);
2175 Record.AddStmt(E->getBase());
2176 Record.AddStmt(E->getIdx());
2177 Record.AddSourceLocation(E->getRBracketLoc());
2179}
2180
2181void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
2182 VisitExpr(E);
2183 Record.AddSourceRange(E->getSourceRange());
2184 Record.AddDeclRef(E->getGuidDecl());
2185 if (E->isTypeOperand()) {
2188 } else {
2189 Record.AddStmt(E->getExprOperand());
2191 }
2192}
2193
2194void ASTStmtWriter::VisitSEHExceptStmt(SEHExceptStmt *S) {
2195 VisitStmt(S);
2196 Record.AddSourceLocation(S->getExceptLoc());
2197 Record.AddStmt(S->getFilterExpr());
2198 Record.AddStmt(S->getBlock());
2200}
2201
2202void ASTStmtWriter::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
2203 VisitStmt(S);
2204 Record.AddSourceLocation(S->getFinallyLoc());
2205 Record.AddStmt(S->getBlock());
2207}
2208
2209void ASTStmtWriter::VisitSEHTryStmt(SEHTryStmt *S) {
2210 VisitStmt(S);
2211 Record.push_back(S->getIsCXXTry());
2212 Record.AddSourceLocation(S->getTryLoc());
2213 Record.AddStmt(S->getTryBlock());
2214 Record.AddStmt(S->getHandler());
2216}
2217
2218void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
2219 VisitStmt(S);
2220 Record.AddSourceLocation(S->getLeaveLoc());
2222}
2223
2224//===----------------------------------------------------------------------===//
2225// OpenMP Directives.
2226//===----------------------------------------------------------------------===//
2227
2228void ASTStmtWriter::VisitOMPCanonicalLoop(OMPCanonicalLoop *S) {
2229 VisitStmt(S);
2230 for (Stmt *SubStmt : S->SubStmts)
2231 Record.AddStmt(SubStmt);
2233}
2234
2235void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2236 Record.writeOMPChildren(E->Data);
2237 Record.AddSourceLocation(E->getBeginLoc());
2238 Record.AddSourceLocation(E->getEndLoc());
2239 Record.writeEnum(E->getMappedDirective());
2240}
2241
2242void ASTStmtWriter::VisitOMPLoopBasedDirective(OMPLoopBasedDirective *D) {
2243 VisitStmt(D);
2244 Record.writeUInt32(D->getLoopsNumber());
2245 VisitOMPExecutableDirective(D);
2246}
2247
2248void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) {
2249 VisitOMPLoopBasedDirective(D);
2250}
2251
2252void ASTStmtWriter::VisitOMPMetaDirective(OMPMetaDirective *D) {
2253 VisitStmt(D);
2254 Record.push_back(D->getNumClauses());
2255 VisitOMPExecutableDirective(D);
2257}
2258
2259void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) {
2260 VisitStmt(D);
2261 VisitOMPExecutableDirective(D);
2262 Record.writeBool(D->hasCancel());
2264}
2265
2266void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) {
2267 VisitOMPLoopDirective(D);
2269}
2270
2271void ASTStmtWriter::VisitOMPLoopTransformationDirective(
2273 VisitOMPLoopBasedDirective(D);
2274 Record.writeUInt32(D->getNumGeneratedLoops());
2275}
2276
2277void ASTStmtWriter::VisitOMPTileDirective(OMPTileDirective *D) {
2278 VisitOMPLoopTransformationDirective(D);
2280}
2281
2282void ASTStmtWriter::VisitOMPUnrollDirective(OMPUnrollDirective *D) {
2283 VisitOMPLoopTransformationDirective(D);
2285}
2286
2287void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) {
2288 VisitOMPLoopDirective(D);
2289 Record.writeBool(D->hasCancel());
2291}
2292
2293void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2294 VisitOMPLoopDirective(D);
2296}
2297
2298void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2299 VisitStmt(D);
2300 VisitOMPExecutableDirective(D);
2301 Record.writeBool(D->hasCancel());
2303}
2304
2305void ASTStmtWriter::VisitOMPSectionDirective(OMPSectionDirective *D) {
2306 VisitStmt(D);
2307 VisitOMPExecutableDirective(D);
2308 Record.writeBool(D->hasCancel());
2310}
2311
2312void ASTStmtWriter::VisitOMPScopeDirective(OMPScopeDirective *D) {
2313 VisitStmt(D);
2314 VisitOMPExecutableDirective(D);
2316}
2317
2318void ASTStmtWriter::VisitOMPSingleDirective(OMPSingleDirective *D) {
2319 VisitStmt(D);
2320 VisitOMPExecutableDirective(D);
2322}
2323
2324void ASTStmtWriter::VisitOMPMasterDirective(OMPMasterDirective *D) {
2325 VisitStmt(D);
2326 VisitOMPExecutableDirective(D);
2328}
2329
2330void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2331 VisitStmt(D);
2332 VisitOMPExecutableDirective(D);
2335}
2336
2337void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2338 VisitOMPLoopDirective(D);
2339 Record.writeBool(D->hasCancel());
2341}
2342
2343void ASTStmtWriter::VisitOMPParallelForSimdDirective(
2345 VisitOMPLoopDirective(D);
2347}
2348
2349void ASTStmtWriter::VisitOMPParallelMasterDirective(
2351 VisitStmt(D);
2352 VisitOMPExecutableDirective(D);
2354}
2355
2356void ASTStmtWriter::VisitOMPParallelMaskedDirective(
2358 VisitStmt(D);
2359 VisitOMPExecutableDirective(D);
2361}
2362
2363void ASTStmtWriter::VisitOMPParallelSectionsDirective(
2365 VisitStmt(D);
2366 VisitOMPExecutableDirective(D);
2367 Record.writeBool(D->hasCancel());
2369}
2370
2371void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) {
2372 VisitStmt(D);
2373 VisitOMPExecutableDirective(D);
2374 Record.writeBool(D->hasCancel());
2376}
2377
2378void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2379 VisitStmt(D);
2380 VisitOMPExecutableDirective(D);
2381 Record.writeBool(D->isXLHSInRHSPart());
2382 Record.writeBool(D->isPostfixUpdate());
2383 Record.writeBool(D->isFailOnly());
2385}
2386
2387void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) {
2388 VisitStmt(D);
2389 VisitOMPExecutableDirective(D);
2391}
2392
2393void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2394 VisitStmt(D);
2395 VisitOMPExecutableDirective(D);
2397}
2398
2399void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
2401 VisitStmt(D);
2402 VisitOMPExecutableDirective(D);
2404}
2405
2406void ASTStmtWriter::VisitOMPTargetExitDataDirective(
2408 VisitStmt(D);
2409 VisitOMPExecutableDirective(D);
2411}
2412
2413void ASTStmtWriter::VisitOMPTargetParallelDirective(
2415 VisitStmt(D);
2416 VisitOMPExecutableDirective(D);
2417 Record.writeBool(D->hasCancel());
2419}
2420
2421void ASTStmtWriter::VisitOMPTargetParallelForDirective(
2423 VisitOMPLoopDirective(D);
2424 Record.writeBool(D->hasCancel());
2426}
2427
2428void ASTStmtWriter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2429 VisitStmt(D);
2430 VisitOMPExecutableDirective(D);
2432}
2433
2434void ASTStmtWriter::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2435 VisitStmt(D);
2436 VisitOMPExecutableDirective(D);
2438}
2439
2440void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2441 VisitStmt(D);
2442 Record.push_back(D->getNumClauses());
2443 VisitOMPExecutableDirective(D);
2445}
2446
2447void ASTStmtWriter::VisitOMPErrorDirective(OMPErrorDirective *D) {
2448 VisitStmt(D);
2449 Record.push_back(D->getNumClauses());
2450 VisitOMPExecutableDirective(D);
2452}
2453
2454void ASTStmtWriter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2455 VisitStmt(D);
2456 VisitOMPExecutableDirective(D);
2458}
2459
2460void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) {
2461 VisitStmt(D);
2462 VisitOMPExecutableDirective(D);
2464}
2465
2466void ASTStmtWriter::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
2467 VisitStmt(D);
2468 VisitOMPExecutableDirective(D);
2470}
2471
2472void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
2473 VisitStmt(D);
2474 VisitOMPExecutableDirective(D);
2476}
2477
2478void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2479 VisitStmt(D);
2480 VisitOMPExecutableDirective(D);
2482}
2483
2484void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2485 VisitStmt(D);
2486 VisitOMPExecutableDirective(D);
2488}
2489
2490void ASTStmtWriter::VisitOMPCancellationPointDirective(
2492 VisitStmt(D);
2493 VisitOMPExecutableDirective(D);
2494 Record.writeEnum(D->getCancelRegion());
2496}
2497
2498void ASTStmtWriter::VisitOMPCancelDirective(OMPCancelDirective *D) {
2499 VisitStmt(D);
2500 VisitOMPExecutableDirective(D);
2501 Record.writeEnum(D->getCancelRegion());
2503}
2504
2505void ASTStmtWriter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2506 VisitOMPLoopDirective(D);
2507 Record.writeBool(D->hasCancel());
2509}
2510
2511void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2512 VisitOMPLoopDirective(D);
2514}
2515
2516void ASTStmtWriter::VisitOMPMasterTaskLoopDirective(
2518 VisitOMPLoopDirective(D);
2519 Record.writeBool(D->hasCancel());
2521}
2522
2523void ASTStmtWriter::VisitOMPMaskedTaskLoopDirective(
2525 VisitOMPLoopDirective(D);
2526 Record.writeBool(D->hasCancel());
2528}
2529
2530void ASTStmtWriter::VisitOMPMasterTaskLoopSimdDirective(
2532 VisitOMPLoopDirective(D);
2534}
2535
2536void ASTStmtWriter::VisitOMPMaskedTaskLoopSimdDirective(
2538 VisitOMPLoopDirective(D);
2540}
2541
2542void ASTStmtWriter::VisitOMPParallelMasterTaskLoopDirective(
2544 VisitOMPLoopDirective(D);
2545 Record.writeBool(D->hasCancel());
2547}
2548
2549void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopDirective(
2551 VisitOMPLoopDirective(D);
2552 Record.writeBool(D->hasCancel());
2554}
2555
2556void ASTStmtWriter::VisitOMPParallelMasterTaskLoopSimdDirective(
2558 VisitOMPLoopDirective(D);
2560}
2561
2562void ASTStmtWriter::VisitOMPParallelMaskedTaskLoopSimdDirective(
2564 VisitOMPLoopDirective(D);
2566}
2567
2568void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2569 VisitOMPLoopDirective(D);
2571}
2572
2573void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2574 VisitStmt(D);
2575 VisitOMPExecutableDirective(D);
2577}
2578
2579void ASTStmtWriter::VisitOMPDistributeParallelForDirective(
2581 VisitOMPLoopDirective(D);
2582 Record.writeBool(D->hasCancel());
2584}
2585
2586void ASTStmtWriter::VisitOMPDistributeParallelForSimdDirective(
2588 VisitOMPLoopDirective(D);
2590}
2591
2592void ASTStmtWriter::VisitOMPDistributeSimdDirective(
2594 VisitOMPLoopDirective(D);
2596}
2597
2598void ASTStmtWriter::VisitOMPTargetParallelForSimdDirective(
2600 VisitOMPLoopDirective(D);
2602}
2603
2604void ASTStmtWriter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2605 VisitOMPLoopDirective(D);
2607}
2608
2609void ASTStmtWriter::VisitOMPTeamsDistributeDirective(
2611 VisitOMPLoopDirective(D);
2613}
2614
2615void ASTStmtWriter::VisitOMPTeamsDistributeSimdDirective(
2617 VisitOMPLoopDirective(D);
2619}
2620
2621void ASTStmtWriter::VisitOMPTeamsDistributeParallelForSimdDirective(
2623 VisitOMPLoopDirective(D);
2625}
2626
2627void ASTStmtWriter::VisitOMPTeamsDistributeParallelForDirective(
2629 VisitOMPLoopDirective(D);
2630 Record.writeBool(D->hasCancel());
2632}
2633
2634void ASTStmtWriter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2635 VisitStmt(D);
2636 VisitOMPExecutableDirective(D);
2638}
2639
2640void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective(
2642 VisitOMPLoopDirective(D);
2644}
2645
2646void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective(
2648 VisitOMPLoopDirective(D);
2649 Record.writeBool(D->hasCancel());
2651}
2652
2653void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2655 VisitOMPLoopDirective(D);
2656 Code = serialization::
2658}
2659
2660void ASTStmtWriter::VisitOMPTargetTeamsDistributeSimdDirective(
2662 VisitOMPLoopDirective(D);
2664}
2665
2666void ASTStmtWriter::VisitOMPInteropDirective(OMPInteropDirective *D) {
2667 VisitStmt(D);
2668 VisitOMPExecutableDirective(D);
2670}
2671
2672void ASTStmtWriter::VisitOMPDispatchDirective(OMPDispatchDirective *D) {
2673 VisitStmt(D);
2674 VisitOMPExecutableDirective(D);
2677}
2678
2679void ASTStmtWriter::VisitOMPMaskedDirective(OMPMaskedDirective *D) {
2680 VisitStmt(D);
2681 VisitOMPExecutableDirective(D);
2683}
2684
2685void ASTStmtWriter::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *D) {
2686 VisitOMPLoopDirective(D);
2688}
2689
2690void ASTStmtWriter::VisitOMPTeamsGenericLoopDirective(
2692 VisitOMPLoopDirective(D);
2694}
2695
2696void ASTStmtWriter::VisitOMPTargetTeamsGenericLoopDirective(
2698 VisitOMPLoopDirective(D);
2700}
2701
2702void ASTStmtWriter::VisitOMPParallelGenericLoopDirective(
2704 VisitOMPLoopDirective(D);
2706}
2707
2708void ASTStmtWriter::VisitOMPTargetParallelGenericLoopDirective(
2710 VisitOMPLoopDirective(D);
2712}
2713
2714//===----------------------------------------------------------------------===//
2715// ASTWriter Implementation
2716//===----------------------------------------------------------------------===//
2717
2719 assert(!SwitchCaseIDs.contains(S) && "SwitchCase recorded twice");
2720 unsigned NextID = SwitchCaseIDs.size();
2721 SwitchCaseIDs[S] = NextID;
2722 return NextID;
2723}
2724
2726 assert(SwitchCaseIDs.contains(S) && "SwitchCase hasn't been seen yet");
2727 return SwitchCaseIDs[S];
2728}
2729
2731 SwitchCaseIDs.clear();
2732}
2733
2734/// Write the given substatement or subexpression to the
2735/// bitstream.
2736void ASTWriter::WriteSubStmt(Stmt *S) {
2737 RecordData Record;
2738 ASTStmtWriter Writer(*this, Record);
2739 ++NumStatements;
2740
2741 if (!S) {
2742 Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
2743 return;
2744 }
2745
2746 llvm::DenseMap<Stmt *, uint64_t>::iterator I = SubStmtEntries.find(S);
2747 if (I != SubStmtEntries.end()) {
2748 Record.push_back(I->second);
2749 Stream.EmitRecord(serialization::STMT_REF_PTR, Record);
2750 return;
2751 }
2752
2753#ifndef NDEBUG
2754 assert(!ParentStmts.count(S) && "There is a Stmt cycle!");
2755
2756 struct ParentStmtInserterRAII {
2757 Stmt *S;
2758 llvm::DenseSet<Stmt *> &ParentStmts;
2759
2760 ParentStmtInserterRAII(Stmt *S, llvm::DenseSet<Stmt *> &ParentStmts)
2761 : S(S), ParentStmts(ParentStmts) {
2762 ParentStmts.insert(S);
2763 }
2764 ~ParentStmtInserterRAII() {
2765 ParentStmts.erase(S);
2766 }
2767 };
2768
2769 ParentStmtInserterRAII ParentStmtInserter(S, ParentStmts);
2770#endif
2771
2772 Writer.Visit(S);
2773
2774 uint64_t Offset = Writer.Emit();
2775 SubStmtEntries[S] = Offset;
2776}
2777
2778/// Flush all of the statements that have been added to the
2779/// queue via AddStmt().
2780void ASTRecordWriter::FlushStmts() {
2781 // We expect to be the only consumer of the two temporary statement maps,
2782 // assert that they are empty.
2783 assert(Writer->SubStmtEntries.empty() && "unexpected entries in sub-stmt map");
2784 assert(Writer->ParentStmts.empty() && "unexpected entries in parent stmt map");
2785
2786 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
2787 Writer->WriteSubStmt(StmtsToEmit[I]);
2788
2789 assert(N == StmtsToEmit.size() && "record modified while being written!");
2790
2791 // Note that we are at the end of a full expression. Any
2792 // expression records that follow this one are part of a different
2793 // expression.
2794 Writer->Stream.EmitRecord(serialization::STMT_STOP, ArrayRef<uint32_t>());
2795
2796 Writer->SubStmtEntries.clear();
2797 Writer->ParentStmts.clear();
2798 }
2799
2800 StmtsToEmit.clear();
2801}
2802
2803void ASTRecordWriter::FlushSubStmts() {
2804 // For a nested statement, write out the substatements in reverse order (so
2805 // that a simple stack machine can be used when loading), and don't emit a
2806 // STMT_STOP after each one.
2807 for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
2808 Writer->WriteSubStmt(StmtsToEmit[N - I - 1]);
2809 assert(N == StmtsToEmit.size() && "record modified while being written!");
2810 }
2811
2812 StmtsToEmit.clear();
2813}
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
Definition: Expr.h:1501
An object for streaming information to a record.
void AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo)
Definition: ASTWriter.cpp:5816
void AddCXXTemporary(const CXXTemporary *Temp)
Emit a CXXTemporary.
Definition: ASTWriter.cpp:5582
void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Emit a C++ base specifier.
Definition: ASTWriter.cpp:5932
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:5559
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:5884
void AddTemplateArgument(const TemplateArgument &Arg)
Emit a template argument.
void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc, DeclarationName Name)
Definition: ASTWriter.cpp:5789
void AddAPFloat(const llvm::APFloat &Value)
Emit a floating-point value.
Definition: ASTWriter.cpp:5513
void AddTypeSourceInfo(TypeSourceInfo *TInfo)
Emits a reference to a declarator info.
Definition: ASTWriter.cpp:5627
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:7276
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:4471
void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg)
Emits a template argument location.
Definition: ASTWriter.cpp:5614
void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Emit a nested name specifier with source-location information.
Definition: ASTWriter.cpp:5830
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 getExprImplicitCastAbbrev() const
Definition: ASTWriter.h:744
unsigned getSwitchCaseID(SwitchCase *S)
Retrieve the ID for the given switch-case statement.
unsigned getDeclRefExprAbbrev() const
Definition: ASTWriter.h:741
unsigned RecordSwitchCaseID(SwitchCase *S)
Record an ID for the given switch-case statement.
unsigned getCharacterLiteralAbbrev() const
Definition: ASTWriter.h:742
void AddToken(const Token &Tok, RecordDataImpl &Record)
Emit a token.
Definition: ASTWriter.cpp:4477
SmallVector< uint64_t, 64 > RecordData
Definition: ASTWriter.h:91
unsigned getIntegerLiteralAbbrev() const
Definition: ASTWriter.h:743
SourceLocation getColonLoc() const
Definition: Expr.h:4176
SourceLocation getQuestionLoc() const
Definition: Expr.h:4175
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4345
SourceLocation getAmpAmpLoc() const
Definition: Expr.h:4360
SourceLocation getLabelLoc() const
Definition: Expr.h:4362
LabelDecl * getLabel() const
Definition: Expr.h:4368
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5559
Represents a loop initializing the elements of an array.
Definition: Expr.h:5506
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2676
SourceLocation getRBracketLoc() const
Definition: Expr.h:2724
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
Definition: Expr.h:2705
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition: ExprCXX.h:2840
uint64_t getValue() const
Definition: ExprCXX.h:2885
ArrayTypeTrait getTrait() const
Definition: ExprCXX.h:2879
Expr * getDimensionExpression() const
Definition: ExprCXX.h:2887
TypeSourceInfo * getQueriedTypeSourceInfo() const
Definition: ExprCXX.h:2883
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:6228
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:6247
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_astype token.
Definition: Expr.h:6250
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition: Expr.h:6253
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition: Stmt.h:2921
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6431
Expr ** getSubExprs()
Definition: Expr.h:6508
SourceLocation getRParenLoc() const
Definition: Expr.h:6534
static unsigned getNumSubExprs(AtomicOp Op)
Determine the number of arguments the specified atomic builtin should have.
Definition: Expr.cpp:4932
AtomicOp getOp() const
Definition: Expr.h:6495
SourceLocation getBuiltinLoc() const
Definition: Expr.h:6533
Represents an attribute applied to a statement.
Definition: Stmt.h:1901
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:4248
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
Definition: Expr.h:4302
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition: Expr.h:4286
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value.
Definition: Expr.h:4290
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
Definition: Expr.h:4295
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Definition: Expr.h:4283
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3847
Expr * getLHS() const
Definition: Expr.h:3896
SourceLocation getOperatorLoc() const
Definition: Expr.h:3888
bool hasStoredFPFeatures() const
Definition: Expr.h:4031
Expr * getRHS() const
Definition: Expr.h:3898
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition: Expr.h:4034
Opcode getOpcode() const
Definition: Expr.h:3891
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4379
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:6167
const BlockDecl * getBlockDecl() const
Definition: Expr.h:6179
BreakStmt - This represents a break.
Definition: Stmt.h:2801
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:5128
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.h:5147
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:5146
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition: Expr.h:3778
SourceLocation getRParenLoc() const
Definition: Expr.h:3813
SourceLocation getLParenLoc() const
Definition: Expr.h:3810
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:1523
SourceRange getParenOrBraceRange() const
Definition: ExprCXX.h:1699
bool isElidable() const
Whether this construction is elidable.
Definition: ExprCXX.h:1601
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1.
Definition: ExprCXX.h:1606
Expr * getArg(unsigned Arg)
Return the specified argument.
Definition: ExprCXX.h:1674
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition: ExprCXX.h:1625
bool isImmediateEscalating() const
Definition: ExprCXX.h:1689
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called.
Definition: ExprCXX.h:1634
SourceLocation getLocation() const
Definition: ExprCXX.h:1597
ConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition: ExprCXX.h:1643
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition: ExprCXX.h:1595
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition: ExprCXX.h:1614
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Definition: ExprCXX.h:1671
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:2486
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2525
bool isArrayForm() const
Definition: ExprCXX.h:2512
SourceLocation getBeginLoc() const
Definition: ExprCXX.h:2536
bool isGlobalDelete() const
Definition: ExprCXX.h:2511
Expr * getArgument()
Definition: ExprCXX.h:2527
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition: ExprCXX.h:2521
bool isArrayFormAsWritten() const
Definition: ExprCXX.h:2513
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3642
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition: ExprCXX.h:3745
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition: ExprCXX.h:3748
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: ExprCXX.h:3840
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:3772
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition: ExprCXX.h:3736
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information.
Definition: ExprCXX.h:3759
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition: ExprCXX.h:3728
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:4689
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:1800
SourceLocation getLParenLoc() const
Definition: ExprCXX.h:1837
SourceLocation getRParenLoc() const
Definition: ExprCXX.h:1839
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1722
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition: ExprCXX.h:1761
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
Definition: ExprCXX.h:1757
SourceLocation getLocation() const LLVM_READONLY
Definition: ExprCXX.h:1773
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
Definition: ExprCXX.h:1771
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:2212
bool isArray() const
Definition: ExprCXX.h:2333
SourceRange getDirectInitRange() const
Definition: ExprCXX.h:2469
bool hasInitializer() const
Whether this new-expression has any initializer at all.
Definition: ExprCXX.h:2389
bool passAlignment() const
Indicates whether the required alignment should be implicitly passed to the allocation function.
Definition: ExprCXX.h:2420
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2330
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:2363
TypeSourceInfo * getAllocatedTypeSourceInfo() const
Definition: ExprCXX.h:2307
SourceRange getSourceRange() const
Definition: ExprCXX.h:2470
SourceRange getTypeIdParens() const
Definition: ExprCXX.h:2381
bool isParenTypeId() const
Definition: ExprCXX.h:2380
raw_arg_iterator raw_arg_end()
Definition: ExprCXX.h:2456
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
Definition: ExprCXX.h:2425
raw_arg_iterator raw_arg_begin()
Definition: ExprCXX.h:2455
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:2328
bool isGlobalNew() const
Definition: ExprCXX.h:2386
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:4085
bool getValue() const
Definition: ExprCXX.h:4108
Expr * getOperand() const
Definition: ExprCXX.h:4102
SourceRange getSourceRange() const
Definition: ExprCXX.h:4106
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:4811
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.h:4869
SourceLocation getInitLoc() const LLVM_READONLY
Definition: ExprCXX.h:4871
ArrayRef< Expr * > getUserSpecifiedInitExprs()
Definition: ExprCXX.h:4859
ArrayRef< Expr * > getInitExprs()
Definition: ExprCXX.h:4851
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:4867
FieldDecl * getInitializedFieldInUnion()
Definition: ExprCXX.h:4891
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2605
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Definition: ExprCXX.h:2698
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise,...
Definition: ExprCXX.h:2668
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition: ExprCXX.h:2682
IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
Definition: ExprCXX.h:2705
SourceLocation getTildeLoc() const
Retrieve the location of the '~'.
Definition: ExprCXX.h:2689
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information.
Definition: ExprCXX.h:2657
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
Definition: ExprCXX.h:2713
SourceLocation getColonColonLoc() const
Retrieve the location of the '::' in a qualified pseudo-destructor expression.
Definition: ExprCXX.h:2686
SourceLocation getOperatorLoc() const
Retrieve the location of the '.' or '->' operator.
Definition: ExprCXX.h:2671
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:2164
TypeSourceInfo * getTypeSourceInfo() const
Definition: ExprCXX.h:2183
SourceLocation getRParenLoc() const
Definition: ExprCXX.h:2187
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:1868
TypeSourceInfo * getTypeSourceInfo() const
Definition: ExprCXX.h:1897
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:3516
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
Definition: ExprCXX.h:3560
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition: ExprCXX.h:3571
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
Definition: ExprCXX.h:3554
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
Definition: ExprCXX.h:3565
unsigned getNumArgs() const
Retrieve the number of arguments.
Definition: ExprCXX.h:3574
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:2832
bool hasStoredFPFeatures() const
Definition: Expr.h:2994
arg_iterator arg_begin()
Definition: Expr.h:3076
arg_iterator arg_end()
Definition: Expr.h:3079
ADLCallKind getADLCallKind() const
Definition: Expr.h:2986
Expr * getCallee()
Definition: Expr.h:2982
FPOptionsOverride getFPFeatures() const
Definition: Expr.h:3114
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: Expr.h:3010
SourceLocation getRParenLoc() const
Definition: Expr.h:3142
This captures a statement into a function.
Definition: Stmt.h:3578
CaseStmt - Represent a case statement.
Definition: Stmt.h:1622
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3502
path_iterator path_begin()
Definition: Expr.h:3572
unsigned path_size() const
Definition: Expr.h:3571
CastKind getCastKind() const
Definition: Expr.h:3546
bool hasStoredFPFeatures() const
Definition: Expr.h:3589
path_iterator path_end()
Definition: Expr.h:3573
FPOptionsOverride getFPFeatures() const
Definition: Expr.h:3605
Expr * getSubExpr()
Definition: Expr.h:3552
SourceLocation getLocation() const
Definition: Expr.h:1633
unsigned getValue() const
Definition: Expr.h:1641
CharacterKind getKind() const
Definition: Expr.h:1634
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4565
SourceLocation getBuiltinLoc() const
Definition: Expr.h:4612
Expr * getLHS() const
Definition: Expr.h:4607
bool isConditionDependent() const
Definition: Expr.h:4595
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
Definition: Expr.h:4588
Expr * getRHS() const
Definition: Expr.h:4609
SourceLocation getRParenLoc() const
Definition: Expr.h:4615
Expr * getCond() const
Definition: Expr.h:4605
Represents a 'co_await' expression.
Definition: ExprCXX.h:5021
bool isImplicit() const
Definition: ExprCXX.h:5043
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4095
QualType getComputationLHSType() const
Definition: Expr.h:4129
QualType getComputationResultType() const
Definition: Expr.h:4132
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3432
SourceLocation getLParenLoc() const
Definition: Expr.h:3462
bool isFileScope() const
Definition: Expr.h:3459
const Expr * getInitializer() const
Definition: Expr.h:3455
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:3465
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1429
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:4186
Expr * getLHS() const
Definition: Expr.h:4220
Expr * getCond() const
getCond - Return the expression representing the condition for the ?: operator.
Definition: Expr.h:4209
Expr * getRHS() const
Definition: Expr.h:4221
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:1049
ContinueStmt - This represents a continue.
Definition: Stmt.h:2771
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4506
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition: Expr.h:4540
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_convertvector token.
Definition: Expr.h:4537
TypeSourceInfo * getTypeSourceInfo() const
getTypeSourceInfo - Return the destination type.
Definition: Expr.h:4529
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:4526
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:4928
SourceLocation getKeywordLoc() const
Definition: ExprCXX.h:4998
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition: ExprCXX.h:4979
child_range children()
Definition: ExprCXX.h:5006
Represents a 'co_yield' expression.
Definition: ExprCXX.h:5102
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:1242
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:1411
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition: Expr.h:1347
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
Definition: Expr.h:1440
bool hasTemplateKWAndArgsInfo() const
Definition: Expr.h:1357
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier,...
Definition: Expr.h:1325
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name,...
Definition: Expr.h:1329
ValueDecl * getDecl()
Definition: Expr.h:1310
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
Definition: Expr.h:1434
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
Definition: Expr.h:1423
SourceLocation getLocation() const
Definition: Expr.h:1318
bool isImmediateEscalating() const
Definition: Expr.h:1444
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition: Stmt.h:1320
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
AccessSpecifier getAccess() const
Definition: DeclBase.h:491
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:5053
SourceLocation getKeywordLoc() const
Definition: ExprCXX.h:5082
child_range children()
Definition: ExprCXX.h:5090
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3282
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
Definition: ExprCXX.h:3330
Represents a single C99 designator.
Definition: Expr.h:5130
Represents a C99 designated initializer expression.
Definition: Expr.h:5088
Expr * getSubExpr(unsigned Idx) const
Definition: Expr.h:5369
llvm::MutableArrayRef< Designator > designators()
Definition: Expr.h:5320
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
Definition: Expr.h:5351
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the '=' that precedes the initializer value itself, if present.
Definition: Expr.h:5342
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression,...
Definition: Expr.h:5367
Expr * getBase() const
Definition: Expr.h:5471
InitListExpr * getUpdater() const
Definition: Expr.h:5474
DoStmt - This represents a 'do/while' stmt.
Definition: Stmt.h:2546
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3737
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
Definition: Expr.h:3759
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:3433
bool cleanupsHaveSideEffects() const
Definition: ExprCXX.h:3468
ArrayRef< CleanupObject > getObjects() const
Definition: ExprCXX.h:3457
unsigned getNumObjects() const
Definition: ExprCXX.h:3461
This represents one expression.
Definition: Expr.h:110
bool isValueDependent() const
Determines whether the value of this expression depends on.
Definition: Expr.h:169
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Definition: Expr.h:431
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Definition: Expr.h:438
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition: Expr.cpp:330
QualType getType() const
Definition: Expr.h:142
ExprDependence getDependence() const
Definition: Expr.h:156
An expression trait intrinsic.
Definition: ExprCXX.h:2910
Expr * getQueriedExpression() const
Definition: ExprCXX.h:2947
ExpressionTrait getTrait() const
Definition: ExprCXX.h:2945
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:6107
SourceLocation getAccessorLoc() const
Definition: Expr.h:6131
const Expr * getBase() const
Definition: Expr.h:6124
IdentifierInfo & getAccessor() const
Definition: Expr.h:6128
storage_type getAsOpaqueInt() const
Definition: LangOptions.h:876
Represents a member of a struct/union/class.
Definition: Decl.h:2962
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition: Expr.h:1585
unsigned getScale() const
Definition: Expr.h:1589
SourceLocation getLocation() const
Definition: Expr.h:1717
llvm::APFloatBase::Semantics getRawSemantics() const
Get a raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE,...
Definition: Expr.h:1686
llvm::APFloat getValue() const
Definition: Expr.h:1676
bool isExact() const
Definition: Expr.h:1709
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition: Stmt.h:2602
const Expr * getSubExpr() const
Definition: Expr.h:1032
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4497
VarDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition: ExprCXX.h:4524
iterator end() const
Definition: ExprCXX.h:4533
VarDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition: ExprCXX.h:4531
unsigned getNumExpansions() const
Get the number of parameters in this parameter pack.
Definition: ExprCXX.h:4536
SourceLocation getParameterPackLocation() const
Get the location of the parameter pack.
Definition: ExprCXX.h:4527
iterator begin() const
Definition: ExprCXX.h:4532
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:3080
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4640
SourceLocation getTokenLocation() const
getTokenLocation - The location of the __null token.
Definition: Expr.h:4654
Represents a C11 generic selection.
Definition: Expr.h:5720
unsigned getNumAssocs() const
The number of association expressions.
Definition: Expr.h:5959
bool isExprPredicate() const
Whether this generic selection uses an expression as its controlling argument.
Definition: Expr.h:5975
SourceLocation getGenericLoc() const
Definition: Expr.h:6072
SourceLocation getRParenLoc() const
Definition: Expr.h:6076
SourceLocation getDefaultLoc() const
Definition: Expr.h:6075
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2683
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1959
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
Definition: Expr.h:1741
const Expr * getSubExpr() const
Definition: Expr.h:1753
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3662
bool isPartOfExplicitCast() const
Definition: Expr.h:3693
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5595
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2722
Describes an C or C++ initializer list.
Definition: Expr.h:4843
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition: Expr.h:4962
unsigned getNumInits() const
Definition: Expr.h:4873
SourceLocation getLBraceLoc() const
Definition: Expr.h:4997
InitListExpr * getSyntacticForm() const
Definition: Expr.h:5009
bool hadArrayRangeDesignator() const
Definition: Expr.h:5020
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition: Expr.h:4937
SourceLocation getRBraceLoc() const
Definition: Expr.h:4999
const Expr * getInit(unsigned Init) const
Definition: Expr.h:4889
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition: Expr.h:1543
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1852
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1937
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Definition: ExprCXX.h:2075
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition: ExprCXX.h:2063
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3303
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:4577
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
Definition: ExprCXX.h:4594
LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl()
Definition: ExprCXX.h:4617
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition: Expr.h:2754
SourceLocation getRBracketLoc() const
Definition: Expr.h:2806
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3195
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
Definition: Expr.h:3380
SourceLocation getOperatorLoc() const
Definition: Expr.h:3373
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name,...
Definition: Expr.h:3293
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:3274
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:3415
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
Definition: Expr.h:3288
Expr * getBase() const
Definition: Expr.h:3268
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:3356
bool hadMultipleCandidates() const
Returns true if this member expression refers to a method that was resolved from an overloaded set ha...
Definition: Expr.h:3395
bool isArrow() const
Definition: Expr.h:3375
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Definition: Expr.h:3278
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:313
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:5415
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1392
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:3109
bool isFailOnly() const
Return true if 'v' is updated only when the condition is evaluated false (compare capture only).
Definition: StmtOpenMP.h:3115
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:3112
This represents '#pragma omp barrier' directive.
Definition: StmtOpenMP.h:2641
This represents '#pragma omp cancel' directive.
Definition: StmtOpenMP.h:3668
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
Definition: StmtOpenMP.h:3712
This represents '#pragma omp cancellation point' directive.
Definition: StmtOpenMP.h:3610
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
Definition: StmtOpenMP.h:3654
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:5824
SourceLocation getTargetCallLoc() const
Return location of target-call.
Definition: StmtOpenMP.h:5875
This represents '#pragma omp distribute' directive.
Definition: StmtOpenMP.h:4438
This represents '#pragma omp distribute parallel for' composite directive.
Definition: StmtOpenMP.h:4561
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:4641
This represents '#pragma omp distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:4657
This represents '#pragma omp distribute simd' composite directive.
Definition: StmtOpenMP.h:4722
This represents '#pragma omp error' directive.
Definition: StmtOpenMP.h:6299
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:5979
This represents '#pragma omp interop' directive.
Definition: StmtOpenMP.h:5771
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:5189
SourceLocation getColonLoc(unsigned I) const
Gets the location of the first ':' in the range for the given iterator definition.
Definition: Expr.cpp:5183
SourceLocation getRParenLoc() const
Definition: ExprOpenMP.h:369
IteratorRange getIteratorRange(unsigned I)
Gets the iterator range for the given iterator.
Definition: Expr.cpp:5160
OMPIteratorHelperData & getHelper(unsigned I)
Fetches helper data for the specified iteration space.
Definition: Expr.cpp:5199
SourceLocation getAssignLoc(unsigned I) const
Gets the location of '=' for the given iterator definition.
Definition: Expr.cpp:5177
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:5156
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()
Return the number of loops generated by this loop transformation.
Definition: StmtOpenMP.h:997
This represents '#pragma omp masked' directive.
Definition: StmtOpenMP.h:5889
This represents '#pragma omp masked taskloop' directive.
Definition: StmtOpenMP.h:3943
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:4003
This represents '#pragma omp masked taskloop simd' directive.
Definition: StmtOpenMP.h:4084
This represents '#pragma omp master' directive.
Definition: StmtOpenMP.h:2044
This represents '#pragma omp master taskloop' directive.
Definition: StmtOpenMP.h:3867
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:3927
This represents '#pragma omp master taskloop simd' directive.
Definition: StmtOpenMP.h:4019
This represents '#pragma omp metadirective' directive.
Definition: StmtOpenMP.h:5940
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:6172
This represents '#pragma omp parallel masked' directive.
Definition: StmtOpenMP.h:2388
This represents '#pragma omp parallel masked taskloop' directive.
Definition: StmtOpenMP.h:4228
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:4289
This represents '#pragma omp parallel masked taskloop simd' directive.
Definition: StmtOpenMP.h:4373
This represents '#pragma omp parallel master' directive.
Definition: StmtOpenMP.h:2325
This represents '#pragma omp parallel master taskloop' directive.
Definition: StmtOpenMP.h:4150
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:4211
This represents '#pragma omp parallel master taskloop simd' directive.
Definition: StmtOpenMP.h:4306
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:5718
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:3219
This represents '#pragma omp target' directive.
Definition: StmtOpenMP.h:3165
This represents '#pragma omp target enter data' directive.
Definition: StmtOpenMP.h:3273
This represents '#pragma omp target exit data' directive.
Definition: StmtOpenMP.h:3328
This represents '#pragma omp target parallel' directive.
Definition: StmtOpenMP.h:3382
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:3446
This represents '#pragma omp target parallel for' directive.
Definition: StmtOpenMP.h:3462
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:3542
This represents '#pragma omp target parallel for simd' directive.
Definition: StmtOpenMP.h:4788
This represents '#pragma omp target parallel loop' directive.
Definition: StmtOpenMP.h:6237
This represents '#pragma omp target simd' directive.
Definition: StmtOpenMP.h:4855
This represents '#pragma omp target teams' directive.
Definition: StmtOpenMP.h:5213
This represents '#pragma omp target teams distribute' combined directive.
Definition: StmtOpenMP.h:5269
This represents '#pragma omp target teams distribute parallel for' combined directive.
Definition: StmtOpenMP.h:5336
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:5416
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
Definition: StmtOpenMP.h:5434
This represents '#pragma omp target teams distribute simd' combined directive.
Definition: StmtOpenMP.h:5504
This represents '#pragma omp target teams loop' directive.
Definition: StmtOpenMP.h:6106
This represents '#pragma omp target update' directive.
Definition: StmtOpenMP.h:4505
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:3728
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:3785
This represents '#pragma omp taskloop simd' directive.
Definition: StmtOpenMP.h:3801
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:3557
This represents '#pragma omp teams distribute' directive.
Definition: StmtOpenMP.h:4920
This represents '#pragma omp teams distribute parallel for' composite directive.
Definition: StmtOpenMP.h:5120
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:5198
This represents '#pragma omp teams distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:5054
This represents '#pragma omp teams distribute simd' combined directive.
Definition: StmtOpenMP.h:4986
This represents '#pragma omp teams loop' directive.
Definition: StmtOpenMP.h:6041
This represents the '#pragma omp tile' loop transformation directive.
Definition: StmtOpenMP.h:5562
This represents the '#pragma omp unroll' loop transformation directive.
Definition: StmtOpenMP.h:5644
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:302
Represents Objective-C's @throw statement.
Definition: StmtObjC.h:357
Represents Objective-C's @try ... @catch ... @finally statement.
Definition: StmtObjC.h:167
Represents Objective-C's @autoreleasepool Statement.
Definition: StmtObjC.h:393
A runtime availability query.
Definition: ExprObjC.h:1685
SourceRange getSourceRange() const
Definition: ExprObjC.h:1704
VersionTuple getVersion() const
Definition: ExprObjC.h:1708
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:1626
SourceLocation getLParenLoc() const
Definition: ExprObjC.h:1648
SourceLocation getBridgeKeywordLoc() const
The location of the bridge keyword.
Definition: ExprObjC.h:1659
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
Definition: ExprObjC.h:1651
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:359
ObjCMethodDecl * getDictWithObjectsMethod() const
Definition: ExprObjC.h:376
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
Definition: ExprObjC.h:361
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprObjC.h:382
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:409
TypeSourceInfo * getEncodedTypeSourceInfo() const
Definition: ExprObjC.h:430
SourceLocation getRParenLoc() const
Definition: ExprObjC.h:425
SourceLocation getAtLoc() const
Definition: ExprObjC.h:423
Represents Objective-C's collection statement.
Definition: StmtObjC.h:23
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1565
bool shouldCopy() const
shouldCopy - True if we should do the 'copy' part of the copy-restore.
Definition: ExprObjC.h:1593
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
Definition: ExprObjC.h:1481
SourceLocation getIsaMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
Definition: ExprObjC.h:1513
SourceLocation getOpLoc() const
Definition: ExprObjC.h:1516
Expr * getBase() const
Definition: ExprObjC.h:1506
bool isArrow() const
Definition: ExprObjC.h:1508
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:548
SourceLocation getLocation() const
Definition: ExprObjC.h:589
SourceLocation getOpLoc() const
Definition: ExprObjC.h:597
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:576
bool isArrow() const
Definition: ExprObjC.h:584
bool isFreeIvar() const
Definition: ExprObjC.h:585
const Expr * getBase() const
Definition: ExprObjC.h:580
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:942
bool isDelegateInitCall() const
isDelegateInitCall - Answers whether this message send has been tagged as a "delegate init call",...
Definition: ExprObjC.h:1403
SourceLocation getLeftLoc() const
Definition: ExprObjC.h:1406
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Definition: ExprObjC.h:1250
SourceLocation getSuperLoc() const
Retrieve the location of the 'super' keyword for a class or instance message to 'super',...
Definition: ExprObjC.h:1291
Selector getSelector() const
Definition: ExprObjC.cpp:293
@ SuperInstance
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:1097
@ Instance
The receiver is an object instance.
Definition: ExprObjC.h:1091
@ SuperClass
The receiver is a superclass.
Definition: ExprObjC.h:1094
@ Class
The receiver is a class.
Definition: ExprObjC.h:1088
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:1278
QualType getSuperType() const
Retrieve the type referred to by 'super'.
Definition: ExprObjC.h:1326
const ObjCMethodDecl * getMethodDecl() const
Definition: ExprObjC.h:1346
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1224
arg_iterator arg_begin()
Definition: ExprObjC.h:1460
SourceLocation getRightLoc() const
Definition: ExprObjC.h:1407
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver.
Definition: ExprObjC.h:1372
arg_iterator arg_end()
Definition: ExprObjC.h:1462
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:614
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:703
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:708
SourceLocation getReceiverLocation() const
Definition: ExprObjC.h:761
const Expr * getBase() const
Definition: ExprObjC.h:752
bool isObjectReceiver() const
Definition: ExprObjC.h:771
QualType getSuperReceiverType() const
Definition: ExprObjC.h:763
bool isImplicitProperty() const
Definition: ExprObjC.h:700
ObjCMethodDecl * getImplicitPropertySetter() const
Definition: ExprObjC.h:713
ObjCInterfaceDecl * getClassReceiver() const
Definition: ExprObjC.h:767
SourceLocation getLocation() const
Definition: ExprObjC.h:759
bool isSuperReceiver() const
Definition: ExprObjC.h:772
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:504
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:521
SourceLocation getRParenLoc() const
Definition: ExprObjC.h:526
SourceLocation getAtLoc() const
Definition: ExprObjC.h:525
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:454
SourceLocation getRParenLoc() const
Definition: ExprObjC.h:472
Selector getSelector() const
Definition: ExprObjC.h:468
SourceLocation getAtLoc() const
Definition: ExprObjC.h:471
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:51
SourceLocation getAtLoc() const
Definition: ExprObjC.h:68
StringLiteral * getString()
Definition: ExprObjC.h:64
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:841
Expr * getKeyExpr() const
Definition: ExprObjC.h:883
Expr * getBaseExpr() const
Definition: ExprObjC.h:880
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition: ExprObjC.h:886
SourceLocation getRBracket() const
Definition: ExprObjC.h:871
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition: ExprObjC.h:890
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Definition: Expr.h:2477
Expr * getIndexExpr(unsigned Idx)
Definition: Expr.h:2538
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition: Expr.h:2510
const OffsetOfNode & getComponent(unsigned Idx) const
Definition: Expr.h:2524
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:2517
unsigned getNumExpressions() const
Definition: Expr.h:2553
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
Definition: Expr.h:2514
unsigned getNumComponents() const
Definition: Expr.h:2534
Helper class for OffsetOfExpr.
Definition: Expr.h:2371
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
Definition: Expr.h:2429
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition: Expr.h:2435
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition: Expr.cpp:1712
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this offsetof node.
Definition: Expr.h:2456
@ Array
An index into an array.
Definition: Expr.h:2376
@ Identifier
A field in a dependent type, known only by its name.
Definition: Expr.h:2380
@ Field
A field.
Definition: Expr.h:2378
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Definition: Expr.h:2383
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:2425
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
Definition: Expr.h:2445
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition: Expr.h:1150
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition: Expr.h:1200
SourceLocation getLocation() const
Retrieve the location of this expression.
Definition: Expr.h:1172
bool isUnique() const
Definition: Expr.h:1208
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Definition: ExprCXX.h:2967
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition: ExprCXX.h:4058
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
Definition: ExprCXX.h:3073
decls_iterator decls_begin() const
Definition: ExprCXX.h:3059
unsigned getNumDecls() const
Gets the number of declarations in the unresolved set.
Definition: ExprCXX.h:3070
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
Definition: ExprCXX.h:3088
TemplateArgumentLoc * getTrailingTemplateArgumentLoc()
Return the optional template arguments.
Definition: ExprCXX.h:4068
bool hasTemplateKWAndArgsInfo() const
Definition: ExprCXX.h:3011
decls_iterator decls_end() const
Definition: ExprCXX.h:3062
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:4139
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition: ExprCXX.h:4168
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
Definition: ExprCXX.h:4175
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:2142
SourceLocation getLParen() const
Get the location of the left parentheses '('.
Definition: Expr.h:2165
const Expr * getSubExpr() const
Definition: Expr.h:2157
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
Definition: Expr.h:2169
ArrayRef< Expr * > exprs()
Definition: Expr.h:5663
unsigned getNumExprs() const
Return the number of expressions in this paren list.
Definition: Expr.h:5648
SourceLocation getLParenLoc() const
Definition: Expr.h:5665
SourceLocation getRParenLoc() const
Definition: Expr.h:5666
Represents a parameter to a function.
Definition: Decl.h:1724
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1985
bool isTransparent() const
Definition: Expr.h:2039
SourceLocation getLocation() const
Definition: Expr.h:2041
StringLiteral * getFunctionName()
Definition: Expr.h:2044
IdentKind getIdentKind() const
Definition: Expr.h:2035
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:6299
semantics_iterator semantics_end()
Definition: Expr.h:6371
unsigned getResultExprIndex() const
Return the index of the result-bearing expression into the semantics expressions, or PseudoObjectExpr...
Definition: Expr.h:6346
semantics_iterator semantics_begin()
Definition: Expr.h:6365
Expr *const * semantics_iterator
Definition: Expr.h:6363
unsigned getNumSemanticExprs() const
Definition: Expr.h:6361
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Definition: Expr.h:6341
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition: Expr.h:6629
SourceLocation getEndLoc() const
Definition: Expr.h:6651
child_range children()
Definition: Expr.h:6645
SourceLocation getBeginLoc() const
Definition: Expr.h:6650
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:507
SourceLocation getLParenLoc() const
Definition: ExprConcepts.h:575
SourceLocation getRParenLoc() const
Definition: ExprConcepts.h:576
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprConcepts.h:586
RequiresExprBodyDecl * getBody() const
Definition: ExprConcepts.h:551
ArrayRef< concepts::Requirement * > getRequirements() const
Definition: ExprConcepts.h:553
ArrayRef< ParmVarDecl * > getLocalParameters() const
Definition: ExprConcepts.h:547
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Definition: Stmt.h:2840
Represents a __leave statement.
Definition: Stmt.h:3539
SourceLocation getLocation() const
Definition: Expr.h:2115
SourceLocation getLParenLocation() const
Definition: Expr.h:2116
TypeSourceInfo * getTypeSourceInfo()
Definition: Expr.h:2103
SourceLocation getRParenLocation() const
Definition: Expr.h:2117
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:4438
SourceLocation getBuiltinLoc() const
Definition: Expr.h:4456
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
Definition: Expr.h:4472
SourceLocation getRParenLoc() const
Definition: Expr.h:4459
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
Definition: Expr.h:4478
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4217
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
Definition: ExprCXX.h:4303
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition: ExprCXX.h:4308
unsigned getPackLength() const
Retrieve the length of the parameter pack.
Definition: ExprCXX.h:4292
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Definition: Expr.h:4724
SourceLocation getBeginLoc() const
Definition: Expr.h:4779
IdentKind getIdentKind() const
Definition: Expr.h:4754
const DeclContext * getParentContext() const
If the SourceLocExpr has been resolved return the subexpression representing the resolved value.
Definition: Expr.h:4775
SourceLocation getEndLoc() const
Definition: Expr.h:4780
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:4390
CompoundStmt * getSubStmt()
Definition: Expr.h:4407
unsigned getTemplateDepth() const
Definition: Expr.h:4419
SourceLocation getRParenLoc() const
Definition: Expr.h:4416
SourceLocation getLParenLoc() const
Definition: Expr.h:4414
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:184
Stmt - This represents one statement.
Definition: Stmt.h:72
LambdaExprBitfields LambdaExprBits
Definition: Stmt.h:1086
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:325
TypeTraitExprBitfields TypeTraitExprBits
Definition: Stmt.h:1075
CXXNewExprBitfields CXXNewExprBits
Definition: Stmt.h:1073
ConstantExprBitfields ConstantExprBits
Definition: Stmt.h:1041
RequiresExprBitfields RequiresExprBits
Definition: Stmt.h:1087
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition: Stmt.h:1076
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1793
SourceLocation getStrTokenLoc(unsigned TokNum) const
Get one of the string literal token.
Definition: Expr.h:1938
StringKind getKind() const
Definition: Expr.h:1905
bool isPascal() const
Definition: Expr.h:1915
unsigned getLength() const
Definition: Expr.h:1902
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
Definition: Expr.h:1881
unsigned getByteLength() const
Definition: Expr.h:1901
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
Definition: Expr.h:1933
unsigned getCharByteWidth() const
Definition: Expr.h:1903
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:4333
std::optional< unsigned > getPackIndex() const
Definition: ExprCXX.h:4381
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition: ExprCXX.h:4375
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition: ExprCXX.h:4379
SourceLocation getNameLoc() const
Definition: ExprCXX.h:4365
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:4418
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
Definition: ExprCXX.cpp:1693
SourceLocation getParameterPackLocation() const
Retrieve the location of the parameter pack name.
Definition: ExprCXX.h:4458
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition: ExprCXX.h:4448
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition: ExprCXX.h:4452
SwitchStmt - This represents a 'switch' stmt.
Definition: Stmt.h:2209
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:484
A container of type source information.
Definition: Type.h:6718
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2755
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition: ExprCXX.h:2805
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition: ExprCXX.h:2802
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:6574
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition: Expr.h:2580
SourceLocation getRParenLoc() const
Definition: Expr.h:2656
SourceLocation getOperatorLoc() const
Definition: Expr.h:2653
bool isArgumentType() const
Definition: Expr.h:2622
TypeSourceInfo * getArgumentTypeInfo() const
Definition: Expr.h:2626
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2612
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition: Expr.h:2195
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition: Expr.h:2244
Expr * getSubExpr() const
Definition: Expr.h:2240
Opcode getOpcode() const
Definition: Expr.h:2235
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
Definition: Expr.h:2336
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
Definition: Expr.h:2339
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition: Expr.h:2253
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3164
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
Definition: ExprCXX.h:3236
bool isOverloaded() const
True if this lookup is overloaded.
Definition: ExprCXX.h:3231
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition: ExprCXX.h:3228
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition: ExprCXX.h:3902
QualType getBaseType() const
Definition: ExprCXX.h:3984
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Definition: ExprCXX.h:3994
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
Definition: ExprCXX.h:3997
bool hasUnresolvedUsing() const
Determine whether the lookup results contain an unresolved using declaration.
Definition: ExprCXX.h:3988
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition: ExprCXX.h:3975
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:1578
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:4674
TypeSourceInfo * getWrittenTypeInfo() const
Definition: Expr.h:4698
SourceLocation getBuiltinLoc() const
Definition: Expr.h:4701
SourceLocation getRParenLoc() const
Definition: Expr.h:4704
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
Definition: Expr.h:4695
const Expr * getSubExpr() const
Definition: Expr.h:4690
WhileStmt - This represents a 'while' stmt.
Definition: Stmt.h:2405
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:1546
@ EXPR_DESIGNATED_INIT
A DesignatedInitExpr record.
Definition: ASTBitCodes.h:1693
@ EXPR_COMPOUND_LITERAL
A CompoundLiteralExpr record.
Definition: ASTBitCodes.h:1684
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1985
@ EXPR_OBJC_IVAR_REF_EXPR
An ObjCIvarRefExpr record.
Definition: ASTBitCodes.h:1768
@ EXPR_MEMBER
A MemberExpr record.
Definition: ASTBitCodes.h:1666
@ EXPR_CXX_TEMPORARY_OBJECT
A CXXTemporaryObjectExpr record.
Definition: ASTBitCodes.h:1842
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1996
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
Definition: ASTBitCodes.h:1672
@ EXPR_CXX_STATIC_CAST
A CXXStaticCastExpr record.
Definition: ASTBitCodes.h:1845
@ EXPR_OBJC_STRING_LITERAL
An ObjCStringLiteral record.
Definition: ASTBitCodes.h:1752
@ EXPR_VA_ARG
A VAArgExpr record.
Definition: ASTBitCodes.h:1711
@ STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1990
@ EXPR_OBJC_ISA
An ObjCIsa Expr record.
Definition: ASTBitCodes.h:1783
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
Definition: ASTBitCodes.h:1827
@ STMT_OBJC_AT_TRY
An ObjCAtTryStmt record.
Definition: ASTBitCodes.h:1798
@ STMT_DO
A DoStmt record.
Definition: ASTBitCodes.h:1585
@ STMT_OBJC_CATCH
An ObjCAtCatchStmt record.
Definition: ASTBitCodes.h:1792
@ STMT_IF
An IfStmt record.
Definition: ASTBitCodes.h:1576
@ EXPR_STRING_LITERAL
A StringLiteral record.
Definition: ASTBitCodes.h:1636
@ EXPR_OBJC_AVAILABILITY_CHECK
An ObjCAvailabilityCheckExpr record.
Definition: ASTBitCodes.h:1813
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_DIRECTIVE
Definition: ASTBitCodes.h:1980
@ EXPR_PSEUDO_OBJECT
A PseudoObjectExpr record.
Definition: ASTBitCodes.h:1741
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1995
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1678
@ STMT_CAPTURED
A CapturedStmt record.
Definition: ASTBitCodes.h:1609
@ STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1987
@ STMT_GCCASM
A GCC-style AsmStmt record.
Definition: ASTBitCodes.h:1612
@ EXPR_IMAGINARY_LITERAL
An ImaginaryLiteral record.
Definition: ASTBitCodes.h:1633
@ STMT_WHILE
A WhileStmt record.
Definition: ASTBitCodes.h:1582
@ EXPR_CONVERT_VECTOR
A ConvertVectorExpr record.
Definition: ASTBitCodes.h:1732
@ EXPR_OBJC_SUBSCRIPT_REF_EXPR
An ObjCSubscriptRefExpr record.
Definition: ASTBitCodes.h:1774
@ EXPR_STMT
A StmtExpr record.
Definition: ASTBitCodes.h:1717
@ STMT_OMP_PARALLEL_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:2005
@ EXPR_CXX_REINTERPRET_CAST
A CXXReinterpretCastExpr record.
Definition: ASTBitCodes.h:1851
@ EXPR_DESIGNATED_INIT_UPDATE
A DesignatedInitUpdateExpr record.
Definition: ASTBitCodes.h:1696
@ STMT_OBJC_AT_SYNCHRONIZED
An ObjCAtSynchronizedStmt record.
Definition: ASTBitCodes.h:1801
@ STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE
Definition: ASTBitCodes.h:1984
@ EXPR_BUILTIN_BIT_CAST
A BuiltinBitCastExpr record.
Definition: ASTBitCodes.h:1863
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1997
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
Definition: ASTBitCodes.h:1639
@ EXPR_OBJC_ENCODE
An ObjCEncodeExpr record.
Definition: ASTBitCodes.h:1759
@ EXPR_CSTYLE_CAST
A CStyleCastExpr record.
Definition: ASTBitCodes.h:1681
@ EXPR_OBJC_BOOL_LITERAL
An ObjCBoolLiteralExpr record.
Definition: ASTBitCodes.h:1810
@ EXPR_EXT_VECTOR_ELEMENT
An ExtVectorElementExpr record.
Definition: ASTBitCodes.h:1687
@ EXPR_ATOMIC
An AtomicExpr record.
Definition: ASTBitCodes.h:1744
@ EXPR_OFFSETOF
An OffsetOfExpr record.
Definition: ASTBitCodes.h:1651
@ STMT_RETURN
A ReturnStmt record.
Definition: ASTBitCodes.h:1603
@ STMT_OBJC_FOR_COLLECTION
An ObjCForCollectionStmt record.
Definition: ASTBitCodes.h:1789
@ STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE
Definition: ASTBitCodes.h:1994
@ EXPR_ARRAY_INIT_LOOP
An ArrayInitLoopExpr record.
Definition: ASTBitCodes.h:1702
@ STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE
Definition: ASTBitCodes.h:1976
@ STMT_OMP_PARALLEL_MASKED_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1981
@ STMT_CONTINUE
A ContinueStmt record.
Definition: ASTBitCodes.h:1597
@ EXPR_PREDEFINED
A PredefinedExpr record.
Definition: ASTBitCodes.h:1621
@ EXPR_CXX_BOOL_LITERAL
A CXXBoolLiteralExpr record.
Definition: ASTBitCodes.h:1872
@ EXPR_PAREN_LIST
A ParenListExpr record.
Definition: ASTBitCodes.h:1645
@ EXPR_CXX_PAREN_LIST_INIT
A CXXParenListInitExpr record.
Definition: ASTBitCodes.h:1875
@ STMT_OMP_MASTER_TASKLOOP_SIMD_DIRECTIVE
Definition: ASTBitCodes.h:1975
@ STMT_COMPOUND
A CompoundStmt record.
Definition: ASTBitCodes.h:1561
@ STMT_FOR
A ForStmt record.
Definition: ASTBitCodes.h:1588
@ STMT_ATTRIBUTED
An AttributedStmt record.
Definition: ASTBitCodes.h:1573
@ STMT_OMP_TARGET_TEAMS_GENERIC_LOOP_DIRECTIVE
Definition: ASTBitCodes.h:2004
@ EXPR_CXX_REWRITTEN_BINARY_OPERATOR
A CXXRewrittenBinaryOperator record.
Definition: ASTBitCodes.h:1833
@ STMT_GOTO
A GotoStmt record.
Definition: ASTBitCodes.h:1591
@ EXPR_NO_INIT
An NoInitExpr record.
Definition: ASTBitCodes.h:1699
@ EXPR_OBJC_PROTOCOL_EXPR
An ObjCProtocolExpr record.
Definition: ASTBitCodes.h:1765
@ EXPR_ARRAY_INIT_INDEX
An ArrayInitIndexExpr record.
Definition: ASTBitCodes.h:1705
@ EXPR_CXX_CONSTRUCT
A CXXConstructExpr record.
Definition: ASTBitCodes.h:1836