clang  6.0.0svn
ASTReaderStmt.cpp
Go to the documentation of this file.
1 //===--- ASTReaderStmt.cpp - Stmt/Expr Deserialization ----------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Statement/expression deserialization. This implements the
11 // ASTReader::ReadStmt method.
12 //
13 //===----------------------------------------------------------------------===//
14 
16 #include "clang/AST/ASTContext.h"
17 #include "clang/AST/DeclCXX.h"
18 #include "clang/AST/DeclTemplate.h"
19 #include "clang/AST/StmtVisitor.h"
20 #include "clang/Lex/Token.h"
21 #include "llvm/ADT/SmallString.h"
22 using namespace clang;
23 using namespace clang::serialization;
24 
25 namespace clang {
26 
27  class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
28  friend class OMPClauseReader;
29 
30  ASTRecordReader &Record;
31  llvm::BitstreamCursor &DeclsCursor;
32 
33  SourceLocation ReadSourceLocation() {
34  return Record.readSourceLocation();
35  }
36 
37  SourceRange ReadSourceRange() {
38  return Record.readSourceRange();
39  }
40 
41  std::string ReadString() {
42  return Record.readString();
43  }
44 
45  TypeSourceInfo *GetTypeSourceInfo() {
46  return Record.getTypeSourceInfo();
47  }
48 
49  Decl *ReadDecl() {
50  return Record.readDecl();
51  }
52 
53  template<typename T>
54  T *ReadDeclAs() {
55  return Record.readDeclAs<T>();
56  }
57 
58  void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc,
59  DeclarationName Name) {
60  Record.readDeclarationNameLoc(DNLoc, Name);
61  }
62 
63  void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo) {
64  Record.readDeclarationNameInfo(NameInfo);
65  }
66 
67  public:
68  ASTStmtReader(ASTRecordReader &Record, llvm::BitstreamCursor &Cursor)
69  : Record(Record), DeclsCursor(Cursor) {}
70 
71  /// \brief The number of record fields required for the Stmt class
72  /// itself.
73  static const unsigned NumStmtFields = 0;
74 
75  /// \brief The number of record fields required for the Expr class
76  /// itself.
77  static const unsigned NumExprFields = NumStmtFields + 7;
78 
79  /// \brief Read and initialize a ExplicitTemplateArgumentList structure.
80  void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
81  TemplateArgumentLoc *ArgsLocArray,
82  unsigned NumTemplateArgs);
83  /// \brief Read and initialize a ExplicitTemplateArgumentList structure.
84  void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList,
85  unsigned NumTemplateArgs);
86 
87  void VisitStmt(Stmt *S);
88 #define STMT(Type, Base) \
89  void Visit##Type(Type *);
90 #include "clang/AST/StmtNodes.inc"
91  };
92 }
93 
95  TemplateArgumentLoc *ArgsLocArray,
96  unsigned NumTemplateArgs) {
97  SourceLocation TemplateKWLoc = ReadSourceLocation();
99  ArgInfo.setLAngleLoc(ReadSourceLocation());
100  ArgInfo.setRAngleLoc(ReadSourceLocation());
101  for (unsigned i = 0; i != NumTemplateArgs; ++i)
102  ArgInfo.addArgument(Record.readTemplateArgumentLoc());
103  Args.initializeFrom(TemplateKWLoc, ArgInfo, ArgsLocArray);
104 }
105 
107  assert(Record.getIdx() == NumStmtFields && "Incorrect statement field count");
108 }
109 
110 void ASTStmtReader::VisitNullStmt(NullStmt *S) {
111  VisitStmt(S);
112  S->setSemiLoc(ReadSourceLocation());
113  S->HasLeadingEmptyMacro = Record.readInt();
114 }
115 
116 void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
117  VisitStmt(S);
119  unsigned NumStmts = Record.readInt();
120  while (NumStmts--)
121  Stmts.push_back(Record.readSubStmt());
122  S->setStmts(Record.getContext(), Stmts);
123  S->LBraceLoc = ReadSourceLocation();
124  S->RBraceLoc = ReadSourceLocation();
125 }
126 
127 void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {
128  VisitStmt(S);
129  Record.recordSwitchCaseID(S, Record.readInt());
130  S->setKeywordLoc(ReadSourceLocation());
131  S->setColonLoc(ReadSourceLocation());
132 }
133 
134 void ASTStmtReader::VisitCaseStmt(CaseStmt *S) {
135  VisitSwitchCase(S);
136  S->setLHS(Record.readSubExpr());
137  S->setRHS(Record.readSubExpr());
138  S->setSubStmt(Record.readSubStmt());
139  S->setEllipsisLoc(ReadSourceLocation());
140 }
141 
142 void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
143  VisitSwitchCase(S);
144  S->setSubStmt(Record.readSubStmt());
145 }
146 
147 void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
148  VisitStmt(S);
149  LabelDecl *LD = ReadDeclAs<LabelDecl>();
150  LD->setStmt(S);
151  S->setDecl(LD);
152  S->setSubStmt(Record.readSubStmt());
153  S->setIdentLoc(ReadSourceLocation());
154 }
155 
156 void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) {
157  VisitStmt(S);
158  uint64_t NumAttrs = Record.readInt();
159  AttrVec Attrs;
160  Record.readAttributes(Attrs);
161  (void)NumAttrs;
162  assert(NumAttrs == S->NumAttrs);
163  assert(NumAttrs == Attrs.size());
164  std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr());
165  S->SubStmt = Record.readSubStmt();
166  S->AttrLoc = ReadSourceLocation();
167 }
168 
169 void ASTStmtReader::VisitIfStmt(IfStmt *S) {
170  VisitStmt(S);
171  S->setConstexpr(Record.readInt());
172  S->setInit(Record.readSubStmt());
173  S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
174  S->setCond(Record.readSubExpr());
175  S->setThen(Record.readSubStmt());
176  S->setElse(Record.readSubStmt());
177  S->setIfLoc(ReadSourceLocation());
178  S->setElseLoc(ReadSourceLocation());
179 }
180 
181 void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
182  VisitStmt(S);
183  S->setInit(Record.readSubStmt());
184  S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
185  S->setCond(Record.readSubExpr());
186  S->setBody(Record.readSubStmt());
187  S->setSwitchLoc(ReadSourceLocation());
188  if (Record.readInt())
190 
191  SwitchCase *PrevSC = nullptr;
192  for (auto E = Record.size(); Record.getIdx() != E; ) {
193  SwitchCase *SC = Record.getSwitchCaseWithID(Record.readInt());
194  if (PrevSC)
195  PrevSC->setNextSwitchCase(SC);
196  else
197  S->setSwitchCaseList(SC);
198 
199  PrevSC = SC;
200  }
201 }
202 
203 void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
204  VisitStmt(S);
205  S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
206 
207  S->setCond(Record.readSubExpr());
208  S->setBody(Record.readSubStmt());
209  S->setWhileLoc(ReadSourceLocation());
210 }
211 
212 void ASTStmtReader::VisitDoStmt(DoStmt *S) {
213  VisitStmt(S);
214  S->setCond(Record.readSubExpr());
215  S->setBody(Record.readSubStmt());
216  S->setDoLoc(ReadSourceLocation());
217  S->setWhileLoc(ReadSourceLocation());
218  S->setRParenLoc(ReadSourceLocation());
219 }
220 
221 void ASTStmtReader::VisitForStmt(ForStmt *S) {
222  VisitStmt(S);
223  S->setInit(Record.readSubStmt());
224  S->setCond(Record.readSubExpr());
225  S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
226  S->setInc(Record.readSubExpr());
227  S->setBody(Record.readSubStmt());
228  S->setForLoc(ReadSourceLocation());
229  S->setLParenLoc(ReadSourceLocation());
230  S->setRParenLoc(ReadSourceLocation());
231 }
232 
233 void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
234  VisitStmt(S);
235  S->setLabel(ReadDeclAs<LabelDecl>());
236  S->setGotoLoc(ReadSourceLocation());
237  S->setLabelLoc(ReadSourceLocation());
238 }
239 
240 void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
241  VisitStmt(S);
242  S->setGotoLoc(ReadSourceLocation());
243  S->setStarLoc(ReadSourceLocation());
244  S->setTarget(Record.readSubExpr());
245 }
246 
247 void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) {
248  VisitStmt(S);
249  S->setContinueLoc(ReadSourceLocation());
250 }
251 
252 void ASTStmtReader::VisitBreakStmt(BreakStmt *S) {
253  VisitStmt(S);
254  S->setBreakLoc(ReadSourceLocation());
255 }
256 
257 void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
258  VisitStmt(S);
259  S->setRetValue(Record.readSubExpr());
260  S->setReturnLoc(ReadSourceLocation());
261  S->setNRVOCandidate(ReadDeclAs<VarDecl>());
262 }
263 
264 void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
265  VisitStmt(S);
266  S->setStartLoc(ReadSourceLocation());
267  S->setEndLoc(ReadSourceLocation());
268 
269  if (Record.size() - Record.getIdx() == 1) {
270  // Single declaration
271  S->setDeclGroup(DeclGroupRef(ReadDecl()));
272  } else {
274  int N = Record.size() - Record.getIdx();
275  Decls.reserve(N);
276  for (int I = 0; I < N; ++I)
277  Decls.push_back(ReadDecl());
279  Decls.data(),
280  Decls.size())));
281  }
282 }
283 
284 void ASTStmtReader::VisitAsmStmt(AsmStmt *S) {
285  VisitStmt(S);
286  S->NumOutputs = Record.readInt();
287  S->NumInputs = Record.readInt();
288  S->NumClobbers = Record.readInt();
289  S->setAsmLoc(ReadSourceLocation());
290  S->setVolatile(Record.readInt());
291  S->setSimple(Record.readInt());
292 }
293 
294 void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) {
295  VisitAsmStmt(S);
296  S->setRParenLoc(ReadSourceLocation());
297  S->setAsmString(cast_or_null<StringLiteral>(Record.readSubStmt()));
298 
299  unsigned NumOutputs = S->getNumOutputs();
300  unsigned NumInputs = S->getNumInputs();
301  unsigned NumClobbers = S->getNumClobbers();
302 
303  // Outputs and inputs
307  for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) {
308  Names.push_back(Record.getIdentifierInfo());
309  Constraints.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
310  Exprs.push_back(Record.readSubStmt());
311  }
312 
313  // Constraints
315  for (unsigned I = 0; I != NumClobbers; ++I)
316  Clobbers.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
317 
318  S->setOutputsAndInputsAndClobbers(Record.getContext(),
319  Names.data(), Constraints.data(),
320  Exprs.data(), NumOutputs, NumInputs,
321  Clobbers.data(), NumClobbers);
322 }
323 
324 void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) {
325  VisitAsmStmt(S);
326  S->LBraceLoc = ReadSourceLocation();
327  S->EndLoc = ReadSourceLocation();
328  S->NumAsmToks = Record.readInt();
329  std::string AsmStr = ReadString();
330 
331  // Read the tokens.
332  SmallVector<Token, 16> AsmToks;
333  AsmToks.reserve(S->NumAsmToks);
334  for (unsigned i = 0, e = S->NumAsmToks; i != e; ++i) {
335  AsmToks.push_back(Record.readToken());
336  }
337 
338  // The calls to reserve() for the FooData vectors are mandatory to
339  // prevent dead StringRefs in the Foo vectors.
340 
341  // Read the clobbers.
342  SmallVector<std::string, 16> ClobbersData;
344  ClobbersData.reserve(S->NumClobbers);
345  Clobbers.reserve(S->NumClobbers);
346  for (unsigned i = 0, e = S->NumClobbers; i != e; ++i) {
347  ClobbersData.push_back(ReadString());
348  Clobbers.push_back(ClobbersData.back());
349  }
350 
351  // Read the operands.
352  unsigned NumOperands = S->NumOutputs + S->NumInputs;
354  SmallVector<std::string, 16> ConstraintsData;
355  SmallVector<StringRef, 16> Constraints;
356  Exprs.reserve(NumOperands);
357  ConstraintsData.reserve(NumOperands);
358  Constraints.reserve(NumOperands);
359  for (unsigned i = 0; i != NumOperands; ++i) {
360  Exprs.push_back(cast<Expr>(Record.readSubStmt()));
361  ConstraintsData.push_back(ReadString());
362  Constraints.push_back(ConstraintsData.back());
363  }
364 
365  S->initialize(Record.getContext(), AsmStr, AsmToks,
366  Constraints, Exprs, Clobbers);
367 }
368 
369 void ASTStmtReader::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) {
370  VisitStmt(S);
371  assert(Record.peekInt() == S->NumParams);
372  Record.skipInts(1);
373  auto *StoredStmts = S->getStoredStmts();
374  for (unsigned i = 0;
375  i < CoroutineBodyStmt::SubStmt::FirstParamMove + S->NumParams; ++i)
376  StoredStmts[i] = Record.readSubStmt();
377 }
378 
379 void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt *S) {
380  VisitStmt(S);
381  S->CoreturnLoc = Record.readSourceLocation();
382  for (auto &SubStmt: S->SubStmts)
383  SubStmt = Record.readSubStmt();
384  S->IsImplicit = Record.readInt() != 0;
385 }
386 
387 void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *E) {
388  VisitExpr(E);
389  E->KeywordLoc = ReadSourceLocation();
390  for (auto &SubExpr: E->SubExprs)
391  SubExpr = Record.readSubStmt();
392  E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
393  E->setIsImplicit(Record.readInt() != 0);
394 }
395 
396 void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *E) {
397  VisitExpr(E);
398  E->KeywordLoc = ReadSourceLocation();
399  for (auto &SubExpr: E->SubExprs)
400  SubExpr = Record.readSubStmt();
401  E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
402 }
403 
404 void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
405  VisitExpr(E);
406  E->KeywordLoc = ReadSourceLocation();
407  for (auto &SubExpr: E->SubExprs)
408  SubExpr = Record.readSubStmt();
409 }
410 
411 void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) {
412  VisitStmt(S);
413  Record.skipInts(1);
414  S->setCapturedDecl(ReadDeclAs<CapturedDecl>());
415  S->setCapturedRegionKind(static_cast<CapturedRegionKind>(Record.readInt()));
416  S->setCapturedRecordDecl(ReadDeclAs<RecordDecl>());
417 
418  // Capture inits
420  E = S->capture_init_end();
421  I != E; ++I)
422  *I = Record.readSubExpr();
423 
424  // Body
425  S->setCapturedStmt(Record.readSubStmt());
427 
428  // Captures
429  for (auto &I : S->captures()) {
430  I.VarAndKind.setPointer(ReadDeclAs<VarDecl>());
431  I.VarAndKind.setInt(
432  static_cast<CapturedStmt::VariableCaptureKind>(Record.readInt()));
433  I.Loc = ReadSourceLocation();
434  }
435 }
436 
437 void ASTStmtReader::VisitExpr(Expr *E) {
438  VisitStmt(E);
439  E->setType(Record.readType());
440  E->setTypeDependent(Record.readInt());
441  E->setValueDependent(Record.readInt());
442  E->setInstantiationDependent(Record.readInt());
443  E->ExprBits.ContainsUnexpandedParameterPack = Record.readInt();
444  E->setValueKind(static_cast<ExprValueKind>(Record.readInt()));
445  E->setObjectKind(static_cast<ExprObjectKind>(Record.readInt()));
446  assert(Record.getIdx() == NumExprFields &&
447  "Incorrect expression field count");
448 }
449 
450 void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
451  VisitExpr(E);
452  E->setLocation(ReadSourceLocation());
453  E->Type = (PredefinedExpr::IdentType)Record.readInt();
454  E->FnName = cast_or_null<StringLiteral>(Record.readSubExpr());
455 }
456 
457 void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
458  VisitExpr(E);
459 
460  E->DeclRefExprBits.HasQualifier = Record.readInt();
461  E->DeclRefExprBits.HasFoundDecl = Record.readInt();
462  E->DeclRefExprBits.HasTemplateKWAndArgsInfo = Record.readInt();
463  E->DeclRefExprBits.HadMultipleCandidates = Record.readInt();
464  E->DeclRefExprBits.RefersToEnclosingVariableOrCapture = Record.readInt();
465  unsigned NumTemplateArgs = 0;
466  if (E->hasTemplateKWAndArgsInfo())
467  NumTemplateArgs = Record.readInt();
468 
469  if (E->hasQualifier())
470  new (E->getTrailingObjects<NestedNameSpecifierLoc>())
472 
473  if (E->hasFoundDecl())
474  *E->getTrailingObjects<NamedDecl *>() = ReadDeclAs<NamedDecl>();
475 
476  if (E->hasTemplateKWAndArgsInfo())
477  ReadTemplateKWAndArgsInfo(
478  *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
479  E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
480 
481  E->setDecl(ReadDeclAs<ValueDecl>());
482  E->setLocation(ReadSourceLocation());
483  ReadDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
484 }
485 
486 void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
487  VisitExpr(E);
488  E->setLocation(ReadSourceLocation());
489  E->setValue(Record.getContext(), Record.readAPInt());
490 }
491 
492 void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) {
493  VisitExpr(E);
494  E->setRawSemantics(static_cast<Stmt::APFloatSemantics>(Record.readInt()));
495  E->setExact(Record.readInt());
496  E->setValue(Record.getContext(), Record.readAPFloat(E->getSemantics()));
497  E->setLocation(ReadSourceLocation());
498 }
499 
500 void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) {
501  VisitExpr(E);
502  E->setSubExpr(Record.readSubExpr());
503 }
504 
505 void ASTStmtReader::VisitStringLiteral(StringLiteral *E) {
506  VisitExpr(E);
507  unsigned Len = Record.readInt();
508  assert(Record.peekInt() == E->getNumConcatenated() &&
509  "Wrong number of concatenated tokens!");
510  Record.skipInts(1);
512  static_cast<StringLiteral::StringKind>(Record.readInt());
513  bool isPascal = Record.readInt();
514 
515  // Read string data
516  auto B = &Record.peekInt();
517  SmallString<16> Str(B, B + Len);
518  E->setString(Record.getContext(), Str, kind, isPascal);
519  Record.skipInts(Len);
520 
521  // Read source locations
522  for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
523  E->setStrTokenLoc(I, ReadSourceLocation());
524 }
525 
526 void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {
527  VisitExpr(E);
528  E->setValue(Record.readInt());
529  E->setLocation(ReadSourceLocation());
530  E->setKind(static_cast<CharacterLiteral::CharacterKind>(Record.readInt()));
531 }
532 
533 void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
534  VisitExpr(E);
535  E->setLParen(ReadSourceLocation());
536  E->setRParen(ReadSourceLocation());
537  E->setSubExpr(Record.readSubExpr());
538 }
539 
540 void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
541  VisitExpr(E);
542  unsigned NumExprs = Record.readInt();
543  E->Exprs = new (Record.getContext()) Stmt*[NumExprs];
544  for (unsigned i = 0; i != NumExprs; ++i)
545  E->Exprs[i] = Record.readSubStmt();
546  E->NumExprs = NumExprs;
547  E->LParenLoc = ReadSourceLocation();
548  E->RParenLoc = ReadSourceLocation();
549 }
550 
551 void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
552  VisitExpr(E);
553  E->setSubExpr(Record.readSubExpr());
555  E->setOperatorLoc(ReadSourceLocation());
556 }
557 
558 void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
559  VisitExpr(E);
560  assert(E->getNumComponents() == Record.peekInt());
561  Record.skipInts(1);
562  assert(E->getNumExpressions() == Record.peekInt());
563  Record.skipInts(1);
564  E->setOperatorLoc(ReadSourceLocation());
565  E->setRParenLoc(ReadSourceLocation());
566  E->setTypeSourceInfo(GetTypeSourceInfo());
567  for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
568  OffsetOfNode::Kind Kind = static_cast<OffsetOfNode::Kind>(Record.readInt());
569  SourceLocation Start = ReadSourceLocation();
570  SourceLocation End = ReadSourceLocation();
571  switch (Kind) {
572  case OffsetOfNode::Array:
573  E->setComponent(I, OffsetOfNode(Start, Record.readInt(), End));
574  break;
575 
576  case OffsetOfNode::Field:
577  E->setComponent(
578  I, OffsetOfNode(Start, ReadDeclAs<FieldDecl>(), End));
579  break;
580 
582  E->setComponent(
583  I,
584  OffsetOfNode(Start, Record.getIdentifierInfo(), End));
585  break;
586 
587  case OffsetOfNode::Base: {
588  CXXBaseSpecifier *Base = new (Record.getContext()) CXXBaseSpecifier();
589  *Base = Record.readCXXBaseSpecifier();
590  E->setComponent(I, OffsetOfNode(Base));
591  break;
592  }
593  }
594  }
595 
596  for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
597  E->setIndexExpr(I, Record.readSubExpr());
598 }
599 
600 void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
601  VisitExpr(E);
602  E->setKind(static_cast<UnaryExprOrTypeTrait>(Record.readInt()));
603  if (Record.peekInt() == 0) {
604  E->setArgument(Record.readSubExpr());
605  Record.skipInts(1);
606  } else {
607  E->setArgument(GetTypeSourceInfo());
608  }
609  E->setOperatorLoc(ReadSourceLocation());
610  E->setRParenLoc(ReadSourceLocation());
611 }
612 
613 void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
614  VisitExpr(E);
615  E->setLHS(Record.readSubExpr());
616  E->setRHS(Record.readSubExpr());
617  E->setRBracketLoc(ReadSourceLocation());
618 }
619 
620 void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) {
621  VisitExpr(E);
622  E->setBase(Record.readSubExpr());
623  E->setLowerBound(Record.readSubExpr());
624  E->setLength(Record.readSubExpr());
625  E->setColonLoc(ReadSourceLocation());
626  E->setRBracketLoc(ReadSourceLocation());
627 }
628 
629 void ASTStmtReader::VisitCallExpr(CallExpr *E) {
630  VisitExpr(E);
631  E->setNumArgs(Record.getContext(), Record.readInt());
632  E->setRParenLoc(ReadSourceLocation());
633  E->setCallee(Record.readSubExpr());
634  for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
635  E->setArg(I, Record.readSubExpr());
636 }
637 
638 void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
639  VisitCallExpr(E);
640 }
641 
642 void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
643  // Don't call VisitExpr, this is fully initialized at creation.
644  assert(E->getStmtClass() == Stmt::MemberExprClass &&
645  "It's a subclass, we must advance Idx!");
646 }
647 
648 void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
649  VisitExpr(E);
650  E->setBase(Record.readSubExpr());
651  E->setIsaMemberLoc(ReadSourceLocation());
652  E->setOpLoc(ReadSourceLocation());
653  E->setArrow(Record.readInt());
654 }
655 
656 void ASTStmtReader::
657 VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
658  VisitExpr(E);
659  E->Operand = Record.readSubExpr();
660  E->setShouldCopy(Record.readInt());
661 }
662 
663 void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
664  VisitExplicitCastExpr(E);
665  E->LParenLoc = ReadSourceLocation();
666  E->BridgeKeywordLoc = ReadSourceLocation();
667  E->Kind = Record.readInt();
668 }
669 
670 void ASTStmtReader::VisitCastExpr(CastExpr *E) {
671  VisitExpr(E);
672  unsigned NumBaseSpecs = Record.readInt();
673  assert(NumBaseSpecs == E->path_size());
674  E->setSubExpr(Record.readSubExpr());
675  E->setCastKind((CastKind)Record.readInt());
676  CastExpr::path_iterator BaseI = E->path_begin();
677  while (NumBaseSpecs--) {
678  CXXBaseSpecifier *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
679  *BaseSpec = Record.readCXXBaseSpecifier();
680  *BaseI++ = BaseSpec;
681  }
682 }
683 
684 void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
685  VisitExpr(E);
686  E->setLHS(Record.readSubExpr());
687  E->setRHS(Record.readSubExpr());
689  E->setOperatorLoc(ReadSourceLocation());
690  E->setFPFeatures(FPOptions(Record.readInt()));
691 }
692 
693 void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
694  VisitBinaryOperator(E);
695  E->setComputationLHSType(Record.readType());
696  E->setComputationResultType(Record.readType());
697 }
698 
699 void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) {
700  VisitExpr(E);
701  E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr();
702  E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr();
703  E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr();
704  E->QuestionLoc = ReadSourceLocation();
705  E->ColonLoc = ReadSourceLocation();
706 }
707 
708 void
709 ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
710  VisitExpr(E);
711  E->OpaqueValue = cast<OpaqueValueExpr>(Record.readSubExpr());
712  E->SubExprs[BinaryConditionalOperator::COMMON] = Record.readSubExpr();
713  E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr();
714  E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr();
715  E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr();
716  E->QuestionLoc = ReadSourceLocation();
717  E->ColonLoc = ReadSourceLocation();
718 }
719 
720 void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
721  VisitCastExpr(E);
722 }
723 
724 void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
725  VisitCastExpr(E);
726  E->setTypeInfoAsWritten(GetTypeSourceInfo());
727 }
728 
729 void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
730  VisitExplicitCastExpr(E);
731  E->setLParenLoc(ReadSourceLocation());
732  E->setRParenLoc(ReadSourceLocation());
733 }
734 
735 void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
736  VisitExpr(E);
737  E->setLParenLoc(ReadSourceLocation());
738  E->setTypeSourceInfo(GetTypeSourceInfo());
739  E->setInitializer(Record.readSubExpr());
740  E->setFileScope(Record.readInt());
741 }
742 
743 void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
744  VisitExpr(E);
745  E->setBase(Record.readSubExpr());
746  E->setAccessor(Record.getIdentifierInfo());
747  E->setAccessorLoc(ReadSourceLocation());
748 }
749 
750 void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
751  VisitExpr(E);
752  if (InitListExpr *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
753  E->setSyntacticForm(SyntForm);
754  E->setLBraceLoc(ReadSourceLocation());
755  E->setRBraceLoc(ReadSourceLocation());
756  bool isArrayFiller = Record.readInt();
757  Expr *filler = nullptr;
758  if (isArrayFiller) {
759  filler = Record.readSubExpr();
760  E->ArrayFillerOrUnionFieldInit = filler;
761  } else
762  E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>();
763  E->sawArrayRangeDesignator(Record.readInt());
764  unsigned NumInits = Record.readInt();
765  E->reserveInits(Record.getContext(), NumInits);
766  if (isArrayFiller) {
767  for (unsigned I = 0; I != NumInits; ++I) {
768  Expr *init = Record.readSubExpr();
769  E->updateInit(Record.getContext(), I, init ? init : filler);
770  }
771  } else {
772  for (unsigned I = 0; I != NumInits; ++I)
773  E->updateInit(Record.getContext(), I, Record.readSubExpr());
774  }
775 }
776 
777 void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
779 
780  VisitExpr(E);
781  unsigned NumSubExprs = Record.readInt();
782  assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs");
783  for (unsigned I = 0; I != NumSubExprs; ++I)
784  E->setSubExpr(I, Record.readSubExpr());
785  E->setEqualOrColonLoc(ReadSourceLocation());
786  E->setGNUSyntax(Record.readInt());
787 
788  SmallVector<Designator, 4> Designators;
789  while (Record.getIdx() < Record.size()) {
790  switch ((DesignatorTypes)Record.readInt()) {
791  case DESIG_FIELD_DECL: {
792  FieldDecl *Field = ReadDeclAs<FieldDecl>();
793  SourceLocation DotLoc = ReadSourceLocation();
794  SourceLocation FieldLoc = ReadSourceLocation();
795  Designators.push_back(Designator(Field->getIdentifier(), DotLoc,
796  FieldLoc));
797  Designators.back().setField(Field);
798  break;
799  }
800 
801  case DESIG_FIELD_NAME: {
802  const IdentifierInfo *Name = Record.getIdentifierInfo();
803  SourceLocation DotLoc = ReadSourceLocation();
804  SourceLocation FieldLoc = ReadSourceLocation();
805  Designators.push_back(Designator(Name, DotLoc, FieldLoc));
806  break;
807  }
808 
809  case DESIG_ARRAY: {
810  unsigned Index = Record.readInt();
811  SourceLocation LBracketLoc = ReadSourceLocation();
812  SourceLocation RBracketLoc = ReadSourceLocation();
813  Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc));
814  break;
815  }
816 
817  case DESIG_ARRAY_RANGE: {
818  unsigned Index = Record.readInt();
819  SourceLocation LBracketLoc = ReadSourceLocation();
820  SourceLocation EllipsisLoc = ReadSourceLocation();
821  SourceLocation RBracketLoc = ReadSourceLocation();
822  Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc,
823  RBracketLoc));
824  break;
825  }
826  }
827  }
828  E->setDesignators(Record.getContext(),
829  Designators.data(), Designators.size());
830 }
831 
832 void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
833  VisitExpr(E);
834  E->setBase(Record.readSubExpr());
835  E->setUpdater(Record.readSubExpr());
836 }
837 
838 void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) {
839  VisitExpr(E);
840 }
841 
842 void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
843  VisitExpr(E);
844  E->SubExprs[0] = Record.readSubExpr();
845  E->SubExprs[1] = Record.readSubExpr();
846 }
847 
848 void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
849  VisitExpr(E);
850 }
851 
852 void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
853  VisitExpr(E);
854 }
855 
856 void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
857  VisitExpr(E);
858  E->setSubExpr(Record.readSubExpr());
859  E->setWrittenTypeInfo(GetTypeSourceInfo());
860  E->setBuiltinLoc(ReadSourceLocation());
861  E->setRParenLoc(ReadSourceLocation());
862  E->setIsMicrosoftABI(Record.readInt());
863 }
864 
865 void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
866  VisitExpr(E);
867  E->setAmpAmpLoc(ReadSourceLocation());
868  E->setLabelLoc(ReadSourceLocation());
869  E->setLabel(ReadDeclAs<LabelDecl>());
870 }
871 
872 void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
873  VisitExpr(E);
874  E->setLParenLoc(ReadSourceLocation());
875  E->setRParenLoc(ReadSourceLocation());
876  E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt()));
877 }
878 
879 void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
880  VisitExpr(E);
881  E->setCond(Record.readSubExpr());
882  E->setLHS(Record.readSubExpr());
883  E->setRHS(Record.readSubExpr());
884  E->setBuiltinLoc(ReadSourceLocation());
885  E->setRParenLoc(ReadSourceLocation());
886  E->setIsConditionTrue(Record.readInt());
887 }
888 
889 void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
890  VisitExpr(E);
891  E->setTokenLocation(ReadSourceLocation());
892 }
893 
894 void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
895  VisitExpr(E);
897  unsigned NumExprs = Record.readInt();
898  while (NumExprs--)
899  Exprs.push_back(Record.readSubExpr());
900  E->setExprs(Record.getContext(), Exprs);
901  E->setBuiltinLoc(ReadSourceLocation());
902  E->setRParenLoc(ReadSourceLocation());
903 }
904 
905 void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
906  VisitExpr(E);
907  E->BuiltinLoc = ReadSourceLocation();
908  E->RParenLoc = ReadSourceLocation();
909  E->TInfo = GetTypeSourceInfo();
910  E->SrcExpr = Record.readSubExpr();
911 }
912 
913 void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
914  VisitExpr(E);
915  E->setBlockDecl(ReadDeclAs<BlockDecl>());
916 }
917 
918 void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
919  VisitExpr(E);
920  E->NumAssocs = Record.readInt();
921  E->AssocTypes = new (Record.getContext()) TypeSourceInfo*[E->NumAssocs];
922  E->SubExprs =
923  new(Record.getContext()) Stmt*[GenericSelectionExpr::END_EXPR+E->NumAssocs];
924 
925  E->SubExprs[GenericSelectionExpr::CONTROLLING] = Record.readSubExpr();
926  for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
927  E->AssocTypes[I] = GetTypeSourceInfo();
928  E->SubExprs[GenericSelectionExpr::END_EXPR+I] = Record.readSubExpr();
929  }
930  E->ResultIndex = Record.readInt();
931 
932  E->GenericLoc = ReadSourceLocation();
933  E->DefaultLoc = ReadSourceLocation();
934  E->RParenLoc = ReadSourceLocation();
935 }
936 
937 void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
938  VisitExpr(E);
939  unsigned numSemanticExprs = Record.readInt();
940  assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs);
941  E->PseudoObjectExprBits.ResultIndex = Record.readInt();
942 
943  // Read the syntactic expression.
944  E->getSubExprsBuffer()[0] = Record.readSubExpr();
945 
946  // Read all the semantic expressions.
947  for (unsigned i = 0; i != numSemanticExprs; ++i) {
948  Expr *subExpr = Record.readSubExpr();
949  E->getSubExprsBuffer()[i+1] = subExpr;
950  }
951 }
952 
953 void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) {
954  VisitExpr(E);
955  E->Op = AtomicExpr::AtomicOp(Record.readInt());
956  E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
957  for (unsigned I = 0; I != E->NumSubExprs; ++I)
958  E->SubExprs[I] = Record.readSubExpr();
959  E->BuiltinLoc = ReadSourceLocation();
960  E->RParenLoc = ReadSourceLocation();
961 }
962 
963 //===----------------------------------------------------------------------===//
964 // Objective-C Expressions and Statements
965 
966 void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
967  VisitExpr(E);
968  E->setString(cast<StringLiteral>(Record.readSubStmt()));
969  E->setAtLoc(ReadSourceLocation());
970 }
971 
972 void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
973  VisitExpr(E);
974  // could be one of several IntegerLiteral, FloatLiteral, etc.
975  E->SubExpr = Record.readSubStmt();
976  E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>();
977  E->Range = ReadSourceRange();
978 }
979 
980 void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
981  VisitExpr(E);
982  unsigned NumElements = Record.readInt();
983  assert(NumElements == E->getNumElements() && "Wrong number of elements");
984  Expr **Elements = E->getElements();
985  for (unsigned I = 0, N = NumElements; I != N; ++I)
986  Elements[I] = Record.readSubExpr();
987  E->ArrayWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>();
988  E->Range = ReadSourceRange();
989 }
990 
991 void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
992  VisitExpr(E);
993  unsigned NumElements = Record.readInt();
994  assert(NumElements == E->getNumElements() && "Wrong number of elements");
995  bool HasPackExpansions = Record.readInt();
996  assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch");
998  E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>();
1000  E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>();
1001  for (unsigned I = 0; I != NumElements; ++I) {
1002  KeyValues[I].Key = Record.readSubExpr();
1003  KeyValues[I].Value = Record.readSubExpr();
1004  if (HasPackExpansions) {
1005  Expansions[I].EllipsisLoc = ReadSourceLocation();
1006  Expansions[I].NumExpansionsPlusOne = Record.readInt();
1007  }
1008  }
1009  E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>();
1010  E->Range = ReadSourceRange();
1011 }
1012 
1013 void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
1014  VisitExpr(E);
1015  E->setEncodedTypeSourceInfo(GetTypeSourceInfo());
1016  E->setAtLoc(ReadSourceLocation());
1017  E->setRParenLoc(ReadSourceLocation());
1018 }
1019 
1020 void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
1021  VisitExpr(E);
1022  E->setSelector(Record.readSelector());
1023  E->setAtLoc(ReadSourceLocation());
1024  E->setRParenLoc(ReadSourceLocation());
1025 }
1026 
1027 void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
1028  VisitExpr(E);
1029  E->setProtocol(ReadDeclAs<ObjCProtocolDecl>());
1030  E->setAtLoc(ReadSourceLocation());
1031  E->ProtoLoc = ReadSourceLocation();
1032  E->setRParenLoc(ReadSourceLocation());
1033 }
1034 
1035 void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
1036  VisitExpr(E);
1037  E->setDecl(ReadDeclAs<ObjCIvarDecl>());
1038  E->setLocation(ReadSourceLocation());
1039  E->setOpLoc(ReadSourceLocation());
1040  E->setBase(Record.readSubExpr());
1041  E->setIsArrow(Record.readInt());
1042  E->setIsFreeIvar(Record.readInt());
1043 }
1044 
1045 void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1046  VisitExpr(E);
1047  unsigned MethodRefFlags = Record.readInt();
1048  bool Implicit = Record.readInt() != 0;
1049  if (Implicit) {
1050  ObjCMethodDecl *Getter = ReadDeclAs<ObjCMethodDecl>();
1051  ObjCMethodDecl *Setter = ReadDeclAs<ObjCMethodDecl>();
1052  E->setImplicitProperty(Getter, Setter, MethodRefFlags);
1053  } else {
1054  E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
1055  }
1056  E->setLocation(ReadSourceLocation());
1057  E->setReceiverLocation(ReadSourceLocation());
1058  switch (Record.readInt()) {
1059  case 0:
1060  E->setBase(Record.readSubExpr());
1061  break;
1062  case 1:
1063  E->setSuperReceiver(Record.readType());
1064  break;
1065  case 2:
1066  E->setClassReceiver(ReadDeclAs<ObjCInterfaceDecl>());
1067  break;
1068  }
1069 }
1070 
1071 void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1072  VisitExpr(E);
1073  E->setRBracket(ReadSourceLocation());
1074  E->setBaseExpr(Record.readSubExpr());
1075  E->setKeyExpr(Record.readSubExpr());
1076  E->GetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>();
1077  E->SetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>();
1078 }
1079 
1080 void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1081  VisitExpr(E);
1082  assert(Record.peekInt() == E->getNumArgs());
1083  Record.skipInts(1);
1084  unsigned NumStoredSelLocs = Record.readInt();
1085  E->SelLocsKind = Record.readInt();
1086  E->setDelegateInitCall(Record.readInt());
1087  E->IsImplicit = Record.readInt();
1089  = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt());
1090  switch (Kind) {
1092  E->setInstanceReceiver(Record.readSubExpr());
1093  break;
1094 
1096  E->setClassReceiver(GetTypeSourceInfo());
1097  break;
1098 
1101  QualType T = Record.readType();
1102  SourceLocation SuperLoc = ReadSourceLocation();
1103  E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
1104  break;
1105  }
1106  }
1107 
1108  assert(Kind == E->getReceiverKind());
1109 
1110  if (Record.readInt())
1111  E->setMethodDecl(ReadDeclAs<ObjCMethodDecl>());
1112  else
1113  E->setSelector(Record.readSelector());
1114 
1115  E->LBracLoc = ReadSourceLocation();
1116  E->RBracLoc = ReadSourceLocation();
1117 
1118  for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1119  E->setArg(I, Record.readSubExpr());
1120 
1121  SourceLocation *Locs = E->getStoredSelLocs();
1122  for (unsigned I = 0; I != NumStoredSelLocs; ++I)
1123  Locs[I] = ReadSourceLocation();
1124 }
1125 
1126 void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1127  VisitStmt(S);
1128  S->setElement(Record.readSubStmt());
1129  S->setCollection(Record.readSubExpr());
1130  S->setBody(Record.readSubStmt());
1131  S->setForLoc(ReadSourceLocation());
1132  S->setRParenLoc(ReadSourceLocation());
1133 }
1134 
1135 void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1136  VisitStmt(S);
1137  S->setCatchBody(Record.readSubStmt());
1138  S->setCatchParamDecl(ReadDeclAs<VarDecl>());
1139  S->setAtCatchLoc(ReadSourceLocation());
1140  S->setRParenLoc(ReadSourceLocation());
1141 }
1142 
1143 void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1144  VisitStmt(S);
1145  S->setFinallyBody(Record.readSubStmt());
1146  S->setAtFinallyLoc(ReadSourceLocation());
1147 }
1148 
1149 void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1150  VisitStmt(S);
1151  S->setSubStmt(Record.readSubStmt());
1152  S->setAtLoc(ReadSourceLocation());
1153 }
1154 
1155 void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1156  VisitStmt(S);
1157  assert(Record.peekInt() == S->getNumCatchStmts());
1158  Record.skipInts(1);
1159  bool HasFinally = Record.readInt();
1160  S->setTryBody(Record.readSubStmt());
1161  for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
1162  S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.readSubStmt()));
1163 
1164  if (HasFinally)
1165  S->setFinallyStmt(Record.readSubStmt());
1166  S->setAtTryLoc(ReadSourceLocation());
1167 }
1168 
1169 void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1170  VisitStmt(S);
1171  S->setSynchExpr(Record.readSubStmt());
1172  S->setSynchBody(Record.readSubStmt());
1173  S->setAtSynchronizedLoc(ReadSourceLocation());
1174 }
1175 
1176 void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1177  VisitStmt(S);
1178  S->setThrowExpr(Record.readSubStmt());
1179  S->setThrowLoc(ReadSourceLocation());
1180 }
1181 
1182 void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1183  VisitExpr(E);
1184  E->setValue(Record.readInt());
1185  E->setLocation(ReadSourceLocation());
1186 }
1187 
1188 void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
1189  VisitExpr(E);
1190  SourceRange R = Record.readSourceRange();
1191  E->AtLoc = R.getBegin();
1192  E->RParen = R.getEnd();
1193  E->VersionToCheck = Record.readVersionTuple();
1194 }
1195 
1196 //===----------------------------------------------------------------------===//
1197 // C++ Expressions and Statements
1198 //===----------------------------------------------------------------------===//
1199 
1200 void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
1201  VisitStmt(S);
1202  S->CatchLoc = ReadSourceLocation();
1203  S->ExceptionDecl = ReadDeclAs<VarDecl>();
1204  S->HandlerBlock = Record.readSubStmt();
1205 }
1206 
1207 void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
1208  VisitStmt(S);
1209  assert(Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?");
1210  Record.skipInts(1);
1211  S->TryLoc = ReadSourceLocation();
1212  S->getStmts()[0] = Record.readSubStmt();
1213  for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1214  S->getStmts()[i + 1] = Record.readSubStmt();
1215 }
1216 
1217 void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1218  VisitStmt(S);
1219  S->ForLoc = ReadSourceLocation();
1220  S->CoawaitLoc = ReadSourceLocation();
1221  S->ColonLoc = ReadSourceLocation();
1222  S->RParenLoc = ReadSourceLocation();
1223  S->setRangeStmt(Record.readSubStmt());
1224  S->setBeginStmt(Record.readSubStmt());
1225  S->setEndStmt(Record.readSubStmt());
1226  S->setCond(Record.readSubExpr());
1227  S->setInc(Record.readSubExpr());
1228  S->setLoopVarStmt(Record.readSubStmt());
1229  S->setBody(Record.readSubStmt());
1230 }
1231 
1232 void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1233  VisitStmt(S);
1234  S->KeywordLoc = ReadSourceLocation();
1235  S->IsIfExists = Record.readInt();
1236  S->QualifierLoc = Record.readNestedNameSpecifierLoc();
1237  ReadDeclarationNameInfo(S->NameInfo);
1238  S->SubStmt = Record.readSubStmt();
1239 }
1240 
1241 void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1242  VisitCallExpr(E);
1243  E->Operator = (OverloadedOperatorKind)Record.readInt();
1244  E->Range = Record.readSourceRange();
1245  E->setFPFeatures(FPOptions(Record.readInt()));
1246 }
1247 
1248 void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
1249  VisitExpr(E);
1250  E->NumArgs = Record.readInt();
1251  if (E->NumArgs)
1252  E->Args = new (Record.getContext()) Stmt*[E->NumArgs];
1253  for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1254  E->setArg(I, Record.readSubExpr());
1255  E->setConstructor(ReadDeclAs<CXXConstructorDecl>());
1256  E->setLocation(ReadSourceLocation());
1257  E->setElidable(Record.readInt());
1258  E->setHadMultipleCandidates(Record.readInt());
1259  E->setListInitialization(Record.readInt());
1263  E->ParenOrBraceRange = ReadSourceRange();
1264 }
1265 
1266 void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
1267  VisitExpr(E);
1268  E->Constructor = ReadDeclAs<CXXConstructorDecl>();
1269  E->Loc = ReadSourceLocation();
1270  E->ConstructsVirtualBase = Record.readInt();
1271  E->InheritedFromVirtualBase = Record.readInt();
1272 }
1273 
1274 void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1275  VisitCXXConstructExpr(E);
1276  E->Type = GetTypeSourceInfo();
1277 }
1278 
1279 void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
1280  VisitExpr(E);
1281  unsigned NumCaptures = Record.readInt();
1282  assert(NumCaptures == E->NumCaptures);(void)NumCaptures;
1283  E->IntroducerRange = ReadSourceRange();
1284  E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record.readInt());
1285  E->CaptureDefaultLoc = ReadSourceLocation();
1286  E->ExplicitParams = Record.readInt();
1287  E->ExplicitResultType = Record.readInt();
1288  E->ClosingBrace = ReadSourceLocation();
1289 
1290  // Read capture initializers.
1292  CEnd = E->capture_init_end();
1293  C != CEnd; ++C)
1294  *C = Record.readSubExpr();
1295 }
1296 
1297 void
1298 ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1299  VisitExpr(E);
1300  E->SubExpr = Record.readSubExpr();
1301 }
1302 
1303 void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1304  VisitExplicitCastExpr(E);
1305  SourceRange R = ReadSourceRange();
1306  E->Loc = R.getBegin();
1307  E->RParenLoc = R.getEnd();
1308  R = ReadSourceRange();
1309  E->AngleBrackets = R;
1310 }
1311 
1312 void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1313  return VisitCXXNamedCastExpr(E);
1314 }
1315 
1316 void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1317  return VisitCXXNamedCastExpr(E);
1318 }
1319 
1320 void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1321  return VisitCXXNamedCastExpr(E);
1322 }
1323 
1324 void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1325  return VisitCXXNamedCastExpr(E);
1326 }
1327 
1328 void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1329  VisitExplicitCastExpr(E);
1330  E->setLParenLoc(ReadSourceLocation());
1331  E->setRParenLoc(ReadSourceLocation());
1332 }
1333 
1334 void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1335  VisitCallExpr(E);
1336  E->UDSuffixLoc = ReadSourceLocation();
1337 }
1338 
1339 void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1340  VisitExpr(E);
1341  E->setValue(Record.readInt());
1342  E->setLocation(ReadSourceLocation());
1343 }
1344 
1345 void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1346  VisitExpr(E);
1347  E->setLocation(ReadSourceLocation());
1348 }
1349 
1350 void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1351  VisitExpr(E);
1352  E->setSourceRange(ReadSourceRange());
1353  if (E->isTypeOperand()) { // typeid(int)
1355  GetTypeSourceInfo());
1356  return;
1357  }
1358 
1359  // typeid(42+2)
1360  E->setExprOperand(Record.readSubExpr());
1361 }
1362 
1363 void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
1364  VisitExpr(E);
1365  E->setLocation(ReadSourceLocation());
1366  E->setImplicit(Record.readInt());
1367 }
1368 
1369 void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
1370  VisitExpr(E);
1371  E->ThrowLoc = ReadSourceLocation();
1372  E->Op = Record.readSubExpr();
1373  E->IsThrownVariableInScope = Record.readInt();
1374 }
1375 
1376 void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1377  VisitExpr(E);
1378  E->Param = ReadDeclAs<ParmVarDecl>();
1379  E->Loc = ReadSourceLocation();
1380 }
1381 
1382 void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1383  VisitExpr(E);
1384  E->Field = ReadDeclAs<FieldDecl>();
1385  E->Loc = ReadSourceLocation();
1386 }
1387 
1388 void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1389  VisitExpr(E);
1390  E->setTemporary(Record.readCXXTemporary());
1391  E->setSubExpr(Record.readSubExpr());
1392 }
1393 
1394 void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1395  VisitExpr(E);
1396  E->TypeInfo = GetTypeSourceInfo();
1397  E->RParenLoc = ReadSourceLocation();
1398 }
1399 
1400 void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
1401  VisitExpr(E);
1402  E->GlobalNew = Record.readInt();
1403  bool isArray = Record.readInt();
1404  E->PassAlignment = Record.readInt();
1405  E->UsualArrayDeleteWantsSize = Record.readInt();
1406  unsigned NumPlacementArgs = Record.readInt();
1407  E->StoredInitializationStyle = Record.readInt();
1408  E->setOperatorNew(ReadDeclAs<FunctionDecl>());
1409  E->setOperatorDelete(ReadDeclAs<FunctionDecl>());
1410  E->AllocatedTypeInfo = GetTypeSourceInfo();
1411  E->TypeIdParens = ReadSourceRange();
1412  E->Range = ReadSourceRange();
1413  E->DirectInitRange = ReadSourceRange();
1414 
1415  E->AllocateArgsArray(Record.getContext(), isArray, NumPlacementArgs,
1416  E->StoredInitializationStyle != 0);
1417 
1418  // Install all the subexpressions.
1420  I != e; ++I)
1421  *I = Record.readSubStmt();
1422 }
1423 
1424 void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1425  VisitExpr(E);
1426  E->GlobalDelete = Record.readInt();
1427  E->ArrayForm = Record.readInt();
1428  E->ArrayFormAsWritten = Record.readInt();
1429  E->UsualArrayDeleteWantsSize = Record.readInt();
1430  E->OperatorDelete = ReadDeclAs<FunctionDecl>();
1431  E->Argument = Record.readSubExpr();
1432  E->Loc = ReadSourceLocation();
1433 }
1434 
1435 void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1436  VisitExpr(E);
1437 
1438  E->Base = Record.readSubExpr();
1439  E->IsArrow = Record.readInt();
1440  E->OperatorLoc = ReadSourceLocation();
1441  E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1442  E->ScopeType = GetTypeSourceInfo();
1443  E->ColonColonLoc = ReadSourceLocation();
1444  E->TildeLoc = ReadSourceLocation();
1445 
1446  IdentifierInfo *II = Record.getIdentifierInfo();
1447  if (II)
1448  E->setDestroyedType(II, ReadSourceLocation());
1449  else
1450  E->setDestroyedType(GetTypeSourceInfo());
1451 }
1452 
1453 void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
1454  VisitExpr(E);
1455 
1456  unsigned NumObjects = Record.readInt();
1457  assert(NumObjects == E->getNumObjects());
1458  for (unsigned i = 0; i != NumObjects; ++i)
1459  E->getTrailingObjects<BlockDecl *>()[i] =
1460  ReadDeclAs<BlockDecl>();
1461 
1462  E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt();
1463  E->SubExpr = Record.readSubExpr();
1464 }
1465 
1466 void
1467 ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
1468  VisitExpr(E);
1469 
1470  if (Record.readInt()) // HasTemplateKWAndArgsInfo
1471  ReadTemplateKWAndArgsInfo(
1472  *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1473  E->getTrailingObjects<TemplateArgumentLoc>(),
1474  /*NumTemplateArgs=*/Record.readInt());
1475 
1476  E->Base = Record.readSubExpr();
1477  E->BaseType = Record.readType();
1478  E->IsArrow = Record.readInt();
1479  E->OperatorLoc = ReadSourceLocation();
1480  E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1481  E->FirstQualifierFoundInScope = ReadDeclAs<NamedDecl>();
1482  ReadDeclarationNameInfo(E->MemberNameInfo);
1483 }
1484 
1485 void
1486 ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
1487  VisitExpr(E);
1488 
1489  if (Record.readInt()) // HasTemplateKWAndArgsInfo
1490  ReadTemplateKWAndArgsInfo(
1491  *E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
1492  E->getTrailingObjects<TemplateArgumentLoc>(),
1493  /*NumTemplateArgs=*/Record.readInt());
1494 
1495  E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1496  ReadDeclarationNameInfo(E->NameInfo);
1497 }
1498 
1499 void
1500 ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
1501  VisitExpr(E);
1502  assert(Record.peekInt() == E->arg_size() &&
1503  "Read wrong record during creation ?");
1504  Record.skipInts(1);
1505  for (unsigned I = 0, N = E->arg_size(); I != N; ++I)
1506  E->setArg(I, Record.readSubExpr());
1507  E->Type = GetTypeSourceInfo();
1508  E->setLParenLoc(ReadSourceLocation());
1509  E->setRParenLoc(ReadSourceLocation());
1510 }
1511 
1512 void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
1513  VisitExpr(E);
1514 
1515  if (Record.readInt()) // HasTemplateKWAndArgsInfo
1516  ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(),
1518  /*NumTemplateArgs=*/Record.readInt());
1519 
1520  unsigned NumDecls = Record.readInt();
1521  UnresolvedSet<8> Decls;
1522  for (unsigned i = 0; i != NumDecls; ++i) {
1523  NamedDecl *D = ReadDeclAs<NamedDecl>();
1524  AccessSpecifier AS = (AccessSpecifier)Record.readInt();
1525  Decls.addDecl(D, AS);
1526  }
1527  E->initializeResults(Record.getContext(), Decls.begin(), Decls.end());
1528 
1529  ReadDeclarationNameInfo(E->NameInfo);
1530  E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1531 }
1532 
1533 void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
1534  VisitOverloadExpr(E);
1535  E->IsArrow = Record.readInt();
1536  E->HasUnresolvedUsing = Record.readInt();
1537  E->Base = Record.readSubExpr();
1538  E->BaseType = Record.readType();
1539  E->OperatorLoc = ReadSourceLocation();
1540 }
1541 
1542 void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
1543  VisitOverloadExpr(E);
1544  E->RequiresADL = Record.readInt();
1545  E->Overloaded = Record.readInt();
1546  E->NamingClass = ReadDeclAs<CXXRecordDecl>();
1547 }
1548 
1549 void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
1550  VisitExpr(E);
1551  E->TypeTraitExprBits.NumArgs = Record.readInt();
1552  E->TypeTraitExprBits.Kind = Record.readInt();
1553  E->TypeTraitExprBits.Value = Record.readInt();
1554  SourceRange Range = ReadSourceRange();
1555  E->Loc = Range.getBegin();
1556  E->RParenLoc = Range.getEnd();
1557 
1558  TypeSourceInfo **Args = E->getTrailingObjects<TypeSourceInfo *>();
1559  for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1560  Args[I] = GetTypeSourceInfo();
1561 }
1562 
1563 void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
1564  VisitExpr(E);
1565  E->ATT = (ArrayTypeTrait)Record.readInt();
1566  E->Value = (unsigned int)Record.readInt();
1567  SourceRange Range = ReadSourceRange();
1568  E->Loc = Range.getBegin();
1569  E->RParen = Range.getEnd();
1570  E->QueriedType = GetTypeSourceInfo();
1571  E->Dimension = Record.readSubExpr();
1572 }
1573 
1574 void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
1575  VisitExpr(E);
1576  E->ET = (ExpressionTrait)Record.readInt();
1577  E->Value = (bool)Record.readInt();
1578  SourceRange Range = ReadSourceRange();
1579  E->QueriedExpression = Record.readSubExpr();
1580  E->Loc = Range.getBegin();
1581  E->RParen = Range.getEnd();
1582 }
1583 
1584 void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
1585  VisitExpr(E);
1586  E->Value = (bool)Record.readInt();
1587  E->Range = ReadSourceRange();
1588  E->Operand = Record.readSubExpr();
1589 }
1590 
1591 void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
1592  VisitExpr(E);
1593  E->EllipsisLoc = ReadSourceLocation();
1594  E->NumExpansions = Record.readInt();
1595  E->Pattern = Record.readSubExpr();
1596 }
1597 
1598 void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
1599  VisitExpr(E);
1600  unsigned NumPartialArgs = Record.readInt();
1601  E->OperatorLoc = ReadSourceLocation();
1602  E->PackLoc = ReadSourceLocation();
1603  E->RParenLoc = ReadSourceLocation();
1604  E->Pack = Record.readDeclAs<NamedDecl>();
1605  if (E->isPartiallySubstituted()) {
1606  assert(E->Length == NumPartialArgs);
1607  for (auto *I = E->getTrailingObjects<TemplateArgument>(),
1608  *E = I + NumPartialArgs;
1609  I != E; ++I)
1610  new (I) TemplateArgument(Record.readTemplateArgument());
1611  } else if (!E->isValueDependent()) {
1612  E->Length = Record.readInt();
1613  }
1614 }
1615 
1616 void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
1618  VisitExpr(E);
1619  E->Param = ReadDeclAs<NonTypeTemplateParmDecl>();
1620  E->NameLoc = ReadSourceLocation();
1621  E->Replacement = Record.readSubExpr();
1622 }
1623 
1624 void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
1626  VisitExpr(E);
1627  E->Param = ReadDeclAs<NonTypeTemplateParmDecl>();
1628  TemplateArgument ArgPack = Record.readTemplateArgument();
1629  if (ArgPack.getKind() != TemplateArgument::Pack)
1630  return;
1631 
1632  E->Arguments = ArgPack.pack_begin();
1633  E->NumArguments = ArgPack.pack_size();
1634  E->NameLoc = ReadSourceLocation();
1635 }
1636 
1637 void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
1638  VisitExpr(E);
1639  E->NumParameters = Record.readInt();
1640  E->ParamPack = ReadDeclAs<ParmVarDecl>();
1641  E->NameLoc = ReadSourceLocation();
1642  ParmVarDecl **Parms = E->getTrailingObjects<ParmVarDecl *>();
1643  for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
1644  Parms[i] = ReadDeclAs<ParmVarDecl>();
1645 }
1646 
1647 void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
1648  VisitExpr(E);
1649  E->State = Record.readSubExpr();
1650  auto VD = ReadDeclAs<ValueDecl>();
1651  unsigned ManglingNumber = Record.readInt();
1652  E->setExtendingDecl(VD, ManglingNumber);
1653 }
1654 
1655 void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
1656  VisitExpr(E);
1657  E->LParenLoc = ReadSourceLocation();
1658  E->EllipsisLoc = ReadSourceLocation();
1659  E->RParenLoc = ReadSourceLocation();
1660  E->SubExprs[0] = Record.readSubExpr();
1661  E->SubExprs[1] = Record.readSubExpr();
1662  E->Opcode = (BinaryOperatorKind)Record.readInt();
1663 }
1664 
1665 void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
1666  VisitExpr(E);
1667  E->SourceExpr = Record.readSubExpr();
1668  E->Loc = ReadSourceLocation();
1669 }
1670 
1671 void ASTStmtReader::VisitTypoExpr(TypoExpr *E) {
1672  llvm_unreachable("Cannot read TypoExpr nodes");
1673 }
1674 
1675 //===----------------------------------------------------------------------===//
1676 // Microsoft Expressions and Statements
1677 //===----------------------------------------------------------------------===//
1678 void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
1679  VisitExpr(E);
1680  E->IsArrow = (Record.readInt() != 0);
1681  E->BaseExpr = Record.readSubExpr();
1682  E->QualifierLoc = Record.readNestedNameSpecifierLoc();
1683  E->MemberLoc = ReadSourceLocation();
1684  E->TheDecl = ReadDeclAs<MSPropertyDecl>();
1685 }
1686 
1687 void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
1688  VisitExpr(E);
1689  E->setBase(Record.readSubExpr());
1690  E->setIdx(Record.readSubExpr());
1691  E->setRBracketLoc(ReadSourceLocation());
1692 }
1693 
1694 void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
1695  VisitExpr(E);
1696  E->setSourceRange(ReadSourceRange());
1697  std::string UuidStr = ReadString();
1698  E->setUuidStr(StringRef(UuidStr).copy(Record.getContext()));
1699  if (E->isTypeOperand()) { // __uuidof(ComType)
1701  GetTypeSourceInfo());
1702  return;
1703  }
1704 
1705  // __uuidof(expr)
1706  E->setExprOperand(Record.readSubExpr());
1707 }
1708 
1709 void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
1710  VisitStmt(S);
1711  S->setLeaveLoc(ReadSourceLocation());
1712 }
1713 
1714 void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
1715  VisitStmt(S);
1716  S->Loc = ReadSourceLocation();
1717  S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
1718  S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
1719 }
1720 
1721 void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
1722  VisitStmt(S);
1723  S->Loc = ReadSourceLocation();
1724  S->Block = Record.readSubStmt();
1725 }
1726 
1727 void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
1728  VisitStmt(S);
1729  S->IsCXXTry = Record.readInt();
1730  S->TryLoc = ReadSourceLocation();
1731  S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
1732  S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
1733 }
1734 
1735 //===----------------------------------------------------------------------===//
1736 // CUDA Expressions and Statements
1737 //===----------------------------------------------------------------------===//
1738 
1739 void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
1740  VisitCallExpr(E);
1741  E->setConfig(cast<CallExpr>(Record.readSubExpr()));
1742 }
1743 
1744 //===----------------------------------------------------------------------===//
1745 // OpenCL Expressions and Statements.
1746 //===----------------------------------------------------------------------===//
1747 void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
1748  VisitExpr(E);
1749  E->BuiltinLoc = ReadSourceLocation();
1750  E->RParenLoc = ReadSourceLocation();
1751  E->SrcExpr = Record.readSubExpr();
1752 }
1753 
1754 //===----------------------------------------------------------------------===//
1755 // OpenMP Clauses.
1756 //===----------------------------------------------------------------------===//
1757 
1758 namespace clang {
1759 class OMPClauseReader : public OMPClauseVisitor<OMPClauseReader> {
1760  ASTStmtReader *Reader;
1761  ASTContext &Context;
1762 public:
1764  : Reader(R), Context(Record.getContext()) {}
1765 #define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *C);
1766 #include "clang/Basic/OpenMPKinds.def"
1767  OMPClause *readClause();
1768  void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C);
1769  void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C);
1770 };
1771 }
1772 
1774  OMPClause *C;
1775  switch (Reader->Record.readInt()) {
1776  case OMPC_if:
1777  C = new (Context) OMPIfClause();
1778  break;
1779  case OMPC_final:
1780  C = new (Context) OMPFinalClause();
1781  break;
1782  case OMPC_num_threads:
1783  C = new (Context) OMPNumThreadsClause();
1784  break;
1785  case OMPC_safelen:
1786  C = new (Context) OMPSafelenClause();
1787  break;
1788  case OMPC_simdlen:
1789  C = new (Context) OMPSimdlenClause();
1790  break;
1791  case OMPC_collapse:
1792  C = new (Context) OMPCollapseClause();
1793  break;
1794  case OMPC_default:
1795  C = new (Context) OMPDefaultClause();
1796  break;
1797  case OMPC_proc_bind:
1798  C = new (Context) OMPProcBindClause();
1799  break;
1800  case OMPC_schedule:
1801  C = new (Context) OMPScheduleClause();
1802  break;
1803  case OMPC_ordered:
1804  C = new (Context) OMPOrderedClause();
1805  break;
1806  case OMPC_nowait:
1807  C = new (Context) OMPNowaitClause();
1808  break;
1809  case OMPC_untied:
1810  C = new (Context) OMPUntiedClause();
1811  break;
1812  case OMPC_mergeable:
1813  C = new (Context) OMPMergeableClause();
1814  break;
1815  case OMPC_read:
1816  C = new (Context) OMPReadClause();
1817  break;
1818  case OMPC_write:
1819  C = new (Context) OMPWriteClause();
1820  break;
1821  case OMPC_update:
1822  C = new (Context) OMPUpdateClause();
1823  break;
1824  case OMPC_capture:
1825  C = new (Context) OMPCaptureClause();
1826  break;
1827  case OMPC_seq_cst:
1828  C = new (Context) OMPSeqCstClause();
1829  break;
1830  case OMPC_threads:
1831  C = new (Context) OMPThreadsClause();
1832  break;
1833  case OMPC_simd:
1834  C = new (Context) OMPSIMDClause();
1835  break;
1836  case OMPC_nogroup:
1837  C = new (Context) OMPNogroupClause();
1838  break;
1839  case OMPC_private:
1840  C = OMPPrivateClause::CreateEmpty(Context, Reader->Record.readInt());
1841  break;
1842  case OMPC_firstprivate:
1843  C = OMPFirstprivateClause::CreateEmpty(Context, Reader->Record.readInt());
1844  break;
1845  case OMPC_lastprivate:
1846  C = OMPLastprivateClause::CreateEmpty(Context, Reader->Record.readInt());
1847  break;
1848  case OMPC_shared:
1849  C = OMPSharedClause::CreateEmpty(Context, Reader->Record.readInt());
1850  break;
1851  case OMPC_reduction:
1852  C = OMPReductionClause::CreateEmpty(Context, Reader->Record.readInt());
1853  break;
1854  case OMPC_task_reduction:
1855  C = OMPTaskReductionClause::CreateEmpty(Context, Reader->Record.readInt());
1856  break;
1857  case OMPC_in_reduction:
1858  C = OMPInReductionClause::CreateEmpty(Context, Reader->Record.readInt());
1859  break;
1860  case OMPC_linear:
1861  C = OMPLinearClause::CreateEmpty(Context, Reader->Record.readInt());
1862  break;
1863  case OMPC_aligned:
1864  C = OMPAlignedClause::CreateEmpty(Context, Reader->Record.readInt());
1865  break;
1866  case OMPC_copyin:
1867  C = OMPCopyinClause::CreateEmpty(Context, Reader->Record.readInt());
1868  break;
1869  case OMPC_copyprivate:
1870  C = OMPCopyprivateClause::CreateEmpty(Context, Reader->Record.readInt());
1871  break;
1872  case OMPC_flush:
1873  C = OMPFlushClause::CreateEmpty(Context, Reader->Record.readInt());
1874  break;
1875  case OMPC_depend:
1876  C = OMPDependClause::CreateEmpty(Context, Reader->Record.readInt());
1877  break;
1878  case OMPC_device:
1879  C = new (Context) OMPDeviceClause();
1880  break;
1881  case OMPC_map: {
1882  unsigned NumVars = Reader->Record.readInt();
1883  unsigned NumDeclarations = Reader->Record.readInt();
1884  unsigned NumLists = Reader->Record.readInt();
1885  unsigned NumComponents = Reader->Record.readInt();
1886  C = OMPMapClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists,
1887  NumComponents);
1888  break;
1889  }
1890  case OMPC_num_teams:
1891  C = new (Context) OMPNumTeamsClause();
1892  break;
1893  case OMPC_thread_limit:
1894  C = new (Context) OMPThreadLimitClause();
1895  break;
1896  case OMPC_priority:
1897  C = new (Context) OMPPriorityClause();
1898  break;
1899  case OMPC_grainsize:
1900  C = new (Context) OMPGrainsizeClause();
1901  break;
1902  case OMPC_num_tasks:
1903  C = new (Context) OMPNumTasksClause();
1904  break;
1905  case OMPC_hint:
1906  C = new (Context) OMPHintClause();
1907  break;
1908  case OMPC_dist_schedule:
1909  C = new (Context) OMPDistScheduleClause();
1910  break;
1911  case OMPC_defaultmap:
1912  C = new (Context) OMPDefaultmapClause();
1913  break;
1914  case OMPC_to: {
1915  unsigned NumVars = Reader->Record.readInt();
1916  unsigned NumDeclarations = Reader->Record.readInt();
1917  unsigned NumLists = Reader->Record.readInt();
1918  unsigned NumComponents = Reader->Record.readInt();
1919  C = OMPToClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists,
1920  NumComponents);
1921  break;
1922  }
1923  case OMPC_from: {
1924  unsigned NumVars = Reader->Record.readInt();
1925  unsigned NumDeclarations = Reader->Record.readInt();
1926  unsigned NumLists = Reader->Record.readInt();
1927  unsigned NumComponents = Reader->Record.readInt();
1928  C = OMPFromClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists,
1929  NumComponents);
1930  break;
1931  }
1932  case OMPC_use_device_ptr: {
1933  unsigned NumVars = Reader->Record.readInt();
1934  unsigned NumDeclarations = Reader->Record.readInt();
1935  unsigned NumLists = Reader->Record.readInt();
1936  unsigned NumComponents = Reader->Record.readInt();
1937  C = OMPUseDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations,
1938  NumLists, NumComponents);
1939  break;
1940  }
1941  case OMPC_is_device_ptr: {
1942  unsigned NumVars = Reader->Record.readInt();
1943  unsigned NumDeclarations = Reader->Record.readInt();
1944  unsigned NumLists = Reader->Record.readInt();
1945  unsigned NumComponents = Reader->Record.readInt();
1946  C = OMPIsDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations,
1947  NumLists, NumComponents);
1948  break;
1949  }
1950  }
1951  Visit(C);
1952  C->setLocStart(Reader->ReadSourceLocation());
1953  C->setLocEnd(Reader->ReadSourceLocation());
1954 
1955  return C;
1956 }
1957 
1959  C->setPreInitStmt(Reader->Record.readSubStmt(),
1960  static_cast<OpenMPDirectiveKind>(Reader->Record.readInt()));
1961 }
1962 
1964  VisitOMPClauseWithPreInit(C);
1965  C->setPostUpdateExpr(Reader->Record.readSubExpr());
1966 }
1967 
1968 void OMPClauseReader::VisitOMPIfClause(OMPIfClause *C) {
1969  VisitOMPClauseWithPreInit(C);
1970  C->setNameModifier(static_cast<OpenMPDirectiveKind>(Reader->Record.readInt()));
1971  C->setNameModifierLoc(Reader->ReadSourceLocation());
1972  C->setColonLoc(Reader->ReadSourceLocation());
1973  C->setCondition(Reader->Record.readSubExpr());
1974  C->setLParenLoc(Reader->ReadSourceLocation());
1975 }
1976 
1977 void OMPClauseReader::VisitOMPFinalClause(OMPFinalClause *C) {
1978  C->setCondition(Reader->Record.readSubExpr());
1979  C->setLParenLoc(Reader->ReadSourceLocation());
1980 }
1981 
1982 void OMPClauseReader::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) {
1983  VisitOMPClauseWithPreInit(C);
1984  C->setNumThreads(Reader->Record.readSubExpr());
1985  C->setLParenLoc(Reader->ReadSourceLocation());
1986 }
1987 
1988 void OMPClauseReader::VisitOMPSafelenClause(OMPSafelenClause *C) {
1989  C->setSafelen(Reader->Record.readSubExpr());
1990  C->setLParenLoc(Reader->ReadSourceLocation());
1991 }
1992 
1993 void OMPClauseReader::VisitOMPSimdlenClause(OMPSimdlenClause *C) {
1994  C->setSimdlen(Reader->Record.readSubExpr());
1995  C->setLParenLoc(Reader->ReadSourceLocation());
1996 }
1997 
1998 void OMPClauseReader::VisitOMPCollapseClause(OMPCollapseClause *C) {
1999  C->setNumForLoops(Reader->Record.readSubExpr());
2000  C->setLParenLoc(Reader->ReadSourceLocation());
2001 }
2002 
2003 void OMPClauseReader::VisitOMPDefaultClause(OMPDefaultClause *C) {
2004  C->setDefaultKind(
2005  static_cast<OpenMPDefaultClauseKind>(Reader->Record.readInt()));
2006  C->setLParenLoc(Reader->ReadSourceLocation());
2007  C->setDefaultKindKwLoc(Reader->ReadSourceLocation());
2008 }
2009 
2010 void OMPClauseReader::VisitOMPProcBindClause(OMPProcBindClause *C) {
2011  C->setProcBindKind(
2012  static_cast<OpenMPProcBindClauseKind>(Reader->Record.readInt()));
2013  C->setLParenLoc(Reader->ReadSourceLocation());
2014  C->setProcBindKindKwLoc(Reader->ReadSourceLocation());
2015 }
2016 
2017 void OMPClauseReader::VisitOMPScheduleClause(OMPScheduleClause *C) {
2018  VisitOMPClauseWithPreInit(C);
2019  C->setScheduleKind(
2020  static_cast<OpenMPScheduleClauseKind>(Reader->Record.readInt()));
2021  C->setFirstScheduleModifier(
2022  static_cast<OpenMPScheduleClauseModifier>(Reader->Record.readInt()));
2023  C->setSecondScheduleModifier(
2024  static_cast<OpenMPScheduleClauseModifier>(Reader->Record.readInt()));
2025  C->setChunkSize(Reader->Record.readSubExpr());
2026  C->setLParenLoc(Reader->ReadSourceLocation());
2027  C->setFirstScheduleModifierLoc(Reader->ReadSourceLocation());
2028  C->setSecondScheduleModifierLoc(Reader->ReadSourceLocation());
2029  C->setScheduleKindLoc(Reader->ReadSourceLocation());
2030  C->setCommaLoc(Reader->ReadSourceLocation());
2031 }
2032 
2033 void OMPClauseReader::VisitOMPOrderedClause(OMPOrderedClause *C) {
2034  C->setNumForLoops(Reader->Record.readSubExpr());
2035  C->setLParenLoc(Reader->ReadSourceLocation());
2036 }
2037 
2038 void OMPClauseReader::VisitOMPNowaitClause(OMPNowaitClause *) {}
2039 
2040 void OMPClauseReader::VisitOMPUntiedClause(OMPUntiedClause *) {}
2041 
2042 void OMPClauseReader::VisitOMPMergeableClause(OMPMergeableClause *) {}
2043 
2044 void OMPClauseReader::VisitOMPReadClause(OMPReadClause *) {}
2045 
2046 void OMPClauseReader::VisitOMPWriteClause(OMPWriteClause *) {}
2047 
2048 void OMPClauseReader::VisitOMPUpdateClause(OMPUpdateClause *) {}
2049 
2050 void OMPClauseReader::VisitOMPCaptureClause(OMPCaptureClause *) {}
2051 
2052 void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
2053 
2054 void OMPClauseReader::VisitOMPThreadsClause(OMPThreadsClause *) {}
2055 
2056 void OMPClauseReader::VisitOMPSIMDClause(OMPSIMDClause *) {}
2057 
2058 void OMPClauseReader::VisitOMPNogroupClause(OMPNogroupClause *) {}
2059 
2060 void OMPClauseReader::VisitOMPPrivateClause(OMPPrivateClause *C) {
2061  C->setLParenLoc(Reader->ReadSourceLocation());
2062  unsigned NumVars = C->varlist_size();
2064  Vars.reserve(NumVars);
2065  for (unsigned i = 0; i != NumVars; ++i)
2066  Vars.push_back(Reader->Record.readSubExpr());
2067  C->setVarRefs(Vars);
2068  Vars.clear();
2069  for (unsigned i = 0; i != NumVars; ++i)
2070  Vars.push_back(Reader->Record.readSubExpr());
2071  C->setPrivateCopies(Vars);
2072 }
2073 
2074 void OMPClauseReader::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) {
2075  VisitOMPClauseWithPreInit(C);
2076  C->setLParenLoc(Reader->ReadSourceLocation());
2077  unsigned NumVars = C->varlist_size();
2079  Vars.reserve(NumVars);
2080  for (unsigned i = 0; i != NumVars; ++i)
2081  Vars.push_back(Reader->Record.readSubExpr());
2082  C->setVarRefs(Vars);
2083  Vars.clear();
2084  for (unsigned i = 0; i != NumVars; ++i)
2085  Vars.push_back(Reader->Record.readSubExpr());
2086  C->setPrivateCopies(Vars);
2087  Vars.clear();
2088  for (unsigned i = 0; i != NumVars; ++i)
2089  Vars.push_back(Reader->Record.readSubExpr());
2090  C->setInits(Vars);
2091 }
2092 
2093 void OMPClauseReader::VisitOMPLastprivateClause(OMPLastprivateClause *C) {
2094  VisitOMPClauseWithPostUpdate(C);
2095  C->setLParenLoc(Reader->ReadSourceLocation());
2096  unsigned NumVars = C->varlist_size();
2098  Vars.reserve(NumVars);
2099  for (unsigned i = 0; i != NumVars; ++i)
2100  Vars.push_back(Reader->Record.readSubExpr());
2101  C->setVarRefs(Vars);
2102  Vars.clear();
2103  for (unsigned i = 0; i != NumVars; ++i)
2104  Vars.push_back(Reader->Record.readSubExpr());
2105  C->setPrivateCopies(Vars);
2106  Vars.clear();
2107  for (unsigned i = 0; i != NumVars; ++i)
2108  Vars.push_back(Reader->Record.readSubExpr());
2109  C->setSourceExprs(Vars);
2110  Vars.clear();
2111  for (unsigned i = 0; i != NumVars; ++i)
2112  Vars.push_back(Reader->Record.readSubExpr());
2113  C->setDestinationExprs(Vars);
2114  Vars.clear();
2115  for (unsigned i = 0; i != NumVars; ++i)
2116  Vars.push_back(Reader->Record.readSubExpr());
2117  C->setAssignmentOps(Vars);
2118 }
2119 
2120 void OMPClauseReader::VisitOMPSharedClause(OMPSharedClause *C) {
2121  C->setLParenLoc(Reader->ReadSourceLocation());
2122  unsigned NumVars = C->varlist_size();
2124  Vars.reserve(NumVars);
2125  for (unsigned i = 0; i != NumVars; ++i)
2126  Vars.push_back(Reader->Record.readSubExpr());
2127  C->setVarRefs(Vars);
2128 }
2129 
2130 void OMPClauseReader::VisitOMPReductionClause(OMPReductionClause *C) {
2131  VisitOMPClauseWithPostUpdate(C);
2132  C->setLParenLoc(Reader->ReadSourceLocation());
2133  C->setColonLoc(Reader->ReadSourceLocation());
2134  NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc();
2135  DeclarationNameInfo DNI;
2136  Reader->ReadDeclarationNameInfo(DNI);
2137  C->setQualifierLoc(NNSL);
2138  C->setNameInfo(DNI);
2139 
2140  unsigned NumVars = C->varlist_size();
2142  Vars.reserve(NumVars);
2143  for (unsigned i = 0; i != NumVars; ++i)
2144  Vars.push_back(Reader->Record.readSubExpr());
2145  C->setVarRefs(Vars);
2146  Vars.clear();
2147  for (unsigned i = 0; i != NumVars; ++i)
2148  Vars.push_back(Reader->Record.readSubExpr());
2149  C->setPrivates(Vars);
2150  Vars.clear();
2151  for (unsigned i = 0; i != NumVars; ++i)
2152  Vars.push_back(Reader->Record.readSubExpr());
2153  C->setLHSExprs(Vars);
2154  Vars.clear();
2155  for (unsigned i = 0; i != NumVars; ++i)
2156  Vars.push_back(Reader->Record.readSubExpr());
2157  C->setRHSExprs(Vars);
2158  Vars.clear();
2159  for (unsigned i = 0; i != NumVars; ++i)
2160  Vars.push_back(Reader->Record.readSubExpr());
2161  C->setReductionOps(Vars);
2162 }
2163 
2164 void OMPClauseReader::VisitOMPTaskReductionClause(OMPTaskReductionClause *C) {
2165  VisitOMPClauseWithPostUpdate(C);
2166  C->setLParenLoc(Reader->ReadSourceLocation());
2167  C->setColonLoc(Reader->ReadSourceLocation());
2168  NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc();
2169  DeclarationNameInfo DNI;
2170  Reader->ReadDeclarationNameInfo(DNI);
2171  C->setQualifierLoc(NNSL);
2172  C->setNameInfo(DNI);
2173 
2174  unsigned NumVars = C->varlist_size();
2176  Vars.reserve(NumVars);
2177  for (unsigned I = 0; I != NumVars; ++I)
2178  Vars.push_back(Reader->Record.readSubExpr());
2179  C->setVarRefs(Vars);
2180  Vars.clear();
2181  for (unsigned I = 0; I != NumVars; ++I)
2182  Vars.push_back(Reader->Record.readSubExpr());
2183  C->setPrivates(Vars);
2184  Vars.clear();
2185  for (unsigned I = 0; I != NumVars; ++I)
2186  Vars.push_back(Reader->Record.readSubExpr());
2187  C->setLHSExprs(Vars);
2188  Vars.clear();
2189  for (unsigned I = 0; I != NumVars; ++I)
2190  Vars.push_back(Reader->Record.readSubExpr());
2191  C->setRHSExprs(Vars);
2192  Vars.clear();
2193  for (unsigned I = 0; I != NumVars; ++I)
2194  Vars.push_back(Reader->Record.readSubExpr());
2195  C->setReductionOps(Vars);
2196 }
2197 
2198 void OMPClauseReader::VisitOMPInReductionClause(OMPInReductionClause *C) {
2199  VisitOMPClauseWithPostUpdate(C);
2200  C->setLParenLoc(Reader->ReadSourceLocation());
2201  C->setColonLoc(Reader->ReadSourceLocation());
2202  NestedNameSpecifierLoc NNSL = Reader->Record.readNestedNameSpecifierLoc();
2203  DeclarationNameInfo DNI;
2204  Reader->ReadDeclarationNameInfo(DNI);
2205  C->setQualifierLoc(NNSL);
2206  C->setNameInfo(DNI);
2207 
2208  unsigned NumVars = C->varlist_size();
2210  Vars.reserve(NumVars);
2211  for (unsigned I = 0; I != NumVars; ++I)
2212  Vars.push_back(Reader->Record.readSubExpr());
2213  C->setVarRefs(Vars);
2214  Vars.clear();
2215  for (unsigned I = 0; I != NumVars; ++I)
2216  Vars.push_back(Reader->Record.readSubExpr());
2217  C->setPrivates(Vars);
2218  Vars.clear();
2219  for (unsigned I = 0; I != NumVars; ++I)
2220  Vars.push_back(Reader->Record.readSubExpr());
2221  C->setLHSExprs(Vars);
2222  Vars.clear();
2223  for (unsigned I = 0; I != NumVars; ++I)
2224  Vars.push_back(Reader->Record.readSubExpr());
2225  C->setRHSExprs(Vars);
2226  Vars.clear();
2227  for (unsigned I = 0; I != NumVars; ++I)
2228  Vars.push_back(Reader->Record.readSubExpr());
2229  C->setReductionOps(Vars);
2230  Vars.clear();
2231  for (unsigned I = 0; I != NumVars; ++I)
2232  Vars.push_back(Reader->Record.readSubExpr());
2233  C->setTaskgroupDescriptors(Vars);
2234 }
2235 
2236 void OMPClauseReader::VisitOMPLinearClause(OMPLinearClause *C) {
2237  VisitOMPClauseWithPostUpdate(C);
2238  C->setLParenLoc(Reader->ReadSourceLocation());
2239  C->setColonLoc(Reader->ReadSourceLocation());
2240  C->setModifier(static_cast<OpenMPLinearClauseKind>(Reader->Record.readInt()));
2241  C->setModifierLoc(Reader->ReadSourceLocation());
2242  unsigned NumVars = C->varlist_size();
2244  Vars.reserve(NumVars);
2245  for (unsigned i = 0; i != NumVars; ++i)
2246  Vars.push_back(Reader->Record.readSubExpr());
2247  C->setVarRefs(Vars);
2248  Vars.clear();
2249  for (unsigned i = 0; i != NumVars; ++i)
2250  Vars.push_back(Reader->Record.readSubExpr());
2251  C->setPrivates(Vars);
2252  Vars.clear();
2253  for (unsigned i = 0; i != NumVars; ++i)
2254  Vars.push_back(Reader->Record.readSubExpr());
2255  C->setInits(Vars);
2256  Vars.clear();
2257  for (unsigned i = 0; i != NumVars; ++i)
2258  Vars.push_back(Reader->Record.readSubExpr());
2259  C->setUpdates(Vars);
2260  Vars.clear();
2261  for (unsigned i = 0; i != NumVars; ++i)
2262  Vars.push_back(Reader->Record.readSubExpr());
2263  C->setFinals(Vars);
2264  C->setStep(Reader->Record.readSubExpr());
2265  C->setCalcStep(Reader->Record.readSubExpr());
2266 }
2267 
2268 void OMPClauseReader::VisitOMPAlignedClause(OMPAlignedClause *C) {
2269  C->setLParenLoc(Reader->ReadSourceLocation());
2270  C->setColonLoc(Reader->ReadSourceLocation());
2271  unsigned NumVars = C->varlist_size();
2273  Vars.reserve(NumVars);
2274  for (unsigned i = 0; i != NumVars; ++i)
2275  Vars.push_back(Reader->Record.readSubExpr());
2276  C->setVarRefs(Vars);
2277  C->setAlignment(Reader->Record.readSubExpr());
2278 }
2279 
2280 void OMPClauseReader::VisitOMPCopyinClause(OMPCopyinClause *C) {
2281  C->setLParenLoc(Reader->ReadSourceLocation());
2282  unsigned NumVars = C->varlist_size();
2284  Exprs.reserve(NumVars);
2285  for (unsigned i = 0; i != NumVars; ++i)
2286  Exprs.push_back(Reader->Record.readSubExpr());
2287  C->setVarRefs(Exprs);
2288  Exprs.clear();
2289  for (unsigned i = 0; i != NumVars; ++i)
2290  Exprs.push_back(Reader->Record.readSubExpr());
2291  C->setSourceExprs(Exprs);
2292  Exprs.clear();
2293  for (unsigned i = 0; i != NumVars; ++i)
2294  Exprs.push_back(Reader->Record.readSubExpr());
2295  C->setDestinationExprs(Exprs);
2296  Exprs.clear();
2297  for (unsigned i = 0; i != NumVars; ++i)
2298  Exprs.push_back(Reader->Record.readSubExpr());
2299  C->setAssignmentOps(Exprs);
2300 }
2301 
2302 void OMPClauseReader::VisitOMPCopyprivateClause(OMPCopyprivateClause *C) {
2303  C->setLParenLoc(Reader->ReadSourceLocation());
2304  unsigned NumVars = C->varlist_size();
2306  Exprs.reserve(NumVars);
2307  for (unsigned i = 0; i != NumVars; ++i)
2308  Exprs.push_back(Reader->Record.readSubExpr());
2309  C->setVarRefs(Exprs);
2310  Exprs.clear();
2311  for (unsigned i = 0; i != NumVars; ++i)
2312  Exprs.push_back(Reader->Record.readSubExpr());
2313  C->setSourceExprs(Exprs);
2314  Exprs.clear();
2315  for (unsigned i = 0; i != NumVars; ++i)
2316  Exprs.push_back(Reader->Record.readSubExpr());
2317  C->setDestinationExprs(Exprs);
2318  Exprs.clear();
2319  for (unsigned i = 0; i != NumVars; ++i)
2320  Exprs.push_back(Reader->Record.readSubExpr());
2321  C->setAssignmentOps(Exprs);
2322 }
2323 
2324 void OMPClauseReader::VisitOMPFlushClause(OMPFlushClause *C) {
2325  C->setLParenLoc(Reader->ReadSourceLocation());
2326  unsigned NumVars = C->varlist_size();
2328  Vars.reserve(NumVars);
2329  for (unsigned i = 0; i != NumVars; ++i)
2330  Vars.push_back(Reader->Record.readSubExpr());
2331  C->setVarRefs(Vars);
2332 }
2333 
2334 void OMPClauseReader::VisitOMPDependClause(OMPDependClause *C) {
2335  C->setLParenLoc(Reader->ReadSourceLocation());
2336  C->setDependencyKind(
2337  static_cast<OpenMPDependClauseKind>(Reader->Record.readInt()));
2338  C->setDependencyLoc(Reader->ReadSourceLocation());
2339  C->setColonLoc(Reader->ReadSourceLocation());
2340  unsigned NumVars = C->varlist_size();
2342  Vars.reserve(NumVars);
2343  for (unsigned i = 0; i != NumVars; ++i)
2344  Vars.push_back(Reader->Record.readSubExpr());
2345  C->setVarRefs(Vars);
2346  C->setCounterValue(Reader->Record.readSubExpr());
2347 }
2348 
2349 void OMPClauseReader::VisitOMPDeviceClause(OMPDeviceClause *C) {
2350  VisitOMPClauseWithPreInit(C);
2351  C->setDevice(Reader->Record.readSubExpr());
2352  C->setLParenLoc(Reader->ReadSourceLocation());
2353 }
2354 
2355 void OMPClauseReader::VisitOMPMapClause(OMPMapClause *C) {
2356  C->setLParenLoc(Reader->ReadSourceLocation());
2357  C->setMapTypeModifier(
2358  static_cast<OpenMPMapClauseKind>(Reader->Record.readInt()));
2359  C->setMapType(
2360  static_cast<OpenMPMapClauseKind>(Reader->Record.readInt()));
2361  C->setMapLoc(Reader->ReadSourceLocation());
2362  C->setColonLoc(Reader->ReadSourceLocation());
2363  auto NumVars = C->varlist_size();
2364  auto UniqueDecls = C->getUniqueDeclarationsNum();
2365  auto TotalLists = C->getTotalComponentListNum();
2366  auto TotalComponents = C->getTotalComponentsNum();
2367 
2369  Vars.reserve(NumVars);
2370  for (unsigned i = 0; i != NumVars; ++i)
2371  Vars.push_back(Reader->Record.readSubExpr());
2372  C->setVarRefs(Vars);
2373 
2375  Decls.reserve(UniqueDecls);
2376  for (unsigned i = 0; i < UniqueDecls; ++i)
2377  Decls.push_back(Reader->Record.readDeclAs<ValueDecl>());
2378  C->setUniqueDecls(Decls);
2379 
2380  SmallVector<unsigned, 16> ListsPerDecl;
2381  ListsPerDecl.reserve(UniqueDecls);
2382  for (unsigned i = 0; i < UniqueDecls; ++i)
2383  ListsPerDecl.push_back(Reader->Record.readInt());
2384  C->setDeclNumLists(ListsPerDecl);
2385 
2386  SmallVector<unsigned, 32> ListSizes;
2387  ListSizes.reserve(TotalLists);
2388  for (unsigned i = 0; i < TotalLists; ++i)
2389  ListSizes.push_back(Reader->Record.readInt());
2390  C->setComponentListSizes(ListSizes);
2391 
2393  Components.reserve(TotalComponents);
2394  for (unsigned i = 0; i < TotalComponents; ++i) {
2395  Expr *AssociatedExpr = Reader->Record.readSubExpr();
2396  ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
2398  AssociatedExpr, AssociatedDecl));
2399  }
2400  C->setComponents(Components, ListSizes);
2401 }
2402 
2403 void OMPClauseReader::VisitOMPNumTeamsClause(OMPNumTeamsClause *C) {
2404  VisitOMPClauseWithPreInit(C);
2405  C->setNumTeams(Reader->Record.readSubExpr());
2406  C->setLParenLoc(Reader->ReadSourceLocation());
2407 }
2408 
2409 void OMPClauseReader::VisitOMPThreadLimitClause(OMPThreadLimitClause *C) {
2410  VisitOMPClauseWithPreInit(C);
2411  C->setThreadLimit(Reader->Record.readSubExpr());
2412  C->setLParenLoc(Reader->ReadSourceLocation());
2413 }
2414 
2415 void OMPClauseReader::VisitOMPPriorityClause(OMPPriorityClause *C) {
2416  C->setPriority(Reader->Record.readSubExpr());
2417  C->setLParenLoc(Reader->ReadSourceLocation());
2418 }
2419 
2420 void OMPClauseReader::VisitOMPGrainsizeClause(OMPGrainsizeClause *C) {
2421  C->setGrainsize(Reader->Record.readSubExpr());
2422  C->setLParenLoc(Reader->ReadSourceLocation());
2423 }
2424 
2425 void OMPClauseReader::VisitOMPNumTasksClause(OMPNumTasksClause *C) {
2426  C->setNumTasks(Reader->Record.readSubExpr());
2427  C->setLParenLoc(Reader->ReadSourceLocation());
2428 }
2429 
2430 void OMPClauseReader::VisitOMPHintClause(OMPHintClause *C) {
2431  C->setHint(Reader->Record.readSubExpr());
2432  C->setLParenLoc(Reader->ReadSourceLocation());
2433 }
2434 
2435 void OMPClauseReader::VisitOMPDistScheduleClause(OMPDistScheduleClause *C) {
2436  VisitOMPClauseWithPreInit(C);
2437  C->setDistScheduleKind(
2438  static_cast<OpenMPDistScheduleClauseKind>(Reader->Record.readInt()));
2439  C->setChunkSize(Reader->Record.readSubExpr());
2440  C->setLParenLoc(Reader->ReadSourceLocation());
2441  C->setDistScheduleKindLoc(Reader->ReadSourceLocation());
2442  C->setCommaLoc(Reader->ReadSourceLocation());
2443 }
2444 
2445 void OMPClauseReader::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) {
2446  C->setDefaultmapKind(
2447  static_cast<OpenMPDefaultmapClauseKind>(Reader->Record.readInt()));
2448  C->setDefaultmapModifier(
2449  static_cast<OpenMPDefaultmapClauseModifier>(Reader->Record.readInt()));
2450  C->setLParenLoc(Reader->ReadSourceLocation());
2451  C->setDefaultmapModifierLoc(Reader->ReadSourceLocation());
2452  C->setDefaultmapKindLoc(Reader->ReadSourceLocation());
2453 }
2454 
2455 void OMPClauseReader::VisitOMPToClause(OMPToClause *C) {
2456  C->setLParenLoc(Reader->ReadSourceLocation());
2457  auto NumVars = C->varlist_size();
2458  auto UniqueDecls = C->getUniqueDeclarationsNum();
2459  auto TotalLists = C->getTotalComponentListNum();
2460  auto TotalComponents = C->getTotalComponentsNum();
2461 
2463  Vars.reserve(NumVars);
2464  for (unsigned i = 0; i != NumVars; ++i)
2465  Vars.push_back(Reader->Record.readSubExpr());
2466  C->setVarRefs(Vars);
2467 
2469  Decls.reserve(UniqueDecls);
2470  for (unsigned i = 0; i < UniqueDecls; ++i)
2471  Decls.push_back(Reader->Record.readDeclAs<ValueDecl>());
2472  C->setUniqueDecls(Decls);
2473 
2474  SmallVector<unsigned, 16> ListsPerDecl;
2475  ListsPerDecl.reserve(UniqueDecls);
2476  for (unsigned i = 0; i < UniqueDecls; ++i)
2477  ListsPerDecl.push_back(Reader->Record.readInt());
2478  C->setDeclNumLists(ListsPerDecl);
2479 
2480  SmallVector<unsigned, 32> ListSizes;
2481  ListSizes.reserve(TotalLists);
2482  for (unsigned i = 0; i < TotalLists; ++i)
2483  ListSizes.push_back(Reader->Record.readInt());
2484  C->setComponentListSizes(ListSizes);
2485 
2487  Components.reserve(TotalComponents);
2488  for (unsigned i = 0; i < TotalComponents; ++i) {
2489  Expr *AssociatedExpr = Reader->Record.readSubExpr();
2490  ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
2492  AssociatedExpr, AssociatedDecl));
2493  }
2494  C->setComponents(Components, ListSizes);
2495 }
2496 
2497 void OMPClauseReader::VisitOMPFromClause(OMPFromClause *C) {
2498  C->setLParenLoc(Reader->ReadSourceLocation());
2499  auto NumVars = C->varlist_size();
2500  auto UniqueDecls = C->getUniqueDeclarationsNum();
2501  auto TotalLists = C->getTotalComponentListNum();
2502  auto TotalComponents = C->getTotalComponentsNum();
2503 
2505  Vars.reserve(NumVars);
2506  for (unsigned i = 0; i != NumVars; ++i)
2507  Vars.push_back(Reader->Record.readSubExpr());
2508  C->setVarRefs(Vars);
2509 
2511  Decls.reserve(UniqueDecls);
2512  for (unsigned i = 0; i < UniqueDecls; ++i)
2513  Decls.push_back(Reader->Record.readDeclAs<ValueDecl>());
2514  C->setUniqueDecls(Decls);
2515 
2516  SmallVector<unsigned, 16> ListsPerDecl;
2517  ListsPerDecl.reserve(UniqueDecls);
2518  for (unsigned i = 0; i < UniqueDecls; ++i)
2519  ListsPerDecl.push_back(Reader->Record.readInt());
2520  C->setDeclNumLists(ListsPerDecl);
2521 
2522  SmallVector<unsigned, 32> ListSizes;
2523  ListSizes.reserve(TotalLists);
2524  for (unsigned i = 0; i < TotalLists; ++i)
2525  ListSizes.push_back(Reader->Record.readInt());
2526  C->setComponentListSizes(ListSizes);
2527 
2529  Components.reserve(TotalComponents);
2530  for (unsigned i = 0; i < TotalComponents; ++i) {
2531  Expr *AssociatedExpr = Reader->Record.readSubExpr();
2532  ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
2534  AssociatedExpr, AssociatedDecl));
2535  }
2536  C->setComponents(Components, ListSizes);
2537 }
2538 
2539 void OMPClauseReader::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *C) {
2540  C->setLParenLoc(Reader->ReadSourceLocation());
2541  auto NumVars = C->varlist_size();
2542  auto UniqueDecls = C->getUniqueDeclarationsNum();
2543  auto TotalLists = C->getTotalComponentListNum();
2544  auto TotalComponents = C->getTotalComponentsNum();
2545 
2547  Vars.reserve(NumVars);
2548  for (unsigned i = 0; i != NumVars; ++i)
2549  Vars.push_back(Reader->Record.readSubExpr());
2550  C->setVarRefs(Vars);
2551  Vars.clear();
2552  for (unsigned i = 0; i != NumVars; ++i)
2553  Vars.push_back(Reader->Record.readSubExpr());
2554  C->setPrivateCopies(Vars);
2555  Vars.clear();
2556  for (unsigned i = 0; i != NumVars; ++i)
2557  Vars.push_back(Reader->Record.readSubExpr());
2558  C->setInits(Vars);
2559 
2561  Decls.reserve(UniqueDecls);
2562  for (unsigned i = 0; i < UniqueDecls; ++i)
2563  Decls.push_back(Reader->Record.readDeclAs<ValueDecl>());
2564  C->setUniqueDecls(Decls);
2565 
2566  SmallVector<unsigned, 16> ListsPerDecl;
2567  ListsPerDecl.reserve(UniqueDecls);
2568  for (unsigned i = 0; i < UniqueDecls; ++i)
2569  ListsPerDecl.push_back(Reader->Record.readInt());
2570  C->setDeclNumLists(ListsPerDecl);
2571 
2572  SmallVector<unsigned, 32> ListSizes;
2573  ListSizes.reserve(TotalLists);
2574  for (unsigned i = 0; i < TotalLists; ++i)
2575  ListSizes.push_back(Reader->Record.readInt());
2576  C->setComponentListSizes(ListSizes);
2577 
2579  Components.reserve(TotalComponents);
2580  for (unsigned i = 0; i < TotalComponents; ++i) {
2581  Expr *AssociatedExpr = Reader->Record.readSubExpr();
2582  ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
2584  AssociatedExpr, AssociatedDecl));
2585  }
2586  C->setComponents(Components, ListSizes);
2587 }
2588 
2589 void OMPClauseReader::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) {
2590  C->setLParenLoc(Reader->ReadSourceLocation());
2591  auto NumVars = C->varlist_size();
2592  auto UniqueDecls = C->getUniqueDeclarationsNum();
2593  auto TotalLists = C->getTotalComponentListNum();
2594  auto TotalComponents = C->getTotalComponentsNum();
2595 
2597  Vars.reserve(NumVars);
2598  for (unsigned i = 0; i != NumVars; ++i)
2599  Vars.push_back(Reader->Record.readSubExpr());
2600  C->setVarRefs(Vars);
2601  Vars.clear();
2602 
2604  Decls.reserve(UniqueDecls);
2605  for (unsigned i = 0; i < UniqueDecls; ++i)
2606  Decls.push_back(Reader->Record.readDeclAs<ValueDecl>());
2607  C->setUniqueDecls(Decls);
2608 
2609  SmallVector<unsigned, 16> ListsPerDecl;
2610  ListsPerDecl.reserve(UniqueDecls);
2611  for (unsigned i = 0; i < UniqueDecls; ++i)
2612  ListsPerDecl.push_back(Reader->Record.readInt());
2613  C->setDeclNumLists(ListsPerDecl);
2614 
2615  SmallVector<unsigned, 32> ListSizes;
2616  ListSizes.reserve(TotalLists);
2617  for (unsigned i = 0; i < TotalLists; ++i)
2618  ListSizes.push_back(Reader->Record.readInt());
2619  C->setComponentListSizes(ListSizes);
2620 
2622  Components.reserve(TotalComponents);
2623  for (unsigned i = 0; i < TotalComponents; ++i) {
2624  Expr *AssociatedExpr = Reader->Record.readSubExpr();
2625  ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
2627  AssociatedExpr, AssociatedDecl));
2628  }
2629  C->setComponents(Components, ListSizes);
2630 }
2631 
2632 //===----------------------------------------------------------------------===//
2633 // OpenMP Directives.
2634 //===----------------------------------------------------------------------===//
2635 void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2636  E->setLocStart(ReadSourceLocation());
2637  E->setLocEnd(ReadSourceLocation());
2638  OMPClauseReader ClauseReader(this, Record);
2640  for (unsigned i = 0; i < E->getNumClauses(); ++i)
2641  Clauses.push_back(ClauseReader.readClause());
2642  E->setClauses(Clauses);
2643  if (E->hasAssociatedStmt())
2644  E->setAssociatedStmt(Record.readSubStmt());
2645 }
2646 
2647 void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
2648  VisitStmt(D);
2649  // Two fields (NumClauses and CollapsedNum) were read in ReadStmtFromStream.
2650  Record.skipInts(2);
2651  VisitOMPExecutableDirective(D);
2652  D->setIterationVariable(Record.readSubExpr());
2653  D->setLastIteration(Record.readSubExpr());
2654  D->setCalcLastIteration(Record.readSubExpr());
2655  D->setPreCond(Record.readSubExpr());
2656  D->setCond(Record.readSubExpr());
2657  D->setInit(Record.readSubExpr());
2658  D->setInc(Record.readSubExpr());
2659  D->setPreInits(Record.readSubStmt());
2663  D->setIsLastIterVariable(Record.readSubExpr());
2664  D->setLowerBoundVariable(Record.readSubExpr());
2665  D->setUpperBoundVariable(Record.readSubExpr());
2666  D->setStrideVariable(Record.readSubExpr());
2667  D->setEnsureUpperBound(Record.readSubExpr());
2668  D->setNextLowerBound(Record.readSubExpr());
2669  D->setNextUpperBound(Record.readSubExpr());
2670  D->setNumIterations(Record.readSubExpr());
2671  }
2675  D->setDistInc(Record.readSubExpr());
2676  D->setPrevEnsureUpperBound(Record.readSubExpr());
2680  D->setCombinedInit(Record.readSubExpr());
2681  D->setCombinedCond(Record.readSubExpr());
2684  }
2686  unsigned CollapsedNum = D->getCollapsedNumber();
2687  Sub.reserve(CollapsedNum);
2688  for (unsigned i = 0; i < CollapsedNum; ++i)
2689  Sub.push_back(Record.readSubExpr());
2690  D->setCounters(Sub);
2691  Sub.clear();
2692  for (unsigned i = 0; i < CollapsedNum; ++i)
2693  Sub.push_back(Record.readSubExpr());
2694  D->setPrivateCounters(Sub);
2695  Sub.clear();
2696  for (unsigned i = 0; i < CollapsedNum; ++i)
2697  Sub.push_back(Record.readSubExpr());
2698  D->setInits(Sub);
2699  Sub.clear();
2700  for (unsigned i = 0; i < CollapsedNum; ++i)
2701  Sub.push_back(Record.readSubExpr());
2702  D->setUpdates(Sub);
2703  Sub.clear();
2704  for (unsigned i = 0; i < CollapsedNum; ++i)
2705  Sub.push_back(Record.readSubExpr());
2706  D->setFinals(Sub);
2707 }
2708 
2709 void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
2710  VisitStmt(D);
2711  // The NumClauses field was read in ReadStmtFromStream.
2712  Record.skipInts(1);
2713  VisitOMPExecutableDirective(D);
2714  D->setHasCancel(Record.readInt());
2715 }
2716 
2717 void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
2718  VisitOMPLoopDirective(D);
2719 }
2720 
2721 void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
2722  VisitOMPLoopDirective(D);
2723  D->setHasCancel(Record.readInt());
2724 }
2725 
2726 void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2727  VisitOMPLoopDirective(D);
2728 }
2729 
2730 void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2731  VisitStmt(D);
2732  // The NumClauses field was read in ReadStmtFromStream.
2733  Record.skipInts(1);
2734  VisitOMPExecutableDirective(D);
2735  D->setHasCancel(Record.readInt());
2736 }
2737 
2738 void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
2739  VisitStmt(D);
2740  VisitOMPExecutableDirective(D);
2741  D->setHasCancel(Record.readInt());
2742 }
2743 
2744 void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
2745  VisitStmt(D);
2746  // The NumClauses field was read in ReadStmtFromStream.
2747  Record.skipInts(1);
2748  VisitOMPExecutableDirective(D);
2749 }
2750 
2751 void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
2752  VisitStmt(D);
2753  VisitOMPExecutableDirective(D);
2754 }
2755 
2756 void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2757  VisitStmt(D);
2758  // The NumClauses field was read in ReadStmtFromStream.
2759  Record.skipInts(1);
2760  VisitOMPExecutableDirective(D);
2761  ReadDeclarationNameInfo(D->DirName);
2762 }
2763 
2764 void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2765  VisitOMPLoopDirective(D);
2766  D->setHasCancel(Record.readInt());
2767 }
2768 
2769 void ASTStmtReader::VisitOMPParallelForSimdDirective(
2771  VisitOMPLoopDirective(D);
2772 }
2773 
2774 void ASTStmtReader::VisitOMPParallelSectionsDirective(
2776  VisitStmt(D);
2777  // The NumClauses field was read in ReadStmtFromStream.
2778  Record.skipInts(1);
2779  VisitOMPExecutableDirective(D);
2780  D->setHasCancel(Record.readInt());
2781 }
2782 
2783 void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
2784  VisitStmt(D);
2785  // The NumClauses field was read in ReadStmtFromStream.
2786  Record.skipInts(1);
2787  VisitOMPExecutableDirective(D);
2788  D->setHasCancel(Record.readInt());
2789 }
2790 
2791 void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2792  VisitStmt(D);
2793  VisitOMPExecutableDirective(D);
2794 }
2795 
2796 void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2797  VisitStmt(D);
2798  VisitOMPExecutableDirective(D);
2799 }
2800 
2801 void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2802  VisitStmt(D);
2803  VisitOMPExecutableDirective(D);
2804 }
2805 
2806 void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2807  VisitStmt(D);
2808  // The NumClauses field was read in ReadStmtFromStream.
2809  Record.skipInts(1);
2810  VisitOMPExecutableDirective(D);
2811  D->setReductionRef(Record.readSubExpr());
2812 }
2813 
2814 void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
2815  VisitStmt(D);
2816  // The NumClauses field was read in ReadStmtFromStream.
2817  Record.skipInts(1);
2818  VisitOMPExecutableDirective(D);
2819 }
2820 
2821 void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2822  VisitStmt(D);
2823  // The NumClauses field was read in ReadStmtFromStream.
2824  Record.skipInts(1);
2825  VisitOMPExecutableDirective(D);
2826 }
2827 
2828 void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2829  VisitStmt(D);
2830  // The NumClauses field was read in ReadStmtFromStream.
2831  Record.skipInts(1);
2832  VisitOMPExecutableDirective(D);
2833  D->setX(Record.readSubExpr());
2834  D->setV(Record.readSubExpr());
2835  D->setExpr(Record.readSubExpr());
2836  D->setUpdateExpr(Record.readSubExpr());
2837  D->IsXLHSInRHSPart = Record.readInt() != 0;
2838  D->IsPostfixUpdate = Record.readInt() != 0;
2839 }
2840 
2841 void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
2842  VisitStmt(D);
2843  // The NumClauses field was read in ReadStmtFromStream.
2844  Record.skipInts(1);
2845  VisitOMPExecutableDirective(D);
2846 }
2847 
2848 void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
2849  VisitStmt(D);
2850  Record.skipInts(1);
2851  VisitOMPExecutableDirective(D);
2852 }
2853 
2854 void ASTStmtReader::VisitOMPTargetEnterDataDirective(
2856  VisitStmt(D);
2857  Record.skipInts(1);
2858  VisitOMPExecutableDirective(D);
2859 }
2860 
2861 void ASTStmtReader::VisitOMPTargetExitDataDirective(
2863  VisitStmt(D);
2864  Record.skipInts(1);
2865  VisitOMPExecutableDirective(D);
2866 }
2867 
2868 void ASTStmtReader::VisitOMPTargetParallelDirective(
2870  VisitStmt(D);
2871  Record.skipInts(1);
2872  VisitOMPExecutableDirective(D);
2873 }
2874 
2875 void ASTStmtReader::VisitOMPTargetParallelForDirective(
2877  VisitOMPLoopDirective(D);
2878  D->setHasCancel(Record.readInt());
2879 }
2880 
2881 void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2882  VisitStmt(D);
2883  // The NumClauses field was read in ReadStmtFromStream.
2884  Record.skipInts(1);
2885  VisitOMPExecutableDirective(D);
2886 }
2887 
2888 void ASTStmtReader::VisitOMPCancellationPointDirective(
2890  VisitStmt(D);
2891  VisitOMPExecutableDirective(D);
2892  D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt()));
2893 }
2894 
2895 void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
2896  VisitStmt(D);
2897  // The NumClauses field was read in ReadStmtFromStream.
2898  Record.skipInts(1);
2899  VisitOMPExecutableDirective(D);
2900  D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt()));
2901 }
2902 
2903 void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
2904  VisitOMPLoopDirective(D);
2905 }
2906 
2907 void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
2908  VisitOMPLoopDirective(D);
2909 }
2910 
2911 void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
2912  VisitOMPLoopDirective(D);
2913 }
2914 
2915 void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
2916  VisitStmt(D);
2917  Record.skipInts(1);
2918  VisitOMPExecutableDirective(D);
2919 }
2920 void ASTStmtReader::VisitOMPDistributeParallelForDirective(
2922  VisitOMPLoopDirective(D);
2923  D->setHasCancel(Record.readInt());
2924 }
2925 
2926 void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
2928  VisitOMPLoopDirective(D);
2929 }
2930 
2931 void ASTStmtReader::VisitOMPDistributeSimdDirective(
2933  VisitOMPLoopDirective(D);
2934 }
2935 
2936 void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
2938  VisitOMPLoopDirective(D);
2939 }
2940 
2941 void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
2942  VisitOMPLoopDirective(D);
2943 }
2944 
2945 void ASTStmtReader::VisitOMPTeamsDistributeDirective(
2947  VisitOMPLoopDirective(D);
2948 }
2949 
2950 void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
2952  VisitOMPLoopDirective(D);
2953 }
2954 
2955 void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
2957  VisitOMPLoopDirective(D);
2958 }
2959 
2960 void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
2962  VisitOMPLoopDirective(D);
2963  D->setHasCancel(Record.readInt());
2964 }
2965 
2966 void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
2967  VisitStmt(D);
2968  // The NumClauses field was read in ReadStmtFromStream.
2969  Record.skipInts(1);
2970  VisitOMPExecutableDirective(D);
2971 }
2972 
2973 void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
2975  VisitOMPLoopDirective(D);
2976 }
2977 
2978 void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
2980  VisitOMPLoopDirective(D);
2981  D->setHasCancel(Record.readInt());
2982 }
2983 
2984 void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
2986  VisitOMPLoopDirective(D);
2987 }
2988 
2989 void ASTStmtReader::VisitOMPTargetTeamsDistributeSimdDirective(
2991  VisitOMPLoopDirective(D);
2992 }
2993 
2994 //===----------------------------------------------------------------------===//
2995 // ASTReader Implementation
2996 //===----------------------------------------------------------------------===//
2997 
2999  switch (ReadingKind) {
3000  case Read_None:
3001  llvm_unreachable("should not call this when not reading anything");
3002  case Read_Decl:
3003  case Read_Type:
3004  return ReadStmtFromStream(F);
3005  case Read_Stmt:
3006  return ReadSubStmt();
3007  }
3008 
3009  llvm_unreachable("ReadingKind not set ?");
3010 }
3011 
3013  return cast_or_null<Expr>(ReadStmt(F));
3014 }
3015 
3017  return cast_or_null<Expr>(ReadSubStmt());
3018 }
3019 
3020 // Within the bitstream, expressions are stored in Reverse Polish
3021 // Notation, with each of the subexpressions preceding the
3022 // expression they are stored in. Subexpressions are stored from last to first.
3023 // To evaluate expressions, we continue reading expressions and placing them on
3024 // the stack, with expressions having operands removing those operands from the
3025 // stack. Evaluation terminates when we see a STMT_STOP record, and
3026 // the single remaining expression on the stack is our result.
3027 Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
3028 
3029  ReadingKindTracker ReadingKind(Read_Stmt, *this);
3030  llvm::BitstreamCursor &Cursor = F.DeclsCursor;
3031 
3032  // Map of offset to previously deserialized stmt. The offset points
3033  // just after the stmt record.
3034  llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
3035 
3036 #ifndef NDEBUG
3037  unsigned PrevNumStmts = StmtStack.size();
3038 #endif
3039 
3040  ASTRecordReader Record(*this, F);
3041  ASTStmtReader Reader(Record, Cursor);
3042  Stmt::EmptyShell Empty;
3043 
3044  while (true) {
3045  llvm::BitstreamEntry Entry = Cursor.advanceSkippingSubblocks();
3046 
3047  switch (Entry.Kind) {
3048  case llvm::BitstreamEntry::SubBlock: // Handled for us already.
3050  Error("malformed block record in AST file");
3051  return nullptr;
3052  case llvm::BitstreamEntry::EndBlock:
3053  goto Done;
3054  case llvm::BitstreamEntry::Record:
3055  // The interesting case.
3056  break;
3057  }
3058 
3059  ASTContext &Context = getContext();
3060  Stmt *S = nullptr;
3061  bool Finished = false;
3062  bool IsStmtReference = false;
3063  switch ((StmtCode)Record.readRecord(Cursor, Entry.ID)) {
3064  case STMT_STOP:
3065  Finished = true;
3066  break;
3067 
3068  case STMT_REF_PTR:
3069  IsStmtReference = true;
3070  assert(StmtEntries.find(Record[0]) != StmtEntries.end() &&
3071  "No stmt was recorded for this offset reference!");
3072  S = StmtEntries[Record.readInt()];
3073  break;
3074 
3075  case STMT_NULL_PTR:
3076  S = nullptr;
3077  break;
3078 
3079  case STMT_NULL:
3080  S = new (Context) NullStmt(Empty);
3081  break;
3082 
3083  case STMT_COMPOUND:
3084  S = new (Context) CompoundStmt(Empty);
3085  break;
3086 
3087  case STMT_CASE:
3088  S = new (Context) CaseStmt(Empty);
3089  break;
3090 
3091  case STMT_DEFAULT:
3092  S = new (Context) DefaultStmt(Empty);
3093  break;
3094 
3095  case STMT_LABEL:
3096  S = new (Context) LabelStmt(Empty);
3097  break;
3098 
3099  case STMT_ATTRIBUTED:
3101  Context,
3102  /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]);
3103  break;
3104 
3105  case STMT_IF:
3106  S = new (Context) IfStmt(Empty);
3107  break;
3108 
3109  case STMT_SWITCH:
3110  S = new (Context) SwitchStmt(Empty);
3111  break;
3112 
3113  case STMT_WHILE:
3114  S = new (Context) WhileStmt(Empty);
3115  break;
3116 
3117  case STMT_DO:
3118  S = new (Context) DoStmt(Empty);
3119  break;
3120 
3121  case STMT_FOR:
3122  S = new (Context) ForStmt(Empty);
3123  break;
3124 
3125  case STMT_GOTO:
3126  S = new (Context) GotoStmt(Empty);
3127  break;
3128 
3129  case STMT_INDIRECT_GOTO:
3130  S = new (Context) IndirectGotoStmt(Empty);
3131  break;
3132 
3133  case STMT_CONTINUE:
3134  S = new (Context) ContinueStmt(Empty);
3135  break;
3136 
3137  case STMT_BREAK:
3138  S = new (Context) BreakStmt(Empty);
3139  break;
3140 
3141  case STMT_RETURN:
3142  S = new (Context) ReturnStmt(Empty);
3143  break;
3144 
3145  case STMT_DECL:
3146  S = new (Context) DeclStmt(Empty);
3147  break;
3148 
3149  case STMT_GCCASM:
3150  S = new (Context) GCCAsmStmt(Empty);
3151  break;
3152 
3153  case STMT_MSASM:
3154  S = new (Context) MSAsmStmt(Empty);
3155  break;
3156 
3157  case STMT_CAPTURED:
3159  Record[ASTStmtReader::NumStmtFields]);
3160  break;
3161 
3162  case EXPR_PREDEFINED:
3163  S = new (Context) PredefinedExpr(Empty);
3164  break;
3165 
3166  case EXPR_DECL_REF:
3168  Context,
3169  /*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
3170  /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
3171  /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2],
3172  /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ?
3173  Record[ASTStmtReader::NumExprFields + 5] : 0);
3174  break;
3175 
3176  case EXPR_INTEGER_LITERAL:
3177  S = IntegerLiteral::Create(Context, Empty);
3178  break;
3179 
3180  case EXPR_FLOATING_LITERAL:
3181  S = FloatingLiteral::Create(Context, Empty);
3182  break;
3183 
3185  S = new (Context) ImaginaryLiteral(Empty);
3186  break;
3187 
3188  case EXPR_STRING_LITERAL:
3189  S = StringLiteral::CreateEmpty(Context,
3190  Record[ASTStmtReader::NumExprFields + 1]);
3191  break;
3192 
3194  S = new (Context) CharacterLiteral(Empty);
3195  break;
3196 
3197  case EXPR_PAREN:
3198  S = new (Context) ParenExpr(Empty);
3199  break;
3200 
3201  case EXPR_PAREN_LIST:
3202  S = new (Context) ParenListExpr(Empty);
3203  break;
3204 
3205  case EXPR_UNARY_OPERATOR:
3206  S = new (Context) UnaryOperator(Empty);
3207  break;
3208 
3209  case EXPR_OFFSETOF:
3210  S = OffsetOfExpr::CreateEmpty(Context,
3211  Record[ASTStmtReader::NumExprFields],
3212  Record[ASTStmtReader::NumExprFields + 1]);
3213  break;
3214 
3215  case EXPR_SIZEOF_ALIGN_OF:
3216  S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
3217  break;
3218 
3219  case EXPR_ARRAY_SUBSCRIPT:
3220  S = new (Context) ArraySubscriptExpr(Empty);
3221  break;
3222 
3224  S = new (Context) OMPArraySectionExpr(Empty);
3225  break;
3226 
3227  case EXPR_CALL:
3228  S = new (Context) CallExpr(Context, Stmt::CallExprClass, Empty);
3229  break;
3230 
3231  case EXPR_MEMBER: {
3232  // We load everything here and fully initialize it at creation.
3233  // That way we can use MemberExpr::Create and don't have to duplicate its
3234  // logic with a MemberExpr::CreateEmpty.
3235 
3236  assert(Record.getIdx() == 0);
3237  NestedNameSpecifierLoc QualifierLoc;
3238  if (Record.readInt()) { // HasQualifier.
3239  QualifierLoc = Record.readNestedNameSpecifierLoc();
3240  }
3241 
3242  SourceLocation TemplateKWLoc;
3243  TemplateArgumentListInfo ArgInfo;
3244  bool HasTemplateKWAndArgsInfo = Record.readInt();
3245  if (HasTemplateKWAndArgsInfo) {
3246  TemplateKWLoc = Record.readSourceLocation();
3247  unsigned NumTemplateArgs = Record.readInt();
3248  ArgInfo.setLAngleLoc(Record.readSourceLocation());
3249  ArgInfo.setRAngleLoc(Record.readSourceLocation());
3250  for (unsigned i = 0; i != NumTemplateArgs; ++i)
3251  ArgInfo.addArgument(Record.readTemplateArgumentLoc());
3252  }
3253 
3254  bool HadMultipleCandidates = Record.readInt();
3255 
3256  NamedDecl *FoundD = Record.readDeclAs<NamedDecl>();
3257  AccessSpecifier AS = (AccessSpecifier)Record.readInt();
3258  DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS);
3259 
3260  QualType T = Record.readType();
3261  ExprValueKind VK = static_cast<ExprValueKind>(Record.readInt());
3262  ExprObjectKind OK = static_cast<ExprObjectKind>(Record.readInt());
3263  Expr *Base = ReadSubExpr();
3264  ValueDecl *MemberD = Record.readDeclAs<ValueDecl>();
3265  SourceLocation MemberLoc = Record.readSourceLocation();
3266  DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
3267  bool IsArrow = Record.readInt();
3268  SourceLocation OperatorLoc = Record.readSourceLocation();
3269 
3270  S = MemberExpr::Create(Context, Base, IsArrow, OperatorLoc, QualifierLoc,
3271  TemplateKWLoc, MemberD, FoundDecl, MemberNameInfo,
3272  HasTemplateKWAndArgsInfo ? &ArgInfo : nullptr, T,
3273  VK, OK);
3274  Record.readDeclarationNameLoc(cast<MemberExpr>(S)->MemberDNLoc,
3275  MemberD->getDeclName());
3276  if (HadMultipleCandidates)
3277  cast<MemberExpr>(S)->setHadMultipleCandidates(true);
3278  break;
3279  }
3280 
3281  case EXPR_BINARY_OPERATOR:
3282  S = new (Context) BinaryOperator(Empty);
3283  break;
3284 
3286  S = new (Context) CompoundAssignOperator(Empty);
3287  break;
3288 
3290  S = new (Context) ConditionalOperator(Empty);
3291  break;
3292 
3294  S = new (Context) BinaryConditionalOperator(Empty);
3295  break;
3296 
3297  case EXPR_IMPLICIT_CAST:
3298  S = ImplicitCastExpr::CreateEmpty(Context,
3299  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3300  break;
3301 
3302  case EXPR_CSTYLE_CAST:
3303  S = CStyleCastExpr::CreateEmpty(Context,
3304  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3305  break;
3306 
3307  case EXPR_COMPOUND_LITERAL:
3308  S = new (Context) CompoundLiteralExpr(Empty);
3309  break;
3310 
3312  S = new (Context) ExtVectorElementExpr(Empty);
3313  break;
3314 
3315  case EXPR_INIT_LIST:
3316  S = new (Context) InitListExpr(Empty);
3317  break;
3318 
3319  case EXPR_DESIGNATED_INIT:
3320  S = DesignatedInitExpr::CreateEmpty(Context,
3321  Record[ASTStmtReader::NumExprFields] - 1);
3322 
3323  break;
3324 
3326  S = new (Context) DesignatedInitUpdateExpr(Empty);
3327  break;
3328 
3330  S = new (Context) ImplicitValueInitExpr(Empty);
3331  break;
3332 
3333  case EXPR_NO_INIT:
3334  S = new (Context) NoInitExpr(Empty);
3335  break;
3336 
3337  case EXPR_ARRAY_INIT_LOOP:
3338  S = new (Context) ArrayInitLoopExpr(Empty);
3339  break;
3340 
3341  case EXPR_ARRAY_INIT_INDEX:
3342  S = new (Context) ArrayInitIndexExpr(Empty);
3343  break;
3344 
3345  case EXPR_VA_ARG:
3346  S = new (Context) VAArgExpr(Empty);
3347  break;
3348 
3349  case EXPR_ADDR_LABEL:
3350  S = new (Context) AddrLabelExpr(Empty);
3351  break;
3352 
3353  case EXPR_STMT:
3354  S = new (Context) StmtExpr(Empty);
3355  break;
3356 
3357  case EXPR_CHOOSE:
3358  S = new (Context) ChooseExpr(Empty);
3359  break;
3360 
3361  case EXPR_GNU_NULL:
3362  S = new (Context) GNUNullExpr(Empty);
3363  break;
3364 
3365  case EXPR_SHUFFLE_VECTOR:
3366  S = new (Context) ShuffleVectorExpr(Empty);
3367  break;
3368 
3369  case EXPR_CONVERT_VECTOR:
3370  S = new (Context) ConvertVectorExpr(Empty);
3371  break;
3372 
3373  case EXPR_BLOCK:
3374  S = new (Context) BlockExpr(Empty);
3375  break;
3376 
3378  S = new (Context) GenericSelectionExpr(Empty);
3379  break;
3380 
3382  S = new (Context) ObjCStringLiteral(Empty);
3383  break;
3385  S = new (Context) ObjCBoxedExpr(Empty);
3386  break;
3388  S = ObjCArrayLiteral::CreateEmpty(Context,
3389  Record[ASTStmtReader::NumExprFields]);
3390  break;
3393  Record[ASTStmtReader::NumExprFields],
3394  Record[ASTStmtReader::NumExprFields + 1]);
3395  break;
3396  case EXPR_OBJC_ENCODE:
3397  S = new (Context) ObjCEncodeExpr(Empty);
3398  break;
3400  S = new (Context) ObjCSelectorExpr(Empty);
3401  break;
3403  S = new (Context) ObjCProtocolExpr(Empty);
3404  break;
3406  S = new (Context) ObjCIvarRefExpr(Empty);
3407  break;
3409  S = new (Context) ObjCPropertyRefExpr(Empty);
3410  break;
3412  S = new (Context) ObjCSubscriptRefExpr(Empty);
3413  break;
3415  llvm_unreachable("mismatching AST file");
3417  S = ObjCMessageExpr::CreateEmpty(Context,
3418  Record[ASTStmtReader::NumExprFields],
3419  Record[ASTStmtReader::NumExprFields + 1]);
3420  break;
3421  case EXPR_OBJC_ISA:
3422  S = new (Context) ObjCIsaExpr(Empty);
3423  break;
3425  S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
3426  break;
3428  S = new (Context) ObjCBridgedCastExpr(Empty);
3429  break;
3431  S = new (Context) ObjCForCollectionStmt(Empty);
3432  break;
3433  case STMT_OBJC_CATCH:
3434  S = new (Context) ObjCAtCatchStmt(Empty);
3435  break;
3436  case STMT_OBJC_FINALLY:
3437  S = new (Context) ObjCAtFinallyStmt(Empty);
3438  break;
3439  case STMT_OBJC_AT_TRY:
3440  S = ObjCAtTryStmt::CreateEmpty(Context,
3441  Record[ASTStmtReader::NumStmtFields],
3442  Record[ASTStmtReader::NumStmtFields + 1]);
3443  break;
3445  S = new (Context) ObjCAtSynchronizedStmt(Empty);
3446  break;
3447  case STMT_OBJC_AT_THROW:
3448  S = new (Context) ObjCAtThrowStmt(Empty);
3449  break;
3451  S = new (Context) ObjCAutoreleasePoolStmt(Empty);
3452  break;
3454  S = new (Context) ObjCBoolLiteralExpr(Empty);
3455  break;
3457  S = new (Context) ObjCAvailabilityCheckExpr(Empty);
3458  break;
3459  case STMT_SEH_LEAVE:
3460  S = new (Context) SEHLeaveStmt(Empty);
3461  break;
3462  case STMT_SEH_EXCEPT:
3463  S = new (Context) SEHExceptStmt(Empty);
3464  break;
3465  case STMT_SEH_FINALLY:
3466  S = new (Context) SEHFinallyStmt(Empty);
3467  break;
3468  case STMT_SEH_TRY:
3469  S = new (Context) SEHTryStmt(Empty);
3470  break;
3471  case STMT_CXX_CATCH:
3472  S = new (Context) CXXCatchStmt(Empty);
3473  break;
3474 
3475  case STMT_CXX_TRY:
3476  S = CXXTryStmt::Create(Context, Empty,
3477  /*NumHandlers=*/Record[ASTStmtReader::NumStmtFields]);
3478  break;
3479 
3480  case STMT_CXX_FOR_RANGE:
3481  S = new (Context) CXXForRangeStmt(Empty);
3482  break;
3483 
3485  S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
3488  nullptr);
3489  break;
3490 
3492  S =
3494  Record[ASTStmtReader::NumStmtFields],
3495  Empty);
3496  break;
3497 
3498  case STMT_OMP_SIMD_DIRECTIVE: {
3499  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3500  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3501  S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
3502  CollapsedNum, Empty);
3503  break;
3504  }
3505 
3506  case STMT_OMP_FOR_DIRECTIVE: {
3507  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3508  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3509  S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3510  Empty);
3511  break;
3512  }
3513 
3515  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3516  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3517  S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3518  Empty);
3519  break;
3520  }
3521 
3524  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3525  break;
3526 
3528  S = OMPSectionDirective::CreateEmpty(Context, Empty);
3529  break;
3530 
3533  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3534  break;
3535 
3537  S = OMPMasterDirective::CreateEmpty(Context, Empty);
3538  break;
3539 
3542  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3543  break;
3544 
3546  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3547  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3548  S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
3549  CollapsedNum, Empty);
3550  break;
3551  }
3552 
3554  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3555  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3556  S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3557  CollapsedNum, Empty);
3558  break;
3559  }
3560 
3563  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3564  break;
3565 
3568  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3569  break;
3570 
3572  S = OMPTaskyieldDirective::CreateEmpty(Context, Empty);
3573  break;
3574 
3576  S = OMPBarrierDirective::CreateEmpty(Context, Empty);
3577  break;
3578 
3580  S = OMPTaskwaitDirective::CreateEmpty(Context, Empty);
3581  break;
3582 
3585  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3586  break;
3587 
3590  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3591  break;
3592 
3595  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3596  break;
3597 
3600  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3601  break;
3602 
3605  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3606  break;
3607 
3610  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3611  break;
3612 
3615  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3616  break;
3617 
3620  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3621  break;
3622 
3625  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3626  break;
3627 
3629  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3630  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3631  S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
3632  CollapsedNum, Empty);
3633  break;
3634  }
3635 
3638  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3639  break;
3640 
3643  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3644  break;
3645 
3647  S = OMPCancellationPointDirective::CreateEmpty(Context, Empty);
3648  break;
3649 
3652  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3653  break;
3654 
3656  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3657  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3658  S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3659  Empty);
3660  break;
3661  }
3662 
3664  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3665  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3666  S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
3667  CollapsedNum, Empty);
3668  break;
3669  }
3670 
3672  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3673  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3674  S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3675  Empty);
3676  break;
3677  }
3678 
3680  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3681  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3682  S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
3683  CollapsedNum, Empty);
3684  break;
3685  }
3686 
3688  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3689  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3691  CollapsedNum,
3692  Empty);
3693  break;
3694  }
3695 
3697  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3698  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3699  S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3700  CollapsedNum, Empty);
3701  break;
3702  }
3703 
3705  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3706  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3707  S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
3708  CollapsedNum, Empty);
3709  break;
3710  }
3711 
3713  auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3714  auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3715  S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
3716  Empty);
3717  break;
3718  }
3719 
3721  auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3722  auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3723  S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3724  CollapsedNum, Empty);
3725  break;
3726  }
3727 
3729  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3730  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3731  S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
3732  CollapsedNum, Empty);
3733  break;
3734  }
3735 
3737  auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3738  auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3740  Context, NumClauses, CollapsedNum, Empty);
3741  break;
3742  }
3743 
3745  auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3746  auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3748  Context, NumClauses, CollapsedNum, Empty);
3749  break;
3750  }
3751 
3754  Context, Record[ASTStmtReader::NumStmtFields], Empty);
3755  break;
3756  }
3757 
3759  auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3760  auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3761  S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
3762  CollapsedNum, Empty);
3763  break;
3764  }
3765 
3767  auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3768  auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3770  Context, NumClauses, CollapsedNum, Empty);
3771  break;
3772  }
3773 
3775  auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3776  auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3778  Context, NumClauses, CollapsedNum, Empty);
3779  break;
3780  }
3781 
3783  auto NumClauses = Record[ASTStmtReader::NumStmtFields];
3784  auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
3786  Context, NumClauses, CollapsedNum, Empty);
3787  break;
3788  }
3789 
3791  S = new (Context) CXXOperatorCallExpr(Context, Empty);
3792  break;
3793 
3794  case EXPR_CXX_MEMBER_CALL:
3795  S = new (Context) CXXMemberCallExpr(Context, Empty);
3796  break;
3797 
3798  case EXPR_CXX_CONSTRUCT:
3799  S = new (Context) CXXConstructExpr(Empty);
3800  break;
3801 
3803  S = new (Context) CXXInheritedCtorInitExpr(Empty);
3804  break;
3805 
3807  S = new (Context) CXXTemporaryObjectExpr(Empty);
3808  break;
3809 
3810  case EXPR_CXX_STATIC_CAST:
3811  S = CXXStaticCastExpr::CreateEmpty(Context,
3812  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3813  break;
3814 
3815  case EXPR_CXX_DYNAMIC_CAST:
3816  S = CXXDynamicCastExpr::CreateEmpty(Context,
3817  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3818  break;
3819 
3822  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3823  break;
3824 
3825  case EXPR_CXX_CONST_CAST:
3826  S = CXXConstCastExpr::CreateEmpty(Context);
3827  break;
3828 
3831  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
3832  break;
3833 
3835  S = new (Context) UserDefinedLiteral(Context, Empty);
3836  break;
3837 
3839  S = new (Context) CXXStdInitializerListExpr(Empty);
3840  break;
3841 
3842  case EXPR_CXX_BOOL_LITERAL:
3843  S = new (Context) CXXBoolLiteralExpr(Empty);
3844  break;
3845 
3847  S = new (Context) CXXNullPtrLiteralExpr(Empty);
3848  break;
3849  case EXPR_CXX_TYPEID_EXPR:
3850  S = new (Context) CXXTypeidExpr(Empty, true);
3851  break;
3852  case EXPR_CXX_TYPEID_TYPE:
3853  S = new (Context) CXXTypeidExpr(Empty, false);
3854  break;
3855  case EXPR_CXX_UUIDOF_EXPR:
3856  S = new (Context) CXXUuidofExpr(Empty, true);
3857  break;
3859  S = new (Context) MSPropertyRefExpr(Empty);
3860  break;
3862  S = new (Context) MSPropertySubscriptExpr(Empty);
3863  break;
3864  case EXPR_CXX_UUIDOF_TYPE:
3865  S = new (Context) CXXUuidofExpr(Empty, false);
3866  break;
3867  case EXPR_CXX_THIS:
3868  S = new (Context) CXXThisExpr(Empty);
3869  break;
3870  case EXPR_CXX_THROW:
3871  S = new (Context) CXXThrowExpr(Empty);
3872  break;
3873  case EXPR_CXX_DEFAULT_ARG:
3874  S = new (Context) CXXDefaultArgExpr(Empty);
3875  break;
3876  case EXPR_CXX_DEFAULT_INIT:
3877  S = new (Context) CXXDefaultInitExpr(Empty);
3878  break;
3880  S = new (Context) CXXBindTemporaryExpr(Empty);
3881  break;
3882 
3884  S = new (Context) CXXScalarValueInitExpr(Empty);
3885  break;
3886  case EXPR_CXX_NEW:
3887  S = new (Context) CXXNewExpr(Empty);
3888  break;
3889  case EXPR_CXX_DELETE:
3890  S = new (Context) CXXDeleteExpr(Empty);
3891  break;
3893  S = new (Context) CXXPseudoDestructorExpr(Empty);
3894  break;
3895 
3897  S = ExprWithCleanups::Create(Context, Empty,
3898  Record[ASTStmtReader::NumExprFields]);
3899  break;
3900 
3903  /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3904  /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3905  ? Record[ASTStmtReader::NumExprFields + 1]
3906  : 0);
3907  break;
3908 
3911  /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3912  /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3913  ? Record[ASTStmtReader::NumExprFields + 1]
3914  : 0);
3915  break;
3916 
3919  /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3920  break;
3921 
3924  /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3925  /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3926  ? Record[ASTStmtReader::NumExprFields + 1]
3927  : 0);
3928  break;
3929 
3932  /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3933  /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3934  ? Record[ASTStmtReader::NumExprFields + 1]
3935  : 0);
3936  break;
3937 
3938  case EXPR_TYPE_TRAIT:
3940  Record[ASTStmtReader::NumExprFields]);
3941  break;
3942 
3943  case EXPR_ARRAY_TYPE_TRAIT:
3944  S = new (Context) ArrayTypeTraitExpr(Empty);
3945  break;
3946 
3948  S = new (Context) ExpressionTraitExpr(Empty);
3949  break;
3950 
3951  case EXPR_CXX_NOEXCEPT:
3952  S = new (Context) CXXNoexceptExpr(Empty);
3953  break;
3954 
3955  case EXPR_PACK_EXPANSION:
3956  S = new (Context) PackExpansionExpr(Empty);
3957  break;
3958 
3959  case EXPR_SIZEOF_PACK:
3961  Context,
3962  /*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]);
3963  break;
3964 
3966  S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
3967  break;
3968 
3970  S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
3971  break;
3972 
3975  Record[ASTStmtReader::NumExprFields]);
3976  break;
3977 
3979  S = new (Context) MaterializeTemporaryExpr(Empty);
3980  break;
3981 
3982  case EXPR_CXX_FOLD:
3983  S = new (Context) CXXFoldExpr(Empty);
3984  break;
3985 
3986  case EXPR_OPAQUE_VALUE:
3987  S = new (Context) OpaqueValueExpr(Empty);
3988  break;
3989 
3990  case EXPR_CUDA_KERNEL_CALL:
3991  S = new (Context) CUDAKernelCallExpr(Context, Empty);
3992  break;
3993 
3994  case EXPR_ASTYPE:
3995  S = new (Context) AsTypeExpr(Empty);
3996  break;
3997 
3998  case EXPR_PSEUDO_OBJECT: {
3999  unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
4000  S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
4001  break;
4002  }
4003 
4004  case EXPR_ATOMIC:
4005  S = new (Context) AtomicExpr(Empty);
4006  break;
4007 
4008  case EXPR_LAMBDA: {
4009  unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
4010  S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
4011  break;
4012  }
4013 
4014  case STMT_COROUTINE_BODY: {
4015  unsigned NumParams = Record[ASTStmtReader::NumStmtFields];
4016  S = CoroutineBodyStmt::Create(Context, Empty, NumParams);
4017  break;
4018  }
4019 
4020  case STMT_CORETURN:
4021  S = new (Context) CoreturnStmt(Empty);
4022  break;
4023 
4024  case EXPR_COAWAIT:
4025  S = new (Context) CoawaitExpr(Empty);
4026  break;
4027 
4028  case EXPR_COYIELD:
4029  S = new (Context) CoyieldExpr(Empty);
4030  break;
4031 
4033  S = new (Context) DependentCoawaitExpr(Empty);
4034  break;
4035 
4036  }
4037 
4038  // We hit a STMT_STOP, so we're done with this expression.
4039  if (Finished)
4040  break;
4041 
4042  ++NumStatementsRead;
4043 
4044  if (S && !IsStmtReference) {
4045  Reader.Visit(S);
4046  StmtEntries[Cursor.GetCurrentBitNo()] = S;
4047  }
4048 
4049  assert(Record.getIdx() == Record.size() &&
4050  "Invalid deserialization of statement");
4051  StmtStack.push_back(S);
4052  }
4053 Done:
4054  assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!");
4055  assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!");
4056  return StmtStack.pop_back_val();
4057 }
void setPreInits(Stmt *PreInits)
Definition: StmtOpenMP.h:469
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
Definition: Stmt.cpp:342
void setFPFeatures(FPOptions F)
Definition: Expr.h:3155
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:577
A PredefinedExpr record.
Definition: ASTBitCodes.h:1517
const uint64_t & readInt()
Returns the current value in this record, and advances to the next value.
Definition: ASTReader.h:2362
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:78
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1517
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:1060
Represents a single C99 designator.
Definition: Expr.h:4181
void setThen(Stmt *S)
Definition: Stmt.h:968
void setConditionVariable(const ASTContext &C, VarDecl *V)
Definition: Stmt.cpp:843
static OMPDependClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
void setValueDependent(bool VD)
Set whether this expression is value-dependent or not.
Definition: Expr.h:152
Defines the clang::ASTContext interface.
void setRParenLoc(SourceLocation L)
Definition: ExprCXX.h:1505
A CompoundLiteralExpr record.
Definition: ASTBitCodes.h:1577
This represents &#39;#pragma omp distribute simd&#39; composite directive.
Definition: StmtOpenMP.h:3190
This represents &#39;#pragma omp master&#39; directive.
Definition: StmtOpenMP.h:1373
DesignatorTypes
The kinds of designators that can occur in a DesignatedInitExpr.
Definition: ASTBitCodes.h:1870
void setRangeStmt(Stmt *S)
Definition: StmtCXX.h:185
SourceLocation readSourceLocation()
Read a source location, advancing Idx.
Definition: ASTReader.h:2554
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:565
This represents &#39;#pragma omp task&#39; directive.
Definition: StmtOpenMP.h:1713
void setEnsureUpperBound(Expr *EUB)
Definition: StmtOpenMP.h:500
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:1616
Represents a &#39;co_await&#39; expression while the type of the promise is dependent.
Definition: ExprCXX.h:4340
void setSubStmt(CompoundStmt *S)
Definition: Expr.h:3506
This represents &#39;thread_limit&#39; clause in the &#39;#pragma omp ...&#39; directive.
The receiver is an object instance.
Definition: ExprObjC.h:1054
unsigned getNumInputs() const
Definition: Stmt.h:1532
static OMPMasterDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:303
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
static OMPCopyinClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
An IndirectGotoStmt record.
Definition: ASTBitCodes.h:1493
This represents clause &#39;copyin&#39; in the &#39;#pragma omp ...&#39; directives.
A (possibly-)qualified type.
Definition: Type.h:653
static OMPUseDevicePtrClause * CreateEmpty(const ASTContext &C, unsigned NumVars, unsigned NumUniqueDeclarations, unsigned NumComponentLists, unsigned NumComponents)
Creates an empty clause with the place for NumVars variables.
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
Definition: Stmt.h:2228
An AddrLabelExpr record.
Definition: ASTBitCodes.h:1607
void setInc(Expr *E)
Definition: StmtCXX.h:189
void setOperatorLoc(SourceLocation L)
Definition: Expr.h:2099
static StringLiteral * CreateEmpty(const ASTContext &C, unsigned NumStrs)
Construct an empty string literal.
Definition: Expr.cpp:879
void setRawSemantics(APFloatSemantics Sem)
Set the raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE...
Definition: Expr.h:1421
void setNRVOCandidate(const VarDecl *Var)
Definition: Stmt.h:1441
void setLocation(SourceLocation L)
Definition: ExprCXX.h:550
A CXXStaticCastExpr record.
Definition: ASTBitCodes.h:1729
ASTStmtReader(ASTRecordReader &Record, llvm::BitstreamCursor &Cursor)
void setCombinedCond(Expr *CombCond)
Definition: StmtOpenMP.h:568
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2339
An AttributedStmt record.
Definition: ASTBitCodes.h:1472
void setCond(Expr *E)
Definition: Stmt.h:1129
A CXXReinterpretCastExpr record.
Definition: ASTBitCodes.h:1735
An ObjCBoolLiteralExpr record.
Definition: ASTBitCodes.h:1697
void setCombinedLowerBoundVariable(Expr *CombLB)
Definition: StmtOpenMP.h:548
void setRHS(Expr *E)
Definition: Expr.h:2160
static OMPTaskwaitDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:519
static OMPTargetParallelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:715
void setHasCancel(bool Has)
Set cancel state.
Definition: StmtOpenMP.h:1300
void setUniqueDecls(ArrayRef< ValueDecl *> UDs)
Set the unique declarations that are in the trailing objects of the class.
Represents a &#39;co_return&#39; statement in the C++ Coroutines TS.
Definition: StmtCXX.h:432
Stmt - This represents one statement.
Definition: Stmt.h:66
static OMPTaskgroupDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:540
void setLastIteration(Expr *LI)
Definition: StmtOpenMP.h:455
This represents clause &#39;in_reduction&#39; in the &#39;#pragma omp task&#39; directives.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: Expr.h:2266
IfStmt - This represents an if/then/else.
Definition: Stmt.h:929
Class that handles pre-initialization statement for some clauses, like &#39;shedule&#39;, &#39;firstprivate&#39; etc...
Definition: OpenMPClause.h:99
void setPrivateCounters(ArrayRef< Expr *> A)
Definition: StmtOpenMP.cpp:32
void setArrow(bool A)
Definition: ExprObjC.h:1465
unsigned getNumOutputs() const
Definition: Stmt.h:1510
This represents &#39;#pragma omp for simd&#39; directive.
Definition: StmtOpenMP.h:1123
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:1638
void setContinueLoc(SourceLocation L)
Definition: Stmt.h:1361
void setThrowExpr(Stmt *S)
Definition: StmtObjC.h:327
void setAtLoc(SourceLocation L)
Definition: ExprObjC.h:447
An ImplicitValueInitExpr record.
Definition: ASTBitCodes.h:1601
static OMPFirstprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
void setDeclGroup(DeclGroupRef DGR)
Definition: Stmt.h:509
This represents &#39;grainsize&#39; clause in the &#39;#pragma omp ...&#39; directive.
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1571
This represents &#39;#pragma omp teams distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:3601
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
void setRBracket(SourceLocation RB)
Definition: ExprObjC.h:839
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:4545
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition: Lambda.h:23
void setType(QualType t)
Definition: Expr.h:129
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2736
This represents &#39;if&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:240
Defines the C++ template declaration subclasses.
void setPrevEnsureUpperBound(Expr *PrevEUB)
Definition: StmtOpenMP.h:543
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression, including the actual initialized value and any expressions that occur within array and array-range designators.
Definition: Expr.h:4352
Represents an attribute applied to a statement.
Definition: Stmt.h:878
void setUpperBoundVariable(Expr *UB)
Definition: StmtOpenMP.h:486
void setComputationResultType(QualType T)
Definition: Expr.h:3218
llvm::APFloat readAPFloat(const llvm::fltSemantics &Sem)
Read a floating-point value, advancing Idx.
Definition: ASTReader.h:2574
void setNumIterations(Expr *NI)
Definition: StmtOpenMP.h:521
static OMPMapClause * CreateEmpty(const ASTContext &C, unsigned NumVars, unsigned NumUniqueDeclarations, unsigned NumComponentLists, unsigned NumComponents)
Creates an empty clause with the place for for NumVars original expressions, NumUniqueDeclarations de...
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:1665
A CXXOperatorCallExpr record.
Definition: ASTBitCodes.h:1714
void setSuper(SourceLocation Loc, QualType T, bool IsInstanceSuper)
Definition: ExprObjC.h:1289
This represents &#39;priority&#39; clause in the &#39;#pragma omp ...&#39; directive.
This represents &#39;#pragma omp target teams distribute&#39; combined directive.
Definition: StmtOpenMP.h:3738
A CXXTemporaryObjectExpr record.
Definition: ASTBitCodes.h:1726
Represents Objective-C&#39;s @throw statement.
Definition: StmtObjC.h:313
void setCond(Expr *E)
Definition: Stmt.h:1174
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
Definition: OpenMPClause.h:717
void setNextLowerBound(Expr *NLB)
Definition: StmtOpenMP.h:507
DeclRefExprBitfields DeclRefExprBits
Definition: Stmt.h:292
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1239
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:802
unsigned NumOutputs
Definition: Stmt.h:1475
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Definition: ExprCXX.h:2423
void setValue(bool V)
Definition: ExprObjC.h:95
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:95
A container of type source information.
Definition: Decl.h:86
This represents &#39;update&#39; clause in the &#39;#pragma omp atomic&#39; directive.
void setSwitchCaseList(SwitchCase *SC)
Set the case list for this switch statement.
Definition: Stmt.h:1056
void setComponents(ArrayRef< MappableComponent > Components, ArrayRef< unsigned > CLSs)
Set the components that are in the trailing objects of the class.
void setInstanceReceiver(Expr *rec)
Turn this message send into an instance message that computes the receiver object with the given expr...
Definition: ExprObjC.h:1218
Floating point control options.
Definition: LangOptions.h:208
This represents &#39;#pragma omp parallel for&#39; directive.
Definition: StmtOpenMP.h:1494
MS property subscript expression.
Definition: ExprCXX.h:797
void setStartLoc(SourceLocation L)
Definition: Stmt.h:512
void setForLoc(SourceLocation L)
Definition: Stmt.h:1251
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
Definition: OpenMPClause.h:584
This represents &#39;#pragma omp target teams distribute parallel for&#39; combined directive.
Definition: StmtOpenMP.h:3806
void setLocation(SourceLocation Loc)
Definition: ExprCXX.h:1305
static ObjCDictionaryLiteral * CreateEmpty(const ASTContext &C, unsigned NumElements, bool HasPackExpansions)
Definition: ExprObjC.cpp:105
void setConditionVariable(const ASTContext &C, VarDecl *V)
Definition: Stmt.cpp:905
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4035
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
Definition: OpenMPClause.h:529
void setLocation(SourceLocation L)
Definition: ExprObjC.h:557
void setDelegateInitCall(bool isDelegate)
Definition: ExprObjC.h:1360
void setProtocol(ObjCProtocolDecl *P)
Definition: ExprObjC.h:491
void setRParenLoc(SourceLocation L)
Definition: ExprCXX.h:3139
static OMPReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
void setIsLastIterVariable(Expr *IL)
Definition: StmtOpenMP.h:472
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
Definition: OpenMPClause.h:954
This represents &#39;#pragma omp target exit data&#39; directive.
Definition: StmtOpenMP.h:2405
void setRAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:566
static OffsetOfExpr * CreateEmpty(const ASTContext &C, unsigned NumComps, unsigned NumExprs)
Definition: Expr.cpp:1358
This represents &#39;read&#39; clause in the &#39;#pragma omp atomic&#39; directive.
static OMPTargetTeamsDistributeSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents clause &#39;private&#39; in the &#39;#pragma omp ...&#39; directives.
static OMPParallelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for N clauses.
Definition: StmtOpenMP.cpp:72
bool hasTemplateKWAndArgsInfo() const
Definition: Expr.h:1088
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC &#39;id&#39; type.
Definition: ExprObjC.h:1436
This represents &#39;num_threads&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:382
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:2637
void setSubExpr(unsigned Idx, Expr *E)
Definition: Expr.h:4359
void setInitializer(Expr *E)
Definition: Expr.h:2665
void setLength(Expr *E)
Set length of the array section.
Definition: ExprOpenMP.h:102
void setOpLoc(SourceLocation L)
Definition: ExprObjC.h:1473
void recordSwitchCaseID(SwitchCase *SC, unsigned ID)
Definition: ASTReader.h:2603
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition: ExprCXX.h:2388
This represents &#39;defaultmap&#39; clause in the &#39;#pragma omp ...&#39; directive.
static FunctionParmPackExpr * CreateEmpty(const ASTContext &Context, unsigned NumParams)
Definition: ExprCXX.cpp:1366
void setInit(Stmt *S)
Definition: Stmt.h:964
void setAsmLoc(SourceLocation L)
Definition: Stmt.h:1492
static DependentScopeDeclRefExpr * CreateEmpty(const ASTContext &C, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition: ExprCXX.cpp:437
QualType readType()
Read a type from the current position in the record.
Definition: ASTReader.h:2453
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:139
void setValue(unsigned Val)
Definition: Expr.h:1376
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Definition: TemplateBase.h:595
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:594
void setStmts(const ASTContext &C, ArrayRef< Stmt *> Stmts)
Definition: Stmt.cpp:318
static DeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Construct an empty declaration reference expression.
Definition: Expr.cpp:435
void setGNUSyntax(bool GNU)
Definition: Expr.h:4337
This represents implicit clause &#39;flush&#39; for the &#39;#pragma omp flush&#39; directive.
A CXXConstructExpr record.
Definition: ASTBitCodes.h:1720
unsigned getNumExpressions() const
Definition: Expr.h:2004
void setBeginStmt(Stmt *S)
Definition: StmtCXX.h:186
void setBase(Expr *E)
Set base of the array section.
Definition: ExprOpenMP.h:85
ReceiverKind
The kind of receiver this message is sending to.
Definition: ExprObjC.h:1049
raw_arg_iterator raw_arg_begin()
Definition: ExprCXX.h:2038
void initializeResults(const ASTContext &C, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
Definition: ExprCXX.cpp:366
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:985
unsigned getTotalComponentsNum() const
Return the total number of components in all lists derived from the clause.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3000
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1514
void setInit(Expr *Init)
Definition: StmtOpenMP.h:467
static OMPTaskReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents &#39;nogroup&#39; clause in the &#39;#pragma omp ...&#39; directive.
void setTarget(Expr *E)
Definition: Stmt.h:1330
A ShuffleVectorExpr record.
Definition: ASTBitCodes.h:1619
This represents &#39;safelen&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:447
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:302
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
Definition: Decl.h:265
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:839
void AllocateArgsArray(const ASTContext &C, bool isArray, unsigned numPlaceArgs, bool hasInitializer)
Definition: ExprCXX.cpp:161
static OMPTargetExitDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
Definition: StmtOpenMP.cpp:832
void setStrTokenLoc(unsigned TokNum, SourceLocation L)
Definition: Expr.h:1623
void setAtLoc(SourceLocation L)
Definition: ExprObjC.h:68
Represents a C99 designated initializer expression.
Definition: Expr.h:4106
unsigned varlist_size() const
Definition: OpenMPClause.h:204
An OffsetOfExpr record.
Definition: ASTBitCodes.h:1547
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Definition: Decl.h:291
NestedNameSpecifierLoc readNestedNameSpecifierLoc()
Definition: ASTReader.h:2508
static OMPTargetTeamsDistributeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
One of these records is kept for each identifier that is lexed.
An ObjCAtThrowStmt record.
Definition: ASTBitCodes.h:1691
T * readDeclAs()
Reads a declaration from the given position in the record, advancing Idx.
Definition: ASTReader.h:2476
static OMPTargetDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:690
void setOpcode(Opcode O)
Definition: Expr.h:1742
A DesignatedInitExpr record.
Definition: ASTBitCodes.h:1586
This represents &#39;#pragma omp parallel&#39; directive.
Definition: StmtOpenMP.h:251
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:3533
void setExprOperand(Expr *E)
Definition: ExprCXX.h:907
void setInit(Stmt *S)
Definition: Stmt.h:1044
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:149
A C++ nested-name-specifier augmented with source location information.
This represents &#39;simd&#39; clause in the &#39;#pragma omp ...&#39; directive.
void setLHS(Expr *E)
Definition: Expr.h:2156
static OMPTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:953
Internal struct for storing Key/value pair.
Definition: ExprObjC.h:268
void setKeyExpr(Stmt *S)
Definition: ExprObjC.h:851
static OMPTargetParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:763
static ObjCMessageExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs, unsigned NumStoredSelLocs)
Create an empty Objective-C message expression, to be filled in by subsequent calls.
Definition: ExprObjC.cpp:264
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
Definition: Decl.h:2461
This represents clause &#39;lastprivate&#39; in the &#39;#pragma omp ...&#39; directives.
void setIsMicrosoftABI(bool IsMS)
Definition: Expr.h:3802
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:4400
void setNumArgs(const ASTContext &C, unsigned NumArgs)
setNumArgs - This changes the number of arguments present in this call.
Definition: Expr.cpp:1251
void setRequiresZeroInitialization(bool ZeroInit)
Definition: ExprCXX.h:1330
static OMPFlushDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:608
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:3744
This represents clause &#39;map&#39; in the &#39;#pragma omp ...&#39; directives.
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
void setArg(unsigned I, Expr *E)
Definition: ExprCXX.h:3171
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
Definition: Expr.h:2288
This represents clause &#39;to&#39; in the &#39;#pragma omp ...&#39; directives.
void setColonLoc(SourceLocation Loc)
Sets the location of &#39;:&#39;.
void setRParen(SourceLocation Loc)
Definition: Expr.h:1694
TemplateArgument readTemplateArgument(bool Canonicalize=false)
Read a template argument, advancing Idx.
Definition: ASTReader.h:2518
This represents &#39;#pragma omp target simd&#39; directive.
Definition: StmtOpenMP.h:3326
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
Definition: Stmt.cpp:1106
void setReturnLoc(SourceLocation L)
Definition: Stmt.h:1433
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3439
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:4790
OpenMPDirectiveKind getDirectiveKind() const
Definition: StmtOpenMP.h:221
void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C)
This represents &#39;#pragma omp barrier&#39; directive.
Definition: StmtOpenMP.h:1825
void setComponent(unsigned Idx, OffsetOfNode ON)
Definition: Expr.h:1980
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:171
TypeSourceInfo * getTypeSourceInfo()
Reads a declarator info from the given record, advancing Idx.
Definition: ASTReader.h:2443
This is a common base class for loop directives (&#39;omp simd&#39;, &#39;omp for&#39;, &#39;omp for simd&#39; etc...
Definition: StmtOpenMP.h:313
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:3894
void setSubStmt(Stmt *S)
Definition: Stmt.h:775
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
This represents &#39;#pragma omp critical&#39; directive.
Definition: StmtOpenMP.h:1420
for(const auto &A :T->param_types())
static OMPCriticalDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:325
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3514
void setCond(Expr *Cond)
Definition: StmtOpenMP.h:464
size_t size() const
The length of this record.
Definition: ASTReader.h:2352
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:74
void setBody(Stmt *S)
Definition: Stmt.h:1052
void setLBraceLoc(SourceLocation Loc)
Definition: Expr.h:4018
This represents clause &#39;copyprivate&#39; in the &#39;#pragma omp ...&#39; directives.
static OMPTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:903
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:1308
Describes an C or C++ initializer list.
Definition: Expr.h:3872
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:638
This represents &#39;#pragma omp distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:3041
void setValue(const ASTContext &C, const llvm::APInt &Val)
Definition: Expr.h:1280
This represents &#39;#pragma omp teams distribute parallel for simd&#39; composite directive.
Definition: StmtOpenMP.h:3530
void setBuiltinLoc(SourceLocation L)
Definition: Expr.h:3552
BinaryOperatorKind
void setSubExpr(Expr *E)
Definition: Expr.h:1683
void setLHS(Expr *E)
Definition: Expr.h:3712
ForStmt - This represents a &#39;for (init;cond;inc)&#39; stmt.
Definition: Stmt.h:1203
void setOperatorNew(FunctionDecl *D)
Definition: ExprCXX.h:1943
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
void setLocation(SourceLocation L)
Definition: ExprCXX.h:581
void setCond(Expr *E)
Definition: Stmt.h:1050
static OMPDistributeSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
void setSynchBody(Stmt *S)
Definition: StmtObjC.h:288
static OMPIsDevicePtrClause * CreateEmpty(const ASTContext &C, unsigned NumVars, unsigned NumUniqueDeclarations, unsigned NumComponentLists, unsigned NumComponents)
Creates an empty clause with the place for NumVars variables.
A convenient class for passing around template argument information.
Definition: TemplateBase.h:546
static OMPInReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
void setSelector(Selector S)
Definition: ExprObjC.h:443
A reference to a previously [de]serialized Stmt record.
Definition: ASTBitCodes.h:1454
void setEndLoc(SourceLocation L)
Definition: Stmt.h:514
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition: ExprCXX.h:1725
path_iterator path_begin()
Definition: Expr.h:2777
void setLocation(SourceLocation L)
Definition: ExprObjC.h:101
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:2985
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
Definition: OpenMPClause.h:647
static OMPTargetTeamsDistributeParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
void setAccessor(IdentifierInfo *II)
Definition: Expr.h:4813
static OMPToClause * CreateEmpty(const ASTContext &C, unsigned NumVars, unsigned NumUniqueDeclarations, unsigned NumComponentLists, unsigned NumComponents)
Creates an empty clause with the place for NumVars variables.
CXXForRangeStmt - This represents C++0x [stmt.ranged]&#39;s ranged for statement, represented as &#39;for (ra...
Definition: StmtCXX.h:128
Class that handles post-update expression for some clauses, like &#39;lastprivate&#39;, &#39;reduction&#39; etc...
Definition: OpenMPClause.h:135
SourceRange readSourceRange()
Read a source range, advancing Idx.
Definition: ASTReader.h:2559
static const unsigned NumStmtFields
The number of record fields required for the Stmt class itself.
This represents &#39;#pragma omp cancellation point&#39; directive.
Definition: StmtOpenMP.h:2660
void setString(StringLiteral *S)
Definition: ExprObjC.h:65
void setAsmString(StringLiteral *E)
Definition: Stmt.h:1644
This represents &#39;default&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:606
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:51
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:5232
This represents &#39;final&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:330
This represents &#39;mergeable&#39; clause in the &#39;#pragma omp ...&#39; directive.
void setCombinedInit(Expr *CombInit)
Definition: StmtOpenMP.h:563
void setListInitialization(bool V)
Definition: ExprCXX.h:1318
void setLHS(Expr *Val)
Definition: Stmt.h:776
This represents &#39;#pragma omp teams&#39; directive.
Definition: StmtOpenMP.h:2603
void setOperatorLoc(SourceLocation L)
Definition: Expr.h:1962
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:2710
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
This represents clause &#39;reduction&#39; in the &#39;#pragma omp ...&#39; directives.
void setBody(Stmt *S)
Definition: Stmt.h:1132
Helper class for OffsetOfExpr.
Definition: Expr.h:1822
A marker record that indicates that we are at the end of an expression.
Definition: ASTBitCodes.h:1448
This represents &#39;#pragma omp teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:3460
static OMPTargetParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1196
void setDestroyedType(IdentifierInfo *II, SourceLocation Loc)
Set the name of destroyed type for a dependent pseudo-destructor expression.
Definition: ExprCXX.h:2311
ArrayTypeTrait
Names for the array type traits.
Definition: TypeTraits.h:90
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1580
static OMPTaskyieldDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:491
void setCond(Expr *E)
Definition: Stmt.h:1246
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value &#39;V&#39; and type &#39;type&#39;.
Definition: Expr.cpp:748
void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args, TemplateArgumentLoc *ArgsLocArray, unsigned NumTemplateArgs)
Read and initialize a ExplicitTemplateArgumentList structure.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3202
This represents clause &#39;is_device_ptr&#39; in the &#39;#pragma omp ...&#39; directives.
void setRParenLoc(SourceLocation Loc)
Definition: StmtObjC.h:56
CXXBaseSpecifier readCXXBaseSpecifier()
Read a C++ base specifier, advancing Idx.
Definition: ASTReader.h:2540
unsigned getUniqueDeclarationsNum() const
Return the number of unique base declarations in this clause.
void setRParenLoc(SourceLocation R)
Definition: Expr.h:1966
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1042
void setStmt(LabelStmt *T)
Definition: Decl.h:485
bool isTypeOperand() const
Definition: ExprCXX.h:885
const uint64_t & peekInt()
Returns the current value in this record, without advancing.
Definition: ASTReader.h:2365
void setSourceRange(SourceRange R)
Definition: ExprCXX.h:918
unsigned NumClobbers
Definition: Stmt.h:1477
void setRParenLoc(SourceLocation L)
Definition: Expr.h:2952
This represents clause &#39;from&#39; in the &#39;#pragma omp ...&#39; directives.
Represents the this expression in C++.
Definition: ExprCXX.h:945
void setCastKind(CastKind K)
Definition: Expr.h:2758
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Definition: TemplateBase.h:638
static OMPTargetDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
Definition: StmtOpenMP.cpp:787
static OMPTeamsDistributeSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
void setEqualOrColonLoc(SourceLocation L)
Definition: Expr.h:4332
This represents &#39;#pragma omp target parallel for simd&#39; directive.
Definition: StmtOpenMP.h:3258
void setArgument(Expr *E)
Definition: Expr.h:2083
OpenMP 4.0 [2.4, Array Sections].
Definition: ExprOpenMP.h:45
void setTypeSourceInfo(TypeSourceInfo *tsi)
Definition: Expr.h:1971
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:3269
static OMPTargetSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2197
void setAmpAmpLoc(SourceLocation L)
Definition: Expr.h:3459
void setBreakLoc(SourceLocation L)
Definition: Stmt.h:1390
ASTTemplateKWAndArgsInfo * getTrailingASTTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition: ExprCXX.h:3575
void setFPFeatures(FPOptions F)
Definition: ExprCXX.h:145
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:595
void setBlockDecl(BlockDecl *BD)
Definition: Expr.h:4867
This represents &#39;threads&#39; clause in the &#39;#pragma omp ...&#39; directive.
This represents &#39;#pragma omp taskgroup&#39; directive.
Definition: StmtOpenMP.h:1913
static OMPSingleDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:282
CastKind
CastKind - The kind of operation required for a conversion.
void setSemiLoc(SourceLocation L)
Definition: Stmt.h:578
This represents clause &#39;aligned&#39; in the &#39;#pragma omp ...&#39; directives.
static OMPAlignedClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
void setSubExpr(Expr *E)
Definition: Expr.h:1745
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2031
void setLocEnd(SourceLocation Loc)
Sets the ending location of the clause.
Definition: OpenMPClause.h:76
void setLParen(SourceLocation Loc)
Definition: Expr.h:1690
This represents clause &#39;task_reduction&#39; in the &#39;#pragma omp taskgroup&#39; directives.
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:3778
static OMPTeamsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:856
void setLeaveLoc(SourceLocation L)
Definition: Stmt.h:2030
This represents &#39;#pragma omp distribute&#39; directive.
Definition: StmtOpenMP.h:2914
This represents implicit clause &#39;depend&#39; for the &#39;#pragma omp task&#39; directive.
void setString(const ASTContext &C, StringRef Str, StringKind Kind, bool IsPascal)
Sets the string data to the given string data.
Definition: Expr.cpp:987
void setInits(ArrayRef< Expr *> A)
Definition: StmtOpenMP.cpp:39
void setOperatorDelete(FunctionDecl *D)
Definition: ExprCXX.h:1945
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:1185
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
Definition: ExprCXX.h:1802
void setLocation(SourceLocation Location)
Definition: Expr.h:1374
void setRParenLoc(SourceLocation Loc)
Definition: StmtObjC.h:105
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
Definition: Decl.h:3689
This represents &#39;proc_bind&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:675
static OMPSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:111
This represents &#39;capture&#39; clause in the &#39;#pragma omp atomic&#39; directive.
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Definition: Decl.h:628
Expr - This represents one expression.
Definition: Expr.h:106
void setDesignators(const ASTContext &C, const Designator *Desigs, unsigned NumDesigs)
Definition: Expr.cpp:3760
void setRBraceLoc(SourceLocation Loc)
Definition: Expr.h:4020
void setIsImplicit(bool value=true)
Definition: ExprCXX.h:4331
SourceLocation End
void setWhileLoc(SourceLocation L)
Definition: Stmt.h:1135
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition: Specifiers.h:104
void setCallee(Expr *F)
Definition: Expr.h:2251
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3555
const FunctionProtoType * T
This represents &#39;simdlen&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:501
void setLParenLoc(SourceLocation L)
Definition: Stmt.h:1253
void setBase(Expr *Base)
Definition: Expr.h:4456
Stmt * ReadStmt(ModuleFile &F)
Reads a statement.
void setSyntacticForm(InitListExpr *Init)
Definition: Expr.h:4033
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1530
void setRBracketLoc(SourceLocation L)
Definition: ExprOpenMP.h:113
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:420
void setTypeDependent(bool TD)
Set whether this expression is type-dependent or not.
Definition: Expr.h:170
void setTypeOperandSourceInfo(TypeSourceInfo *TSI)
Definition: ExprCXX.h:897
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:4851
Field designator where only the field name is known.
Definition: ASTBitCodes.h:1872
static OMPDistributeParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents &#39;#pragma omp target teams distribute parallel for simd&#39; combined directive.
Definition: StmtOpenMP.h:3890
void setRHS(Expr *E)
Definition: Expr.h:3032
void setInc(Expr *E)
Definition: Stmt.h:1247
raw_arg_iterator raw_arg_end()
Definition: ExprCXX.h:2039
static CXXReinterpretCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition: ExprCXX.cpp:656
#define bool
Definition: stdbool.h:31
void setUuidStr(StringRef US)
Definition: ExprCXX.h:912
void setWrittenTypeInfo(TypeSourceInfo *TI)
Definition: Expr.h:3805
void setRetValue(Expr *E)
Definition: Stmt.h:1430
void setBody(Stmt *S)
Definition: Stmt.h:1248
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:288
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
Definition: OpenMPClause.h:220
ExprBitfields ExprBits
Definition: Stmt.h:288
void setObjectKind(ExprObjectKind Cat)
setObjectKind - Set the object kind produced by this expression.
Definition: Expr.h:425
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier, e.g., N::foo.
Definition: Expr.h:1056
Represents Objective-C&#39;s @synchronized statement.
Definition: StmtObjC.h:262
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:429
A CXXStdInitializerListExpr record.
Definition: ASTBitCodes.h:1747
void setFinallyBody(Stmt *S)
Definition: StmtObjC.h:134
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:3724
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:65
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:4896
An ArraySubscriptExpr record.
Definition: ASTBitCodes.h:1553
Decl * readDecl()
Reads a declaration from the given position in a record in the given module, advancing Idx...
Definition: ASTReader.h:2466
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
Definition: Expr.cpp:774
This represents &#39;#pragma omp target teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:3963
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
Definition: OpenMPClause.h:359
Information about a module that has been loaded by the ASTReader.
Definition: Module.h:100
void setDeclNumLists(ArrayRef< unsigned > DNLs)
Set the number of lists per declaration that are in the trailing objects of the class.
This represents &#39;ordered&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:925
ExprWithCleanupsBitfields ExprWithCleanupsBits
Definition: Stmt.h:295
static OMPFlushClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
An ArrayInitLoopExpr record.
Definition: ASTBitCodes.h:1595
unsigned getNumClauses() const
Get number of clauses.
Definition: StmtOpenMP.h:184
A PseudoObjectExpr record.
Definition: ASTBitCodes.h:1631
void setColonLoc(SourceLocation L)
Definition: ExprOpenMP.h:110
void setFinallyStmt(Stmt *S)
Definition: StmtObjC.h:236
An ObjCIndirectCopyRestoreExpr record.
Definition: ASTBitCodes.h:1673
This represents &#39;#pragma omp for&#39; directive.
Definition: StmtOpenMP.h:1046
IdentifierInfo * getIdentifierInfo()
Definition: ASTReader.h:2480
static OMPTargetEnterDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
Definition: StmtOpenMP.cpp:810
void setValueKind(ExprValueKind Cat)
setValueKind - Set the value kind produced by this expression.
Definition: Expr.h:422
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
void setRParenLoc(SourceLocation L)
Definition: ExprObjC.h:497
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4145
void setEndStmt(Stmt *S)
Definition: StmtCXX.h:187
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Definition: Stmt.h:1413
This represents &#39;#pragma omp target teams&#39; directive.
Definition: StmtOpenMP.h:3679
void setAssociatedStmt(Stmt *S)
Set the associated statement for the directive.
Definition: StmtOpenMP.h:85
static OMPDistributeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:903
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:1795
void setColonLoc(SourceLocation L)
Definition: Stmt.h:719
void setIsArrow(bool A)
Definition: ExprObjC.h:553
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3720
A DesignatedInitUpdateExpr record.
Definition: ASTBitCodes.h:1589
SourceLocation getEnd() const
void setAtLoc(SourceLocation L)
Definition: ExprObjC.h:403
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:1717
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a taskloop directive.
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1187
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:728
static OMPParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:422
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:3838
static OMPPrivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
void setForLoc(SourceLocation Loc)
Definition: StmtObjC.h:54
This represents &#39;#pragma omp cancel&#39; directive.
Definition: StmtOpenMP.h:2718
This represents &#39;collapse&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:555
This represents clause &#39;firstprivate&#39; in the &#39;#pragma omp ...&#39; directives.
void setDistInc(Expr *DistInc)
Definition: StmtOpenMP.h:538
void setBase(Expr *base)
Definition: ExprObjC.h:549
ValueDecl * getDecl()
Definition: Expr.h:1041
An ObjCAvailabilityCheckExpr record.
Definition: ASTBitCodes.h:1700
void setRParenLoc(SourceLocation L)
Definition: ExprObjC.h:448
std::string readString()
Read a string, advancing Idx.
Definition: ASTReader.h:2579
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr.
Definition: Expr.h:2922
static OMPDistributeParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
void setClauses(ArrayRef< OMPClause *> Clauses)
Sets the list of variables for this clause.
Definition: StmtOpenMP.cpp:20
void skipInts(unsigned N)
Skips the specified number of values.
Definition: ASTReader.h:2368
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
Definition: Expr.h:1463
An ObjCForCollectionStmt record.
Definition: ASTBitCodes.h:1676
This represents &#39;#pragma omp flush&#39; directive.
Definition: StmtOpenMP.h:1986
This represents &#39;#pragma omp parallel for simd&#39; directive.
Definition: StmtOpenMP.h:1574
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3811
void setAtTryLoc(SourceLocation Loc)
Definition: StmtObjC.h:194
DoStmt - This represents a &#39;do/while&#39; stmt.
Definition: Stmt.h:1154
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition: Stmt.h:1461
This represents &#39;seq_cst&#39; clause in the &#39;#pragma omp atomic&#39; directive.
This represents &#39;untied&#39; clause in the &#39;#pragma omp ...&#39; directive.
void setTypeOperandSourceInfo(TypeSourceInfo *TSI)
Definition: ExprCXX.h:690
void setBody(Stmt *S)
Definition: StmtCXX.h:191
void setOpcode(Opcode O)
Definition: Expr.h:3027
A MS-style AsmStmt record.
Definition: ASTBitCodes.h:1514
unsigned readRecord(llvm::BitstreamCursor &Cursor, unsigned AbbrevID)
Reads a record with id AbbrevID from Cursor, resetting the internal state.
void setLocStart(SourceLocation Loc)
Set starting location of directive kind.
Definition: StmtOpenMP.h:176
static OMPParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:374
static CoroutineBodyStmt * Create(const ASTContext &C, CtorArgs const &Args)
Definition: StmtCXX.cpp:90
void setSynchExpr(Stmt *S)
Definition: StmtObjC.h:296
This represents &#39;#pragma omp target enter data&#39; directive.
Definition: StmtOpenMP.h:2346
void setPostUpdateExpr(Expr *S)
Set pre-initialization statement for the clause.
Definition: OpenMPClause.h:147
void setUpdates(ArrayRef< Expr *> A)
Definition: StmtOpenMP.cpp:45
const llvm::fltSemantics & getSemantics() const
Return the APFloat semantics this literal uses.
Definition: Expr.cpp:784
void setLowerBoundVariable(Expr *LB)
Definition: StmtOpenMP.h:479
void setLParenLoc(SourceLocation L)
Definition: ExprCXX.h:1503
This represents &#39;num_teams&#39; clause in the &#39;#pragma omp ...&#39; directive.
void setTypeSourceInfo(TypeSourceInfo *tinfo)
Definition: Expr.h:2676
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:338
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:868
void setComputationLHSType(QualType T)
Definition: Expr.h:3215
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:3601
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver. ...
Definition: ExprObjC.h:1328
static OMPSectionDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:259
void setDecl(LabelDecl *D)
Definition: Stmt.h:857
Kind
void setElse(Stmt *S)
Definition: Stmt.h:970
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
Definition: ExprCXX.h:2548
A field in a dependent type, known only by its name.
Definition: Expr.h:1831
This captures a statement into a function.
Definition: Stmt.h:2054
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1400
unsigned path_size() const
Definition: Expr.h:2776
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:4969
void setLParenLoc(SourceLocation L)
Definition: Expr.h:2949
void setSubStmt(Stmt *S)
Definition: Stmt.h:813
void setElidable(bool E)
Definition: ExprCXX.h:1309
void setAccessorLoc(SourceLocation L)
Definition: Expr.h:4816
void setGotoLoc(SourceLocation L)
Definition: Stmt.h:1323
static CXXDynamicCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition: ExprCXX.cpp:598
unsigned getTotalComponentListNum() const
Return the number of lists derived from the clause expressions.
CXXTemporary * readCXXTemporary()
Definition: ASTReader.h:2549
void setHadMultipleCandidates(bool V)
Definition: ExprCXX.h:1314
void setLocation(SourceLocation L)
Definition: Expr.h:1050
This represents &#39;#pragma omp single&#39; directive.
Definition: StmtOpenMP.h:1318
Encodes a location in the source.
void setLocation(SourceLocation L)
Definition: Expr.h:1218
void setPrevLowerBoundVariable(Expr *PrevLB)
Definition: StmtOpenMP.h:528
void setIterationVariable(Expr *IV)
Definition: StmtOpenMP.h:452
This represents &#39;hint&#39; clause in the &#39;#pragma omp ...&#39; directive.
PseudoObjectExprBitfields PseudoObjectExprBits
Definition: Stmt.h:296
Stmt * readSubStmt()
Reads a sub-statement operand during statement reading.
Definition: ASTReader.h:2411
unsigned getNumHandlers() const
Definition: StmtCXX.h:103
void setUpdater(Expr *Updater)
Definition: Expr.h:4461
static OMPTaskDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:473
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:33
static CXXDependentScopeMemberExpr * CreateEmpty(const ASTContext &C, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition: ExprCXX.cpp:1171
static OMPTargetUpdateDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
void setDoLoc(SourceLocation L)
Definition: Stmt.h:1180
static CXXConstCastExpr * CreateEmpty(const ASTContext &Context)
Definition: ExprCXX.cpp:670
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:1842
void setCombinedNextLowerBound(Expr *CombNLB)
Definition: StmtOpenMP.h:573
void setAtCatchLoc(SourceLocation Loc)
Definition: StmtObjC.h:103
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
Definition: ExprObjC.h:342
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
Definition: ExprCXX.h:457
void setSourceRange(SourceRange R)
Definition: ExprCXX.h:708
This represents &#39;schedule&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:744
static ObjCAtTryStmt * CreateEmpty(const ASTContext &Context, unsigned NumCatchStmts, bool HasFinally)
Definition: StmtObjC.cpp:58
void setConstexpr(bool C)
Definition: Stmt.h:982
Represents a call to a member function that may be written either with member call syntax (e...
Definition: ExprCXX.h:164
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
Definition: OpenMPClause.h:420
void setIdentLoc(SourceLocation L)
Definition: Stmt.h:861
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:487
OpenMPDirectiveKind
OpenMP directives.
Definition: OpenMPKinds.h:23
LabelDecl - Represents the declaration of a label.
Definition: Decl.h:460
This represents clause &#39;shared&#39; in the &#39;#pragma omp ...&#39; directives.
void setLabelLoc(SourceLocation L)
Definition: Expr.h:3461
void readDeclarationNameInfo(DeclarationNameInfo &NameInfo)
Definition: ASTReader.h:2496
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition: Specifiers.h:121
A CXXFunctionalCastExpr record.
Definition: ASTBitCodes.h:1741
void setTemporary(CXXTemporary *T)
Definition: ExprCXX.h:1217
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
Definition: ExprCXX.cpp:1058
void setAllEnumCasesCovered()
Set a flag in the SwitchStmt indicating that if the &#39;switch (X)&#39; is a switch over an enum value then ...
Definition: Stmt.h:1075
Expr * readSubExpr()
Reads a sub-expression operand during statement reading.
Definition: ASTReader.h:2414
void VisitStmt(Stmt *S)
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:183
void setClassReceiver(TypeSourceInfo *TSInfo)
Definition: ExprObjC.h:1240
void setCatchParamDecl(VarDecl *D)
Definition: StmtObjC.h:100
void setCond(Expr *E)
Definition: Stmt.h:966
An ObjCEncodeExpr record.
Definition: ASTBitCodes.h:1646
static OMPAtomicDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:664
This represents &#39;#pragma omp taskwait&#39; directive.
Definition: StmtOpenMP.h:1869
void setLHS(Expr *E)
Definition: Expr.h:3030
void setPrivateCopies(ArrayRef< Expr *> PrivateCopies)
Set list of helper expressions, required for generation of private copies of original lastprivate var...
void setConfig(CallExpr *E)
Sets the kernel configuration expression.
Definition: ExprCXX.h:225
void setConditionVariable(const ASTContext &C, VarDecl *V)
Definition: Stmt.cpp:871
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:51
void setIsFreeIvar(bool A)
Definition: ExprObjC.h:554
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
Definition: Expr.h:5103
void readDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name)
Definition: ASTReader.h:2493
Expr * updateInit(const ASTContext &C, unsigned Init, Expr *expr)
Updates the initializer at index Init with the new expression expr, and returns the old expression at...
Definition: Expr.cpp:1895
static OMPOrderedDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
Definition: StmtOpenMP.cpp:633
bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of the composite or combined directives that need loop ...
void addDecl(NamedDecl *D)
Definition: UnresolvedSet.h:89
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:474
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
Definition: Expr.h:149
void setDecl(ValueDecl *NewD)
Definition: Expr.h:1043
void setThrowLoc(SourceLocation Loc)
Definition: StmtObjC.h:330
unsigned getIdx() const
The current position in this record.
Definition: ASTReader.h:2349
void setVarRefs(ArrayRef< Expr *> VL)
Sets the list of variables for this clause.
Definition: OpenMPClause.h:191
An ObjCIsa Expr record.
Definition: ASTBitCodes.h:1670
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Definition: ASTReader.h:2346
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:2822
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition: Stmt.h:2155
This represents &#39;#pragma omp target&#39; directive.
Definition: StmtOpenMP.h:2230
static OMPTeamsDistributeParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
void setSubExpr(Expr *E)
Definition: ExprCXX.h:1221
static DesignatedInitExpr * CreateEmpty(const ASTContext &C, unsigned NumIndexExprs)
Definition: Expr.cpp:3753
static DeclGroup * Create(ASTContext &C, Decl **Decls, unsigned NumDecls)
Definition: DeclGroup.cpp:21
static OMPTeamsDistributeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
void setBaseExpr(Stmt *S)
Definition: ExprObjC.h:848
An expression trait intrinsic.
Definition: ExprCXX.h:2493
void setEncodedTypeSourceInfo(TypeSourceInfo *EncType)
Definition: ExprObjC.h:411
An AtomicExpr record.
Definition: ASTBitCodes.h:1634
This represents &#39;#pragma omp ordered&#39; directive.
Definition: StmtOpenMP.h:2041
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:3488
void setCond(Expr *E)
Definition: StmtCXX.h:188
static SizeOfPackExpr * CreateDeserialized(ASTContext &Context, unsigned NumPartialArgs)
Definition: ExprCXX.cpp:1324
This represents &#39;#pragma omp target update&#39; directive.
Definition: StmtOpenMP.h:2982
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:117
void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C)
void setSubExpr(Expr *E)
Definition: Expr.h:3798
void setLAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:565
void sawArrayRangeDesignator(bool ARD=true)
Definition: Expr.h:4043
void addArgument(const TemplateArgumentLoc &Loc)
Definition: TemplateBase.h:586
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
Definition: Stmt.h:2175
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
Definition: StmtCXX.h:240
static MemberExpr * Create(const ASTContext &C, Expr *base, bool isarrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *memberdecl, DeclAccessPair founddecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *targs, QualType ty, ExprValueKind VK, ExprObjectKind OK)
Definition: Expr.cpp:1437
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
Definition: Stmt.h:325
void setSimple(bool V)
Definition: Stmt.h:1495
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:2854
void setRBracketLoc(SourceLocation L)
Definition: ExprCXX.h:836
void readAttributes(AttrVec &Attrs)
Reads attributes from the current stream position, advancing Idx.
Definition: ASTReader.h:2594
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3191
Expr ** getElements()
Retrieve elements of array of literals.
Definition: ExprObjC.h:202
A POD class for pairing a NamedDecl* with an access specifier.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
Represents a C11 generic selection.
Definition: Expr.h:4684
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3444
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
Definition: ExprObjC.h:1572
Represents a reference to a function parameter pack that has been substituted but not yet expanded...
Definition: ExprCXX.h:3957
Represents a template argument.
Definition: TemplateBase.h:51
void setGotoLoc(SourceLocation L)
Definition: Stmt.h:1290
void setPrevUpperBoundVariable(Expr *PrevUB)
Definition: StmtOpenMP.h:533
void setCombinedEnsureUpperBound(Expr *CombEUB)
Definition: StmtOpenMP.h:558
static OMPForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: StmtOpenMP.cpp:160
void setLocation(SourceLocation L)
Definition: Expr.h:1440
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:556
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
void setCounters(ArrayRef< Expr *> A)
Definition: StmtOpenMP.cpp:26
bool isTypeOperand() const
Definition: ExprCXX.h:678
unsigned getNumAssocs() const
Definition: Expr.h:4711
Dataflow Directional Tag Classes.
void setExtendingDecl(const ValueDecl *ExtendedBy, unsigned ManglingNumber)
Definition: ExprCXX.cpp:1372
This represents &#39;device&#39; clause in the &#39;#pragma omp ...&#39; directive.
An InitListExpr record.
Definition: ASTBitCodes.h:1583
OMPClauseReader(ASTStmtReader *R, ASTRecordReader &Record)
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLS_BLOCK block.
Definition: Module.h:387
void setBuiltinLoc(SourceLocation L)
Definition: Expr.h:3717
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1188
UnaryOperatorKind
void setValue(bool V)
Definition: ExprCXX.h:544
A CXXBoolLiteralExpr record.
Definition: ASTBitCodes.h:1750
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2071
void setLParenLoc(SourceLocation Loc)
Sets the location of &#39;(&#39;.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
void setCombinedUpperBoundVariable(Expr *CombUB)
Definition: StmtOpenMP.h:553
void setRParenLoc(SourceLocation L)
Definition: Expr.h:2346
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
Definition: Stmt.cpp:1079