//===--- PCHReaderStmt.cpp - Stmt/Expr Deserialization ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Statement/expression deserialization. This implements the
// PCHReader::ReadStmt method.
//
//===----------------------------------------------------------------------===//
#include "clang/Frontend/PCHReader.h"
#include "clang/AST/StmtVisitor.h"
using namespace clang;
namespace {
class PCHStmtReader : public StmtVisitor<PCHStmtReader, unsigned> {
PCHReader &Reader;
const PCHReader::RecordData &Record;
unsigned &Idx;
llvm::SmallVectorImpl<Stmt *> &StmtStack;
public:
PCHStmtReader(PCHReader &Reader, const PCHReader::RecordData &Record,
unsigned &Idx, llvm::SmallVectorImpl<Stmt *> &StmtStack)
: Reader(Reader), Record(Record), Idx(Idx), StmtStack(StmtStack) { }
/// \brief The number of record fields required for the Stmt class
/// itself.
static const unsigned NumStmtFields = 0;
/// \brief The number of record fields required for the Expr class
/// itself.
static const unsigned NumExprFields = NumStmtFields + 3;
// Each of the Visit* functions reads in part of the expression
// from the given record and the current expression stack, then
// return the total number of operands that it read from the
// expression stack.
unsigned VisitStmt(Stmt *S);
unsigned VisitNullStmt(NullStmt *S);
unsigned VisitCompoundStmt(CompoundStmt *S);
unsigned VisitSwitchCase(SwitchCase *S);
unsigned VisitCaseStmt(CaseStmt *S);
unsigned VisitDefaultStmt(DefaultStmt *S);
unsigned VisitLabelStmt(LabelStmt *S);
unsigned VisitIfStmt(IfStmt *S);
unsigned VisitSwitchStmt(SwitchStmt *S);
unsigned VisitWhileStmt(WhileStmt *S);
unsigned VisitDoStmt(DoStmt *S);
unsigned VisitForStmt(ForStmt *S);
unsigned VisitGotoStmt(GotoStmt *S);
unsigned VisitIndirectGotoStmt(IndirectGotoStmt *S);
unsigned VisitContinueStmt(ContinueStmt *S);
unsigned VisitBreakStmt(BreakStmt *S);
unsigned VisitReturnStmt(ReturnStmt *S);
unsigned VisitDeclStmt(DeclStmt *S);
unsigned VisitAsmStmt(AsmStmt *S);
unsigned VisitExpr(Expr *E);
unsigned VisitPredefinedExpr(PredefinedExpr *E);
unsigned VisitDeclRefExpr(DeclRefExpr *E);
unsigned VisitIntegerLiteral(IntegerLiteral *E);
unsigned VisitFloatingLiteral(FloatingLiteral *E);
unsigned VisitImaginaryLiteral(ImaginaryLiteral *E);
unsigned VisitStringLiteral(StringLiteral *E);
unsigned VisitCharacterLiteral(CharacterLiteral *E);
unsigned VisitParenExpr(ParenExpr *E);
unsigned VisitUnaryOperator(UnaryOperator *E);
unsigned VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E);
unsigned VisitArraySubscriptExpr(ArraySubscriptExpr *E);
unsigned VisitCallExpr(CallExpr *E);
unsigned VisitMemberExpr(MemberExpr *E);
unsigned VisitCastExpr(CastExpr *E);
unsigned VisitBinaryOperator(BinaryOperator *E);
unsigned VisitCompoundAssignOperator(CompoundAssignOperator *E);
unsigned VisitConditionalOperator(ConditionalOperator *E);
unsigned VisitImplicitCastExpr(ImplicitCastExpr *