clang  3.7.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  unsigned NumTemplateArgs);
97  /// \brief Read and initialize a ExplicitTemplateArgumentList structure.
98  void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList,
99  unsigned NumTemplateArgs);
100 
101  void VisitStmt(Stmt *S);
102 #define STMT(Type, Base) \
103  void Visit##Type(Type *);
104 #include "clang/AST/StmtNodes.inc"
105  };
106 }
107 
108 void ASTStmtReader::
110  unsigned NumTemplateArgs) {
111  SourceLocation TemplateKWLoc = ReadSourceLocation(Record, Idx);
112  TemplateArgumentListInfo ArgInfo;
113  ArgInfo.setLAngleLoc(ReadSourceLocation(Record, Idx));
114  ArgInfo.setRAngleLoc(ReadSourceLocation(Record, Idx));
115  for (unsigned i = 0; i != NumTemplateArgs; ++i)
116  ArgInfo.addArgument(
117  Reader.ReadTemplateArgumentLoc(F, Record, Idx));
118  Args.initializeFrom(TemplateKWLoc, ArgInfo);
119 }
120 
122  assert(Idx == NumStmtFields && "Incorrect statement field count");
123 }
124 
125 void ASTStmtReader::VisitNullStmt(NullStmt *S) {
126  VisitStmt(S);
127  S->setSemiLoc(ReadSourceLocation(Record, Idx));
128  S->HasLeadingEmptyMacro = Record[Idx++];
129 }
130 
131 void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
132  VisitStmt(S);
134  unsigned NumStmts = Record[Idx++];
135  while (NumStmts--)
136  Stmts.push_back(Reader.ReadSubStmt());
137  S->setStmts(Reader.getContext(), Stmts.data(), Stmts.size());
138  S->LBraceLoc = ReadSourceLocation(Record, Idx);
139  S->RBraceLoc = ReadSourceLocation(Record, Idx);
140 }
141 
142 void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {
143  VisitStmt(S);
144  Reader.RecordSwitchCaseID(S, Record[Idx++]);
145  S->setKeywordLoc(ReadSourceLocation(Record, Idx));
146  S->setColonLoc(ReadSourceLocation(Record, Idx));
147 }
148 
149 void ASTStmtReader::VisitCaseStmt(CaseStmt *S) {
150  VisitSwitchCase(S);
151  S->setLHS(Reader.ReadSubExpr());
152  S->setRHS(Reader.ReadSubExpr());
153  S->setSubStmt(Reader.ReadSubStmt());
154  S->setEllipsisLoc(ReadSourceLocation(Record, Idx));
155 }
156 
157 void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
158  VisitSwitchCase(S);
159  S->setSubStmt(Reader.ReadSubStmt());
160 }
161 
162 void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
163  VisitStmt(S);
164  LabelDecl *LD = ReadDeclAs<LabelDecl>(Record, Idx);
165  LD->setStmt(S);
166  S->setDecl(LD);
167  S->setSubStmt(Reader.ReadSubStmt());
168  S->setIdentLoc(ReadSourceLocation(Record, Idx));
169 }
170 
171 void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) {
172  VisitStmt(S);
173  uint64_t NumAttrs = Record[Idx++];
174  AttrVec Attrs;
175  Reader.ReadAttributes(F, Attrs, Record, Idx);
176  (void)NumAttrs;
177  assert(NumAttrs == S->NumAttrs);
178  assert(NumAttrs == Attrs.size());
179  std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr());
180  S->SubStmt = Reader.ReadSubStmt();
181  S->AttrLoc = ReadSourceLocation(Record, Idx);
182 }
183 
184 void ASTStmtReader::VisitIfStmt(IfStmt *S) {
185  VisitStmt(S);
186  S->setConditionVariable(Reader.getContext(),
187  ReadDeclAs<VarDecl>(Record, Idx));
188  S->setCond(Reader.ReadSubExpr());
189  S->setThen(Reader.ReadSubStmt());
190  S->setElse(Reader.ReadSubStmt());
191  S->setIfLoc(ReadSourceLocation(Record, Idx));
192  S->setElseLoc(ReadSourceLocation(Record, Idx));
193 }
194 
195 void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
196  VisitStmt(S);
197  S->setConditionVariable(Reader.getContext(),
198  ReadDeclAs<VarDecl>(Record, Idx));
199  S->setCond(Reader.ReadSubExpr());
200  S->setBody(Reader.ReadSubStmt());
201  S->setSwitchLoc(ReadSourceLocation(Record, Idx));
202  if (Record[Idx++])
204 
205  SwitchCase *PrevSC = nullptr;
206  for (unsigned N = Record.size(); Idx != N; ++Idx) {
207  SwitchCase *SC = Reader.getSwitchCaseWithID(Record[Idx]);
208  if (PrevSC)
209  PrevSC->setNextSwitchCase(SC);
210  else
211  S->setSwitchCaseList(SC);
212 
213  PrevSC = SC;
214  }
215 }
216 
217 void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
218  VisitStmt(S);
219  S->setConditionVariable(Reader.getContext(),
220  ReadDeclAs<VarDecl>(Record, Idx));
221 
222  S->setCond(Reader.ReadSubExpr());
223  S->setBody(Reader.ReadSubStmt());
224  S->setWhileLoc(ReadSourceLocation(Record, Idx));
225 }
226 
227 void ASTStmtReader::VisitDoStmt(DoStmt *S) {
228  VisitStmt(S);
229  S->setCond(Reader.ReadSubExpr());
230  S->setBody(Reader.ReadSubStmt());
231  S->setDoLoc(ReadSourceLocation(Record, Idx));
232  S->setWhileLoc(ReadSourceLocation(Record, Idx));
233  S->setRParenLoc(ReadSourceLocation(Record, Idx));
234 }
235 
236 void ASTStmtReader::VisitForStmt(ForStmt *S) {
237  VisitStmt(S);
238  S->setInit(Reader.ReadSubStmt());
239  S->setCond(Reader.ReadSubExpr());
240  S->setConditionVariable(Reader.getContext(),
241  ReadDeclAs<VarDecl>(Record, Idx));
242  S->setInc(Reader.ReadSubExpr());
243  S->setBody(Reader.ReadSubStmt());
244  S->setForLoc(ReadSourceLocation(Record, Idx));
245  S->setLParenLoc(ReadSourceLocation(Record, Idx));
246  S->setRParenLoc(ReadSourceLocation(Record, Idx));
247 }
248 
249 void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
250  VisitStmt(S);
251  S->setLabel(ReadDeclAs<LabelDecl>(Record, Idx));
252  S->setGotoLoc(ReadSourceLocation(Record, Idx));
253  S->setLabelLoc(ReadSourceLocation(Record, Idx));
254 }
255 
256 void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
257  VisitStmt(S);
258  S->setGotoLoc(ReadSourceLocation(Record, Idx));
259  S->setStarLoc(ReadSourceLocation(Record, Idx));
260  S->setTarget(Reader.ReadSubExpr());
261 }
262 
263 void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) {
264  VisitStmt(S);
265  S->setContinueLoc(ReadSourceLocation(Record, Idx));
266 }
267 
268 void ASTStmtReader::VisitBreakStmt(BreakStmt *S) {
269  VisitStmt(S);
270  S->setBreakLoc(ReadSourceLocation(Record, Idx));
271 }
272 
273 void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
274  VisitStmt(S);
275  S->setRetValue(Reader.ReadSubExpr());
276  S->setReturnLoc(ReadSourceLocation(Record, Idx));
277  S->setNRVOCandidate(ReadDeclAs<VarDecl>(Record, Idx));
278 }
279 
280 void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
281  VisitStmt(S);
282  S->setStartLoc(ReadSourceLocation(Record, Idx));
283  S->setEndLoc(ReadSourceLocation(Record, Idx));
284 
285  if (Idx + 1 == Record.size()) {
286  // Single declaration
287  S->setDeclGroup(DeclGroupRef(ReadDecl(Record, Idx)));
288  } else {
290  Decls.reserve(Record.size() - Idx);
291  for (unsigned N = Record.size(); Idx != N; )
292  Decls.push_back(ReadDecl(Record, Idx));
293  S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Reader.getContext(),
294  Decls.data(),
295  Decls.size())));
296  }
297 }
298 
299 void ASTStmtReader::VisitAsmStmt(AsmStmt *S) {
300  VisitStmt(S);
301  S->NumOutputs = Record[Idx++];
302  S->NumInputs = Record[Idx++];
303  S->NumClobbers = Record[Idx++];
304  S->setAsmLoc(ReadSourceLocation(Record, Idx));
305  S->setVolatile(Record[Idx++]);
306  S->setSimple(Record[Idx++]);
307 }
308 
309 void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) {
310  VisitAsmStmt(S);
311  S->setRParenLoc(ReadSourceLocation(Record, Idx));
312  S->setAsmString(cast_or_null<StringLiteral>(Reader.ReadSubStmt()));
313 
314  unsigned NumOutputs = S->getNumOutputs();
315  unsigned NumInputs = S->getNumInputs();
316  unsigned NumClobbers = S->getNumClobbers();
317 
318  // Outputs and inputs
322  for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) {
323  Names.push_back(Reader.GetIdentifierInfo(F, Record, Idx));
324  Constraints.push_back(cast_or_null<StringLiteral>(Reader.ReadSubStmt()));
325  Exprs.push_back(Reader.ReadSubStmt());
326  }
327 
328  // Constraints
330  for (unsigned I = 0; I != NumClobbers; ++I)
331  Clobbers.push_back(cast_or_null<StringLiteral>(Reader.ReadSubStmt()));
332 
333  S->setOutputsAndInputsAndClobbers(Reader.getContext(),
334  Names.data(), Constraints.data(),
335  Exprs.data(), NumOutputs, NumInputs,
336  Clobbers.data(), NumClobbers);
337 }
338 
339 void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) {
340  VisitAsmStmt(S);
341  S->LBraceLoc = ReadSourceLocation(Record, Idx);
342  S->EndLoc = ReadSourceLocation(Record, Idx);
343  S->NumAsmToks = Record[Idx++];
344  std::string AsmStr = ReadString(Record, Idx);
345 
346  // Read the tokens.
347  SmallVector<Token, 16> AsmToks;
348  AsmToks.reserve(S->NumAsmToks);
349  for (unsigned i = 0, e = S->NumAsmToks; i != e; ++i) {
350  AsmToks.push_back(ReadToken(Record, Idx));
351  }
352 
353  // The calls to reserve() for the FooData vectors are mandatory to
354  // prevent dead StringRefs in the Foo vectors.
355 
356  // Read the clobbers.
357  SmallVector<std::string, 16> ClobbersData;
359  ClobbersData.reserve(S->NumClobbers);
360  Clobbers.reserve(S->NumClobbers);
361  for (unsigned i = 0, e = S->NumClobbers; i != e; ++i) {
362  ClobbersData.push_back(ReadString(Record, Idx));
363  Clobbers.push_back(ClobbersData.back());
364  }
365 
366  // Read the operands.
367  unsigned NumOperands = S->NumOutputs + S->NumInputs;
369  SmallVector<std::string, 16> ConstraintsData;
370  SmallVector<StringRef, 16> Constraints;
371  Exprs.reserve(NumOperands);
372  ConstraintsData.reserve(NumOperands);
373  Constraints.reserve(NumOperands);
374  for (unsigned i = 0; i != NumOperands; ++i) {
375  Exprs.push_back(cast<Expr>(Reader.ReadSubStmt()));
376  ConstraintsData.push_back(ReadString(Record, Idx));
377  Constraints.push_back(ConstraintsData.back());
378  }
379 
380  S->initialize(Reader.getContext(), AsmStr, AsmToks,
381  Constraints, Exprs, Clobbers);
382 }
383 
384 void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) {
385  VisitStmt(S);
386  ++Idx;
387  S->setCapturedDecl(ReadDeclAs<CapturedDecl>(Record, Idx));
388  S->setCapturedRegionKind(static_cast<CapturedRegionKind>(Record[Idx++]));
389  S->setCapturedRecordDecl(ReadDeclAs<RecordDecl>(Record, Idx));
390 
391  // Capture inits
393  E = S->capture_init_end();
394  I != E; ++I)
395  *I = Reader.ReadSubExpr();
396 
397  // Body
398  S->setCapturedStmt(Reader.ReadSubStmt());
400 
401  // Captures
402  for (auto &I : S->captures()) {
403  I.VarAndKind.setPointer(ReadDeclAs<VarDecl>(Record, Idx));
404  I.VarAndKind
405  .setInt(static_cast<CapturedStmt::VariableCaptureKind>(Record[Idx++]));
406  I.Loc = ReadSourceLocation(Record, Idx);
407  }
408 }
409 
410 void ASTStmtReader::VisitExpr(Expr *E) {
411  VisitStmt(E);
412  E->setType(Reader.readType(F, Record, Idx));
413  E->setTypeDependent(Record[Idx++]);
414  E->setValueDependent(Record[Idx++]);
415  E->setInstantiationDependent(Record[Idx++]);
416  E->ExprBits.ContainsUnexpandedParameterPack = Record[Idx++];
417  E->setValueKind(static_cast<ExprValueKind>(Record[Idx++]));
418  E->setObjectKind(static_cast<ExprObjectKind>(Record[Idx++]));
419  assert(Idx == NumExprFields && "Incorrect expression field count");
420 }
421 
422 void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
423  VisitExpr(E);
424  E->setLocation(ReadSourceLocation(Record, Idx));
425  E->Type = (PredefinedExpr::IdentType)Record[Idx++];
426  E->FnName = cast_or_null<StringLiteral>(Reader.ReadSubExpr());
427 }
428 
429 void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
430  VisitExpr(E);
431 
432  E->DeclRefExprBits.HasQualifier = Record[Idx++];
433  E->DeclRefExprBits.HasFoundDecl = Record[Idx++];
434  E->DeclRefExprBits.HasTemplateKWAndArgsInfo = Record[Idx++];
435  E->DeclRefExprBits.HadMultipleCandidates = Record[Idx++];
436  E->DeclRefExprBits.RefersToEnclosingVariableOrCapture = Record[Idx++];
437  unsigned NumTemplateArgs = 0;
438  if (E->hasTemplateKWAndArgsInfo())
439  NumTemplateArgs = Record[Idx++];
440 
441  if (E->hasQualifier())
442  E->getInternalQualifierLoc()
443  = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
444 
445  if (E->hasFoundDecl())
446  E->getInternalFoundDecl() = ReadDeclAs<NamedDecl>(Record, Idx);
447 
448  if (E->hasTemplateKWAndArgsInfo())
449  ReadTemplateKWAndArgsInfo(*E->getTemplateKWAndArgsInfo(),
450  NumTemplateArgs);
451 
452  E->setDecl(ReadDeclAs<ValueDecl>(Record, Idx));
453  E->setLocation(ReadSourceLocation(Record, Idx));
454  ReadDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName(), Record, Idx);
455 }
456 
457 void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
458  VisitExpr(E);
459  E->setLocation(ReadSourceLocation(Record, Idx));
460  E->setValue(Reader.getContext(), Reader.ReadAPInt(Record, Idx));
461 }
462 
463 void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) {
464  VisitExpr(E);
465  E->setRawSemantics(static_cast<Stmt::APFloatSemantics>(Record[Idx++]));
466  E->setExact(Record[Idx++]);
467  E->setValue(Reader.getContext(),
468  Reader.ReadAPFloat(Record, E->getSemantics(), Idx));
469  E->setLocation(ReadSourceLocation(Record, Idx));
470 }
471 
472 void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) {
473  VisitExpr(E);
474  E->setSubExpr(Reader.ReadSubExpr());
475 }
476 
477 void ASTStmtReader::VisitStringLiteral(StringLiteral *E) {
478  VisitExpr(E);
479  unsigned Len = Record[Idx++];
480  assert(Record[Idx] == E->getNumConcatenated() &&
481  "Wrong number of concatenated tokens!");
482  ++Idx;
484  static_cast<StringLiteral::StringKind>(Record[Idx++]);
485  bool isPascal = Record[Idx++];
486 
487  // Read string data
488  SmallString<16> Str(&Record[Idx], &Record[Idx] + Len);
489  E->setString(Reader.getContext(), Str, kind, isPascal);
490  Idx += Len;
491 
492  // Read source locations
493  for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
494  E->setStrTokenLoc(I, ReadSourceLocation(Record, Idx));
495 }
496 
497 void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {
498  VisitExpr(E);
499  E->setValue(Record[Idx++]);
500  E->setLocation(ReadSourceLocation(Record, Idx));
501  E->setKind(static_cast<CharacterLiteral::CharacterKind>(Record[Idx++]));
502 }
503 
504 void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
505  VisitExpr(E);
506  E->setLParen(ReadSourceLocation(Record, Idx));
507  E->setRParen(ReadSourceLocation(Record, Idx));
508  E->setSubExpr(Reader.ReadSubExpr());
509 }
510 
511 void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
512  VisitExpr(E);
513  unsigned NumExprs = Record[Idx++];
514  E->Exprs = new (Reader.getContext()) Stmt*[NumExprs];
515  for (unsigned i = 0; i != NumExprs; ++i)
516  E->Exprs[i] = Reader.ReadSubStmt();
517  E->NumExprs = NumExprs;
518  E->LParenLoc = ReadSourceLocation(Record, Idx);
519  E->RParenLoc = ReadSourceLocation(Record, Idx);
520 }
521 
522 void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
523  VisitExpr(E);
524  E->setSubExpr(Reader.ReadSubExpr());
525  E->setOpcode((UnaryOperator::Opcode)Record[Idx++]);
526  E->setOperatorLoc(ReadSourceLocation(Record, Idx));
527 }
528 
529 void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
531  VisitExpr(E);
532  assert(E->getNumComponents() == Record[Idx]);
533  ++Idx;
534  assert(E->getNumExpressions() == Record[Idx]);
535  ++Idx;
536  E->setOperatorLoc(ReadSourceLocation(Record, Idx));
537  E->setRParenLoc(ReadSourceLocation(Record, Idx));
538  E->setTypeSourceInfo(GetTypeSourceInfo(Record, Idx));
539  for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
540  Node::Kind Kind = static_cast<Node::Kind>(Record[Idx++]);
541  SourceLocation Start = ReadSourceLocation(Record, Idx);
542  SourceLocation End = ReadSourceLocation(Record, Idx);
543  switch (Kind) {
544  case Node::Array:
545  E->setComponent(I, Node(Start, Record[Idx++], End));
546  break;
547 
548  case Node::Field:
549  E->setComponent(I, Node(Start, ReadDeclAs<FieldDecl>(Record, Idx), End));
550  break;
551 
552  case Node::Identifier:
553  E->setComponent(I,
554  Node(Start,
555  Reader.GetIdentifierInfo(F, Record, Idx),
556  End));
557  break;
558 
559  case Node::Base: {
560  CXXBaseSpecifier *Base = new (Reader.getContext()) CXXBaseSpecifier();
561  *Base = Reader.ReadCXXBaseSpecifier(F, Record, Idx);
562  E->setComponent(I, Node(Base));
563  break;
564  }
565  }
566  }
567 
568  for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
569  E->setIndexExpr(I, Reader.ReadSubExpr());
570 }
571 
572 void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
573  VisitExpr(E);
574  E->setKind(static_cast<UnaryExprOrTypeTrait>(Record[Idx++]));
575  if (Record[Idx] == 0) {
576  E->setArgument(Reader.ReadSubExpr());
577  ++Idx;
578  } else {
579  E->setArgument(GetTypeSourceInfo(Record, Idx));
580  }
581  E->setOperatorLoc(ReadSourceLocation(Record, Idx));
582  E->setRParenLoc(ReadSourceLocation(Record, Idx));
583 }
584 
585 void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
586  VisitExpr(E);
587  E->setLHS(Reader.ReadSubExpr());
588  E->setRHS(Reader.ReadSubExpr());
589  E->setRBracketLoc(ReadSourceLocation(Record, Idx));
590 }
591 
592 void ASTStmtReader::VisitCallExpr(CallExpr *E) {
593  VisitExpr(E);
594  E->setNumArgs(Reader.getContext(), Record[Idx++]);
595  E->setRParenLoc(ReadSourceLocation(Record, Idx));
596  E->setCallee(Reader.ReadSubExpr());
597  for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
598  E->setArg(I, Reader.ReadSubExpr());
599 }
600 
601 void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
602  VisitCallExpr(E);
603 }
604 
605 void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
606  // Don't call VisitExpr, this is fully initialized at creation.
607  assert(E->getStmtClass() == Stmt::MemberExprClass &&
608  "It's a subclass, we must advance Idx!");
609 }
610 
611 void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
612  VisitExpr(E);
613  E->setBase(Reader.ReadSubExpr());
614  E->setIsaMemberLoc(ReadSourceLocation(Record, Idx));
615  E->setOpLoc(ReadSourceLocation(Record, Idx));
616  E->setArrow(Record[Idx++]);
617 }
618 
619 void ASTStmtReader::
620 VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
621  VisitExpr(E);
622  E->Operand = Reader.ReadSubExpr();
623  E->setShouldCopy(Record[Idx++]);
624 }
625 
626 void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
627  VisitExplicitCastExpr(E);
628  E->LParenLoc = ReadSourceLocation(Record, Idx);
629  E->BridgeKeywordLoc = ReadSourceLocation(Record, Idx);
630  E->Kind = Record[Idx++];
631 }
632 
633 void ASTStmtReader::VisitCastExpr(CastExpr *E) {
634  VisitExpr(E);
635  unsigned NumBaseSpecs = Record[Idx++];
636  assert(NumBaseSpecs == E->path_size());
637  E->setSubExpr(Reader.ReadSubExpr());
638  E->setCastKind((CastKind)Record[Idx++]);
639  CastExpr::path_iterator BaseI = E->path_begin();
640  while (NumBaseSpecs--) {
641  CXXBaseSpecifier *BaseSpec = new (Reader.getContext()) CXXBaseSpecifier;
642  *BaseSpec = Reader.ReadCXXBaseSpecifier(F, Record, Idx);
643  *BaseI++ = BaseSpec;
644  }
645 }
646 
647 void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
648  VisitExpr(E);
649  E->setLHS(Reader.ReadSubExpr());
650  E->setRHS(Reader.ReadSubExpr());
651  E->setOpcode((BinaryOperator::Opcode)Record[Idx++]);
652  E->setOperatorLoc(ReadSourceLocation(Record, Idx));
653  E->setFPContractable((bool)Record[Idx++]);
654 }
655 
656 void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
657  VisitBinaryOperator(E);
658  E->setComputationLHSType(Reader.readType(F, Record, Idx));
659  E->setComputationResultType(Reader.readType(F, Record, Idx));
660 }
661 
662 void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) {
663  VisitExpr(E);
664  E->SubExprs[ConditionalOperator::COND] = Reader.ReadSubExpr();
665  E->SubExprs[ConditionalOperator::LHS] = Reader.ReadSubExpr();
666  E->SubExprs[ConditionalOperator::RHS] = Reader.ReadSubExpr();
667  E->QuestionLoc = ReadSourceLocation(Record, Idx);
668  E->ColonLoc = ReadSourceLocation(Record, Idx);
669 }
670 
671 void
672 ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
673  VisitExpr(E);
674  E->OpaqueValue = cast<OpaqueValueExpr>(Reader.ReadSubExpr());
675  E->SubExprs[BinaryConditionalOperator::COMMON] = Reader.ReadSubExpr();
676  E->SubExprs[BinaryConditionalOperator::COND] = Reader.ReadSubExpr();
677  E->SubExprs[BinaryConditionalOperator::LHS] = Reader.ReadSubExpr();
678  E->SubExprs[BinaryConditionalOperator::RHS] = Reader.ReadSubExpr();
679  E->QuestionLoc = ReadSourceLocation(Record, Idx);
680  E->ColonLoc = ReadSourceLocation(Record, Idx);
681 }
682 
683 void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
684  VisitCastExpr(E);
685 }
686 
687 void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
688  VisitCastExpr(E);
689  E->setTypeInfoAsWritten(GetTypeSourceInfo(Record, Idx));
690 }
691 
692 void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
693  VisitExplicitCastExpr(E);
694  E->setLParenLoc(ReadSourceLocation(Record, Idx));
695  E->setRParenLoc(ReadSourceLocation(Record, Idx));
696 }
697 
698 void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
699  VisitExpr(E);
700  E->setLParenLoc(ReadSourceLocation(Record, Idx));
701  E->setTypeSourceInfo(GetTypeSourceInfo(Record, Idx));
702  E->setInitializer(Reader.ReadSubExpr());
703  E->setFileScope(Record[Idx++]);
704 }
705 
706 void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
707  VisitExpr(E);
708  E->setBase(Reader.ReadSubExpr());
709  E->setAccessor(Reader.GetIdentifierInfo(F, Record, Idx));
710  E->setAccessorLoc(ReadSourceLocation(Record, Idx));
711 }
712 
713 void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
714  VisitExpr(E);
715  if (InitListExpr *SyntForm = cast_or_null<InitListExpr>(Reader.ReadSubStmt()))
716  E->setSyntacticForm(SyntForm);
717  E->setLBraceLoc(ReadSourceLocation(Record, Idx));
718  E->setRBraceLoc(ReadSourceLocation(Record, Idx));
719  bool isArrayFiller = Record[Idx++];
720  Expr *filler = nullptr;
721  if (isArrayFiller) {
722  filler = Reader.ReadSubExpr();
723  E->ArrayFillerOrUnionFieldInit = filler;
724  } else
725  E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>(Record, Idx);
726  E->sawArrayRangeDesignator(Record[Idx++]);
727  unsigned NumInits = Record[Idx++];
728  E->reserveInits(Reader.getContext(), NumInits);
729  if (isArrayFiller) {
730  for (unsigned I = 0; I != NumInits; ++I) {
731  Expr *init = Reader.ReadSubExpr();
732  E->updateInit(Reader.getContext(), I, init ? init : filler);
733  }
734  } else {
735  for (unsigned I = 0; I != NumInits; ++I)
736  E->updateInit(Reader.getContext(), I, Reader.ReadSubExpr());
737  }
738 }
739 
740 void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
742 
743  VisitExpr(E);
744  unsigned NumSubExprs = Record[Idx++];
745  assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs");
746  for (unsigned I = 0; I != NumSubExprs; ++I)
747  E->setSubExpr(I, Reader.ReadSubExpr());
748  E->setEqualOrColonLoc(ReadSourceLocation(Record, Idx));
749  E->setGNUSyntax(Record[Idx++]);
750 
751  SmallVector<Designator, 4> Designators;
752  while (Idx < Record.size()) {
753  switch ((DesignatorTypes)Record[Idx++]) {
754  case DESIG_FIELD_DECL: {
755  FieldDecl *Field = ReadDeclAs<FieldDecl>(Record, Idx);
756  SourceLocation DotLoc
757  = ReadSourceLocation(Record, Idx);
758  SourceLocation FieldLoc
759  = ReadSourceLocation(Record, Idx);
760  Designators.push_back(Designator(Field->getIdentifier(), DotLoc,
761  FieldLoc));
762  Designators.back().setField(Field);
763  break;
764  }
765 
766  case DESIG_FIELD_NAME: {
767  const IdentifierInfo *Name = Reader.GetIdentifierInfo(F, Record, Idx);
768  SourceLocation DotLoc
769  = ReadSourceLocation(Record, Idx);
770  SourceLocation FieldLoc
771  = ReadSourceLocation(Record, Idx);
772  Designators.push_back(Designator(Name, DotLoc, FieldLoc));
773  break;
774  }
775 
776  case DESIG_ARRAY: {
777  unsigned Index = Record[Idx++];
778  SourceLocation LBracketLoc
779  = ReadSourceLocation(Record, Idx);
780  SourceLocation RBracketLoc
781  = ReadSourceLocation(Record, Idx);
782  Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc));
783  break;
784  }
785 
786  case DESIG_ARRAY_RANGE: {
787  unsigned Index = Record[Idx++];
788  SourceLocation LBracketLoc
789  = ReadSourceLocation(Record, Idx);
790  SourceLocation EllipsisLoc
791  = ReadSourceLocation(Record, Idx);
792  SourceLocation RBracketLoc
793  = ReadSourceLocation(Record, Idx);
794  Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc,
795  RBracketLoc));
796  break;
797  }
798  }
799  }
800  E->setDesignators(Reader.getContext(),
801  Designators.data(), Designators.size());
802 }
803 
804 void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
805  VisitExpr(E);
806  E->setBase(Reader.ReadSubExpr());
807  E->setUpdater(Reader.ReadSubExpr());
808 }
809 
810 void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) {
811  VisitExpr(E);
812 }
813 
814 void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
815  VisitExpr(E);
816 }
817 
818 void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
819  VisitExpr(E);
820  E->setSubExpr(Reader.ReadSubExpr());
821  E->setWrittenTypeInfo(GetTypeSourceInfo(Record, Idx));
822  E->setBuiltinLoc(ReadSourceLocation(Record, Idx));
823  E->setRParenLoc(ReadSourceLocation(Record, Idx));
824 }
825 
826 void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
827  VisitExpr(E);
828  E->setAmpAmpLoc(ReadSourceLocation(Record, Idx));
829  E->setLabelLoc(ReadSourceLocation(Record, Idx));
830  E->setLabel(ReadDeclAs<LabelDecl>(Record, Idx));
831 }
832 
833 void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
834  VisitExpr(E);
835  E->setLParenLoc(ReadSourceLocation(Record, Idx));
836  E->setRParenLoc(ReadSourceLocation(Record, Idx));
837  E->setSubStmt(cast_or_null<CompoundStmt>(Reader.ReadSubStmt()));
838 }
839 
840 void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
841  VisitExpr(E);
842  E->setCond(Reader.ReadSubExpr());
843  E->setLHS(Reader.ReadSubExpr());
844  E->setRHS(Reader.ReadSubExpr());
845  E->setBuiltinLoc(ReadSourceLocation(Record, Idx));
846  E->setRParenLoc(ReadSourceLocation(Record, Idx));
847  E->setIsConditionTrue(Record[Idx++]);
848 }
849 
850 void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
851  VisitExpr(E);
852  E->setTokenLocation(ReadSourceLocation(Record, Idx));
853 }
854 
855 void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
856  VisitExpr(E);
858  unsigned NumExprs = Record[Idx++];
859  while (NumExprs--)
860  Exprs.push_back(Reader.ReadSubExpr());
861  E->setExprs(Reader.getContext(), Exprs);
862  E->setBuiltinLoc(ReadSourceLocation(Record, Idx));
863  E->setRParenLoc(ReadSourceLocation(Record, Idx));
864 }
865 
866 void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
867  VisitExpr(E);
868  E->BuiltinLoc = ReadSourceLocation(Record, Idx);
869  E->RParenLoc = ReadSourceLocation(Record, Idx);
870  E->TInfo = GetTypeSourceInfo(Record, Idx);
871  E->SrcExpr = Reader.ReadSubExpr();
872 }
873 
874 void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
875  VisitExpr(E);
876  E->setBlockDecl(ReadDeclAs<BlockDecl>(Record, Idx));
877 }
878 
879 void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
880  VisitExpr(E);
881  E->NumAssocs = Record[Idx++];
882  E->AssocTypes = new (Reader.getContext()) TypeSourceInfo*[E->NumAssocs];
883  E->SubExprs =
884  new(Reader.getContext()) Stmt*[GenericSelectionExpr::END_EXPR+E->NumAssocs];
885 
886  E->SubExprs[GenericSelectionExpr::CONTROLLING] = Reader.ReadSubExpr();
887  for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
888  E->AssocTypes[I] = GetTypeSourceInfo(Record, Idx);
889  E->SubExprs[GenericSelectionExpr::END_EXPR+I] = Reader.ReadSubExpr();
890  }
891  E->ResultIndex = Record[Idx++];
892 
893  E->GenericLoc = ReadSourceLocation(Record, Idx);
894  E->DefaultLoc = ReadSourceLocation(Record, Idx);
895  E->RParenLoc = ReadSourceLocation(Record, Idx);
896 }
897 
898 void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
899  VisitExpr(E);
900  unsigned numSemanticExprs = Record[Idx++];
901  assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs);
902  E->PseudoObjectExprBits.ResultIndex = Record[Idx++];
903 
904  // Read the syntactic expression.
905  E->getSubExprsBuffer()[0] = Reader.ReadSubExpr();
906 
907  // Read all the semantic expressions.
908  for (unsigned i = 0; i != numSemanticExprs; ++i) {
909  Expr *subExpr = Reader.ReadSubExpr();
910  E->getSubExprsBuffer()[i+1] = subExpr;
911  }
912 }
913 
914 void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) {
915  VisitExpr(E);
916  E->Op = AtomicExpr::AtomicOp(Record[Idx++]);
917  E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
918  for (unsigned I = 0; I != E->NumSubExprs; ++I)
919  E->SubExprs[I] = Reader.ReadSubExpr();
920  E->BuiltinLoc = ReadSourceLocation(Record, Idx);
921  E->RParenLoc = ReadSourceLocation(Record, Idx);
922 }
923 
924 //===----------------------------------------------------------------------===//
925 // Objective-C Expressions and Statements
926 
927 void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
928  VisitExpr(E);
929  E->setString(cast<StringLiteral>(Reader.ReadSubStmt()));
930  E->setAtLoc(ReadSourceLocation(Record, Idx));
931 }
932 
933 void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
934  VisitExpr(E);
935  // could be one of several IntegerLiteral, FloatLiteral, etc.
936  E->SubExpr = Reader.ReadSubStmt();
937  E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx);
938  E->Range = ReadSourceRange(Record, Idx);
939 }
940 
941 void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
942  VisitExpr(E);
943  unsigned NumElements = Record[Idx++];
944  assert(NumElements == E->getNumElements() && "Wrong number of elements");
945  Expr **Elements = E->getElements();
946  for (unsigned I = 0, N = NumElements; I != N; ++I)
947  Elements[I] = Reader.ReadSubExpr();
948  E->ArrayWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx);
949  E->Range = ReadSourceRange(Record, Idx);
950 }
951 
952 void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
953  VisitExpr(E);
954  unsigned NumElements = Record[Idx++];
955  assert(NumElements == E->getNumElements() && "Wrong number of elements");
956  bool HasPackExpansions = Record[Idx++];
957  assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch");
958  ObjCDictionaryLiteral::KeyValuePair *KeyValues = E->getKeyValues();
959  ObjCDictionaryLiteral::ExpansionData *Expansions = E->getExpansionData();
960  for (unsigned I = 0; I != NumElements; ++I) {
961  KeyValues[I].Key = Reader.ReadSubExpr();
962  KeyValues[I].Value = Reader.ReadSubExpr();
963  if (HasPackExpansions) {
964  Expansions[I].EllipsisLoc = ReadSourceLocation(Record, Idx);
965  Expansions[I].NumExpansionsPlusOne = Record[Idx++];
966  }
967  }
968  E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx);
969  E->Range = ReadSourceRange(Record, Idx);
970 }
971 
972 void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
973  VisitExpr(E);
974  E->setEncodedTypeSourceInfo(GetTypeSourceInfo(Record, Idx));
975  E->setAtLoc(ReadSourceLocation(Record, Idx));
976  E->setRParenLoc(ReadSourceLocation(Record, Idx));
977 }
978 
979 void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
980  VisitExpr(E);
981  E->setSelector(Reader.ReadSelector(F, Record, Idx));
982  E->setAtLoc(ReadSourceLocation(Record, Idx));
983  E->setRParenLoc(ReadSourceLocation(Record, Idx));
984 }
985 
986 void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
987  VisitExpr(E);
988  E->setProtocol(ReadDeclAs<ObjCProtocolDecl>(Record, Idx));
989  E->setAtLoc(ReadSourceLocation(Record, Idx));
990  E->ProtoLoc = ReadSourceLocation(Record, Idx);
991  E->setRParenLoc(ReadSourceLocation(Record, Idx));
992 }
993 
994 void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
995  VisitExpr(E);
996  E->setDecl(ReadDeclAs<ObjCIvarDecl>(Record, Idx));
997  E->setLocation(ReadSourceLocation(Record, Idx));
998  E->setOpLoc(ReadSourceLocation(Record, Idx));
999  E->setBase(Reader.ReadSubExpr());
1000  E->setIsArrow(Record[Idx++]);
1001  E->setIsFreeIvar(Record[Idx++]);
1002 }
1003 
1004 void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
1005  VisitExpr(E);
1006  unsigned MethodRefFlags = Record[Idx++];
1007  bool Implicit = Record[Idx++] != 0;
1008  if (Implicit) {
1009  ObjCMethodDecl *Getter = ReadDeclAs<ObjCMethodDecl>(Record, Idx);
1010  ObjCMethodDecl *Setter = ReadDeclAs<ObjCMethodDecl>(Record, Idx);
1011  E->setImplicitProperty(Getter, Setter, MethodRefFlags);
1012  } else {
1013  E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(Record, Idx),
1014  MethodRefFlags);
1015  }
1016  E->setLocation(ReadSourceLocation(Record, Idx));
1017  E->setReceiverLocation(ReadSourceLocation(Record, Idx));
1018  switch (Record[Idx++]) {
1019  case 0:
1020  E->setBase(Reader.ReadSubExpr());
1021  break;
1022  case 1:
1023  E->setSuperReceiver(Reader.readType(F, Record, Idx));
1024  break;
1025  case 2:
1026  E->setClassReceiver(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx));
1027  break;
1028  }
1029 }
1030 
1031 void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
1032  VisitExpr(E);
1033  E->setRBracket(ReadSourceLocation(Record, Idx));
1034  E->setBaseExpr(Reader.ReadSubExpr());
1035  E->setKeyExpr(Reader.ReadSubExpr());
1036  E->GetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>(Record, Idx);
1037  E->SetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>(Record, Idx);
1038 }
1039 
1040 void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
1041  VisitExpr(E);
1042  assert(Record[Idx] == E->getNumArgs());
1043  ++Idx;
1044  unsigned NumStoredSelLocs = Record[Idx++];
1045  E->SelLocsKind = Record[Idx++];
1046  E->setDelegateInitCall(Record[Idx++]);
1047  E->IsImplicit = Record[Idx++];
1049  = static_cast<ObjCMessageExpr::ReceiverKind>(Record[Idx++]);
1050  switch (Kind) {
1052  E->setInstanceReceiver(Reader.ReadSubExpr());
1053  break;
1054 
1056  E->setClassReceiver(GetTypeSourceInfo(Record, Idx));
1057  break;
1058 
1061  QualType T = Reader.readType(F, Record, Idx);
1062  SourceLocation SuperLoc = ReadSourceLocation(Record, Idx);
1063  E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
1064  break;
1065  }
1066  }
1067 
1068  assert(Kind == E->getReceiverKind());
1069 
1070  if (Record[Idx++])
1071  E->setMethodDecl(ReadDeclAs<ObjCMethodDecl>(Record, Idx));
1072  else
1073  E->setSelector(Reader.ReadSelector(F, Record, Idx));
1074 
1075  E->LBracLoc = ReadSourceLocation(Record, Idx);
1076  E->RBracLoc = ReadSourceLocation(Record, Idx);
1077 
1078  for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1079  E->setArg(I, Reader.ReadSubExpr());
1080 
1081  SourceLocation *Locs = E->getStoredSelLocs();
1082  for (unsigned I = 0; I != NumStoredSelLocs; ++I)
1083  Locs[I] = ReadSourceLocation(Record, Idx);
1084 }
1085 
1086 void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
1087  VisitStmt(S);
1088  S->setElement(Reader.ReadSubStmt());
1089  S->setCollection(Reader.ReadSubExpr());
1090  S->setBody(Reader.ReadSubStmt());
1091  S->setForLoc(ReadSourceLocation(Record, Idx));
1092  S->setRParenLoc(ReadSourceLocation(Record, Idx));
1093 }
1094 
1095 void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
1096  VisitStmt(S);
1097  S->setCatchBody(Reader.ReadSubStmt());
1098  S->setCatchParamDecl(ReadDeclAs<VarDecl>(Record, Idx));
1099  S->setAtCatchLoc(ReadSourceLocation(Record, Idx));
1100  S->setRParenLoc(ReadSourceLocation(Record, Idx));
1101 }
1102 
1103 void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
1104  VisitStmt(S);
1105  S->setFinallyBody(Reader.ReadSubStmt());
1106  S->setAtFinallyLoc(ReadSourceLocation(Record, Idx));
1107 }
1108 
1109 void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
1110  VisitStmt(S);
1111  S->setSubStmt(Reader.ReadSubStmt());
1112  S->setAtLoc(ReadSourceLocation(Record, Idx));
1113 }
1114 
1115 void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
1116  VisitStmt(S);
1117  assert(Record[Idx] == S->getNumCatchStmts());
1118  ++Idx;
1119  bool HasFinally = Record[Idx++];
1120  S->setTryBody(Reader.ReadSubStmt());
1121  for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
1122  S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Reader.ReadSubStmt()));
1123 
1124  if (HasFinally)
1125  S->setFinallyStmt(Reader.ReadSubStmt());
1126  S->setAtTryLoc(ReadSourceLocation(Record, Idx));
1127 }
1128 
1129 void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
1130  VisitStmt(S);
1131  S->setSynchExpr(Reader.ReadSubStmt());
1132  S->setSynchBody(Reader.ReadSubStmt());
1133  S->setAtSynchronizedLoc(ReadSourceLocation(Record, Idx));
1134 }
1135 
1136 void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
1137  VisitStmt(S);
1138  S->setThrowExpr(Reader.ReadSubStmt());
1139  S->setThrowLoc(ReadSourceLocation(Record, Idx));
1140 }
1141 
1142 void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
1143  VisitExpr(E);
1144  E->setValue(Record[Idx++]);
1145  E->setLocation(ReadSourceLocation(Record, Idx));
1146 }
1147 
1148 //===----------------------------------------------------------------------===//
1149 // C++ Expressions and Statements
1150 //===----------------------------------------------------------------------===//
1151 
1152 void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
1153  VisitStmt(S);
1154  S->CatchLoc = ReadSourceLocation(Record, Idx);
1155  S->ExceptionDecl = ReadDeclAs<VarDecl>(Record, Idx);
1156  S->HandlerBlock = Reader.ReadSubStmt();
1157 }
1158 
1159 void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
1160  VisitStmt(S);
1161  assert(Record[Idx] == S->getNumHandlers() && "NumStmtFields is wrong ?");
1162  ++Idx;
1163  S->TryLoc = ReadSourceLocation(Record, Idx);
1164  S->getStmts()[0] = Reader.ReadSubStmt();
1165  for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
1166  S->getStmts()[i + 1] = Reader.ReadSubStmt();
1167 }
1168 
1169 void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
1170  VisitStmt(S);
1171  S->setForLoc(ReadSourceLocation(Record, Idx));
1172  S->setColonLoc(ReadSourceLocation(Record, Idx));
1173  S->setRParenLoc(ReadSourceLocation(Record, Idx));
1174  S->setRangeStmt(Reader.ReadSubStmt());
1175  S->setBeginEndStmt(Reader.ReadSubStmt());
1176  S->setCond(Reader.ReadSubExpr());
1177  S->setInc(Reader.ReadSubExpr());
1178  S->setLoopVarStmt(Reader.ReadSubStmt());
1179  S->setBody(Reader.ReadSubStmt());
1180 }
1181 
1182 void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
1183  VisitStmt(S);
1184  S->KeywordLoc = ReadSourceLocation(Record, Idx);
1185  S->IsIfExists = Record[Idx++];
1186  S->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
1187  ReadDeclarationNameInfo(S->NameInfo, Record, Idx);
1188  S->SubStmt = Reader.ReadSubStmt();
1189 }
1190 
1191 void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1192  VisitCallExpr(E);
1193  E->Operator = (OverloadedOperatorKind)Record[Idx++];
1194  E->Range = Reader.ReadSourceRange(F, Record, Idx);
1195  E->setFPContractable((bool)Record[Idx++]);
1196 }
1197 
1198 void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
1199  VisitExpr(E);
1200  E->NumArgs = Record[Idx++];
1201  if (E->NumArgs)
1202  E->Args = new (Reader.getContext()) Stmt*[E->NumArgs];
1203  for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1204  E->setArg(I, Reader.ReadSubExpr());
1205  E->setConstructor(ReadDeclAs<CXXConstructorDecl>(Record, Idx));
1206  E->setLocation(ReadSourceLocation(Record, Idx));
1207  E->setElidable(Record[Idx++]);
1208  E->setHadMultipleCandidates(Record[Idx++]);
1209  E->setListInitialization(Record[Idx++]);
1210  E->setStdInitListInitialization(Record[Idx++]);
1211  E->setRequiresZeroInitialization(Record[Idx++]);
1213  E->ParenOrBraceRange = ReadSourceRange(Record, Idx);
1214 }
1215 
1216 void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
1217  VisitCXXConstructExpr(E);
1218  E->Type = GetTypeSourceInfo(Record, Idx);
1219 }
1220 
1221 void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
1222  VisitExpr(E);
1223  unsigned NumCaptures = Record[Idx++];
1224  assert(NumCaptures == E->NumCaptures);(void)NumCaptures;
1225  unsigned NumArrayIndexVars = Record[Idx++];
1226  E->IntroducerRange = ReadSourceRange(Record, Idx);
1227  E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record[Idx++]);
1228  E->CaptureDefaultLoc = ReadSourceLocation(Record, Idx);
1229  E->ExplicitParams = Record[Idx++];
1230  E->ExplicitResultType = Record[Idx++];
1231  E->ClosingBrace = ReadSourceLocation(Record, Idx);
1232 
1233  // Read capture initializers.
1235  CEnd = E->capture_init_end();
1236  C != CEnd; ++C)
1237  *C = Reader.ReadSubExpr();
1238 
1239  // Read array capture index variables.
1240  if (NumArrayIndexVars > 0) {
1241  unsigned *ArrayIndexStarts = E->getArrayIndexStarts();
1242  for (unsigned I = 0; I != NumCaptures + 1; ++I)
1243  ArrayIndexStarts[I] = Record[Idx++];
1244 
1245  VarDecl **ArrayIndexVars = E->getArrayIndexVars();
1246  for (unsigned I = 0; I != NumArrayIndexVars; ++I)
1247  ArrayIndexVars[I] = ReadDeclAs<VarDecl>(Record, Idx);
1248  }
1249 }
1250 
1251 void
1252 ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
1253  VisitExpr(E);
1254  E->SubExpr = Reader.ReadSubExpr();
1255 }
1256 
1257 void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
1258  VisitExplicitCastExpr(E);
1259  SourceRange R = ReadSourceRange(Record, Idx);
1260  E->Loc = R.getBegin();
1261  E->RParenLoc = R.getEnd();
1262  R = ReadSourceRange(Record, Idx);
1263  E->AngleBrackets = R;
1264 }
1265 
1266 void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
1267  return VisitCXXNamedCastExpr(E);
1268 }
1269 
1270 void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
1271  return VisitCXXNamedCastExpr(E);
1272 }
1273 
1274 void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
1275  return VisitCXXNamedCastExpr(E);
1276 }
1277 
1278 void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
1279  return VisitCXXNamedCastExpr(E);
1280 }
1281 
1282 void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
1283  VisitExplicitCastExpr(E);
1284  E->setLParenLoc(ReadSourceLocation(Record, Idx));
1285  E->setRParenLoc(ReadSourceLocation(Record, Idx));
1286 }
1287 
1288 void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
1289  VisitCallExpr(E);
1290  E->UDSuffixLoc = ReadSourceLocation(Record, Idx);
1291 }
1292 
1293 void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
1294  VisitExpr(E);
1295  E->setValue(Record[Idx++]);
1296  E->setLocation(ReadSourceLocation(Record, Idx));
1297 }
1298 
1299 void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
1300  VisitExpr(E);
1301  E->setLocation(ReadSourceLocation(Record, Idx));
1302 }
1303 
1304 void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
1305  VisitExpr(E);
1306  E->setSourceRange(ReadSourceRange(Record, Idx));
1307  if (E->isTypeOperand()) { // typeid(int)
1309  GetTypeSourceInfo(Record, Idx));
1310  return;
1311  }
1312 
1313  // typeid(42+2)
1314  E->setExprOperand(Reader.ReadSubExpr());
1315 }
1316 
1317 void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
1318  VisitExpr(E);
1319  E->setLocation(ReadSourceLocation(Record, Idx));
1320  E->setImplicit(Record[Idx++]);
1321 }
1322 
1323 void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
1324  VisitExpr(E);
1325  E->ThrowLoc = ReadSourceLocation(Record, Idx);
1326  E->Op = Reader.ReadSubExpr();
1327  E->IsThrownVariableInScope = Record[Idx++];
1328 }
1329 
1330 void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
1331  VisitExpr(E);
1332 
1333  assert((bool)Record[Idx] == E->Param.getInt() && "We messed up at creation ?");
1334  ++Idx; // HasOtherExprStored and SubExpr was handled during creation.
1335  E->Param.setPointer(ReadDeclAs<ParmVarDecl>(Record, Idx));
1336  E->Loc = ReadSourceLocation(Record, Idx);
1337 }
1338 
1339 void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
1340  VisitExpr(E);
1341  E->Field = ReadDeclAs<FieldDecl>(Record, Idx);
1342  E->Loc = ReadSourceLocation(Record, Idx);
1343 }
1344 
1345 void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
1346  VisitExpr(E);
1347  E->setTemporary(Reader.ReadCXXTemporary(F, Record, Idx));
1348  E->setSubExpr(Reader.ReadSubExpr());
1349 }
1350 
1351 void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
1352  VisitExpr(E);
1353  E->TypeInfo = GetTypeSourceInfo(Record, Idx);
1354  E->RParenLoc = ReadSourceLocation(Record, Idx);
1355 }
1356 
1357 void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
1358  VisitExpr(E);
1359  E->GlobalNew = Record[Idx++];
1360  bool isArray = Record[Idx++];
1361  E->UsualArrayDeleteWantsSize = Record[Idx++];
1362  unsigned NumPlacementArgs = Record[Idx++];
1363  E->StoredInitializationStyle = Record[Idx++];
1364  E->setOperatorNew(ReadDeclAs<FunctionDecl>(Record, Idx));
1365  E->setOperatorDelete(ReadDeclAs<FunctionDecl>(Record, Idx));
1366  E->AllocatedTypeInfo = GetTypeSourceInfo(Record, Idx);
1367  E->TypeIdParens = ReadSourceRange(Record, Idx);
1368  E->Range = ReadSourceRange(Record, Idx);
1369  E->DirectInitRange = ReadSourceRange(Record, Idx);
1370 
1371  E->AllocateArgsArray(Reader.getContext(), isArray, NumPlacementArgs,
1372  E->StoredInitializationStyle != 0);
1373 
1374  // Install all the subexpressions.
1376  I != e; ++I)
1377  *I = Reader.ReadSubStmt();
1378 }
1379 
1380 void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1381  VisitExpr(E);
1382  E->GlobalDelete = Record[Idx++];
1383  E->ArrayForm = Record[Idx++];
1384  E->ArrayFormAsWritten = Record[Idx++];
1385  E->UsualArrayDeleteWantsSize = Record[Idx++];
1386  E->OperatorDelete = ReadDeclAs<FunctionDecl>(Record, Idx);
1387  E->Argument = Reader.ReadSubExpr();
1388  E->Loc = ReadSourceLocation(Record, Idx);
1389 }
1390 
1391 void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
1392  VisitExpr(E);
1393 
1394  E->Base = Reader.ReadSubExpr();
1395  E->IsArrow = Record[Idx++];
1396  E->OperatorLoc = ReadSourceLocation(Record, Idx);
1397  E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
1398  E->ScopeType = GetTypeSourceInfo(Record, Idx);
1399  E->ColonColonLoc = ReadSourceLocation(Record, Idx);
1400  E->TildeLoc = ReadSourceLocation(Record, Idx);
1401 
1402  IdentifierInfo *II = Reader.GetIdentifierInfo(F, Record, Idx);
1403  if (II)
1404  E->setDestroyedType(II, ReadSourceLocation(Record, Idx));
1405  else
1406  E->setDestroyedType(GetTypeSourceInfo(Record, Idx));
1407 }
1408 
1409 void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
1410  VisitExpr(E);
1411 
1412  unsigned NumObjects = Record[Idx++];
1413  assert(NumObjects == E->getNumObjects());
1414  for (unsigned i = 0; i != NumObjects; ++i)
1415  E->getObjectsBuffer()[i] = ReadDeclAs<BlockDecl>(Record, Idx);
1416 
1417  E->SubExpr = Reader.ReadSubExpr();
1418 }
1419 
1420 void
1421 ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
1422  VisitExpr(E);
1423 
1424  if (Record[Idx++]) // HasTemplateKWAndArgsInfo
1425  ReadTemplateKWAndArgsInfo(*E->getTemplateKWAndArgsInfo(),
1426  /*NumTemplateArgs=*/Record[Idx++]);
1427 
1428  E->Base = Reader.ReadSubExpr();
1429  E->BaseType = Reader.readType(F, Record, Idx);
1430  E->IsArrow = Record[Idx++];
1431  E->OperatorLoc = ReadSourceLocation(Record, Idx);
1432  E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
1433  E->FirstQualifierFoundInScope = ReadDeclAs<NamedDecl>(Record, Idx);
1434  ReadDeclarationNameInfo(E->MemberNameInfo, Record, Idx);
1435 }
1436 
1437 void
1438 ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
1439  VisitExpr(E);
1440 
1441  if (Record[Idx++]) // HasTemplateKWAndArgsInfo
1442  ReadTemplateKWAndArgsInfo(*E->getTemplateKWAndArgsInfo(),
1443  /*NumTemplateArgs=*/Record[Idx++]);
1444 
1445  E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
1446  ReadDeclarationNameInfo(E->NameInfo, Record, Idx);
1447 }
1448 
1449 void
1450 ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
1451  VisitExpr(E);
1452  assert(Record[Idx] == E->arg_size() && "Read wrong record during creation ?");
1453  ++Idx; // NumArgs;
1454  for (unsigned I = 0, N = E->arg_size(); I != N; ++I)
1455  E->setArg(I, Reader.ReadSubExpr());
1456  E->Type = GetTypeSourceInfo(Record, Idx);
1457  E->setLParenLoc(ReadSourceLocation(Record, Idx));
1458  E->setRParenLoc(ReadSourceLocation(Record, Idx));
1459 }
1460 
1461 void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
1462  VisitExpr(E);
1463 
1464  if (Record[Idx++]) // HasTemplateKWAndArgsInfo
1465  ReadTemplateKWAndArgsInfo(*E->getTemplateKWAndArgsInfo(),
1466  /*NumTemplateArgs=*/Record[Idx++]);
1467 
1468  unsigned NumDecls = Record[Idx++];
1469  UnresolvedSet<8> Decls;
1470  for (unsigned i = 0; i != NumDecls; ++i) {
1471  NamedDecl *D = ReadDeclAs<NamedDecl>(Record, Idx);
1472  AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
1473  Decls.addDecl(D, AS);
1474  }
1475  E->initializeResults(Reader.getContext(), Decls.begin(), Decls.end());
1476 
1477  ReadDeclarationNameInfo(E->NameInfo, Record, Idx);
1478  E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
1479 }
1480 
1481 void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
1482  VisitOverloadExpr(E);
1483  E->IsArrow = Record[Idx++];
1484  E->HasUnresolvedUsing = Record[Idx++];
1485  E->Base = Reader.ReadSubExpr();
1486  E->BaseType = Reader.readType(F, Record, Idx);
1487  E->OperatorLoc = ReadSourceLocation(Record, Idx);
1488 }
1489 
1490 void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
1491  VisitOverloadExpr(E);
1492  E->RequiresADL = Record[Idx++];
1493  E->Overloaded = Record[Idx++];
1494  E->NamingClass = ReadDeclAs<CXXRecordDecl>(Record, Idx);
1495 }
1496 
1497 void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
1498  VisitExpr(E);
1499  E->TypeTraitExprBits.NumArgs = Record[Idx++];
1500  E->TypeTraitExprBits.Kind = Record[Idx++];
1501  E->TypeTraitExprBits.Value = Record[Idx++];
1502  SourceRange Range = ReadSourceRange(Record, Idx);
1503  E->Loc = Range.getBegin();
1504  E->RParenLoc = Range.getEnd();
1505 
1506  TypeSourceInfo **Args = E->getTypeSourceInfos();
1507  for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
1508  Args[I] = GetTypeSourceInfo(Record, Idx);
1509 }
1510 
1511 void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
1512  VisitExpr(E);
1513  E->ATT = (ArrayTypeTrait)Record[Idx++];
1514  E->Value = (unsigned int)Record[Idx++];
1515  SourceRange Range = ReadSourceRange(Record, Idx);
1516  E->Loc = Range.getBegin();
1517  E->RParen = Range.getEnd();
1518  E->QueriedType = GetTypeSourceInfo(Record, Idx);
1519 }
1520 
1521 void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
1522  VisitExpr(E);
1523  E->ET = (ExpressionTrait)Record[Idx++];
1524  E->Value = (bool)Record[Idx++];
1525  SourceRange Range = ReadSourceRange(Record, Idx);
1526  E->QueriedExpression = Reader.ReadSubExpr();
1527  E->Loc = Range.getBegin();
1528  E->RParen = Range.getEnd();
1529 }
1530 
1531 void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
1532  VisitExpr(E);
1533  E->Value = (bool)Record[Idx++];
1534  E->Range = ReadSourceRange(Record, Idx);
1535  E->Operand = Reader.ReadSubExpr();
1536 }
1537 
1538 void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
1539  VisitExpr(E);
1540  E->EllipsisLoc = ReadSourceLocation(Record, Idx);
1541  E->NumExpansions = Record[Idx++];
1542  E->Pattern = Reader.ReadSubExpr();
1543 }
1544 
1545 void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
1546  VisitExpr(E);
1547  E->OperatorLoc = ReadSourceLocation(Record, Idx);
1548  E->PackLoc = ReadSourceLocation(Record, Idx);
1549  E->RParenLoc = ReadSourceLocation(Record, Idx);
1550  E->Length = Record[Idx++];
1551  E->Pack = ReadDeclAs<NamedDecl>(Record, Idx);
1552 }
1553 
1554 void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
1556  VisitExpr(E);
1557  E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(Record, Idx);
1558  E->NameLoc = ReadSourceLocation(Record, Idx);
1559  E->Replacement = Reader.ReadSubExpr();
1560 }
1561 
1562 void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
1564  VisitExpr(E);
1565  E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(Record, Idx);
1566  TemplateArgument ArgPack = Reader.ReadTemplateArgument(F, Record, Idx);
1567  if (ArgPack.getKind() != TemplateArgument::Pack)
1568  return;
1569 
1570  E->Arguments = ArgPack.pack_begin();
1571  E->NumArguments = ArgPack.pack_size();
1572  E->NameLoc = ReadSourceLocation(Record, Idx);
1573 }
1574 
1575 void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
1576  VisitExpr(E);
1577  E->NumParameters = Record[Idx++];
1578  E->ParamPack = ReadDeclAs<ParmVarDecl>(Record, Idx);
1579  E->NameLoc = ReadSourceLocation(Record, Idx);
1580  ParmVarDecl **Parms = reinterpret_cast<ParmVarDecl**>(E+1);
1581  for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
1582  Parms[i] = ReadDeclAs<ParmVarDecl>(Record, Idx);
1583 }
1584 
1585 void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
1586  VisitExpr(E);
1587  E->State = Reader.ReadSubExpr();
1588  auto VD = ReadDeclAs<ValueDecl>(Record, Idx);
1589  unsigned ManglingNumber = Record[Idx++];
1590  E->setExtendingDecl(VD, ManglingNumber);
1591 }
1592 
1593 void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
1594  VisitExpr(E);
1595  E->LParenLoc = ReadSourceLocation(Record, Idx);
1596  E->EllipsisLoc = ReadSourceLocation(Record, Idx);
1597  E->RParenLoc = ReadSourceLocation(Record, Idx);
1598  E->SubExprs[0] = Reader.ReadSubExpr();
1599  E->SubExprs[1] = Reader.ReadSubExpr();
1600  E->Opcode = (BinaryOperatorKind)Record[Idx++];
1601 }
1602 
1603 void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
1604  VisitExpr(E);
1605  E->SourceExpr = Reader.ReadSubExpr();
1606  E->Loc = ReadSourceLocation(Record, Idx);
1607 }
1608 
1609 void ASTStmtReader::VisitTypoExpr(TypoExpr *E) {
1610  llvm_unreachable("Cannot read TypoExpr nodes");
1611 }
1612 
1613 //===----------------------------------------------------------------------===//
1614 // Microsoft Expressions and Statements
1615 //===----------------------------------------------------------------------===//
1616 void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
1617  VisitExpr(E);
1618  E->IsArrow = (Record[Idx++] != 0);
1619  E->BaseExpr = Reader.ReadSubExpr();
1620  E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
1621  E->MemberLoc = ReadSourceLocation(Record, Idx);
1622  E->TheDecl = ReadDeclAs<MSPropertyDecl>(Record, Idx);
1623 }
1624 
1625 void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
1626  VisitExpr(E);
1627  E->setSourceRange(ReadSourceRange(Record, Idx));
1628  if (E->isTypeOperand()) { // __uuidof(ComType)
1630  GetTypeSourceInfo(Record, Idx));
1631  return;
1632  }
1633 
1634  // __uuidof(expr)
1635  E->setExprOperand(Reader.ReadSubExpr());
1636 }
1637 
1638 void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
1639  VisitStmt(S);
1640  S->setLeaveLoc(ReadSourceLocation(Record, Idx));
1641 }
1642 
1643 void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
1644  VisitStmt(S);
1645  S->Loc = ReadSourceLocation(Record, Idx);
1646  S->Children[SEHExceptStmt::FILTER_EXPR] = Reader.ReadSubStmt();
1647  S->Children[SEHExceptStmt::BLOCK] = Reader.ReadSubStmt();
1648 }
1649 
1650 void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
1651  VisitStmt(S);
1652  S->Loc = ReadSourceLocation(Record, Idx);
1653  S->Block = Reader.ReadSubStmt();
1654 }
1655 
1656 void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
1657  VisitStmt(S);
1658  S->IsCXXTry = Record[Idx++];
1659  S->TryLoc = ReadSourceLocation(Record, Idx);
1660  S->Children[SEHTryStmt::TRY] = Reader.ReadSubStmt();
1661  S->Children[SEHTryStmt::HANDLER] = Reader.ReadSubStmt();
1662 }
1663 
1664 //===----------------------------------------------------------------------===//
1665 // CUDA Expressions and Statements
1666 //===----------------------------------------------------------------------===//
1667 
1668 void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
1669  VisitCallExpr(E);
1670  E->setConfig(cast<CallExpr>(Reader.ReadSubExpr()));
1671 }
1672 
1673 //===----------------------------------------------------------------------===//
1674 // OpenCL Expressions and Statements.
1675 //===----------------------------------------------------------------------===//
1676 void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
1677  VisitExpr(E);
1678  E->BuiltinLoc = ReadSourceLocation(Record, Idx);
1679  E->RParenLoc = ReadSourceLocation(Record, Idx);
1680  E->SrcExpr = Reader.ReadSubExpr();
1681 }
1682 
1683 //===----------------------------------------------------------------------===//
1684 // OpenMP Clauses.
1685 //===----------------------------------------------------------------------===//
1686 
1687 namespace clang {
1688 class OMPClauseReader : public OMPClauseVisitor<OMPClauseReader> {
1689  ASTStmtReader *Reader;
1691  const ASTReader::RecordData &Record;
1692  unsigned &Idx;
1693 public:
1695  const ASTReader::RecordData &Record, unsigned &Idx)
1696  : Reader(R), Context(C), Record(Record), Idx(Idx) { }
1697 #define OPENMP_CLAUSE(Name, Class) \
1698  void Visit##Class(Class *S);
1699 #include "clang/Basic/OpenMPKinds.def"
1700  OMPClause *readClause();
1701 };
1702 }
1703 
1705  OMPClause *C;
1706  switch (Record[Idx++]) {
1707  case OMPC_if:
1708  C = new (Context) OMPIfClause();
1709  break;
1710  case OMPC_final:
1711  C = new (Context) OMPFinalClause();
1712  break;
1713  case OMPC_num_threads:
1714  C = new (Context) OMPNumThreadsClause();
1715  break;
1716  case OMPC_safelen:
1717  C = new (Context) OMPSafelenClause();
1718  break;
1719  case OMPC_collapse:
1720  C = new (Context) OMPCollapseClause();
1721  break;
1722  case OMPC_default:
1723  C = new (Context) OMPDefaultClause();
1724  break;
1725  case OMPC_proc_bind:
1726  C = new (Context) OMPProcBindClause();
1727  break;
1728  case OMPC_schedule:
1729  C = new (Context) OMPScheduleClause();
1730  break;
1731  case OMPC_ordered:
1732  C = new (Context) OMPOrderedClause();
1733  break;
1734  case OMPC_nowait:
1735  C = new (Context) OMPNowaitClause();
1736  break;
1737  case OMPC_untied:
1738  C = new (Context) OMPUntiedClause();
1739  break;
1740  case OMPC_mergeable:
1741  C = new (Context) OMPMergeableClause();
1742  break;
1743  case OMPC_read:
1744  C = new (Context) OMPReadClause();
1745  break;
1746  case OMPC_write:
1747  C = new (Context) OMPWriteClause();
1748  break;
1749  case OMPC_update:
1750  C = new (Context) OMPUpdateClause();
1751  break;
1752  case OMPC_capture:
1753  C = new (Context) OMPCaptureClause();
1754  break;
1755  case OMPC_seq_cst:
1756  C = new (Context) OMPSeqCstClause();
1757  break;
1758  case OMPC_private:
1759  C = OMPPrivateClause::CreateEmpty(Context, Record[Idx++]);
1760  break;
1761  case OMPC_firstprivate:
1762  C = OMPFirstprivateClause::CreateEmpty(Context, Record[Idx++]);
1763  break;
1764  case OMPC_lastprivate:
1765  C = OMPLastprivateClause::CreateEmpty(Context, Record[Idx++]);
1766  break;
1767  case OMPC_shared:
1768  C = OMPSharedClause::CreateEmpty(Context, Record[Idx++]);
1769  break;
1770  case OMPC_reduction:
1771  C = OMPReductionClause::CreateEmpty(Context, Record[Idx++]);
1772  break;
1773  case OMPC_linear:
1774  C = OMPLinearClause::CreateEmpty(Context, Record[Idx++]);
1775  break;
1776  case OMPC_aligned:
1777  C = OMPAlignedClause::CreateEmpty(Context, Record[Idx++]);
1778  break;
1779  case OMPC_copyin:
1780  C = OMPCopyinClause::CreateEmpty(Context, Record[Idx++]);
1781  break;
1782  case OMPC_copyprivate:
1783  C = OMPCopyprivateClause::CreateEmpty(Context, Record[Idx++]);
1784  break;
1785  case OMPC_flush:
1786  C = OMPFlushClause::CreateEmpty(Context, Record[Idx++]);
1787  break;
1788  case OMPC_depend:
1789  C = OMPDependClause::CreateEmpty(Context, Record[Idx++]);
1790  break;
1791  }
1792  Visit(C);
1793  C->setLocStart(Reader->ReadSourceLocation(Record, Idx));
1794  C->setLocEnd(Reader->ReadSourceLocation(Record, Idx));
1795 
1796  return C;
1797 }
1798 
1799 void OMPClauseReader::VisitOMPIfClause(OMPIfClause *C) {
1800  C->setCondition(Reader->Reader.ReadSubExpr());
1801  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1802 }
1803 
1804 void OMPClauseReader::VisitOMPFinalClause(OMPFinalClause *C) {
1805  C->setCondition(Reader->Reader.ReadSubExpr());
1806  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1807 }
1808 
1809 void OMPClauseReader::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) {
1810  C->setNumThreads(Reader->Reader.ReadSubExpr());
1811  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1812 }
1813 
1814 void OMPClauseReader::VisitOMPSafelenClause(OMPSafelenClause *C) {
1815  C->setSafelen(Reader->Reader.ReadSubExpr());
1816  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1817 }
1818 
1819 void OMPClauseReader::VisitOMPCollapseClause(OMPCollapseClause *C) {
1820  C->setNumForLoops(Reader->Reader.ReadSubExpr());
1821  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1822 }
1823 
1824 void OMPClauseReader::VisitOMPDefaultClause(OMPDefaultClause *C) {
1825  C->setDefaultKind(
1826  static_cast<OpenMPDefaultClauseKind>(Record[Idx++]));
1827  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1828  C->setDefaultKindKwLoc(Reader->ReadSourceLocation(Record, Idx));
1829 }
1830 
1831 void OMPClauseReader::VisitOMPProcBindClause(OMPProcBindClause *C) {
1832  C->setProcBindKind(
1833  static_cast<OpenMPProcBindClauseKind>(Record[Idx++]));
1834  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1835  C->setProcBindKindKwLoc(Reader->ReadSourceLocation(Record, Idx));
1836 }
1837 
1838 void OMPClauseReader::VisitOMPScheduleClause(OMPScheduleClause *C) {
1839  C->setScheduleKind(
1840  static_cast<OpenMPScheduleClauseKind>(Record[Idx++]));
1841  C->setChunkSize(Reader->Reader.ReadSubExpr());
1842  C->setHelperChunkSize(Reader->Reader.ReadSubExpr());
1843  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1844  C->setScheduleKindLoc(Reader->ReadSourceLocation(Record, Idx));
1845  C->setCommaLoc(Reader->ReadSourceLocation(Record, Idx));
1846 }
1847 
1848 void OMPClauseReader::VisitOMPOrderedClause(OMPOrderedClause *) {}
1849 
1850 void OMPClauseReader::VisitOMPNowaitClause(OMPNowaitClause *) {}
1851 
1852 void OMPClauseReader::VisitOMPUntiedClause(OMPUntiedClause *) {}
1853 
1854 void OMPClauseReader::VisitOMPMergeableClause(OMPMergeableClause *) {}
1855 
1856 void OMPClauseReader::VisitOMPReadClause(OMPReadClause *) {}
1857 
1858 void OMPClauseReader::VisitOMPWriteClause(OMPWriteClause *) {}
1859 
1860 void OMPClauseReader::VisitOMPUpdateClause(OMPUpdateClause *) {}
1861 
1862 void OMPClauseReader::VisitOMPCaptureClause(OMPCaptureClause *) {}
1863 
1864 void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
1865 
1866 void OMPClauseReader::VisitOMPPrivateClause(OMPPrivateClause *C) {
1867  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1868  unsigned NumVars = C->varlist_size();
1870  Vars.reserve(NumVars);
1871  for (unsigned i = 0; i != NumVars; ++i)
1872  Vars.push_back(Reader->Reader.ReadSubExpr());
1873  C->setVarRefs(Vars);
1874  Vars.clear();
1875  for (unsigned i = 0; i != NumVars; ++i)
1876  Vars.push_back(Reader->Reader.ReadSubExpr());
1877  C->setPrivateCopies(Vars);
1878 }
1879 
1880 void OMPClauseReader::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) {
1881  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1882  unsigned NumVars = C->varlist_size();
1884  Vars.reserve(NumVars);
1885  for (unsigned i = 0; i != NumVars; ++i)
1886  Vars.push_back(Reader->Reader.ReadSubExpr());
1887  C->setVarRefs(Vars);
1888  Vars.clear();
1889  for (unsigned i = 0; i != NumVars; ++i)
1890  Vars.push_back(Reader->Reader.ReadSubExpr());
1891  C->setPrivateCopies(Vars);
1892  Vars.clear();
1893  for (unsigned i = 0; i != NumVars; ++i)
1894  Vars.push_back(Reader->Reader.ReadSubExpr());
1895  C->setInits(Vars);
1896 }
1897 
1898 void OMPClauseReader::VisitOMPLastprivateClause(OMPLastprivateClause *C) {
1899  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1900  unsigned NumVars = C->varlist_size();
1902  Vars.reserve(NumVars);
1903  for (unsigned i = 0; i != NumVars; ++i)
1904  Vars.push_back(Reader->Reader.ReadSubExpr());
1905  C->setVarRefs(Vars);
1906  Vars.clear();
1907  for (unsigned i = 0; i != NumVars; ++i)
1908  Vars.push_back(Reader->Reader.ReadSubExpr());
1909  C->setPrivateCopies(Vars);
1910  Vars.clear();
1911  for (unsigned i = 0; i != NumVars; ++i)
1912  Vars.push_back(Reader->Reader.ReadSubExpr());
1913  C->setSourceExprs(Vars);
1914  Vars.clear();
1915  for (unsigned i = 0; i != NumVars; ++i)
1916  Vars.push_back(Reader->Reader.ReadSubExpr());
1917  C->setDestinationExprs(Vars);
1918  Vars.clear();
1919  for (unsigned i = 0; i != NumVars; ++i)
1920  Vars.push_back(Reader->Reader.ReadSubExpr());
1921  C->setAssignmentOps(Vars);
1922 }
1923 
1924 void OMPClauseReader::VisitOMPSharedClause(OMPSharedClause *C) {
1925  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1926  unsigned NumVars = C->varlist_size();
1928  Vars.reserve(NumVars);
1929  for (unsigned i = 0; i != NumVars; ++i)
1930  Vars.push_back(Reader->Reader.ReadSubExpr());
1931  C->setVarRefs(Vars);
1932 }
1933 
1934 void OMPClauseReader::VisitOMPReductionClause(OMPReductionClause *C) {
1935  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1936  C->setColonLoc(Reader->ReadSourceLocation(Record, Idx));
1937  NestedNameSpecifierLoc NNSL =
1938  Reader->Reader.ReadNestedNameSpecifierLoc(Reader->F, Record, Idx);
1939  DeclarationNameInfo DNI;
1940  Reader->ReadDeclarationNameInfo(DNI, Record, Idx);
1941  C->setQualifierLoc(NNSL);
1942  C->setNameInfo(DNI);
1943 
1944  unsigned NumVars = C->varlist_size();
1946  Vars.reserve(NumVars);
1947  for (unsigned i = 0; i != NumVars; ++i)
1948  Vars.push_back(Reader->Reader.ReadSubExpr());
1949  C->setVarRefs(Vars);
1950  Vars.clear();
1951  for (unsigned i = 0; i != NumVars; ++i)
1952  Vars.push_back(Reader->Reader.ReadSubExpr());
1953  C->setLHSExprs(Vars);
1954  Vars.clear();
1955  for (unsigned i = 0; i != NumVars; ++i)
1956  Vars.push_back(Reader->Reader.ReadSubExpr());
1957  C->setRHSExprs(Vars);
1958  Vars.clear();
1959  for (unsigned i = 0; i != NumVars; ++i)
1960  Vars.push_back(Reader->Reader.ReadSubExpr());
1961  C->setReductionOps(Vars);
1962 }
1963 
1964 void OMPClauseReader::VisitOMPLinearClause(OMPLinearClause *C) {
1965  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1966  C->setColonLoc(Reader->ReadSourceLocation(Record, Idx));
1967  unsigned NumVars = C->varlist_size();
1969  Vars.reserve(NumVars);
1970  for (unsigned i = 0; i != NumVars; ++i)
1971  Vars.push_back(Reader->Reader.ReadSubExpr());
1972  C->setVarRefs(Vars);
1973  Vars.clear();
1974  for (unsigned i = 0; i != NumVars; ++i)
1975  Vars.push_back(Reader->Reader.ReadSubExpr());
1976  C->setInits(Vars);
1977  Vars.clear();
1978  for (unsigned i = 0; i != NumVars; ++i)
1979  Vars.push_back(Reader->Reader.ReadSubExpr());
1980  C->setUpdates(Vars);
1981  Vars.clear();
1982  for (unsigned i = 0; i != NumVars; ++i)
1983  Vars.push_back(Reader->Reader.ReadSubExpr());
1984  C->setFinals(Vars);
1985  C->setStep(Reader->Reader.ReadSubExpr());
1986  C->setCalcStep(Reader->Reader.ReadSubExpr());
1987 }
1988 
1989 void OMPClauseReader::VisitOMPAlignedClause(OMPAlignedClause *C) {
1990  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
1991  C->setColonLoc(Reader->ReadSourceLocation(Record, Idx));
1992  unsigned NumVars = C->varlist_size();
1994  Vars.reserve(NumVars);
1995  for (unsigned i = 0; i != NumVars; ++i)
1996  Vars.push_back(Reader->Reader.ReadSubExpr());
1997  C->setVarRefs(Vars);
1998  C->setAlignment(Reader->Reader.ReadSubExpr());
1999 }
2000 
2001 void OMPClauseReader::VisitOMPCopyinClause(OMPCopyinClause *C) {
2002  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
2003  unsigned NumVars = C->varlist_size();
2005  Exprs.reserve(NumVars);
2006  for (unsigned i = 0; i != NumVars; ++i)
2007  Exprs.push_back(Reader->Reader.ReadSubExpr());
2008  C->setVarRefs(Exprs);
2009  Exprs.clear();
2010  for (unsigned i = 0; i != NumVars; ++i)
2011  Exprs.push_back(Reader->Reader.ReadSubExpr());
2012  C->setSourceExprs(Exprs);
2013  Exprs.clear();
2014  for (unsigned i = 0; i != NumVars; ++i)
2015  Exprs.push_back(Reader->Reader.ReadSubExpr());
2016  C->setDestinationExprs(Exprs);
2017  Exprs.clear();
2018  for (unsigned i = 0; i != NumVars; ++i)
2019  Exprs.push_back(Reader->Reader.ReadSubExpr());
2020  C->setAssignmentOps(Exprs);
2021 }
2022 
2023 void OMPClauseReader::VisitOMPCopyprivateClause(OMPCopyprivateClause *C) {
2024  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
2025  unsigned NumVars = C->varlist_size();
2027  Exprs.reserve(NumVars);
2028  for (unsigned i = 0; i != NumVars; ++i)
2029  Exprs.push_back(Reader->Reader.ReadSubExpr());
2030  C->setVarRefs(Exprs);
2031  Exprs.clear();
2032  for (unsigned i = 0; i != NumVars; ++i)
2033  Exprs.push_back(Reader->Reader.ReadSubExpr());
2034  C->setSourceExprs(Exprs);
2035  Exprs.clear();
2036  for (unsigned i = 0; i != NumVars; ++i)
2037  Exprs.push_back(Reader->Reader.ReadSubExpr());
2038  C->setDestinationExprs(Exprs);
2039  Exprs.clear();
2040  for (unsigned i = 0; i != NumVars; ++i)
2041  Exprs.push_back(Reader->Reader.ReadSubExpr());
2042  C->setAssignmentOps(Exprs);
2043 }
2044 
2045 void OMPClauseReader::VisitOMPFlushClause(OMPFlushClause *C) {
2046  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
2047  unsigned NumVars = C->varlist_size();
2049  Vars.reserve(NumVars);
2050  for (unsigned i = 0; i != NumVars; ++i)
2051  Vars.push_back(Reader->Reader.ReadSubExpr());
2052  C->setVarRefs(Vars);
2053 }
2054 
2055 void OMPClauseReader::VisitOMPDependClause(OMPDependClause *C) {
2056  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
2057  C->setDependencyKind(static_cast<OpenMPDependClauseKind>(Record[Idx++]));
2058  C->setDependencyLoc(Reader->ReadSourceLocation(Record, Idx));
2059  C->setColonLoc(Reader->ReadSourceLocation(Record, Idx));
2060  unsigned NumVars = C->varlist_size();
2062  Vars.reserve(NumVars);
2063  for (unsigned i = 0; i != NumVars; ++i)
2064  Vars.push_back(Reader->Reader.ReadSubExpr());
2065  C->setVarRefs(Vars);
2066 }
2067 
2068 //===----------------------------------------------------------------------===//
2069 // OpenMP Directives.
2070 //===----------------------------------------------------------------------===//
2071 void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
2072  E->setLocStart(ReadSourceLocation(Record, Idx));
2073  E->setLocEnd(ReadSourceLocation(Record, Idx));
2074  OMPClauseReader ClauseReader(this, Reader.getContext(), Record, Idx);
2076  for (unsigned i = 0; i < E->getNumClauses(); ++i)
2077  Clauses.push_back(ClauseReader.readClause());
2078  E->setClauses(Clauses);
2079  if (E->hasAssociatedStmt())
2080  E->setAssociatedStmt(Reader.ReadSubStmt());
2081 }
2082 
2083 void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
2084  VisitStmt(D);
2085  // Two fields (NumClauses and CollapsedNum) were read in ReadStmtFromStream.
2086  Idx += 2;
2087  VisitOMPExecutableDirective(D);
2088  D->setIterationVariable(Reader.ReadSubExpr());
2089  D->setLastIteration(Reader.ReadSubExpr());
2090  D->setCalcLastIteration(Reader.ReadSubExpr());
2091  D->setPreCond(Reader.ReadSubExpr());
2092  D->setCond(Reader.ReadSubExpr());
2093  D->setInit(Reader.ReadSubExpr());
2094  D->setInc(Reader.ReadSubExpr());
2096  D->setIsLastIterVariable(Reader.ReadSubExpr());
2097  D->setLowerBoundVariable(Reader.ReadSubExpr());
2098  D->setUpperBoundVariable(Reader.ReadSubExpr());
2099  D->setStrideVariable(Reader.ReadSubExpr());
2100  D->setEnsureUpperBound(Reader.ReadSubExpr());
2101  D->setNextLowerBound(Reader.ReadSubExpr());
2102  D->setNextUpperBound(Reader.ReadSubExpr());
2103  }
2105  unsigned CollapsedNum = D->getCollapsedNumber();
2106  Sub.reserve(CollapsedNum);
2107  for (unsigned i = 0; i < CollapsedNum; ++i)
2108  Sub.push_back(Reader.ReadSubExpr());
2109  D->setCounters(Sub);
2110  Sub.clear();
2111  for (unsigned i = 0; i < CollapsedNum; ++i)
2112  Sub.push_back(Reader.ReadSubExpr());
2113  D->setInits(Sub);
2114  Sub.clear();
2115  for (unsigned i = 0; i < CollapsedNum; ++i)
2116  Sub.push_back(Reader.ReadSubExpr());
2117  D->setUpdates(Sub);
2118  Sub.clear();
2119  for (unsigned i = 0; i < CollapsedNum; ++i)
2120  Sub.push_back(Reader.ReadSubExpr());
2121  D->setFinals(Sub);
2122 }
2123 
2124 void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
2125  VisitStmt(D);
2126  // The NumClauses field was read in ReadStmtFromStream.
2127  ++Idx;
2128  VisitOMPExecutableDirective(D);
2129 }
2130 
2131 void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
2132  VisitOMPLoopDirective(D);
2133 }
2134 
2135 void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
2136  VisitOMPLoopDirective(D);
2137 }
2138 
2139 void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
2140  VisitOMPLoopDirective(D);
2141 }
2142 
2143 void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
2144  VisitStmt(D);
2145  // The NumClauses field was read in ReadStmtFromStream.
2146  ++Idx;
2147  VisitOMPExecutableDirective(D);
2148 }
2149 
2150 void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
2151  VisitStmt(D);
2152  VisitOMPExecutableDirective(D);
2153 }
2154 
2155 void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
2156  VisitStmt(D);
2157  // The NumClauses field was read in ReadStmtFromStream.
2158  ++Idx;
2159  VisitOMPExecutableDirective(D);
2160 }
2161 
2162 void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
2163  VisitStmt(D);
2164  VisitOMPExecutableDirective(D);
2165 }
2166 
2167 void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
2168  VisitStmt(D);
2169  VisitOMPExecutableDirective(D);
2170  ReadDeclarationNameInfo(D->DirName, Record, Idx);
2171 }
2172 
2173 void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
2174  VisitOMPLoopDirective(D);
2175 }
2176 
2177 void ASTStmtReader::VisitOMPParallelForSimdDirective(
2179  VisitOMPLoopDirective(D);
2180 }
2181 
2182 void ASTStmtReader::VisitOMPParallelSectionsDirective(
2184  VisitStmt(D);
2185  // The NumClauses field was read in ReadStmtFromStream.
2186  ++Idx;
2187  VisitOMPExecutableDirective(D);
2188 }
2189 
2190 void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
2191  VisitStmt(D);
2192  // The NumClauses field was read in ReadStmtFromStream.
2193  ++Idx;
2194  VisitOMPExecutableDirective(D);
2195 }
2196 
2197 void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
2198  VisitStmt(D);
2199  VisitOMPExecutableDirective(D);
2200 }
2201 
2202 void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
2203  VisitStmt(D);
2204  VisitOMPExecutableDirective(D);
2205 }
2206 
2207 void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
2208  VisitStmt(D);
2209  VisitOMPExecutableDirective(D);
2210 }
2211 
2212 void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
2213  VisitStmt(D);
2214  VisitOMPExecutableDirective(D);
2215 }
2216 
2217 void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
2218  VisitStmt(D);
2219  // The NumClauses field was read in ReadStmtFromStream.
2220  ++Idx;
2221  VisitOMPExecutableDirective(D);
2222 }
2223 
2224 void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
2225  VisitStmt(D);
2226  VisitOMPExecutableDirective(D);
2227 }
2228 
2229 void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
2230  VisitStmt(D);
2231  // The NumClauses field was read in ReadStmtFromStream.
2232  ++Idx;
2233  VisitOMPExecutableDirective(D);
2234  D->setX(Reader.ReadSubExpr());
2235  D->setV(Reader.ReadSubExpr());
2236  D->setExpr(Reader.ReadSubExpr());
2237  D->setUpdateExpr(Reader.ReadSubExpr());
2238  D->IsXLHSInRHSPart = Record[Idx++] != 0;
2239  D->IsPostfixUpdate = Record[Idx++] != 0;
2240 }
2241 
2242 void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
2243  VisitStmt(D);
2244  // The NumClauses field was read in ReadStmtFromStream.
2245  ++Idx;
2246  VisitOMPExecutableDirective(D);
2247 }
2248 
2249 void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
2250  VisitStmt(D);
2251  // The NumClauses field was read in ReadStmtFromStream.
2252  ++Idx;
2253  VisitOMPExecutableDirective(D);
2254 }
2255 
2256 void ASTStmtReader::VisitOMPCancellationPointDirective(
2258  VisitStmt(D);
2259  VisitOMPExecutableDirective(D);
2260  D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record[Idx++]));
2261 }
2262 
2263 void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
2264  VisitStmt(D);
2265  VisitOMPExecutableDirective(D);
2266  D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record[Idx++]));
2267 }
2268 
2269 //===----------------------------------------------------------------------===//
2270 // ASTReader Implementation
2271 //===----------------------------------------------------------------------===//
2272 
2274  switch (ReadingKind) {
2275  case Read_None:
2276  llvm_unreachable("should not call this when not reading anything");
2277  case Read_Decl:
2278  case Read_Type:
2279  return ReadStmtFromStream(F);
2280  case Read_Stmt:
2281  return ReadSubStmt();
2282  }
2283 
2284  llvm_unreachable("ReadingKind not set ?");
2285 }
2286 
2288  return cast_or_null<Expr>(ReadStmt(F));
2289 }
2290 
2292  return cast_or_null<Expr>(ReadSubStmt());
2293 }
2294 
2295 // Within the bitstream, expressions are stored in Reverse Polish
2296 // Notation, with each of the subexpressions preceding the
2297 // expression they are stored in. Subexpressions are stored from last to first.
2298 // To evaluate expressions, we continue reading expressions and placing them on
2299 // the stack, with expressions having operands removing those operands from the
2300 // stack. Evaluation terminates when we see a STMT_STOP record, and
2301 // the single remaining expression on the stack is our result.
2302 Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
2303 
2304  ReadingKindTracker ReadingKind(Read_Stmt, *this);
2305  llvm::BitstreamCursor &Cursor = F.DeclsCursor;
2306 
2307  // Map of offset to previously deserialized stmt. The offset points
2308  /// just after the stmt record.
2309  llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
2310 
2311 #ifndef NDEBUG
2312  unsigned PrevNumStmts = StmtStack.size();
2313 #endif
2314 
2315  RecordData Record;
2316  unsigned Idx;
2317  ASTStmtReader Reader(*this, F, Cursor, Record, Idx);
2318  Stmt::EmptyShell Empty;
2319 
2320  while (true) {
2321  llvm::BitstreamEntry Entry = Cursor.advanceSkippingSubblocks();
2322 
2323  switch (Entry.Kind) {
2324  case llvm::BitstreamEntry::SubBlock: // Handled for us already.
2326  Error("malformed block record in AST file");
2327  return nullptr;
2328  case llvm::BitstreamEntry::EndBlock:
2329  goto Done;
2330  case llvm::BitstreamEntry::Record:
2331  // The interesting case.
2332  break;
2333  }
2334 
2335  Stmt *S = nullptr;
2336  Idx = 0;
2337  Record.clear();
2338  bool Finished = false;
2339  bool IsStmtReference = false;
2340  switch ((StmtCode)Cursor.readRecord(Entry.ID, Record)) {
2341  case STMT_STOP:
2342  Finished = true;
2343  break;
2344 
2345  case STMT_REF_PTR:
2346  IsStmtReference = true;
2347  assert(StmtEntries.find(Record[0]) != StmtEntries.end() &&
2348  "No stmt was recorded for this offset reference!");
2349  S = StmtEntries[Record[Idx++]];
2350  break;
2351 
2352  case STMT_NULL_PTR:
2353  S = nullptr;
2354  break;
2355 
2356  case STMT_NULL:
2357  S = new (Context) NullStmt(Empty);
2358  break;
2359 
2360  case STMT_COMPOUND:
2361  S = new (Context) CompoundStmt(Empty);
2362  break;
2363 
2364  case STMT_CASE:
2365  S = new (Context) CaseStmt(Empty);
2366  break;
2367 
2368  case STMT_DEFAULT:
2369  S = new (Context) DefaultStmt(Empty);
2370  break;
2371 
2372  case STMT_LABEL:
2373  S = new (Context) LabelStmt(Empty);
2374  break;
2375 
2376  case STMT_ATTRIBUTED:
2378  Context,
2379  /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]);
2380  break;
2381 
2382  case STMT_IF:
2383  S = new (Context) IfStmt(Empty);
2384  break;
2385 
2386  case STMT_SWITCH:
2387  S = new (Context) SwitchStmt(Empty);
2388  break;
2389 
2390  case STMT_WHILE:
2391  S = new (Context) WhileStmt(Empty);
2392  break;
2393 
2394  case STMT_DO:
2395  S = new (Context) DoStmt(Empty);
2396  break;
2397 
2398  case STMT_FOR:
2399  S = new (Context) ForStmt(Empty);
2400  break;
2401 
2402  case STMT_GOTO:
2403  S = new (Context) GotoStmt(Empty);
2404  break;
2405 
2406  case STMT_INDIRECT_GOTO:
2407  S = new (Context) IndirectGotoStmt(Empty);
2408  break;
2409 
2410  case STMT_CONTINUE:
2411  S = new (Context) ContinueStmt(Empty);
2412  break;
2413 
2414  case STMT_BREAK:
2415  S = new (Context) BreakStmt(Empty);
2416  break;
2417 
2418  case STMT_RETURN:
2419  S = new (Context) ReturnStmt(Empty);
2420  break;
2421 
2422  case STMT_DECL:
2423  S = new (Context) DeclStmt(Empty);
2424  break;
2425 
2426  case STMT_GCCASM:
2427  S = new (Context) GCCAsmStmt(Empty);
2428  break;
2429 
2430  case STMT_MSASM:
2431  S = new (Context) MSAsmStmt(Empty);
2432  break;
2433 
2434  case STMT_CAPTURED:
2437  break;
2438 
2439  case EXPR_PREDEFINED:
2440  S = new (Context) PredefinedExpr(Empty);
2441  break;
2442 
2443  case EXPR_DECL_REF:
2445  Context,
2446  /*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
2447  /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
2448  /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2],
2449  /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ?
2450  Record[ASTStmtReader::NumExprFields + 5] : 0);
2451  break;
2452 
2453  case EXPR_INTEGER_LITERAL:
2454  S = IntegerLiteral::Create(Context, Empty);
2455  break;
2456 
2457  case EXPR_FLOATING_LITERAL:
2458  S = FloatingLiteral::Create(Context, Empty);
2459  break;
2460 
2462  S = new (Context) ImaginaryLiteral(Empty);
2463  break;
2464 
2465  case EXPR_STRING_LITERAL:
2467  Record[ASTStmtReader::NumExprFields + 1]);
2468  break;
2469 
2471  S = new (Context) CharacterLiteral(Empty);
2472  break;
2473 
2474  case EXPR_PAREN:
2475  S = new (Context) ParenExpr(Empty);
2476  break;
2477 
2478  case EXPR_PAREN_LIST:
2479  S = new (Context) ParenListExpr(Empty);
2480  break;
2481 
2482  case EXPR_UNARY_OPERATOR:
2483  S = new (Context) UnaryOperator(Empty);
2484  break;
2485 
2486  case EXPR_OFFSETOF:
2489  Record[ASTStmtReader::NumExprFields + 1]);
2490  break;
2491 
2492  case EXPR_SIZEOF_ALIGN_OF:
2493  S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
2494  break;
2495 
2496  case EXPR_ARRAY_SUBSCRIPT:
2497  S = new (Context) ArraySubscriptExpr(Empty);
2498  break;
2499 
2500  case EXPR_CALL:
2501  S = new (Context) CallExpr(Context, Stmt::CallExprClass, Empty);
2502  break;
2503 
2504  case EXPR_MEMBER: {
2505  // We load everything here and fully initialize it at creation.
2506  // That way we can use MemberExpr::Create and don't have to duplicate its
2507  // logic with a MemberExpr::CreateEmpty.
2508 
2509  assert(Idx == 0);
2510  NestedNameSpecifierLoc QualifierLoc;
2511  if (Record[Idx++]) { // HasQualifier.
2512  QualifierLoc = ReadNestedNameSpecifierLoc(F, Record, Idx);
2513  }
2514 
2515  SourceLocation TemplateKWLoc;
2516  TemplateArgumentListInfo ArgInfo;
2517  bool HasTemplateKWAndArgsInfo = Record[Idx++];
2518  if (HasTemplateKWAndArgsInfo) {
2519  TemplateKWLoc = ReadSourceLocation(F, Record, Idx);
2520  unsigned NumTemplateArgs = Record[Idx++];
2521  ArgInfo.setLAngleLoc(ReadSourceLocation(F, Record, Idx));
2522  ArgInfo.setRAngleLoc(ReadSourceLocation(F, Record, Idx));
2523  for (unsigned i = 0; i != NumTemplateArgs; ++i)
2524  ArgInfo.addArgument(ReadTemplateArgumentLoc(F, Record, Idx));
2525  }
2526 
2527  bool HadMultipleCandidates = Record[Idx++];
2528 
2529  NamedDecl *FoundD = ReadDeclAs<NamedDecl>(F, Record, Idx);
2530  AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
2531  DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS);
2532 
2533  QualType T = readType(F, Record, Idx);
2534  ExprValueKind VK = static_cast<ExprValueKind>(Record[Idx++]);
2535  ExprObjectKind OK = static_cast<ExprObjectKind>(Record[Idx++]);
2536  Expr *Base = ReadSubExpr();
2537  ValueDecl *MemberD = ReadDeclAs<ValueDecl>(F, Record, Idx);
2538  SourceLocation MemberLoc = ReadSourceLocation(F, Record, Idx);
2539  DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
2540  bool IsArrow = Record[Idx++];
2541  SourceLocation OperatorLoc = ReadSourceLocation(F, Record, Idx);
2542 
2543  S = MemberExpr::Create(Context, Base, IsArrow, OperatorLoc, QualifierLoc,
2544  TemplateKWLoc, MemberD, FoundDecl, MemberNameInfo,
2545  HasTemplateKWAndArgsInfo ? &ArgInfo : nullptr, T,
2546  VK, OK);
2547  ReadDeclarationNameLoc(F, cast<MemberExpr>(S)->MemberDNLoc,
2548  MemberD->getDeclName(), Record, Idx);
2549  if (HadMultipleCandidates)
2550  cast<MemberExpr>(S)->setHadMultipleCandidates(true);
2551  break;
2552  }
2553 
2554  case EXPR_BINARY_OPERATOR:
2555  S = new (Context) BinaryOperator(Empty);
2556  break;
2557 
2559  S = new (Context) CompoundAssignOperator(Empty);
2560  break;
2561 
2563  S = new (Context) ConditionalOperator(Empty);
2564  break;
2565 
2567  S = new (Context) BinaryConditionalOperator(Empty);
2568  break;
2569 
2570  case EXPR_IMPLICIT_CAST:
2572  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
2573  break;
2574 
2575  case EXPR_CSTYLE_CAST:
2577  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
2578  break;
2579 
2580  case EXPR_COMPOUND_LITERAL:
2581  S = new (Context) CompoundLiteralExpr(Empty);
2582  break;
2583 
2585  S = new (Context) ExtVectorElementExpr(Empty);
2586  break;
2587 
2588  case EXPR_INIT_LIST:
2589  S = new (Context) InitListExpr(Empty);
2590  break;
2591 
2592  case EXPR_DESIGNATED_INIT:
2594  Record[ASTStmtReader::NumExprFields] - 1);
2595 
2596  break;
2597 
2599  S = new (Context) DesignatedInitUpdateExpr(Empty);
2600  break;
2601 
2603  S = new (Context) ImplicitValueInitExpr(Empty);
2604  break;
2605 
2606  case EXPR_NO_INIT:
2607  S = new (Context) NoInitExpr(Empty);
2608  break;
2609 
2610  case EXPR_VA_ARG:
2611  S = new (Context) VAArgExpr(Empty);
2612  break;
2613 
2614  case EXPR_ADDR_LABEL:
2615  S = new (Context) AddrLabelExpr(Empty);
2616  break;
2617 
2618  case EXPR_STMT:
2619  S = new (Context) StmtExpr(Empty);
2620  break;
2621 
2622  case EXPR_CHOOSE:
2623  S = new (Context) ChooseExpr(Empty);
2624  break;
2625 
2626  case EXPR_GNU_NULL:
2627  S = new (Context) GNUNullExpr(Empty);
2628  break;
2629 
2630  case EXPR_SHUFFLE_VECTOR:
2631  S = new (Context) ShuffleVectorExpr(Empty);
2632  break;
2633 
2634  case EXPR_CONVERT_VECTOR:
2635  S = new (Context) ConvertVectorExpr(Empty);
2636  break;
2637 
2638  case EXPR_BLOCK:
2639  S = new (Context) BlockExpr(Empty);
2640  break;
2641 
2643  S = new (Context) GenericSelectionExpr(Empty);
2644  break;
2645 
2647  S = new (Context) ObjCStringLiteral(Empty);
2648  break;
2650  S = new (Context) ObjCBoxedExpr(Empty);
2651  break;
2655  break;
2659  Record[ASTStmtReader::NumExprFields + 1]);
2660  break;
2661  case EXPR_OBJC_ENCODE:
2662  S = new (Context) ObjCEncodeExpr(Empty);
2663  break;
2665  S = new (Context) ObjCSelectorExpr(Empty);
2666  break;
2668  S = new (Context) ObjCProtocolExpr(Empty);
2669  break;
2671  S = new (Context) ObjCIvarRefExpr(Empty);
2672  break;
2674  S = new (Context) ObjCPropertyRefExpr(Empty);
2675  break;
2677  S = new (Context) ObjCSubscriptRefExpr(Empty);
2678  break;
2680  llvm_unreachable("mismatching AST file");
2684  Record[ASTStmtReader::NumExprFields + 1]);
2685  break;
2686  case EXPR_OBJC_ISA:
2687  S = new (Context) ObjCIsaExpr(Empty);
2688  break;
2690  S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
2691  break;
2693  S = new (Context) ObjCBridgedCastExpr(Empty);
2694  break;
2696  S = new (Context) ObjCForCollectionStmt(Empty);
2697  break;
2698  case STMT_OBJC_CATCH:
2699  S = new (Context) ObjCAtCatchStmt(Empty);
2700  break;
2701  case STMT_OBJC_FINALLY:
2702  S = new (Context) ObjCAtFinallyStmt(Empty);
2703  break;
2704  case STMT_OBJC_AT_TRY:
2707  Record[ASTStmtReader::NumStmtFields + 1]);
2708  break;
2710  S = new (Context) ObjCAtSynchronizedStmt(Empty);
2711  break;
2712  case STMT_OBJC_AT_THROW:
2713  S = new (Context) ObjCAtThrowStmt(Empty);
2714  break;
2716  S = new (Context) ObjCAutoreleasePoolStmt(Empty);
2717  break;
2719  S = new (Context) ObjCBoolLiteralExpr(Empty);
2720  break;
2721  case STMT_SEH_LEAVE:
2722  S = new (Context) SEHLeaveStmt(Empty);
2723  break;
2724  case STMT_SEH_EXCEPT:
2725  S = new (Context) SEHExceptStmt(Empty);
2726  break;
2727  case STMT_SEH_FINALLY:
2728  S = new (Context) SEHFinallyStmt(Empty);
2729  break;
2730  case STMT_SEH_TRY:
2731  S = new (Context) SEHTryStmt(Empty);
2732  break;
2733  case STMT_CXX_CATCH:
2734  S = new (Context) CXXCatchStmt(Empty);
2735  break;
2736 
2737  case STMT_CXX_TRY:
2738  S = CXXTryStmt::Create(Context, Empty,
2739  /*NumHandlers=*/Record[ASTStmtReader::NumStmtFields]);
2740  break;
2741 
2742  case STMT_CXX_FOR_RANGE:
2743  S = new (Context) CXXForRangeStmt(Empty);
2744  break;
2745 
2747  S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
2750  nullptr);
2751  break;
2752 
2754  S =
2757  Empty);
2758  break;
2759 
2760  case STMT_OMP_SIMD_DIRECTIVE: {
2761  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2762  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2763  S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
2764  CollapsedNum, Empty);
2765  break;
2766  }
2767 
2768  case STMT_OMP_FOR_DIRECTIVE: {
2769  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2770  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2771  S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
2772  Empty);
2773  break;
2774  }
2775 
2777  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2778  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2779  S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
2780  Empty);
2781  break;
2782  }
2783 
2786  Context, Record[ASTStmtReader::NumStmtFields], Empty);
2787  break;
2788 
2791  break;
2792 
2795  Context, Record[ASTStmtReader::NumStmtFields], Empty);
2796  break;
2797 
2800  break;
2801 
2804  break;
2805 
2807  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2808  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2810  CollapsedNum, Empty);
2811  break;
2812  }
2813 
2815  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
2816  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
2818  CollapsedNum, Empty);
2819  break;
2820  }
2821 
2824  Context, Record[ASTStmtReader::NumStmtFields], Empty);
2825  break;
2826 
2829  Context, Record[ASTStmtReader::NumStmtFields], Empty);
2830  break;
2831 
2834  break;
2835 
2838  break;
2839 
2842  break;
2843 
2846  break;
2847 
2850  Context, Record[ASTStmtReader::NumStmtFields], Empty);
2851  break;
2852 
2855  break;
2856 
2859  Context, Record[ASTStmtReader::NumStmtFields], Empty);
2860  break;
2861 
2864  Context, Record[ASTStmtReader::NumStmtFields], Empty);
2865  break;
2866 
2869  Context, Record[ASTStmtReader::NumStmtFields], Empty);
2870  break;
2871 
2874  break;
2875 
2878  break;
2879 
2881  S = new (Context) CXXOperatorCallExpr(Context, Empty);
2882  break;
2883 
2884  case EXPR_CXX_MEMBER_CALL:
2885  S = new (Context) CXXMemberCallExpr(Context, Empty);
2886  break;
2887 
2888  case EXPR_CXX_CONSTRUCT:
2889  S = new (Context) CXXConstructExpr(Empty);
2890  break;
2891 
2893  S = new (Context) CXXTemporaryObjectExpr(Empty);
2894  break;
2895 
2896  case EXPR_CXX_STATIC_CAST:
2898  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
2899  break;
2900 
2901  case EXPR_CXX_DYNAMIC_CAST:
2903  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
2904  break;
2905 
2908  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
2909  break;
2910 
2911  case EXPR_CXX_CONST_CAST:
2913  break;
2914 
2917  /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
2918  break;
2919 
2921  S = new (Context) UserDefinedLiteral(Context, Empty);
2922  break;
2923 
2925  S = new (Context) CXXStdInitializerListExpr(Empty);
2926  break;
2927 
2928  case EXPR_CXX_BOOL_LITERAL:
2929  S = new (Context) CXXBoolLiteralExpr(Empty);
2930  break;
2931 
2933  S = new (Context) CXXNullPtrLiteralExpr(Empty);
2934  break;
2935  case EXPR_CXX_TYPEID_EXPR:
2936  S = new (Context) CXXTypeidExpr(Empty, true);
2937  break;
2938  case EXPR_CXX_TYPEID_TYPE:
2939  S = new (Context) CXXTypeidExpr(Empty, false);
2940  break;
2941  case EXPR_CXX_UUIDOF_EXPR:
2942  S = new (Context) CXXUuidofExpr(Empty, true);
2943  break;
2945  S = new (Context) MSPropertyRefExpr(Empty);
2946  break;
2947  case EXPR_CXX_UUIDOF_TYPE:
2948  S = new (Context) CXXUuidofExpr(Empty, false);
2949  break;
2950  case EXPR_CXX_THIS:
2951  S = new (Context) CXXThisExpr(Empty);
2952  break;
2953  case EXPR_CXX_THROW:
2954  S = new (Context) CXXThrowExpr(Empty);
2955  break;
2956  case EXPR_CXX_DEFAULT_ARG: {
2957  bool HasOtherExprStored = Record[ASTStmtReader::NumExprFields];
2958  if (HasOtherExprStored) {
2959  Expr *SubExpr = ReadSubExpr();
2961  SubExpr);
2962  } else
2963  S = new (Context) CXXDefaultArgExpr(Empty);
2964  break;
2965  }
2966  case EXPR_CXX_DEFAULT_INIT:
2967  S = new (Context) CXXDefaultInitExpr(Empty);
2968  break;
2970  S = new (Context) CXXBindTemporaryExpr(Empty);
2971  break;
2972 
2974  S = new (Context) CXXScalarValueInitExpr(Empty);
2975  break;
2976  case EXPR_CXX_NEW:
2977  S = new (Context) CXXNewExpr(Empty);
2978  break;
2979  case EXPR_CXX_DELETE:
2980  S = new (Context) CXXDeleteExpr(Empty);
2981  break;
2983  S = new (Context) CXXPseudoDestructorExpr(Empty);
2984  break;
2985 
2987  S = ExprWithCleanups::Create(Context, Empty,
2989  break;
2990 
2993  /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
2994  /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
2995  ? Record[ASTStmtReader::NumExprFields + 1]
2996  : 0);
2997  break;
2998 
3001  /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3002  /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3003  ? Record[ASTStmtReader::NumExprFields + 1]
3004  : 0);
3005  break;
3006 
3009  /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
3010  break;
3011 
3014  /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3015  /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3016  ? Record[ASTStmtReader::NumExprFields + 1]
3017  : 0);
3018  break;
3019 
3022  /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
3023  /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
3024  ? Record[ASTStmtReader::NumExprFields + 1]
3025  : 0);
3026  break;
3027 
3028  case EXPR_TYPE_TRAIT:
3031  break;
3032 
3033  case EXPR_ARRAY_TYPE_TRAIT:
3034  S = new (Context) ArrayTypeTraitExpr(Empty);
3035  break;
3036 
3038  S = new (Context) ExpressionTraitExpr(Empty);
3039  break;
3040 
3041  case EXPR_CXX_NOEXCEPT:
3042  S = new (Context) CXXNoexceptExpr(Empty);
3043  break;
3044 
3045  case EXPR_PACK_EXPANSION:
3046  S = new (Context) PackExpansionExpr(Empty);
3047  break;
3048 
3049  case EXPR_SIZEOF_PACK:
3050  S = new (Context) SizeOfPackExpr(Empty);
3051  break;
3052 
3054  S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
3055  break;
3056 
3058  S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
3059  break;
3060 
3064  break;
3065 
3067  S = new (Context) MaterializeTemporaryExpr(Empty);
3068  break;
3069 
3070  case EXPR_CXX_FOLD:
3071  S = new (Context) CXXFoldExpr(Empty);
3072  break;
3073 
3074  case EXPR_OPAQUE_VALUE:
3075  S = new (Context) OpaqueValueExpr(Empty);
3076  break;
3077 
3078  case EXPR_CUDA_KERNEL_CALL:
3079  S = new (Context) CUDAKernelCallExpr(Context, Empty);
3080  break;
3081 
3082  case EXPR_ASTYPE:
3083  S = new (Context) AsTypeExpr(Empty);
3084  break;
3085 
3086  case EXPR_PSEUDO_OBJECT: {
3087  unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
3088  S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
3089  break;
3090  }
3091 
3092  case EXPR_ATOMIC:
3093  S = new (Context) AtomicExpr(Empty);
3094  break;
3095 
3096  case EXPR_LAMBDA: {
3097  unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
3098  unsigned NumArrayIndexVars = Record[ASTStmtReader::NumExprFields + 1];
3099  S = LambdaExpr::CreateDeserialized(Context, NumCaptures,
3100  NumArrayIndexVars);
3101  break;
3102  }
3103  }
3104 
3105  // We hit a STMT_STOP, so we're done with this expression.
3106  if (Finished)
3107  break;
3108 
3109  ++NumStatementsRead;
3110 
3111  if (S && !IsStmtReference) {
3112  Reader.Visit(S);
3113  StmtEntries[Cursor.GetCurrentBitNo()] = S;
3114  }
3115 
3116 
3117  assert(Idx == Record.size() && "Invalid deserialization of statement");
3118  StmtStack.push_back(S);
3119  }
3120 Done:
3121  assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!");
3122  assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!");
3123  return StmtStack.pop_back_val();
3124 }
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
Definition: Stmt.cpp:320
A PredefinedExpr record.
Definition: ASTBitCodes.h:1169
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:54
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:1006
Represents a single C99 designator.
Definition: Expr.h:4035
void setThen(Stmt *S)
Definition: Stmt.h:917
void setConditionVariable(const ASTContext &C, VarDecl *V)
Definition: Stmt.cpp:933
static OMPDependClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
Definition: Stmt.cpp:1607
void setValueDependent(bool VD)
Set whether this expression is value-dependent or not.
Definition: Expr.h:149
Defines the clang::ASTContext interface.
void setRParenLoc(SourceLocation L)
Definition: ExprCXX.h:1270
A CompoundLiteralExpr record.
Definition: ASTBitCodes.h:1209
This represents '#pragma omp master' directive.
Definition: StmtOpenMP.h:989
DesignatorTypes
The kinds of designators that can occur in a DesignatedInitExpr.
Definition: ASTBitCodes.h:1414
SourceLocation getEnd() const
void setRangeStmt(Stmt *S)
Definition: StmtCXX.h:177
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:466
This represents '#pragma omp task' directive.
Definition: StmtOpenMP.h:1295
void setEnsureUpperBound(Expr *EUB)
Definition: StmtOpenMP.h:409
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition: Stmt.h:2104
unsigned arg_size() const
Retrieve the number of arguments.
Definition: ExprCXX.h:2900
void setSubStmt(CompoundStmt *S)
Definition: Expr.h:3414
unsigned getNumOutputs() const
Definition: Stmt.h:1447
The receiver is an object instance.
Definition: ExprObjC.h:1002
static OMPMasterDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: Stmt.cpp:1869
static OMPCopyinClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
Definition: Stmt.cpp:1438
An IndirectGotoStmt record.
Definition: ASTBitCodes.h:1153
This represents clause 'copyin' in the '#pragma omp ...' directives.
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
Definition: Stmt.h:2110
An AddrLabelExpr record.
Definition: ASTBitCodes.h:1225
void setInc(Expr *E)
Definition: StmtCXX.h:180
void setOperatorLoc(SourceLocation L)
Definition: Expr.h:2045
static StringLiteral * CreateEmpty(const ASTContext &C, unsigned NumStrs)
Construct an empty string literal.
Definition: Expr.cpp:857
void setRawSemantics(APFloatSemantics Sem)
Definition: Expr.h:1393
void setNRVOCandidate(const VarDecl *Var)
Definition: Stmt.h:1379
void setLocation(SourceLocation L)
Definition: ExprCXX.h:453
A CXXStaticCastExpr record.
Definition: ASTBitCodes.h:1311
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2083
An AttributedStmt record.
Definition: ASTBitCodes.h:1139
void setCond(Expr *E)
Definition: Stmt.h:1068
IdentifierInfo * getIdentifier() const
Definition: Decl.h:163
A CXXReinterpretCastExpr record.
Definition: ASTBitCodes.h:1315
A ObjCBoolLiteralExpr record.
Definition: ASTBitCodes.h:1291
void setRHS(Expr *E)
Definition: Expr.h:2105
static OMPTaskwaitDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: Stmt.cpp:2075
void setLastIteration(Expr *LI)
Definition: StmtOpenMP.h:375
void setBeginEndStmt(Stmt *S)
Definition: StmtCXX.h:178
void setArrow(bool A)
Definition: ExprObjC.h:1398
This represents '#pragma omp for simd' directive.
Definition: StmtOpenMP.h:765
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:1573
void setContinueLoc(SourceLocation L)
Definition: Stmt.h:1300
void setThrowExpr(Stmt *S)
Definition: StmtObjC.h:327
void setAtLoc(SourceLocation L)
Definition: ExprObjC.h:413
An ImplicitValueInitExpr record.
Definition: ASTBitCodes.h:1219
static OMPFirstprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
Definition: Stmt.cpp:1243
void setDeclGroup(DeclGroupRef DGR)
Definition: Stmt.h:472
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1205
void setRBracket(SourceLocation RB)
Definition: ExprObjC.h:798
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition: Lambda.h:23
void setType(QualType t)
Definition: Expr.h:126
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2500
This represents 'if' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:154
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:833
void setUpperBoundVariable(Expr *UB)
Definition: StmtOpenMP.h:399
void setComputationResultType(QualType T)
Definition: Expr.h:3137
A CXXOperatorCallExpr record.
Definition: ASTBitCodes.h:1303
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
Definition: TemplateBase.h:317
void setSuper(SourceLocation Loc, QualType T, bool IsInstanceSuper)
Definition: ExprObjC.h:1235
A CXXTemporaryObjectExpr record.
Definition: ASTBitCodes.h:1309
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:62
void setCond(Expr *E)
Definition: Stmt.h:1113
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
Definition: OpenMPClause.h:541
void setNextLowerBound(Expr *NLB)
Definition: StmtOpenMP.h:414
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1075
unsigned NumOutputs
Definition: Stmt.h:1410
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Definition: ExprCXX.h:2182
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:83
A container of type source information.
Definition: Decl.h:60
This represents 'update' clause in the '#pragma omp atomic' directive.
Definition: OpenMPClause.h:866
void setSwitchCaseList(SwitchCase *SC)
Set the case list for this switch statement.
Definition: Stmt.h:996
void setInstanceReceiver(Expr *rec)
Turn this message send into an instance message that computes the receiver object with the given expr...
Definition: ExprObjC.h:1164
This represents '#pragma omp parallel for' directive.
Definition: StmtOpenMP.h:1102
void setStartLoc(SourceLocation L)
Definition: Stmt.h:475
void setForLoc(SourceLocation L)
Definition: Stmt.h:1192
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
Definition: OpenMPClause.h:404
void setLocation(SourceLocation Loc)
Definition: ExprCXX.h:1141
static ObjCDictionaryLiteral * CreateEmpty(const ASTContext &C, unsigned NumElements, bool HasPackExpansions)
Definition: Expr.cpp:4287
void setConditionVariable(const ASTContext &C, VarDecl *V)
Definition: Stmt.cpp:993
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:3746
void setLocation(SourceLocation L)
Definition: ExprObjC.h:514
void setDelegateInitCall(bool isDelegate)
Definition: ExprObjC.h:1304
void setProtocol(ObjCProtocolDecl *P)
Definition: ExprObjC.h:451
void setRParenLoc(SourceLocation L)
Definition: ExprCXX.h:2897
static OMPReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
Definition: Stmt.cpp:1561
void setIsLastIterVariable(Expr *IL)
Definition: StmtOpenMP.h:389
void setRAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:539
static OffsetOfExpr * CreateEmpty(const ASTContext &C, unsigned NumComps, unsigned NumExprs)
Definition: Expr.cpp:1299
This represents 'read' clause in the '#pragma omp atomic' directive.
Definition: OpenMPClause.h:808
This represents clause 'private' in the '#pragma omp ...' directives.
Definition: OpenMPClause.h:956
static OMPParallelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for N clauses.
Definition: Stmt.cpp:1643
This represents 'num_threads' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:261
void setSubExpr(unsigned Idx, Expr *E)
Definition: Expr.h:4244
void setFPContractable(bool FPC)
Definition: ExprCXX.h:106
void setInitializer(Expr *E)
Definition: Expr.h:2619
void setOpLoc(SourceLocation L)
Definition: ExprObjC.h:1406
static FunctionParmPackExpr * CreateEmpty(const ASTContext &Context, unsigned NumParams)
Definition: ExprCXX.cpp:1467
void setAsmLoc(SourceLocation L)
Definition: Stmt.h:1429
static DependentScopeDeclRefExpr * CreateEmpty(const ASTContext &C, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition: ExprCXX.cpp:463
void setValue(unsigned Val)
Definition: Expr.h:1353
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>". This is safe to be used inside an AST node, in contrast with TemplateArgumentListInfo.
Definition: TemplateBase.h:564
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:492
static DeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Construct an empty declaration reference expression.
Definition: Expr.cpp:413
void setGNUSyntax(bool GNU)
Definition: Expr.h:4222
This represents implicit clause 'flush' for the '#pragma omp flush' directive. This clause does not e...
A CXXConstructExpr record.
Definition: ASTBitCodes.h:1307
ReceiverKind
The kind of receiver this message is sending to.
Definition: ExprObjC.h:998
raw_arg_iterator raw_arg_begin()
Definition: ExprCXX.h:1787
void initializeResults(const ASTContext &C, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
Definition: ExprCXX.cpp:391
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:808
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1334
void setInit(Expr *Init)
Definition: StmtOpenMP.h:387
unsigned path_size() const
Definition: Expr.h:2728
void setTarget(Expr *E)
Definition: Stmt.h:1268
A ShuffleVectorExpr record.
Definition: ASTBitCodes.h:1233
This represents 'safelen' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:319
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:238
OpenMPDirectiveKind getDirectiveKind() const
Definition: StmtOpenMP.h:189
void AllocateArgsArray(const ASTContext &C, bool isArray, unsigned numPlaceArgs, bool hasInitializer)
Definition: ExprCXX.cpp:200
void setStrTokenLoc(unsigned TokNum, SourceLocation L)
Definition: Expr.h:1587
void setAtLoc(SourceLocation L)
Definition: ExprObjC.h:45
Represents a C99 designated initializer expression.
Definition: Expr.h:3961
void setFinals(ArrayRef< Expr * > A)
Definition: Stmt.cpp:1516
An OffsetOfExpr record.
Definition: ASTBitCodes.h:1189
An ObjCAtThrowStmt record.
Definition: ASTBitCodes.h:1287
static OMPTargetDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:2231
void setOpcode(Opcode O)
Definition: Expr.h:1697
A DesignatedInitExpr record.
Definition: ASTBitCodes.h:1215
This represents '#pragma omp parallel' directive.
Definition: StmtOpenMP.h:219
unsigned getNumInputs() const
Definition: Stmt.h:1469
void setExprOperand(Expr *E)
Definition: ExprCXX.h:729
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:89
A C++ nested-name-specifier augmented with source location information.
void setLHS(Expr *E)
Definition: Expr.h:2101
unsigned getNumAssocs() const
Definition: Expr.h:4473
void setKeyExpr(Stmt *S)
Definition: ExprObjC.h:813
static OMPCancelDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: Stmt.cpp:2134
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: Expr.cpp:3668
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:4279
void setNumArgs(const ASTContext &C, unsigned NumArgs)
Definition: Expr.cpp:1191
void setForLoc(SourceLocation Loc)
Definition: StmtCXX.h:186
void setRequiresZeroInitialization(bool ZeroInit)
Definition: ExprCXX.h:1166
ASTTemplateKWAndArgsInfo * getTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition: ExprCXX.h:3454
static OMPFlushDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:2155
void setArg(unsigned I, Expr *E)
Definition: ExprCXX.h:2924
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
Definition: Expr.h:2226
void setColonLoc(SourceLocation Loc)
Sets the location of ':'.
void setRParen(SourceLocation Loc)
Definition: Expr.h:1651
void setReturnLoc(SourceLocation L)
Definition: Stmt.h:1371
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3209
This represents '#pragma omp barrier' directive.
Definition: StmtOpenMP.h:1395
void setComponent(unsigned Idx, OffsetOfNode ON)
Definition: Expr.h:1930
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc...
Definition: StmtOpenMP.h:268
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:3613
void setSubStmt(Stmt *S)
Definition: Stmt.h:729
This represents '#pragma omp critical' directive.
Definition: StmtOpenMP.h:1036
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3422
void setCond(Expr *Cond)
Definition: StmtOpenMP.h:384
Represents Objective-C's @catch statement.
Definition: StmtObjC.h:74
void setBody(Stmt *S)
Definition: Stmt.h:992
void setLBraceLoc(SourceLocation Loc)
Definition: Expr.h:3883
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
Describes an C or C++ initializer list.
Definition: Expr.h:3759
void setConstructor(CXXConstructorDecl *C)
Definition: ExprCXX.h:1138
void setValue(const ASTContext &C, const llvm::APInt &Val)
Definition: Expr.h:1263
void setBuiltinLoc(SourceLocation L)
Definition: Expr.h:3458
BinaryOperatorKind
void setSubExpr(Expr *E)
Definition: Expr.h:1640
void setLHS(Expr *E)
Definition: Expr.h:3612
void setOperatorNew(FunctionDecl *D)
Definition: ExprCXX.h:1709
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
void setLocation(SourceLocation L)
Definition: ExprCXX.h:481
void setCond(Expr *E)
Definition: Stmt.h:990
void setCounters(ArrayRef< Expr * > A)
Definition: Stmt.cpp:1498
void setSynchBody(Stmt *S)
Definition: StmtObjC.h:288
void setSelector(Selector S)
Definition: ExprObjC.h:409
capture_init_iterator capture_init_end() const
Retrieve the iterator pointing one past the last initialization argument for this lambda expression...
Definition: ExprCXX.h:1518
A reference to a previously [de]serialized Stmt record.
Definition: ASTBitCodes.h:1127
void setEndLoc(SourceLocation L)
Definition: Stmt.h:477
path_iterator path_begin()
Definition: Expr.h:2729
void setLocation(SourceLocation L)
Definition: ExprObjC.h:78
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:2918
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
Definition: OpenMPClause.h:470
static CXXTryStmt * Create(const ASTContext &C, SourceLocation tryLoc, Stmt *tryBlock, ArrayRef< Stmt * > handlers)
Definition: Stmt.cpp:824
void setAccessor(IdentifierInfo *II)
Definition: Expr.h:4566
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:1885
void setString(StringLiteral *S)
Definition: ExprObjC.h:42
void setAsmString(StringLiteral *E)
Definition: Stmt.h:1579
This represents 'default' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:426
This represents 'final' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:207
This represents 'mergeable' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:779
void setListInitialization(bool V)
Definition: ExprCXX.h:1154
void setLHS(Expr *Val)
Definition: Stmt.h:730
This represents '#pragma omp teams' directive.
Definition: StmtOpenMP.h:1828
void setOperatorLoc(SourceLocation L)
Definition: Expr.h:1912
This represents clause 'reduction' in the '#pragma omp ...' directives.
void setBody(Stmt *S)
Definition: Stmt.h:1071
A marker record that indicates that we are at the end of an expression.
Definition: ASTBitCodes.h:1123
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1032
void setDestroyedType(IdentifierInfo *II, SourceLocation Loc)
Set the name of destroyed type for a dependent pseudo-destructor expression.
Definition: ExprCXX.h:2055
ArrayTypeTrait
Names for the array type traits.
Definition: TypeTraits.h:86
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:1343
static OMPTaskyieldDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: Stmt.cpp:2047
void setCond(Expr *E)
Definition: Stmt.h:1187
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:726
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:2954
void setRParenLoc(SourceLocation Loc)
Definition: StmtObjC.h:56
ASTTemplateKWAndArgsInfo * getTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
Definition: Expr.h:1049
void setRParenLoc(SourceLocation R)
Definition: Expr.h:1916
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:862
void setStmt(LabelStmt *T)
Definition: Decl.h:379
void setSourceRange(SourceRange R)
Definition: ExprCXX.h:739
unsigned NumClobbers
Definition: Stmt.h:1412
void setRParenLoc(SourceLocation L)
Definition: Expr.h:2888
Represents the this expression in C++.
Definition: ExprCXX.h:770
void setCastKind(CastKind K)
Definition: Expr.h:2710
Extends ASTTemplateArgumentListInfo with the source location information for the template keyword; th...
Definition: TemplateBase.h:611
void setEqualOrColonLoc(SourceLocation L)
Definition: Expr.h:4217
void setArgument(Expr *E)
Definition: Expr.h:2029
void setTypeSourceInfo(TypeSourceInfo *tsi)
Definition: Expr.h:1921
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:1019
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:1940
void setAmpAmpLoc(SourceLocation L)
Definition: Expr.h:3372
static OMPTaskgroupDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: Stmt.cpp:2094
void setBreakLoc(SourceLocation L)
Definition: Stmt.h:1328
void setBlockDecl(BlockDecl *BD)
Definition: Expr.h:4618
This represents '#pragma omp taskgroup' directive.
Definition: StmtOpenMP.h:1483
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition: ExprCXX.h:2132
static OMPSingleDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:1847
unsigned getNumObjects() const
Definition: ExprCXX.h:2799
CastKind
CastKind - The kind of operation required for a conversion.
void setSemiLoc(SourceLocation L)
Definition: Stmt.h:536
capture_init_iterator capture_init_begin() const
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition: ExprCXX.h:1512
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.
Definition: Stmt.cpp:1392
void setSubExpr(Expr *E)
Definition: Expr.h:1700
void setLocEnd(SourceLocation Loc)
Sets the ending location of the clause.
Definition: OpenMPClause.h:53
void setLParen(SourceLocation Loc)
Definition: Expr.h:1647
ASTContext * Context
const SmallVectorImpl< AnnotatedLine * >::const_iterator End
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param)
Definition: ExprCXX.h:896
VAArgExpr, used for the builtin function __builtin_va_arg.
Definition: Expr.h:3670
static OMPTeamsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:2257
void setLeaveLoc(SourceLocation L)
Definition: Stmt.h:1967
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:962
void setOperatorDelete(FunctionDecl *D)
Definition: ExprCXX.h:1711
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:1124
void setLocation(SourceLocation Location)
Definition: Expr.h:1351
void setRParenLoc(SourceLocation Loc)
Definition: StmtObjC.h:105
This represents 'proc_bind' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:496
static OMPSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:1681
This represents 'capture' clause in the '#pragma omp atomic' directive.
Definition: OpenMPClause.h:896
void setDesignators(const ASTContext &C, const Designator *Desigs, unsigned NumDesigs)
Definition: Expr.cpp:3955
void setRBraceLoc(SourceLocation Loc)
Definition: Expr.h:3885
void setWhileLoc(SourceLocation L)
Definition: Stmt.h:1074
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition: Specifiers.h:92
void setCallee(Expr *F)
Definition: Expr.h:2190
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3461
void setLParenLoc(SourceLocation L)
Definition: Stmt.h:1194
void setBase(Expr *Base)
Definition: Expr.h:4330
Stmt * ReadStmt(ModuleFile &F)
Reads a statement.
void setSyntacticForm(InitListExpr *Init)
Definition: Expr.h:3895
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1295
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:340
unsigned getNumExpressions() const
Definition: Expr.h:1954
void setTypeDependent(bool TD)
Set whether this expression is type-dependent or not.
Definition: Expr.h:169
void setTypeOperandSourceInfo(TypeSourceInfo *TSI)
Definition: ExprCXX.h:719
Field designator where only the field name is known.
Definition: ASTBitCodes.h:1416
void setRHS(Expr *E)
Definition: Expr.h:2967
void setInc(Expr *E)
Definition: Stmt.h:1188
raw_arg_iterator raw_arg_end()
Definition: ExprCXX.h:1788
static CXXReinterpretCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition: ExprCXX.cpp:682
#define bool
Definition: stdbool.h:31
void setWrittenTypeInfo(TypeSourceInfo *TI)
Definition: Expr.h:3695
void setRetValue(Expr *E)
Definition: Stmt.h:1368
void setBody(Stmt *S)
Definition: Stmt.h:1189
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
Definition: OpenMPClause.h:132
void setObjectKind(ExprObjectKind Cat)
setObjectKind - Set the object kind produced by this expression.
Definition: Expr.h:424
Represents Objective-C's @synchronized statement.
Definition: StmtObjC.h:262
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:396
A CXXStdInitializerListExpr record.
Definition: ASTBitCodes.h:1323
void setFinallyBody(Stmt *S)
Definition: StmtObjC.h:134
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:3473
An ArraySubscriptExpr record.
Definition: ASTBitCodes.h:1193
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
Definition: Expr.cpp:752
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
Definition: OpenMPClause.h:238
Information about a module that has been loaded by the ASTReader.
This represents 'ordered' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:691
static OMPFlushClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
Definition: Stmt.cpp:1583
A PseudoObjectExpr record.
Definition: ASTBitCodes.h:1241
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c array literal.
Definition: ExprObjC.h:180
void setFinallyStmt(Stmt *S)
Definition: StmtObjC.h:236
An ObjCIndirectCopyRestoreExpr record.
Definition: ASTBitCodes.h:1274
This represents '#pragma omp for' directive.
Definition: StmtOpenMP.h:701
void setValueKind(ExprValueKind Cat)
setValueKind - Set the value kind produced by this expression.
Definition: Expr.h:421
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:457
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:3849
void setAssociatedStmt(Stmt *S)
Set the associated statement for the directive.
Definition: StmtOpenMP.h:86
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:858
unsigned getNumComponents() const
Definition: Expr.h:1935
void setColonLoc(SourceLocation L)
Definition: Stmt.h:676
void setPrivateCopies(ArrayRef< Expr * > PrivateCopies)
Set list of helper expressions, required for generation of private copies of original lastprivate var...
Definition: Stmt.cpp:1251
void setIsArrow(bool A)
Definition: ExprObjC.h:510
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3620
A DesignatedInitUpdateExpr record.
Definition: ASTBitCodes.h:1217
void setAtLoc(SourceLocation L)
Definition: ExprObjC.h:373
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:621
DeclarationName getDeclName() const
Definition: Decl.h:189
static OMPParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:1977
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:3558
static OMPPrivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
Definition: Stmt.cpp:1207
void setForLoc(SourceLocation Loc)
Definition: StmtObjC.h:54
This represents '#pragma omp cancel' directive.
Definition: StmtOpenMP.h:1943
This represents 'collapse' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:374
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
void setBase(Expr *base)
Definition: ExprObjC.h:506
ValueDecl * getDecl()
Definition: Expr.h:994
void setRParenLoc(SourceLocation L)
Definition: ExprObjC.h:414
unsigned getNumClauses() const
Get number of clauses.
Definition: StmtOpenMP.h:172
An ObjCForCollectionStmt record.
Definition: ASTBitCodes.h:1277
This represents '#pragma omp flush' directive.
Definition: StmtOpenMP.h:1534
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:4237
This represents '#pragma omp parallel for simd' directive.
Definition: StmtOpenMP.h:1169
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3701
void setAtTryLoc(SourceLocation Loc)
Definition: StmtObjC.h:194
This represents 'seq_cst' clause in the '#pragma omp atomic' directive.
Definition: OpenMPClause.h:926
This represents 'untied' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:749
void setTypeOperandSourceInfo(TypeSourceInfo *TSI)
Definition: ExprCXX.h:584
void setBody(Stmt *S)
Definition: StmtCXX.h:182
void setOpcode(Opcode O)
Definition: Expr.h:2962
A MS-style AsmStmt record.
Definition: ASTBitCodes.h:1167
void setLocStart(SourceLocation Loc)
Set starting location of directive kind.
Definition: StmtOpenMP.h:164
static OMPParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:1932
void setSynchExpr(Stmt *S)
Definition: StmtObjC.h:296
const llvm::fltSemantics & getSemantics() const
Return the APFloat semantics this literal uses.
Definition: Expr.cpp:762
void setLowerBoundVariable(Expr *LB)
Definition: StmtOpenMP.h:394
void setLParenLoc(SourceLocation L)
Definition: ExprCXX.h:1268
void setTypeSourceInfo(TypeSourceInfo *tinfo)
Definition: Expr.h:2630
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:269
void setComputationLHSType(QualType T)
Definition: Expr.h:3134
static OMPSectionDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: Stmt.cpp:1823
void setDecl(LabelDecl *D)
Definition: Stmt.h:810
Kind
void setElse(Stmt *S)
Definition: Stmt.h:919
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
Definition: ExprCXX.h:2305
This captures a statement into a function. For example, the following pragma annotated compound state...
Definition: Stmt.h:1989
void setLParenLoc(SourceLocation L)
Definition: Expr.h:2885
void setSubStmt(Stmt *S)
Definition: Stmt.h:765
OMPClauseReader(ASTStmtReader *R, ASTContext &C, const ASTReader::RecordData &Record, unsigned &Idx)
void setElidable(bool E)
Definition: ExprCXX.h:1145
void setAccessorLoc(SourceLocation L)
Definition: Expr.h:4569
void setGotoLoc(SourceLocation L)
Definition: Stmt.h:1261
static CXXDynamicCastExpr * CreateEmpty(const ASTContext &Context, unsigned pathSize)
Definition: ExprCXX.cpp:624
void setHadMultipleCandidates(bool V)
Definition: ExprCXX.h:1150
void setLocation(SourceLocation L)
Definition: Expr.h:1003
This represents '#pragma omp single' directive.
Definition: StmtOpenMP.h:934
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
void setLocation(SourceLocation L)
Definition: Expr.h:1204
void setIterationVariable(Expr *IV)
Definition: StmtOpenMP.h:372
static OMPOrderedDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: Stmt.cpp:2176
void setUpdater(Expr *Updater)
Definition: Expr.h:4335
static OMPTaskDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:2028
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:1281
void setDoLoc(SourceLocation L)
Definition: Stmt.h:1119
static CXXConstCastExpr * CreateEmpty(const ASTContext &Context)
Definition: ExprCXX.cpp:697
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:1623
void setAtCatchLoc(SourceLocation Loc)
Definition: StmtObjC.h:103
void setVarRefs(ArrayRef< Expr * > VL)
Sets the list of variables for this clause.
Definition: OpenMPClause.h:88
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
Definition: ExprCXX.h:372
capture_init_iterator capture_init_end() const
Retrieve the iterator pointing one past the last initialization argument.
Definition: Stmt.h:2178
void setSourceRange(SourceRange R)
Definition: ExprCXX.h:602
This represents 'schedule' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:566
static ObjCAtTryStmt * CreateEmpty(const ASTContext &Context, unsigned NumCatchStmts, bool HasFinally)
Definition: Stmt.cpp:807
unsigned getCollapsedNumber() const
Get number of collapsed loops.
Definition: StmtOpenMP.h:511
void setBody(Stmt *B)
Definition: Decl.h:3641
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
Definition: OpenMPClause.h:292
void setIdentLoc(SourceLocation L)
Definition: Stmt.h:814
This represents clause 'shared' in the '#pragma omp ...' directives.
void setLabelLoc(SourceLocation L)
Definition: Expr.h:3374
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition: Specifiers.h:109
A CXXFunctionalCastExpr record.
Definition: ASTBitCodes.h:1319
void setTemporary(CXXTemporary *T)
Definition: ExprCXX.h:1054
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
Definition: ExprCXX.cpp:1138
void setAllEnumCasesCovered()
Definition: Stmt.h:1014
void VisitStmt(Stmt *S)
void setClassReceiver(TypeSourceInfo *TSInfo)
Definition: ExprObjC.h:1186
void setCatchParamDecl(VarDecl *D)
Definition: StmtObjC.h:100
void setCond(Expr *E)
Definition: Stmt.h:915
An ObjCEncodeExpr record.
Definition: ASTBitCodes.h:1256
static OMPAtomicDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:2205
This represents '#pragma omp taskwait' directive.
Definition: StmtOpenMP.h:1439
void setLHS(Expr *E)
Definition: Expr.h:2965
void setConfig(CallExpr *E)
Definition: ExprCXX.h:174
void setConditionVariable(const ASTContext &C, VarDecl *V)
Definition: Stmt.cpp:959
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:32
void setIsFreeIvar(bool A)
Definition: ExprObjC.h:511
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:1913
void addDecl(NamedDecl *D)
Definition: UnresolvedSet.h:77
void setDecl(ValueDecl *NewD)
Definition: Expr.h:996
void setThrowLoc(SourceLocation Loc)
Definition: StmtObjC.h:330
An ObjCIsa Expr record.
Definition: ASTBitCodes.h:1272
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition: Stmt.h:2098
This represents '#pragma omp target' directive.
Definition: StmtOpenMP.h:1771
SourceLocation getBegin() const
void setClauses(ArrayRef< OMPClause * > Clauses)
Sets the list of variables for this clause.
Definition: Stmt.cpp:1492
void setSubExpr(Expr *E)
Definition: ExprCXX.h:1058
static DesignatedInitExpr * CreateEmpty(const ASTContext &C, unsigned NumIndexExprs)
Definition: Expr.cpp:3948
static DeclGroup * Create(ASTContext &C, Decl **Decls, unsigned NumDecls)
Definition: DeclGroup.cpp:20
void setBaseExpr(Stmt *S)
Definition: ExprObjC.h:810
An expression trait intrinsic.
Definition: ExprCXX.h:2252
void setEncodedTypeSourceInfo(TypeSourceInfo *EncType)
Definition: ExprObjC.h:380
An AtomicExpr record.
Definition: ASTBitCodes.h:1243
This represents '#pragma omp ordered' directive.
Definition: StmtOpenMP.h:1589
void setCond(Expr *E)
Definition: StmtCXX.h:179
static OMPCriticalDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: Stmt.cpp:1889
void setSubExpr(Expr *E)
Definition: Expr.h:3692
void setLAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:538
void sawArrayRangeDesignator(bool ARD=true)
Definition: Expr.h:3905
void addArgument(const TemplateArgumentLoc &Loc)
Definition: TemplateBase.h:555
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
Definition: Stmt.h:2129
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
Definition: StmtCXX.h:234
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:1379
void setSimple(bool V)
Definition: Stmt.h:1432
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:2609
Expr ** getElements()
Retrieve elements of array of literals.
Definition: ExprObjC.h:172
Represents a C11 generic selection.
Definition: Expr.h:4446
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3357
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
Definition: ExprObjC.h:1506
ast_type_traits::DynTypedNode Node
Represents a reference to a function parameter pack that has been substituted but not yet expanded...
Definition: ExprCXX.h:3673
Represents a template argument.
Definition: TemplateBase.h:39
void setGotoLoc(SourceLocation L)
Definition: Stmt.h:1230
static OMPForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:1728
void setLocation(SourceLocation L)
Definition: Expr.h:1412
void setExtendingDecl(const ValueDecl *ExtendedBy, unsigned ManglingNumber)
Definition: ExprCXX.cpp:1474
An InitListExpr record.
Definition: ASTBitCodes.h:1213
void setExprs(const ASTContext &C, ArrayRef< Expr * > Exprs)
Definition: Expr.cpp:3798
void setBuiltinLoc(SourceLocation L)
Definition: Expr.h:3617
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1174
void setValue(bool V)
Definition: ExprCXX.h:447
A CXXBoolLiteralExpr record.
Definition: ASTBitCodes.h:1325
Represents a delete expression for memory deallocation and destructor calls, e.g. "delete[] pArray"...
Definition: ExprCXX.h:1819
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
void setRParenLoc(SourceLocation L)
Definition: Expr.h:2284
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
Definition: Stmt.cpp:1143
An ExtVectorElementExpr record.
Definition: ASTBitCodes.h:1211
void setLabel(LabelDecl *L)
Definition: Expr.h:3380
void setTypeInfoAsWritten(TypeSourceInfo *writtenTy)
Definition: Expr.h:2845
This represents '#pragma omp section' directive.
Definition: StmtOpenMP.h:885
void setAtLoc(SourceLocation L)
Definition: ExprObjC.h:456
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:302
Expr * ReadExpr(ModuleFile &F)
Reads an expression.
void setSubExpr(Expr *E)
Definition: Expr.h:1444
void setSubExpr(Expr *E)
Definition: Expr.h:2715
void setCollection(Expr *E)
Definition: StmtObjC.h:48
void setDecl(ObjCIvarDecl *d)
Definition: ExprObjC.h:502
void setFileScope(bool FS)
Definition: Expr.h:2622
void setExact(bool E)
Definition: Expr.h:1404
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:306
This represents '#pragma omp simd' directive.
Definition: StmtOpenMP.h:636
void setConstructionKind(ConstructionKind CK)
Definition: ExprCXX.h:1175
An ObjCAutoreleasePoolStmt record.
Definition: ASTBitCodes.h:1289
const internal::VariadicDynCastAllOfMatcher< Stmt, CUDAKernelCallExpr > CUDAKernelCallExpr
Matches CUDA kernel call expression.
Definition: ASTMatchers.h:4113
unsigned getNumHandlers() const
Definition: StmtCXX.h:103
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:3392
A CXXDynamicCastExpr record.
Definition: ASTBitCodes.h:1313
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:197
void setEllipsisLoc(SourceLocation L)
Definition: Stmt.h:713
bool isTypeOperand() const
Definition: ExprCXX.h:707
for(auto typeArg:T->getTypeArgsAsWritten())
unsigned getNumArgs() const
Definition: Expr.h:2205
void setLParenLoc(SourceLocation L)
Definition: Expr.h:3420
void setSelector(Selector S)
Definition: ExprObjC.h:1243
unsigned getNumArgs() const
Definition: ExprCXX.h:1198
unsigned getNumConcatenated() const
Definition: Expr.h:1581
void setMethodDecl(ObjCMethodDecl *MD)
Definition: ExprObjC.h:1262
This represents '#pragma omp atomic' directive.
Definition: StmtOpenMP.h:1637
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:4103
static OMPSharedClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
Definition: Stmt.cpp:1317
void setImplicit(bool I)
Definition: ExprCXX.h:793
void setBody(Stmt *S)
Definition: Stmt.h:1116
An ObjCAtFinallyStmt record.
Definition: ASTBitCodes.h:1281
void setRBracketLoc(SourceLocation L)
Definition: Expr.h:2129
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:3337
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier, e.g., N::foo.
Definition: Expr.h:1009
static OMPForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:1775
void setElement(Stmt *S)
Definition: StmtObjC.h:47
void setConditionVariable(const ASTContext &C, VarDecl *V)
Definition: Stmt.cpp:902
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:2066
static OMPBarrierDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: Stmt.cpp:2061
Represents Objective-C's collection statement.
Definition: StmtObjC.h:24
void setRHS(Expr *Val)
Definition: Stmt.h:731
An ObjCAtSynchronizedStmt record.
Definition: ASTBitCodes.h:1285
void setIndexExpr(unsigned Idx, Expr *E)
Definition: Expr.h:1948
static OMPCopyprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
Definition: Stmt.cpp:1484
void setVolatile(bool V)
Definition: Stmt.h:1435
void setColonLoc(SourceLocation Loc)
Definition: StmtCXX.h:188
static UnresolvedMemberExpr * CreateEmpty(const ASTContext &C, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition: ExprCXX.cpp:1388
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:155
void setRParenLoc(SourceLocation Loc)
Definition: StmtCXX.h:190
static ImplicitCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize)
Definition: Expr.cpp:1750
void setSwitchLoc(SourceLocation L)
Definition: Stmt.h:999
A CXXMemberCallExpr record.
Definition: ASTBitCodes.h:1305
void setAtFinallyLoc(SourceLocation Loc)
Definition: StmtObjC.h:142
void setArg(unsigned Arg, Expr *ArgExpr)
Set the specified argument.
Definition: ExprCXX.h:1211
void setKind(UnaryExprOrTypeTrait K)
Definition: Expr.h:2011
void setRParenLoc(SourceLocation L)
Definition: Expr.h:2048
void setRHS(Expr *E)
Definition: Expr.h:3614
void setOperatorLoc(SourceLocation L)
Definition: Expr.h:2959
void setValue(const ASTContext &C, const llvm::APFloat &Val)
Definition: Expr.h:1380
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:716
void setLParenLoc(SourceLocation L)
Definition: Expr.h:2625
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver. ...
Definition: ExprObjC.h:1274
void setFPContractable(bool FPC)
Definition: Expr.h:3078
Represents a base class of a C++ class.
Definition: DeclCXX.h:157
This represents 'write' clause in the '#pragma omp atomic' directive.
Definition: OpenMPClause.h:836
void setRParenLoc(SourceLocation L)
Definition: ExprObjC.h:375
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:474
void setAtSynchronizedLoc(SourceLocation Loc)
Definition: StmtObjC.h:280
void setOperatorLoc(SourceLocation L)
Definition: Expr.h:1704
void setLocation(SourceLocation Location)
Definition: Expr.h:1306
A ConvertVectorExpr record.
Definition: ASTBitCodes.h:1235
void setStarLoc(SourceLocation L)
Definition: Stmt.h:1263
bool hasAssociatedStmt() const
Returns true if directive has associated statement.
Definition: StmtOpenMP.h:181
void setLParenLoc(SourceLocation L)
Definition: ExprCXX.h:2892
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:2848
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:952
static CStyleCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize)
Definition: Expr.cpp:1772
void setLocation(SourceLocation L)
Definition: ExprCXX.h:787
static UnresolvedLookupExpr * CreateEmpty(const ASTContext &C, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Definition: ExprCXX.cpp:307
void setBuiltinLoc(SourceLocation L)
Definition: Expr.h:3698
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
GNU array range designator.
Definition: ASTBitCodes.h:1423
void setBase(Expr *E)
Definition: Expr.h:4563
A GCC-style AsmStmt record.
Definition: ASTBitCodes.h:1165
This represents 'nowait' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:720
void setStrideVariable(Expr *ST)
Definition: StmtOpenMP.h:404
static CXXStaticCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize)
Definition: ExprCXX.cpp:599
void initializeFrom(SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &List)
static OMPParallelSectionsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:2003
void setElseLoc(SourceLocation L)
Definition: Stmt.h:928
static CXXUnresolvedConstructExpr * CreateEmpty(const ASTContext &C, unsigned NumArgs)
Definition: ExprCXX.cpp:1183
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
Definition: ExprCXX.h:1241
void setUpdates(ArrayRef< Expr * > A)
Definition: Stmt.cpp:1510
An ObjCAtCatchStmt record.
Definition: ASTBitCodes.h:1279
static TypeTraitExpr * CreateDeserialized(const ASTContext &C, unsigned NumArgs)
Definition: ExprCXX.cpp:1533
Expr * ReadSubExpr()
Reads a sub-expression operand during statement reading.
void setIfLoc(SourceLocation L)
Definition: Stmt.h:926
Field designator where the field has been resolved to a declaration.
Definition: ASTBitCodes.h:1419
void setIsaMemberLoc(SourceLocation L)
Definition: ExprObjC.h:1403
unsigned kind
All of the diagnostics that can be emitted by the frontend.
Definition: DiagnosticIDs.h:43
void setExprOperand(Expr *E)
Definition: ExprCXX.h:594
unsigned getNumSubExprs()
Definition: Expr.h:4894
The receiver is a class.
Definition: ExprObjC.h:1000
Represents Objective-C's @try ... @catch ... @finally statement.
Definition: StmtObjC.h:154
void setCapturedRegionKind(CapturedRegionKind Kind)
Set the captured region kind.
Definition: Stmt.h:2121
bool hasTemplateKWAndArgsInfo() const
Definition: Expr.h:1044
void setTokenLocation(SourceLocation L)
Definition: Expr.h:3656
static OMPSectionsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Definition: Stmt.cpp:1801
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
Definition: OpenMPClause.h:348
void setOpLoc(SourceLocation L)
Definition: ExprObjC.h:522
void setLoopVarStmt(Stmt *S)
Definition: StmtCXX.h:181
void setTryBody(Stmt *S)
Definition: StmtObjC.h:199
capture_init_iterator capture_init_begin() const
Retrieve the first initialization argument.
Definition: Stmt.h:2172
void setPreCond(Expr *PC)
Definition: StmtOpenMP.h:381
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:1196
void reserveInits(const ASTContext &C, unsigned NumInits)
Reserve space for some number of initializers.
Definition: Expr.cpp:1904
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:187
This represents '#pragma omp sections' directive.
Definition: StmtOpenMP.h:830
void setNextSwitchCase(SwitchCase *SC)
Definition: Stmt.h:671
void setNextUpperBound(Expr *NUB)
Definition: StmtOpenMP.h:419
capture_range captures()
Definition: Stmt.h:2143
void setKind(CharacterKind kind)
Definition: Expr.h:1352
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
Definition: Expr.h:899
void setLabel(LabelDecl *D)
Definition: Stmt.h:1227
void setSubStmt(Stmt *SS)
Definition: Stmt.h:815
static ObjCArrayLiteral * CreateEmpty(const ASTContext &C, unsigned NumElements)
Definition: Expr.cpp:4227
void setInc(Expr *Inc)
Definition: StmtOpenMP.h:388
unsigned getNumClobbers() const
Definition: Stmt.h:1479
A trivial tuple used to represent a source range.
void setInit(Stmt *S)
Definition: Stmt.h:1186
This represents '#pragma omp taskyield' directive.
Definition: StmtOpenMP.h:1351
unsigned NumInputs
Definition: Stmt.h:1411
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:434
This represents '#pragma omp parallel sections' directive.
Definition: StmtOpenMP.h:1237
void setCalcLastIteration(Expr *CLI)
Definition: StmtOpenMP.h:378
void setStdInitListInitialization(bool V)
Definition: ExprCXX.h:1161
bool isTypeOperand() const
Definition: ExprCXX.h:572
The receiver is a superclass.
Definition: ExprObjC.h:1004
static OMPLastprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
Definition: Stmt.cpp:1295
void setStmts(const ASTContext &C, Stmt **Stmts, unsigned NumStmts)
Definition: Stmt.cpp:297
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
Definition: OpenMPClause.h:185
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1133
Represents Objective-C's @autoreleasepool Statement.
Definition: StmtObjC.h:345
void setWhileLoc(SourceLocation L)
Definition: Stmt.h:1121
unsigned varlist_size() const
Definition: OpenMPClause.h:116
StmtCode
Record codes for each kind of statement or expression.
Definition: ASTBitCodes.h:1120
void setLocEnd(SourceLocation Loc)
Set ending location of directive.
Definition: StmtOpenMP.h:169
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
Definition: ExprObjC.h:1295
void setBase(Expr *E)
Definition: ExprObjC.h:1394
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:4352
void setInits(ArrayRef< Expr * > A)
Definition: Stmt.cpp:1504
void setKeywordLoc(SourceLocation L)
Definition: Stmt.h:674
unsigned getNumElements() const
Definition: ExprObjC.h:314
A GenericSelectionExpr record.
Definition: ASTBitCodes.h:1239
static OMPCancellationPointDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Definition: Stmt.cpp:2115
void setLabelLoc(SourceLocation L)
Definition: Stmt.h:1232
void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args, unsigned NumTemplateArgs)
Read and initialize a ExplicitTemplateArgumentList structure.
#define BLOCK(DERIVED, BASE)
Definition: Template.h:423
void setCond(Expr *E)
Definition: Expr.h:3610
void setAtLoc(SourceLocation Loc)
Definition: StmtObjC.h:364
void setIsConditionTrue(bool isTrue)
Definition: Expr.h:3597