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