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