2010-08-19 07:57:11 +08:00
|
|
|
//===--- ASTReaderStmt.cpp - Stmt/Expr Deserialization ----------*- C++ -*-===//
|
2009-04-27 13:14:47 +08:00
|
|
|
//
|
|
|
|
// 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
|
2010-08-19 07:56:43 +08:00
|
|
|
// ASTReader::ReadStmt method.
|
2009-04-27 13:14:47 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-08-19 07:57:17 +08:00
|
|
|
#include "clang/Serialization/ASTReader.h"
|
2012-07-05 04:19:54 +08:00
|
|
|
#include "clang/AST/ASTContext.h"
|
2009-09-10 07:08:42 +08:00
|
|
|
#include "clang/AST/DeclCXX.h"
|
2011-01-15 09:15:58 +08:00
|
|
|
#include "clang/AST/DeclTemplate.h"
|
2009-04-27 13:14:47 +08:00
|
|
|
#include "clang/AST/StmtVisitor.h"
|
2013-05-03 08:10:13 +08:00
|
|
|
#include "clang/Lex/Token.h"
|
2012-02-04 21:45:25 +08:00
|
|
|
#include "llvm/ADT/SmallString.h"
|
2009-04-27 13:14:47 +08:00
|
|
|
using namespace clang;
|
2010-08-19 07:57:32 +08:00
|
|
|
using namespace clang::serialization;
|
2009-04-27 13:14:47 +08:00
|
|
|
|
2010-06-30 16:49:18 +08:00
|
|
|
namespace clang {
|
2010-06-28 17:31:42 +08:00
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
|
2013-07-19 11:13:43 +08:00
|
|
|
friend class OMPClauseReader;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
|
|
|
ASTRecordReader Record;
|
2010-07-23 06:43:28 +08:00
|
|
|
llvm::BitstreamCursor &DeclsCursor;
|
2009-04-27 13:14:47 +08:00
|
|
|
unsigned &Idx;
|
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
SourceLocation ReadSourceLocation() {
|
|
|
|
return Record.ReadSourceLocation(Idx);
|
2013-05-03 08:10:13 +08:00
|
|
|
}
|
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
SourceRange ReadSourceRange() {
|
|
|
|
return Record.ReadSourceRange(Idx);
|
2010-10-05 23:59:54 +08:00
|
|
|
}
|
2013-05-03 08:10:13 +08:00
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
std::string ReadString() {
|
|
|
|
return Record.ReadString(Idx);
|
2010-10-05 23:59:54 +08:00
|
|
|
}
|
2013-05-03 08:10:13 +08:00
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
TypeSourceInfo *GetTypeSourceInfo() {
|
|
|
|
return Record.GetTypeSourceInfo(Idx);
|
2010-10-05 23:59:54 +08:00
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
|
|
|
|
Decl *ReadDecl() {
|
|
|
|
return Record.ReadDecl(Idx);
|
2011-07-22 06:35:25 +08:00
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2011-07-22 06:35:25 +08:00
|
|
|
template<typename T>
|
2016-12-16 04:53:26 +08:00
|
|
|
T *ReadDeclAs() {
|
|
|
|
return Record.ReadDeclAs<T>(Idx);
|
2011-07-22 06:35:25 +08:00
|
|
|
}
|
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc,
|
|
|
|
DeclarationName Name) {
|
|
|
|
Record.ReadDeclarationNameLoc(DNLoc, Name, Idx);
|
2010-10-16 02:21:24 +08:00
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
|
|
|
|
void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo) {
|
|
|
|
Record.ReadDeclarationNameInfo(NameInfo, Idx);
|
2010-10-16 02:21:24 +08:00
|
|
|
}
|
2010-10-05 23:59:54 +08:00
|
|
|
|
2009-04-27 13:14:47 +08:00
|
|
|
public:
|
2011-12-01 07:21:26 +08:00
|
|
|
ASTStmtReader(ASTReader &Reader, ModuleFile &F,
|
2010-10-05 23:59:54 +08:00
|
|
|
llvm::BitstreamCursor &Cursor,
|
2010-08-19 07:56:43 +08:00
|
|
|
const ASTReader::RecordData &Record, unsigned &Idx)
|
2016-12-16 04:53:26 +08:00
|
|
|
: Record(Reader, Record, F), DeclsCursor(Cursor), Idx(Idx) { }
|
2009-04-27 13:14:47 +08:00
|
|
|
|
|
|
|
/// \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.
|
2011-07-01 09:22:09 +08:00
|
|
|
static const unsigned NumExprFields = NumStmtFields + 7;
|
2012-01-27 17:46:47 +08:00
|
|
|
|
|
|
|
/// \brief Read and initialize a ExplicitTemplateArgumentList structure.
|
|
|
|
void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
|
2015-12-30 02:15:14 +08:00
|
|
|
TemplateArgumentLoc *ArgsLocArray,
|
2012-01-27 17:46:47 +08:00
|
|
|
unsigned NumTemplateArgs);
|
2010-06-28 17:31:48 +08:00
|
|
|
/// \brief Read and initialize a ExplicitTemplateArgumentList structure.
|
2011-09-23 04:07:03 +08:00
|
|
|
void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList,
|
2010-06-29 06:28:35 +08:00
|
|
|
unsigned NumTemplateArgs);
|
|
|
|
|
|
|
|
void VisitStmt(Stmt *S);
|
2011-07-15 15:00:14 +08:00
|
|
|
#define STMT(Type, Base) \
|
|
|
|
void Visit##Type(Type *);
|
|
|
|
#include "clang/AST/StmtNodes.inc"
|
2009-04-27 13:14:47 +08:00
|
|
|
};
|
2015-06-23 07:07:51 +08:00
|
|
|
}
|
2009-04-27 13:14:47 +08:00
|
|
|
|
2015-12-30 02:15:14 +08:00
|
|
|
void ASTStmtReader::ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
|
|
|
|
TemplateArgumentLoc *ArgsLocArray,
|
|
|
|
unsigned NumTemplateArgs) {
|
2016-12-16 04:53:26 +08:00
|
|
|
SourceLocation TemplateKWLoc = ReadSourceLocation();
|
2010-06-28 17:31:48 +08:00
|
|
|
TemplateArgumentListInfo ArgInfo;
|
2016-12-16 04:53:26 +08:00
|
|
|
ArgInfo.setLAngleLoc(ReadSourceLocation());
|
|
|
|
ArgInfo.setRAngleLoc(ReadSourceLocation());
|
2010-06-28 17:31:48 +08:00
|
|
|
for (unsigned i = 0; i != NumTemplateArgs; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
ArgInfo.addArgument(Record.ReadTemplateArgumentLoc(Idx));
|
2015-12-30 02:15:14 +08:00
|
|
|
Args.initializeFrom(TemplateKWLoc, ArgInfo, ArgsLocArray);
|
2010-06-28 17:31:48 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitStmt(Stmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
assert(Idx == NumStmtFields && "Incorrect statement field count");
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitNullStmt(NullStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setSemiLoc(ReadSourceLocation());
|
2011-09-02 05:53:45 +08:00
|
|
|
S->HasLeadingEmptyMacro = Record[Idx++];
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2011-07-23 18:55:15 +08:00
|
|
|
SmallVector<Stmt *, 16> Stmts;
|
2009-04-27 13:14:47 +08:00
|
|
|
unsigned NumStmts = Record[Idx++];
|
2010-06-29 06:28:35 +08:00
|
|
|
while (NumStmts--)
|
2016-12-16 04:53:26 +08:00
|
|
|
Stmts.push_back(Record.ReadSubStmt());
|
|
|
|
S->setStmts(Record.getContext(), Stmts);
|
|
|
|
S->LBraceLoc = ReadSourceLocation();
|
|
|
|
S->RBraceLoc = ReadSourceLocation();
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
Record.RecordSwitchCaseID(S, Record[Idx++]);
|
|
|
|
S->setKeywordLoc(ReadSourceLocation());
|
|
|
|
S->setColonLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCaseStmt(CaseStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitSwitchCase(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setLHS(Record.ReadSubExpr());
|
|
|
|
S->setRHS(Record.ReadSubExpr());
|
|
|
|
S->setSubStmt(Record.ReadSubStmt());
|
|
|
|
S->setEllipsisLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitSwitchCase(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setSubStmt(Record.ReadSubStmt());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
LabelDecl *LD = ReadDeclAs<LabelDecl>();
|
2011-02-17 15:39:24 +08:00
|
|
|
LD->setStmt(S);
|
|
|
|
S->setDecl(LD);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setSubStmt(Record.ReadSubStmt());
|
|
|
|
S->setIdentLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2012-04-14 08:33:13 +08:00
|
|
|
void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) {
|
|
|
|
VisitStmt(S);
|
2012-07-09 18:04:07 +08:00
|
|
|
uint64_t NumAttrs = Record[Idx++];
|
2012-04-14 08:33:13 +08:00
|
|
|
AttrVec Attrs;
|
2016-12-16 04:53:26 +08:00
|
|
|
Record.ReadAttributes(Attrs, Idx);
|
2012-07-10 02:55:31 +08:00
|
|
|
(void)NumAttrs;
|
2012-07-09 18:04:07 +08:00
|
|
|
assert(NumAttrs == S->NumAttrs);
|
|
|
|
assert(NumAttrs == Attrs.size());
|
2014-05-13 22:55:01 +08:00
|
|
|
std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr());
|
2016-12-16 04:53:26 +08:00
|
|
|
S->SubStmt = Record.ReadSubStmt();
|
|
|
|
S->AttrLoc = ReadSourceLocation();
|
2012-04-14 08:33:13 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitIfStmt(IfStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-06-24 03:16:49 +08:00
|
|
|
S->setConstexpr(Record[Idx++]);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setInit(Record.ReadSubStmt());
|
|
|
|
S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
|
|
|
|
S->setCond(Record.ReadSubExpr());
|
|
|
|
S->setThen(Record.ReadSubStmt());
|
|
|
|
S->setElse(Record.ReadSubStmt());
|
|
|
|
S->setIfLoc(ReadSourceLocation());
|
|
|
|
S->setElseLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setInit(Record.ReadSubStmt());
|
|
|
|
S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
|
|
|
|
S->setCond(Record.ReadSubExpr());
|
|
|
|
S->setBody(Record.ReadSubStmt());
|
|
|
|
S->setSwitchLoc(ReadSourceLocation());
|
2010-09-09 08:05:53 +08:00
|
|
|
if (Record[Idx++])
|
|
|
|
S->setAllEnumCasesCovered();
|
|
|
|
|
2014-05-22 13:54:18 +08:00
|
|
|
SwitchCase *PrevSC = nullptr;
|
2009-04-27 13:14:47 +08:00
|
|
|
for (unsigned N = Record.size(); Idx != N; ++Idx) {
|
2016-12-16 04:53:26 +08:00
|
|
|
SwitchCase *SC = Record.getSwitchCaseWithID(Record[Idx]);
|
2009-04-27 13:14:47 +08:00
|
|
|
if (PrevSC)
|
|
|
|
PrevSC->setNextSwitchCase(SC);
|
|
|
|
else
|
|
|
|
S->setSwitchCaseList(SC);
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-04-27 13:14:47 +08:00
|
|
|
PrevSC = SC;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
|
2011-07-22 06:35:25 +08:00
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setCond(Record.ReadSubExpr());
|
|
|
|
S->setBody(Record.ReadSubStmt());
|
|
|
|
S->setWhileLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitDoStmt(DoStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setCond(Record.ReadSubExpr());
|
|
|
|
S->setBody(Record.ReadSubStmt());
|
|
|
|
S->setDoLoc(ReadSourceLocation());
|
|
|
|
S->setWhileLoc(ReadSourceLocation());
|
|
|
|
S->setRParenLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitForStmt(ForStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setInit(Record.ReadSubStmt());
|
|
|
|
S->setCond(Record.ReadSubExpr());
|
|
|
|
S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
|
|
|
|
S->setInc(Record.ReadSubExpr());
|
|
|
|
S->setBody(Record.ReadSubStmt());
|
|
|
|
S->setForLoc(ReadSourceLocation());
|
|
|
|
S->setLParenLoc(ReadSourceLocation());
|
|
|
|
S->setRParenLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setLabel(ReadDeclAs<LabelDecl>());
|
|
|
|
S->setGotoLoc(ReadSourceLocation());
|
|
|
|
S->setLabelLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setGotoLoc(ReadSourceLocation());
|
|
|
|
S->setStarLoc(ReadSourceLocation());
|
|
|
|
S->setTarget(Record.ReadSubExpr());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setContinueLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitBreakStmt(BreakStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setBreakLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setRetValue(Record.ReadSubExpr());
|
|
|
|
S->setReturnLoc(ReadSourceLocation());
|
|
|
|
S->setNRVOCandidate(ReadDeclAs<VarDecl>());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setStartLoc(ReadSourceLocation());
|
|
|
|
S->setEndLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
|
|
|
|
if (Idx + 1 == Record.size()) {
|
|
|
|
// Single declaration
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setDeclGroup(DeclGroupRef(ReadDecl()));
|
2009-04-27 13:14:47 +08:00
|
|
|
} else {
|
2011-07-23 18:55:15 +08:00
|
|
|
SmallVector<Decl *, 16> Decls;
|
2016-12-16 04:53:26 +08:00
|
|
|
Decls.reserve(Record.size() - Idx);
|
2011-07-22 06:35:25 +08:00
|
|
|
for (unsigned N = Record.size(); Idx != N; )
|
2016-12-16 04:53:26 +08:00
|
|
|
Decls.push_back(ReadDecl());
|
|
|
|
S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Record.getContext(),
|
2009-05-23 06:45:36 +08:00
|
|
|
Decls.data(),
|
|
|
|
Decls.size())));
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-03 08:10:13 +08:00
|
|
|
void ASTStmtReader::VisitAsmStmt(AsmStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2013-05-03 08:10:13 +08:00
|
|
|
S->NumOutputs = Record[Idx++];
|
|
|
|
S->NumInputs = Record[Idx++];
|
|
|
|
S->NumClobbers = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setAsmLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
S->setVolatile(Record[Idx++]);
|
|
|
|
S->setSimple(Record[Idx++]);
|
2013-05-03 08:10:13 +08:00
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2013-05-03 08:10:13 +08:00
|
|
|
void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) {
|
|
|
|
VisitAsmStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setRParenLoc(ReadSourceLocation());
|
|
|
|
S->setAsmString(cast_or_null<StringLiteral>(Record.ReadSubStmt()));
|
2009-04-27 13:14:47 +08:00
|
|
|
|
2013-05-03 08:10:13 +08:00
|
|
|
unsigned NumOutputs = S->getNumOutputs();
|
|
|
|
unsigned NumInputs = S->getNumInputs();
|
|
|
|
unsigned NumClobbers = S->getNumClobbers();
|
|
|
|
|
2009-04-27 13:14:47 +08:00
|
|
|
// Outputs and inputs
|
2011-07-23 18:55:15 +08:00
|
|
|
SmallVector<IdentifierInfo *, 16> Names;
|
|
|
|
SmallVector<StringLiteral*, 16> Constraints;
|
|
|
|
SmallVector<Stmt*, 16> Exprs;
|
2009-04-27 13:14:47 +08:00
|
|
|
for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) {
|
2016-12-16 04:53:26 +08:00
|
|
|
Names.push_back(Record.GetIdentifierInfo(Idx));
|
|
|
|
Constraints.push_back(cast_or_null<StringLiteral>(Record.ReadSubStmt()));
|
|
|
|
Exprs.push_back(Record.ReadSubStmt());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Constraints
|
2011-07-23 18:55:15 +08:00
|
|
|
SmallVector<StringLiteral*, 16> Clobbers;
|
2009-04-27 13:14:47 +08:00
|
|
|
for (unsigned I = 0; I != NumClobbers; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
Clobbers.push_back(cast_or_null<StringLiteral>(Record.ReadSubStmt()));
|
2010-01-31 03:34:25 +08:00
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setOutputsAndInputsAndClobbers(Record.getContext(),
|
|
|
|
Names.data(), Constraints.data(),
|
|
|
|
Exprs.data(), NumOutputs, NumInputs,
|
2010-01-31 03:34:25 +08:00
|
|
|
Clobbers.data(), NumClobbers);
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2012-06-12 04:47:18 +08:00
|
|
|
void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) {
|
2013-05-03 08:10:13 +08:00
|
|
|
VisitAsmStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->LBraceLoc = ReadSourceLocation();
|
|
|
|
S->EndLoc = ReadSourceLocation();
|
2013-05-03 08:10:13 +08:00
|
|
|
S->NumAsmToks = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
std::string AsmStr = ReadString();
|
2013-05-03 08:10:13 +08:00
|
|
|
|
|
|
|
// Read the tokens.
|
|
|
|
SmallVector<Token, 16> AsmToks;
|
|
|
|
AsmToks.reserve(S->NumAsmToks);
|
|
|
|
for (unsigned i = 0, e = S->NumAsmToks; i != e; ++i) {
|
2016-12-16 04:53:26 +08:00
|
|
|
AsmToks.push_back(Record.ReadToken(Idx));
|
2013-05-03 08:10:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// The calls to reserve() for the FooData vectors are mandatory to
|
|
|
|
// prevent dead StringRefs in the Foo vectors.
|
|
|
|
|
|
|
|
// Read the clobbers.
|
|
|
|
SmallVector<std::string, 16> ClobbersData;
|
|
|
|
SmallVector<StringRef, 16> Clobbers;
|
|
|
|
ClobbersData.reserve(S->NumClobbers);
|
|
|
|
Clobbers.reserve(S->NumClobbers);
|
|
|
|
for (unsigned i = 0, e = S->NumClobbers; i != e; ++i) {
|
2016-12-16 04:53:26 +08:00
|
|
|
ClobbersData.push_back(ReadString());
|
2013-05-03 08:10:13 +08:00
|
|
|
Clobbers.push_back(ClobbersData.back());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Read the operands.
|
|
|
|
unsigned NumOperands = S->NumOutputs + S->NumInputs;
|
|
|
|
SmallVector<Expr*, 16> Exprs;
|
|
|
|
SmallVector<std::string, 16> ConstraintsData;
|
|
|
|
SmallVector<StringRef, 16> Constraints;
|
|
|
|
Exprs.reserve(NumOperands);
|
|
|
|
ConstraintsData.reserve(NumOperands);
|
|
|
|
Constraints.reserve(NumOperands);
|
|
|
|
for (unsigned i = 0; i != NumOperands; ++i) {
|
2016-12-16 04:53:26 +08:00
|
|
|
Exprs.push_back(cast<Expr>(Record.ReadSubStmt()));
|
|
|
|
ConstraintsData.push_back(ReadString());
|
2013-05-03 08:10:13 +08:00
|
|
|
Constraints.push_back(ConstraintsData.back());
|
|
|
|
}
|
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
S->initialize(Record.getContext(), AsmStr, AsmToks,
|
2013-05-03 08:10:13 +08:00
|
|
|
Constraints, Exprs, Clobbers);
|
2012-06-12 04:47:18 +08:00
|
|
|
}
|
|
|
|
|
2015-10-27 14:02:45 +08:00
|
|
|
void ASTStmtReader::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) {
|
|
|
|
// FIXME: Implement coroutine serialization.
|
|
|
|
llvm_unreachable("unimplemented");
|
|
|
|
}
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt *S) {
|
|
|
|
// FIXME: Implement coroutine serialization.
|
|
|
|
llvm_unreachable("unimplemented");
|
|
|
|
}
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *S) {
|
|
|
|
// FIXME: Implement coroutine serialization.
|
|
|
|
llvm_unreachable("unimplemented");
|
|
|
|
}
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *S) {
|
|
|
|
// FIXME: Implement coroutine serialization.
|
|
|
|
llvm_unreachable("unimplemented");
|
|
|
|
}
|
|
|
|
|
2013-04-17 02:53:08 +08:00
|
|
|
void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) {
|
2013-05-04 03:20:19 +08:00
|
|
|
VisitStmt(S);
|
2013-07-19 11:13:43 +08:00
|
|
|
++Idx;
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setCapturedDecl(ReadDeclAs<CapturedDecl>());
|
2013-05-04 11:59:06 +08:00
|
|
|
S->setCapturedRegionKind(static_cast<CapturedRegionKind>(Record[Idx++]));
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setCapturedRecordDecl(ReadDeclAs<RecordDecl>());
|
2013-05-04 03:20:19 +08:00
|
|
|
|
|
|
|
// Capture inits
|
|
|
|
for (CapturedStmt::capture_init_iterator I = S->capture_init_begin(),
|
|
|
|
E = S->capture_init_end();
|
|
|
|
I != E; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
*I = Record.ReadSubExpr();
|
2013-05-04 03:20:19 +08:00
|
|
|
|
|
|
|
// Body
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setCapturedStmt(Record.ReadSubStmt());
|
2013-05-04 11:59:06 +08:00
|
|
|
S->getCapturedDecl()->setBody(S->getCapturedStmt());
|
2013-05-04 03:20:19 +08:00
|
|
|
|
|
|
|
// Captures
|
2014-03-15 02:08:33 +08:00
|
|
|
for (auto &I : S->captures()) {
|
2016-12-16 04:53:26 +08:00
|
|
|
I.VarAndKind.setPointer(ReadDeclAs<VarDecl>());
|
2014-03-15 02:08:33 +08:00
|
|
|
I.VarAndKind
|
2013-05-04 03:20:19 +08:00
|
|
|
.setInt(static_cast<CapturedStmt::VariableCaptureKind>(Record[Idx++]));
|
2016-12-16 04:53:26 +08:00
|
|
|
I.Loc = ReadSourceLocation();
|
2013-05-04 03:20:19 +08:00
|
|
|
}
|
2013-04-17 02:53:08 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitExpr(Expr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setType(Record.readType(Idx));
|
2009-04-27 13:14:47 +08:00
|
|
|
E->setTypeDependent(Record[Idx++]);
|
|
|
|
E->setValueDependent(Record[Idx++]);
|
2011-07-01 09:22:09 +08:00
|
|
|
E->setInstantiationDependent(Record[Idx++]);
|
Variadic templates: extend Type, NestedNameSpecifier, TemplateName,
and TemplateArgument with an operation that determines whether there
are any unexpanded parameter packs within that construct. Use this
information to diagnose the appearance of the names of parameter packs
that have not been expanded (C++ [temp.variadic]p5). Since this
property is checked often (every declaration, ever expression
statement, etc.), we extend Type and Expr with a bit storing the
result of this computation, rather than walking the AST each time to
determine whether any unexpanded parameter packs occur.
This commit is deficient in several ways, which will be remedied with
future commits:
- Expr has a bit to store the presence of an unexpanded parameter
pack, but it is never set.
- The error messages don't point out where the unexpanded parameter
packs were named in the type/expression, but they should.
- We don't check for unexpanded parameter packs in all of the places
where we should.
- Testing is sparse, pending the resolution of the above three
issues.
llvm-svn: 121724
2010-12-14 06:49:22 +08:00
|
|
|
E->ExprBits.ContainsUnexpandedParameterPack = Record[Idx++];
|
2010-11-18 14:31:45 +08:00
|
|
|
E->setValueKind(static_cast<ExprValueKind>(Record[Idx++]));
|
|
|
|
E->setObjectKind(static_cast<ExprObjectKind>(Record[Idx++]));
|
2009-04-27 13:14:47 +08:00
|
|
|
assert(Idx == NumExprFields && "Incorrect expression field count");
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLocation(ReadSourceLocation());
|
2014-10-09 16:45:04 +08:00
|
|
|
E->Type = (PredefinedExpr::IdentType)Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->FnName = cast_or_null<StringLiteral>(Record.ReadSubExpr());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2010-07-08 21:09:47 +08:00
|
|
|
|
2011-05-02 05:29:53 +08:00
|
|
|
E->DeclRefExprBits.HasQualifier = Record[Idx++];
|
Add an optional field attached to a DeclRefExpr which points back to the
Decl actually found via name lookup & overload resolution when that Decl
is different from the ValueDecl which is actually referenced by the
expression.
This can be used by AST consumers to correctly attribute references to
the spelling location of a using declaration, and otherwise gain insight
into the name resolution performed by Clang.
The public interface to DRE is kept as narrow as possible: we provide
a getFoundDecl() which always returns a NamedDecl, either the ValueDecl
referenced or the new, more precise NamedDecl if present. This way AST
clients can code against getFoundDecl without know when exactly the AST
has a split representation.
For an example of the data this provides consider:
% cat x.cc
namespace N1 {
struct S {};
void f(const S&);
}
void test(N1::S s) {
f(s);
using N1::f;
f(s);
}
% ./bin/clang -fsyntax-only -Xclang -ast-dump x.cc
[...]
void test(N1::S s) (CompoundStmt 0x5b02010 <x.cc:5:20, line:9:1>
(CallExpr 0x5b01df0 <line:6:3, col:6> 'void'
(ImplicitCastExpr 0x5b01dd8 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01d80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)'))
(ImplicitCastExpr 0x5b01e20 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01d58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S')))
(DeclStmt 0x5b01ee0 <line:7:3, col:14>
0x5b01e40 "UsingN1::;")
(CallExpr 0x5b01fc8 <line:8:3, col:6> 'void'
(ImplicitCastExpr 0x5b01fb0 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01f80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)' (UsingShadow 0x5b01ea0 'f')))
(ImplicitCastExpr 0x5b01ff8 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01f58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S'))))
Now we can tell that the second call is 'using' (no pun intended) the using
declaration, and *which* using declaration it sees. Without this, we can
mistake calls that go through using declarations for ADL calls, and have no way
to attribute names looked up with using declarations to the appropriate
UsingDecl.
llvm-svn: 130670
2011-05-02 07:48:14 +08:00
|
|
|
E->DeclRefExprBits.HasFoundDecl = Record[Idx++];
|
2012-01-27 17:46:47 +08:00
|
|
|
E->DeclRefExprBits.HasTemplateKWAndArgsInfo = Record[Idx++];
|
2011-10-05 15:56:41 +08:00
|
|
|
E->DeclRefExprBits.HadMultipleCandidates = Record[Idx++];
|
2015-01-12 18:17:46 +08:00
|
|
|
E->DeclRefExprBits.RefersToEnclosingVariableOrCapture = Record[Idx++];
|
2011-03-07 02:19:42 +08:00
|
|
|
unsigned NumTemplateArgs = 0;
|
2012-01-27 17:46:47 +08:00
|
|
|
if (E->hasTemplateKWAndArgsInfo())
|
2011-03-07 02:19:42 +08:00
|
|
|
NumTemplateArgs = Record[Idx++];
|
|
|
|
|
2011-05-02 05:29:53 +08:00
|
|
|
if (E->hasQualifier())
|
2015-12-30 02:15:14 +08:00
|
|
|
new (E->getTrailingObjects<NestedNameSpecifierLoc>())
|
2016-12-16 04:53:26 +08:00
|
|
|
NestedNameSpecifierLoc(Record.ReadNestedNameSpecifierLoc(Idx));
|
2010-07-08 21:09:47 +08:00
|
|
|
|
Add an optional field attached to a DeclRefExpr which points back to the
Decl actually found via name lookup & overload resolution when that Decl
is different from the ValueDecl which is actually referenced by the
expression.
This can be used by AST consumers to correctly attribute references to
the spelling location of a using declaration, and otherwise gain insight
into the name resolution performed by Clang.
The public interface to DRE is kept as narrow as possible: we provide
a getFoundDecl() which always returns a NamedDecl, either the ValueDecl
referenced or the new, more precise NamedDecl if present. This way AST
clients can code against getFoundDecl without know when exactly the AST
has a split representation.
For an example of the data this provides consider:
% cat x.cc
namespace N1 {
struct S {};
void f(const S&);
}
void test(N1::S s) {
f(s);
using N1::f;
f(s);
}
% ./bin/clang -fsyntax-only -Xclang -ast-dump x.cc
[...]
void test(N1::S s) (CompoundStmt 0x5b02010 <x.cc:5:20, line:9:1>
(CallExpr 0x5b01df0 <line:6:3, col:6> 'void'
(ImplicitCastExpr 0x5b01dd8 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01d80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)'))
(ImplicitCastExpr 0x5b01e20 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01d58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S')))
(DeclStmt 0x5b01ee0 <line:7:3, col:14>
0x5b01e40 "UsingN1::;")
(CallExpr 0x5b01fc8 <line:8:3, col:6> 'void'
(ImplicitCastExpr 0x5b01fb0 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01f80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)' (UsingShadow 0x5b01ea0 'f')))
(ImplicitCastExpr 0x5b01ff8 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01f58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S'))))
Now we can tell that the second call is 'using' (no pun intended) the using
declaration, and *which* using declaration it sees. Without this, we can
mistake calls that go through using declarations for ADL calls, and have no way
to attribute names looked up with using declarations to the appropriate
UsingDecl.
llvm-svn: 130670
2011-05-02 07:48:14 +08:00
|
|
|
if (E->hasFoundDecl())
|
2016-12-16 04:53:26 +08:00
|
|
|
*E->getTrailingObjects<NamedDecl *>() = ReadDeclAs<NamedDecl>();
|
Add an optional field attached to a DeclRefExpr which points back to the
Decl actually found via name lookup & overload resolution when that Decl
is different from the ValueDecl which is actually referenced by the
expression.
This can be used by AST consumers to correctly attribute references to
the spelling location of a using declaration, and otherwise gain insight
into the name resolution performed by Clang.
The public interface to DRE is kept as narrow as possible: we provide
a getFoundDecl() which always returns a NamedDecl, either the ValueDecl
referenced or the new, more precise NamedDecl if present. This way AST
clients can code against getFoundDecl without know when exactly the AST
has a split representation.
For an example of the data this provides consider:
% cat x.cc
namespace N1 {
struct S {};
void f(const S&);
}
void test(N1::S s) {
f(s);
using N1::f;
f(s);
}
% ./bin/clang -fsyntax-only -Xclang -ast-dump x.cc
[...]
void test(N1::S s) (CompoundStmt 0x5b02010 <x.cc:5:20, line:9:1>
(CallExpr 0x5b01df0 <line:6:3, col:6> 'void'
(ImplicitCastExpr 0x5b01dd8 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01d80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)'))
(ImplicitCastExpr 0x5b01e20 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01d58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S')))
(DeclStmt 0x5b01ee0 <line:7:3, col:14>
0x5b01e40 "UsingN1::;")
(CallExpr 0x5b01fc8 <line:8:3, col:6> 'void'
(ImplicitCastExpr 0x5b01fb0 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01f80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)' (UsingShadow 0x5b01ea0 'f')))
(ImplicitCastExpr 0x5b01ff8 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01f58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S'))))
Now we can tell that the second call is 'using' (no pun intended) the using
declaration, and *which* using declaration it sees. Without this, we can
mistake calls that go through using declarations for ADL calls, and have no way
to attribute names looked up with using declarations to the appropriate
UsingDecl.
llvm-svn: 130670
2011-05-02 07:48:14 +08:00
|
|
|
|
2012-01-27 17:46:47 +08:00
|
|
|
if (E->hasTemplateKWAndArgsInfo())
|
2015-12-30 02:15:14 +08:00
|
|
|
ReadTemplateKWAndArgsInfo(
|
|
|
|
*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
|
|
|
|
E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
|
2010-07-08 21:09:47 +08:00
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setDecl(ReadDeclAs<ValueDecl>());
|
|
|
|
E->setLocation(ReadSourceLocation());
|
|
|
|
ReadDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLocation(ReadSourceLocation());
|
|
|
|
E->setValue(Record.getContext(), Record.ReadAPInt(Idx));
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2013-01-22 17:46:51 +08:00
|
|
|
E->setRawSemantics(static_cast<Stmt::APFloatSemantics>(Record[Idx++]));
|
2009-04-27 13:14:47 +08:00
|
|
|
E->setExact(Record[Idx++]);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setValue(Record.getContext(), Record.ReadAPFloat(E->getSemantics(), Idx));
|
|
|
|
E->setLocation(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setSubExpr(Record.ReadSubExpr());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitStringLiteral(StringLiteral *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
|
|
|
unsigned Len = Record[Idx++];
|
2009-09-09 23:08:12 +08:00
|
|
|
assert(Record[Idx] == E->getNumConcatenated() &&
|
2009-04-27 13:14:47 +08:00
|
|
|
"Wrong number of concatenated tokens!");
|
|
|
|
++Idx;
|
2011-11-01 10:23:42 +08:00
|
|
|
StringLiteral::StringKind kind =
|
|
|
|
static_cast<StringLiteral::StringKind>(Record[Idx++]);
|
|
|
|
bool isPascal = Record[Idx++];
|
2009-04-27 13:14:47 +08:00
|
|
|
|
2009-09-09 23:08:12 +08:00
|
|
|
// Read string data
|
2012-02-05 10:13:05 +08:00
|
|
|
SmallString<16> Str(&Record[Idx], &Record[Idx] + Len);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setString(Record.getContext(), Str, kind, isPascal);
|
2009-04-27 13:14:47 +08:00
|
|
|
Idx += Len;
|
|
|
|
|
|
|
|
// Read source locations
|
|
|
|
for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setStrTokenLoc(I, ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
|
|
|
E->setValue(Record[Idx++]);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLocation(ReadSourceLocation());
|
2011-07-27 13:40:30 +08:00
|
|
|
E->setKind(static_cast<CharacterLiteral::CharacterKind>(Record[Idx++]));
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLParen(ReadSourceLocation());
|
|
|
|
E->setRParen(ReadSourceLocation());
|
|
|
|
E->setSubExpr(Record.ReadSubExpr());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
|
2010-06-30 16:49:18 +08:00
|
|
|
VisitExpr(E);
|
|
|
|
unsigned NumExprs = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Exprs = new (Record.getContext()) Stmt*[NumExprs];
|
2010-06-30 16:49:18 +08:00
|
|
|
for (unsigned i = 0; i != NumExprs; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Exprs[i] = Record.ReadSubStmt();
|
2010-06-30 16:49:18 +08:00
|
|
|
E->NumExprs = NumExprs;
|
2016-12-16 04:53:26 +08:00
|
|
|
E->LParenLoc = ReadSourceLocation();
|
|
|
|
E->RParenLoc = ReadSourceLocation();
|
2010-06-30 16:49:18 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setSubExpr(Record.ReadSubExpr());
|
2009-04-27 13:14:47 +08:00
|
|
|
E->setOpcode((UnaryOperator::Opcode)Record[Idx++]);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setOperatorLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
|
Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-29 06:16:22 +08:00
|
|
|
VisitExpr(E);
|
|
|
|
assert(E->getNumComponents() == Record[Idx]);
|
|
|
|
++Idx;
|
|
|
|
assert(E->getNumExpressions() == Record[Idx]);
|
|
|
|
++Idx;
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setOperatorLoc(ReadSourceLocation());
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
|
|
|
E->setTypeSourceInfo(GetTypeSourceInfo());
|
Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-29 06:16:22 +08:00
|
|
|
for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
|
2015-12-30 06:31:18 +08:00
|
|
|
OffsetOfNode::Kind Kind = static_cast<OffsetOfNode::Kind>(Record[Idx++]);
|
2016-12-16 04:53:26 +08:00
|
|
|
SourceLocation Start = ReadSourceLocation();
|
|
|
|
SourceLocation End = ReadSourceLocation();
|
Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-29 06:16:22 +08:00
|
|
|
switch (Kind) {
|
2015-12-30 06:31:18 +08:00
|
|
|
case OffsetOfNode::Array:
|
|
|
|
E->setComponent(I, OffsetOfNode(Start, Record[Idx++], End));
|
Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-29 06:16:22 +08:00
|
|
|
break;
|
2015-12-30 06:31:18 +08:00
|
|
|
|
|
|
|
case OffsetOfNode::Field:
|
|
|
|
E->setComponent(
|
2016-12-16 04:53:26 +08:00
|
|
|
I, OffsetOfNode(Start, ReadDeclAs<FieldDecl>(), End));
|
Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-29 06:16:22 +08:00
|
|
|
break;
|
|
|
|
|
2015-12-30 06:31:18 +08:00
|
|
|
case OffsetOfNode::Identifier:
|
|
|
|
E->setComponent(
|
|
|
|
I,
|
2016-12-16 04:53:26 +08:00
|
|
|
OffsetOfNode(Start, Record.GetIdentifierInfo(Idx), End));
|
Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-29 06:16:22 +08:00
|
|
|
break;
|
2015-12-30 06:31:18 +08:00
|
|
|
|
|
|
|
case OffsetOfNode::Base: {
|
2016-12-16 04:53:26 +08:00
|
|
|
CXXBaseSpecifier *Base = new (Record.getContext()) CXXBaseSpecifier();
|
|
|
|
*Base = Record.ReadCXXBaseSpecifier(Idx);
|
2015-12-30 06:31:18 +08:00
|
|
|
E->setComponent(I, OffsetOfNode(Base));
|
2010-04-29 08:18:15 +08:00
|
|
|
break;
|
Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-29 06:16:22 +08:00
|
|
|
}
|
2010-07-30 02:16:10 +08:00
|
|
|
}
|
Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-29 06:16:22 +08:00
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
|
Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-29 06:16:22 +08:00
|
|
|
for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setIndexExpr(I, Record.ReadSubExpr());
|
Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-29 06:16:22 +08:00
|
|
|
}
|
|
|
|
|
2011-03-12 03:24:49 +08:00
|
|
|
void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2011-03-12 03:24:49 +08:00
|
|
|
E->setKind(static_cast<UnaryExprOrTypeTrait>(Record[Idx++]));
|
2009-04-27 13:14:47 +08:00
|
|
|
if (Record[Idx] == 0) {
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setArgument(Record.ReadSubExpr());
|
2009-04-27 13:14:47 +08:00
|
|
|
++Idx;
|
|
|
|
} else {
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setArgument(GetTypeSourceInfo());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setOperatorLoc(ReadSourceLocation());
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLHS(Record.ReadSubExpr());
|
|
|
|
E->setRHS(Record.ReadSubExpr());
|
|
|
|
E->setRBracketLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2015-08-25 22:24:04 +08:00
|
|
|
void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setBase(Record.ReadSubExpr());
|
|
|
|
E->setLowerBound(Record.ReadSubExpr());
|
|
|
|
E->setLength(Record.ReadSubExpr());
|
|
|
|
E->setColonLoc(ReadSourceLocation());
|
|
|
|
E->setRBracketLoc(ReadSourceLocation());
|
2015-08-25 22:24:04 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCallExpr(CallExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setNumArgs(Record.getContext(), Record[Idx++]);
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
|
|
|
E->setCallee(Record.ReadSubExpr());
|
2009-04-27 13:14:47 +08:00
|
|
|
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setArg(I, Record.ReadSubExpr());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2011-07-15 15:00:14 +08:00
|
|
|
void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
|
|
|
|
VisitCallExpr(E);
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
|
2010-07-08 21:09:47 +08:00
|
|
|
// Don't call VisitExpr, this is fully initialized at creation.
|
|
|
|
assert(E->getStmtClass() == Stmt::MemberExprClass &&
|
|
|
|
"It's a subclass, we must advance Idx!");
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
|
2009-07-25 01:54:45 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setBase(Record.ReadSubExpr());
|
|
|
|
E->setIsaMemberLoc(ReadSourceLocation());
|
|
|
|
E->setOpLoc(ReadSourceLocation());
|
2009-07-25 01:54:45 +08:00
|
|
|
E->setArrow(Record[Idx++]);
|
|
|
|
}
|
|
|
|
|
2011-06-16 07:02:42 +08:00
|
|
|
void ASTStmtReader::
|
|
|
|
VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Operand = Record.ReadSubExpr();
|
2011-06-16 07:02:42 +08:00
|
|
|
E->setShouldCopy(Record[Idx++]);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
|
|
|
|
VisitExplicitCastExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->LParenLoc = ReadSourceLocation();
|
|
|
|
E->BridgeKeywordLoc = ReadSourceLocation();
|
2011-06-16 07:02:42 +08:00
|
|
|
E->Kind = Record[Idx++];
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCastExpr(CastExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2010-08-07 14:22:56 +08:00
|
|
|
unsigned NumBaseSpecs = Record[Idx++];
|
|
|
|
assert(NumBaseSpecs == E->path_size());
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setSubExpr(Record.ReadSubExpr());
|
2014-10-31 14:57:10 +08:00
|
|
|
E->setCastKind((CastKind)Record[Idx++]);
|
2010-08-07 14:22:56 +08:00
|
|
|
CastExpr::path_iterator BaseI = E->path_begin();
|
2010-07-03 07:30:27 +08:00
|
|
|
while (NumBaseSpecs--) {
|
2016-12-16 04:53:26 +08:00
|
|
|
CXXBaseSpecifier *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
|
|
|
|
*BaseSpec = Record.ReadCXXBaseSpecifier(Idx);
|
2010-08-07 14:22:56 +08:00
|
|
|
*BaseI++ = BaseSpec;
|
2010-07-03 07:30:27 +08:00
|
|
|
}
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLHS(Record.ReadSubExpr());
|
|
|
|
E->setRHS(Record.ReadSubExpr());
|
2009-04-27 13:14:47 +08:00
|
|
|
E->setOpcode((BinaryOperator::Opcode)Record[Idx++]);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setOperatorLoc(ReadSourceLocation());
|
2012-10-02 12:45:10 +08:00
|
|
|
E->setFPContractable((bool)Record[Idx++]);
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitBinaryOperator(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setComputationLHSType(Record.readType(Idx));
|
|
|
|
E->setComputationResultType(Record.readType(Idx));
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->SubExprs[ConditionalOperator::COND] = Record.ReadSubExpr();
|
|
|
|
E->SubExprs[ConditionalOperator::LHS] = Record.ReadSubExpr();
|
|
|
|
E->SubExprs[ConditionalOperator::RHS] = Record.ReadSubExpr();
|
|
|
|
E->QuestionLoc = ReadSourceLocation();
|
|
|
|
E->ColonLoc = ReadSourceLocation();
|
2011-02-17 18:25:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->OpaqueValue = cast<OpaqueValueExpr>(Record.ReadSubExpr());
|
|
|
|
E->SubExprs[BinaryConditionalOperator::COMMON] = Record.ReadSubExpr();
|
|
|
|
E->SubExprs[BinaryConditionalOperator::COND] = Record.ReadSubExpr();
|
|
|
|
E->SubExprs[BinaryConditionalOperator::LHS] = Record.ReadSubExpr();
|
|
|
|
E->SubExprs[BinaryConditionalOperator::RHS] = Record.ReadSubExpr();
|
|
|
|
E->QuestionLoc = ReadSourceLocation();
|
|
|
|
E->ColonLoc = ReadSourceLocation();
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitCastExpr(E);
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitCastExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setTypeInfoAsWritten(GetTypeSourceInfo());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExplicitCastExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLParenLoc(ReadSourceLocation());
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLParenLoc(ReadSourceLocation());
|
|
|
|
E->setTypeSourceInfo(GetTypeSourceInfo());
|
|
|
|
E->setInitializer(Record.ReadSubExpr());
|
2009-04-27 13:14:47 +08:00
|
|
|
E->setFileScope(Record[Idx++]);
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setBase(Record.ReadSubExpr());
|
|
|
|
E->setAccessor(Record.GetIdentifierInfo(Idx));
|
|
|
|
E->setAccessorLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
if (InitListExpr *SyntForm = cast_or_null<InitListExpr>(Record.ReadSubStmt()))
|
2012-11-09 02:41:43 +08:00
|
|
|
E->setSyntacticForm(SyntForm);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLBraceLoc(ReadSourceLocation());
|
|
|
|
E->setRBraceLoc(ReadSourceLocation());
|
2011-04-22 13:29:30 +08:00
|
|
|
bool isArrayFiller = Record[Idx++];
|
2014-05-22 13:54:18 +08:00
|
|
|
Expr *filler = nullptr;
|
2011-04-22 13:29:30 +08:00
|
|
|
if (isArrayFiller) {
|
2016-12-16 04:53:26 +08:00
|
|
|
filler = Record.ReadSubExpr();
|
2011-04-22 13:29:30 +08:00
|
|
|
E->ArrayFillerOrUnionFieldInit = filler;
|
|
|
|
} else
|
2016-12-16 04:53:26 +08:00
|
|
|
E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>();
|
2009-04-27 13:14:47 +08:00
|
|
|
E->sawArrayRangeDesignator(Record[Idx++]);
|
2011-04-22 13:29:30 +08:00
|
|
|
unsigned NumInits = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->reserveInits(Record.getContext(), NumInits);
|
2011-04-22 13:29:30 +08:00
|
|
|
if (isArrayFiller) {
|
|
|
|
for (unsigned I = 0; I != NumInits; ++I) {
|
2016-12-16 04:53:26 +08:00
|
|
|
Expr *init = Record.ReadSubExpr();
|
|
|
|
E->updateInit(Record.getContext(), I, init ? init : filler);
|
2011-04-22 13:29:30 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (unsigned I = 0; I != NumInits; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->updateInit(Record.getContext(), I, Record.ReadSubExpr());
|
2011-04-22 13:29:30 +08:00
|
|
|
}
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
typedef DesignatedInitExpr::Designator Designator;
|
|
|
|
|
|
|
|
VisitExpr(E);
|
|
|
|
unsigned NumSubExprs = Record[Idx++];
|
|
|
|
assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs");
|
|
|
|
for (unsigned I = 0; I != NumSubExprs; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setSubExpr(I, Record.ReadSubExpr());
|
|
|
|
E->setEqualOrColonLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
E->setGNUSyntax(Record[Idx++]);
|
|
|
|
|
2011-07-23 18:55:15 +08:00
|
|
|
SmallVector<Designator, 4> Designators;
|
2009-04-27 13:14:47 +08:00
|
|
|
while (Idx < Record.size()) {
|
2010-08-19 07:57:32 +08:00
|
|
|
switch ((DesignatorTypes)Record[Idx++]) {
|
|
|
|
case DESIG_FIELD_DECL: {
|
2016-12-16 04:53:26 +08:00
|
|
|
FieldDecl *Field = ReadDeclAs<FieldDecl>();
|
|
|
|
SourceLocation DotLoc = ReadSourceLocation();
|
|
|
|
SourceLocation FieldLoc = ReadSourceLocation();
|
2009-09-09 23:08:12 +08:00
|
|
|
Designators.push_back(Designator(Field->getIdentifier(), DotLoc,
|
2009-04-27 13:14:47 +08:00
|
|
|
FieldLoc));
|
|
|
|
Designators.back().setField(Field);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case DESIG_FIELD_NAME: {
|
2016-12-16 04:53:26 +08:00
|
|
|
const IdentifierInfo *Name = Record.GetIdentifierInfo(Idx);
|
|
|
|
SourceLocation DotLoc = ReadSourceLocation();
|
|
|
|
SourceLocation FieldLoc = ReadSourceLocation();
|
2009-04-27 13:14:47 +08:00
|
|
|
Designators.push_back(Designator(Name, DotLoc, FieldLoc));
|
|
|
|
break;
|
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case DESIG_ARRAY: {
|
2009-04-27 13:14:47 +08:00
|
|
|
unsigned Index = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
SourceLocation LBracketLoc = ReadSourceLocation();
|
|
|
|
SourceLocation RBracketLoc = ReadSourceLocation();
|
2009-04-27 13:14:47 +08:00
|
|
|
Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case DESIG_ARRAY_RANGE: {
|
2009-04-27 13:14:47 +08:00
|
|
|
unsigned Index = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
SourceLocation LBracketLoc = ReadSourceLocation();
|
|
|
|
SourceLocation EllipsisLoc = ReadSourceLocation();
|
|
|
|
SourceLocation RBracketLoc = ReadSourceLocation();
|
2009-04-27 13:14:47 +08:00
|
|
|
Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc,
|
|
|
|
RBracketLoc));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setDesignators(Record.getContext(),
|
2010-01-07 07:17:19 +08:00
|
|
|
Designators.data(), Designators.size());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2015-06-10 08:27:52 +08:00
|
|
|
void ASTStmtReader::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setBase(Record.ReadSubExpr());
|
|
|
|
E->setUpdater(Record.ReadSubExpr());
|
2015-06-10 08:27:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitNoInitExpr(NoInitExpr *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
}
|
|
|
|
|
2016-12-12 10:53:20 +08:00
|
|
|
void ASTStmtReader::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->SubExprs[0] = Record.ReadSubExpr();
|
|
|
|
E->SubExprs[1] = Record.ReadSubExpr();
|
2016-12-12 10:53:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setSubExpr(Record.ReadSubExpr());
|
|
|
|
E->setWrittenTypeInfo(GetTypeSourceInfo());
|
|
|
|
E->setBuiltinLoc(ReadSourceLocation());
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
2015-09-18 04:55:33 +08:00
|
|
|
E->setIsMicrosoftABI(Record[Idx++]);
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setAmpAmpLoc(ReadSourceLocation());
|
|
|
|
E->setLabelLoc(ReadSourceLocation());
|
|
|
|
E->setLabel(ReadDeclAs<LabelDecl>());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLParenLoc(ReadSourceLocation());
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
|
|
|
E->setSubStmt(cast_or_null<CompoundStmt>(Record.ReadSubStmt()));
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setCond(Record.ReadSubExpr());
|
|
|
|
E->setLHS(Record.ReadSubExpr());
|
|
|
|
E->setRHS(Record.ReadSubExpr());
|
|
|
|
E->setBuiltinLoc(ReadSourceLocation());
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
2013-07-20 08:40:58 +08:00
|
|
|
E->setIsConditionTrue(Record[Idx++]);
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setTokenLocation(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2011-07-23 18:55:15 +08:00
|
|
|
SmallVector<Expr *, 16> Exprs;
|
2009-04-27 13:14:47 +08:00
|
|
|
unsigned NumExprs = Record[Idx++];
|
2010-06-29 06:28:35 +08:00
|
|
|
while (NumExprs--)
|
2016-12-16 04:53:26 +08:00
|
|
|
Exprs.push_back(Record.ReadSubExpr());
|
|
|
|
E->setExprs(Record.getContext(), Exprs);
|
|
|
|
E->setBuiltinLoc(ReadSourceLocation());
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2013-09-18 11:29:45 +08:00
|
|
|
void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->BuiltinLoc = ReadSourceLocation();
|
|
|
|
E->RParenLoc = ReadSourceLocation();
|
|
|
|
E->TInfo = GetTypeSourceInfo();
|
|
|
|
E->SrcExpr = Record.ReadSubExpr();
|
2013-09-18 11:29:45 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setBlockDecl(ReadDeclAs<BlockDecl>());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2011-04-15 08:35:48 +08:00
|
|
|
void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
E->NumAssocs = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->AssocTypes = new (Record.getContext()) TypeSourceInfo*[E->NumAssocs];
|
2011-04-15 08:35:48 +08:00
|
|
|
E->SubExprs =
|
2016-12-16 04:53:26 +08:00
|
|
|
new(Record.getContext()) Stmt*[GenericSelectionExpr::END_EXPR+E->NumAssocs];
|
2011-04-15 08:35:48 +08:00
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
E->SubExprs[GenericSelectionExpr::CONTROLLING] = Record.ReadSubExpr();
|
2011-04-15 08:35:48 +08:00
|
|
|
for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
|
2016-12-16 04:53:26 +08:00
|
|
|
E->AssocTypes[I] = GetTypeSourceInfo();
|
|
|
|
E->SubExprs[GenericSelectionExpr::END_EXPR+I] = Record.ReadSubExpr();
|
2011-04-15 08:35:48 +08:00
|
|
|
}
|
|
|
|
E->ResultIndex = Record[Idx++];
|
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
E->GenericLoc = ReadSourceLocation();
|
|
|
|
E->DefaultLoc = ReadSourceLocation();
|
|
|
|
E->RParenLoc = ReadSourceLocation();
|
2011-04-15 08:35:48 +08:00
|
|
|
}
|
|
|
|
|
2011-11-06 17:01:30 +08:00
|
|
|
void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
unsigned numSemanticExprs = Record[Idx++];
|
|
|
|
assert(numSemanticExprs + 1 == E->PseudoObjectExprBits.NumSubExprs);
|
|
|
|
E->PseudoObjectExprBits.ResultIndex = Record[Idx++];
|
|
|
|
|
|
|
|
// Read the syntactic expression.
|
2016-12-16 04:53:26 +08:00
|
|
|
E->getSubExprsBuffer()[0] = Record.ReadSubExpr();
|
2011-11-06 17:01:30 +08:00
|
|
|
|
|
|
|
// Read all the semantic expressions.
|
|
|
|
for (unsigned i = 0; i != numSemanticExprs; ++i) {
|
2016-12-16 04:53:26 +08:00
|
|
|
Expr *subExpr = Record.ReadSubExpr();
|
2011-11-06 17:01:30 +08:00
|
|
|
E->getSubExprsBuffer()[i+1] = subExpr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-11 10:20:01 +08:00
|
|
|
void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) {
|
|
|
|
VisitExpr(E);
|
2012-04-11 06:49:28 +08:00
|
|
|
E->Op = AtomicExpr::AtomicOp(Record[Idx++]);
|
|
|
|
E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
|
|
|
|
for (unsigned I = 0; I != E->NumSubExprs; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->SubExprs[I] = Record.ReadSubExpr();
|
|
|
|
E->BuiltinLoc = ReadSourceLocation();
|
|
|
|
E->RParenLoc = ReadSourceLocation();
|
2011-10-11 10:20:01 +08:00
|
|
|
}
|
|
|
|
|
2009-04-27 13:14:47 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Objective-C Expressions and Statements
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setString(cast<StringLiteral>(Record.ReadSubStmt()));
|
|
|
|
E->setAtLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2012-04-19 08:25:12 +08:00
|
|
|
void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
|
2012-03-07 04:05:56 +08:00
|
|
|
VisitExpr(E);
|
|
|
|
// could be one of several IntegerLiteral, FloatLiteral, etc.
|
2016-12-16 04:53:26 +08:00
|
|
|
E->SubExpr = Record.ReadSubStmt();
|
|
|
|
E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>();
|
|
|
|
E->Range = ReadSourceRange();
|
2012-03-07 04:05:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
unsigned NumElements = Record[Idx++];
|
|
|
|
assert(NumElements == E->getNumElements() && "Wrong number of elements");
|
|
|
|
Expr **Elements = E->getElements();
|
|
|
|
for (unsigned I = 0, N = NumElements; I != N; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
Elements[I] = Record.ReadSubExpr();
|
|
|
|
E->ArrayWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>();
|
|
|
|
E->Range = ReadSourceRange();
|
2012-03-07 04:05:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
unsigned NumElements = Record[Idx++];
|
|
|
|
assert(NumElements == E->getNumElements() && "Wrong number of elements");
|
|
|
|
bool HasPackExpansions = Record[Idx++];
|
|
|
|
assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch");
|
2015-12-31 12:43:19 +08:00
|
|
|
ObjCDictionaryLiteral::KeyValuePair *KeyValues =
|
|
|
|
E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>();
|
|
|
|
ObjCDictionaryLiteral::ExpansionData *Expansions =
|
|
|
|
E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>();
|
2012-03-07 04:05:56 +08:00
|
|
|
for (unsigned I = 0; I != NumElements; ++I) {
|
2016-12-16 04:53:26 +08:00
|
|
|
KeyValues[I].Key = Record.ReadSubExpr();
|
|
|
|
KeyValues[I].Value = Record.ReadSubExpr();
|
2012-03-07 04:05:56 +08:00
|
|
|
if (HasPackExpansions) {
|
2016-12-16 04:53:26 +08:00
|
|
|
Expansions[I].EllipsisLoc = ReadSourceLocation();
|
2012-03-07 04:05:56 +08:00
|
|
|
Expansions[I].NumExpansionsPlusOne = Record[Idx++];
|
|
|
|
}
|
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>();
|
|
|
|
E->Range = ReadSourceRange();
|
2012-03-07 04:05:56 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setEncodedTypeSourceInfo(GetTypeSourceInfo());
|
|
|
|
E->setAtLoc(ReadSourceLocation());
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setSelector(Record.ReadSelector(Idx));
|
|
|
|
E->setAtLoc(ReadSourceLocation());
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setProtocol(ReadDeclAs<ObjCProtocolDecl>());
|
|
|
|
E->setAtLoc(ReadSourceLocation());
|
|
|
|
E->ProtoLoc = ReadSourceLocation();
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setDecl(ReadDeclAs<ObjCIvarDecl>());
|
|
|
|
E->setLocation(ReadSourceLocation());
|
|
|
|
E->setOpLoc(ReadSourceLocation());
|
|
|
|
E->setBase(Record.ReadSubExpr());
|
2009-04-27 13:14:47 +08:00
|
|
|
E->setIsArrow(Record[Idx++]);
|
|
|
|
E->setIsFreeIvar(Record[Idx++]);
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
2012-03-30 08:19:18 +08:00
|
|
|
unsigned MethodRefFlags = Record[Idx++];
|
2010-12-02 09:19:52 +08:00
|
|
|
bool Implicit = Record[Idx++] != 0;
|
|
|
|
if (Implicit) {
|
2016-12-16 04:53:26 +08:00
|
|
|
ObjCMethodDecl *Getter = ReadDeclAs<ObjCMethodDecl>();
|
|
|
|
ObjCMethodDecl *Setter = ReadDeclAs<ObjCMethodDecl>();
|
2012-03-30 08:19:18 +08:00
|
|
|
E->setImplicitProperty(Getter, Setter, MethodRefFlags);
|
2010-12-02 09:19:52 +08:00
|
|
|
} else {
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
|
2010-10-15 00:04:05 +08:00
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLocation(ReadSourceLocation());
|
|
|
|
E->setReceiverLocation(ReadSourceLocation());
|
2010-12-02 09:19:52 +08:00
|
|
|
switch (Record[Idx++]) {
|
|
|
|
case 0:
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setBase(Record.ReadSubExpr());
|
2010-12-02 09:19:52 +08:00
|
|
|
break;
|
|
|
|
case 1:
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setSuperReceiver(Record.readType(Idx));
|
2010-12-02 09:19:52 +08:00
|
|
|
break;
|
|
|
|
case 2:
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setClassReceiver(ReadDeclAs<ObjCInterfaceDecl>());
|
2010-12-02 09:19:52 +08:00
|
|
|
break;
|
|
|
|
}
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2012-03-07 04:05:56 +08:00
|
|
|
void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setRBracket(ReadSourceLocation());
|
|
|
|
E->setBaseExpr(Record.ReadSubExpr());
|
|
|
|
E->setKeyExpr(Record.ReadSubExpr());
|
|
|
|
E->GetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>();
|
|
|
|
E->SetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>();
|
2012-03-07 04:05:56 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitExpr(E);
|
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 08:45:42 +08:00
|
|
|
assert(Record[Idx] == E->getNumArgs());
|
|
|
|
++Idx;
|
2011-10-03 14:36:51 +08:00
|
|
|
unsigned NumStoredSelLocs = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->SelLocsKind = Record[Idx++];
|
2011-06-16 07:02:42 +08:00
|
|
|
E->setDelegateInitCall(Record[Idx++]);
|
2012-01-12 10:34:39 +08:00
|
|
|
E->IsImplicit = Record[Idx++];
|
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 08:45:42 +08:00
|
|
|
ObjCMessageExpr::ReceiverKind Kind
|
|
|
|
= static_cast<ObjCMessageExpr::ReceiverKind>(Record[Idx++]);
|
|
|
|
switch (Kind) {
|
|
|
|
case ObjCMessageExpr::Instance:
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setInstanceReceiver(Record.ReadSubExpr());
|
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 08:45:42 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ObjCMessageExpr::Class:
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setClassReceiver(GetTypeSourceInfo());
|
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 08:45:42 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ObjCMessageExpr::SuperClass:
|
|
|
|
case ObjCMessageExpr::SuperInstance: {
|
2016-12-16 04:53:26 +08:00
|
|
|
QualType T = Record.readType(Idx);
|
|
|
|
SourceLocation SuperLoc = ReadSourceLocation();
|
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 08:45:42 +08:00
|
|
|
E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
|
|
|
|
break;
|
|
|
|
}
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 08:45:42 +08:00
|
|
|
assert(Kind == E->getReceiverKind());
|
|
|
|
|
|
|
|
if (Record[Idx++])
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setMethodDecl(ReadDeclAs<ObjCMethodDecl>());
|
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 08:45:42 +08:00
|
|
|
else
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setSelector(Record.ReadSelector(Idx));
|
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 08:45:42 +08:00
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
E->LBracLoc = ReadSourceLocation();
|
|
|
|
E->RBracLoc = ReadSourceLocation();
|
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 08:45:42 +08:00
|
|
|
|
2009-04-27 13:14:47 +08:00
|
|
|
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setArg(I, Record.ReadSubExpr());
|
2011-10-03 14:36:51 +08:00
|
|
|
|
|
|
|
SourceLocation *Locs = E->getStoredSelLocs();
|
|
|
|
for (unsigned I = 0; I != NumStoredSelLocs; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
Locs[I] = ReadSourceLocation();
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setElement(Record.ReadSubStmt());
|
|
|
|
S->setCollection(Record.ReadSubExpr());
|
|
|
|
S->setBody(Record.ReadSubStmt());
|
|
|
|
S->setForLoc(ReadSourceLocation());
|
|
|
|
S->setRParenLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setCatchBody(Record.ReadSubStmt());
|
|
|
|
S->setCatchParamDecl(ReadDeclAs<VarDecl>());
|
|
|
|
S->setAtCatchLoc(ReadSourceLocation());
|
|
|
|
S->setRParenLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setFinallyBody(Record.ReadSubStmt());
|
|
|
|
S->setAtFinallyLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2011-06-16 07:02:42 +08:00
|
|
|
void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
|
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setSubStmt(Record.ReadSubStmt());
|
|
|
|
S->setAtLoc(ReadSourceLocation());
|
2011-06-16 07:02:42 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2010-04-24 06:50:49 +08:00
|
|
|
assert(Record[Idx] == S->getNumCatchStmts());
|
|
|
|
++Idx;
|
|
|
|
bool HasFinally = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setTryBody(Record.ReadSubStmt());
|
2010-06-29 06:28:35 +08:00
|
|
|
for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setCatchStmt(I, cast_or_null<ObjCAtCatchStmt>(Record.ReadSubStmt()));
|
2010-04-24 06:50:49 +08:00
|
|
|
|
|
|
|
if (HasFinally)
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setFinallyStmt(Record.ReadSubStmt());
|
|
|
|
S->setAtTryLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setSynchExpr(Record.ReadSubStmt());
|
|
|
|
S->setSynchBody(Record.ReadSubStmt());
|
|
|
|
S->setAtSynchronizedLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
|
2009-04-27 13:14:47 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setThrowExpr(Record.ReadSubStmt());
|
|
|
|
S->setThrowLoc(ReadSourceLocation());
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
|
|
|
|
2012-03-07 04:05:56 +08:00
|
|
|
void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
E->setValue(Record[Idx++]);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLocation(ReadSourceLocation());
|
2012-03-07 04:05:56 +08:00
|
|
|
}
|
|
|
|
|
2016-07-16 08:35:23 +08:00
|
|
|
void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
SourceRange R = Record.ReadSourceRange(Idx);
|
2016-07-16 08:35:23 +08:00
|
|
|
E->AtLoc = R.getBegin();
|
|
|
|
E->RParen = R.getEnd();
|
2016-12-16 04:53:26 +08:00
|
|
|
E->VersionToCheck = Record.ReadVersionTuple(Idx);
|
2016-07-16 08:35:23 +08:00
|
|
|
}
|
|
|
|
|
2009-07-14 11:19:21 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// C++ Expressions and Statements
|
2010-07-23 00:03:56 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
|
2010-07-23 00:03:56 +08:00
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->CatchLoc = ReadSourceLocation();
|
|
|
|
S->ExceptionDecl = ReadDeclAs<VarDecl>();
|
|
|
|
S->HandlerBlock = Record.ReadSubStmt();
|
2010-07-23 00:03:56 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
|
2010-07-23 00:03:56 +08:00
|
|
|
VisitStmt(S);
|
|
|
|
assert(Record[Idx] == S->getNumHandlers() && "NumStmtFields is wrong ?");
|
|
|
|
++Idx;
|
2016-12-16 04:53:26 +08:00
|
|
|
S->TryLoc = ReadSourceLocation();
|
|
|
|
S->getStmts()[0] = Record.ReadSubStmt();
|
2010-07-23 00:03:56 +08:00
|
|
|
for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
S->getStmts()[i + 1] = Record.ReadSubStmt();
|
2010-07-23 00:03:56 +08:00
|
|
|
}
|
2009-07-14 11:19:21 +08:00
|
|
|
|
2011-04-15 06:09:26 +08:00
|
|
|
void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
|
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->ForLoc = ReadSourceLocation();
|
|
|
|
S->CoawaitLoc = ReadSourceLocation();
|
|
|
|
S->ColonLoc = ReadSourceLocation();
|
|
|
|
S->RParenLoc = ReadSourceLocation();
|
|
|
|
S->setRangeStmt(Record.ReadSubStmt());
|
|
|
|
S->setBeginStmt(Record.ReadSubStmt());
|
|
|
|
S->setEndStmt(Record.ReadSubStmt());
|
|
|
|
S->setCond(Record.ReadSubExpr());
|
|
|
|
S->setInc(Record.ReadSubExpr());
|
|
|
|
S->setLoopVarStmt(Record.ReadSubStmt());
|
|
|
|
S->setBody(Record.ReadSubStmt());
|
2011-04-15 06:09:26 +08:00
|
|
|
}
|
|
|
|
|
2011-10-25 09:33:02 +08:00
|
|
|
void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
|
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->KeywordLoc = ReadSourceLocation();
|
2011-10-25 09:33:02 +08:00
|
|
|
S->IsIfExists = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
S->QualifierLoc = Record.ReadNestedNameSpecifierLoc(Idx);
|
|
|
|
ReadDeclarationNameInfo(S->NameInfo);
|
|
|
|
S->SubStmt = Record.ReadSubStmt();
|
2011-10-25 09:33:02 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
|
2010-06-29 06:28:35 +08:00
|
|
|
VisitCallExpr(E);
|
2012-05-01 06:12:22 +08:00
|
|
|
E->Operator = (OverloadedOperatorKind)Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Range = Record.ReadSourceRange(Idx);
|
2012-10-02 12:45:10 +08:00
|
|
|
E->setFPContractable((bool)Record[Idx++]);
|
2009-07-14 11:19:21 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
|
2009-09-10 07:08:42 +08:00
|
|
|
VisitExpr(E);
|
2010-07-10 19:46:15 +08:00
|
|
|
E->NumArgs = Record[Idx++];
|
|
|
|
if (E->NumArgs)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Args = new (Record.getContext()) Stmt*[E->NumArgs];
|
2010-06-24 16:57:09 +08:00
|
|
|
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setArg(I, Record.ReadSubExpr());
|
|
|
|
E->setConstructor(ReadDeclAs<CXXConstructorDecl>());
|
|
|
|
E->setLocation(ReadSourceLocation());
|
2011-10-05 15:56:41 +08:00
|
|
|
E->setElidable(Record[Idx++]);
|
|
|
|
E->setHadMultipleCandidates(Record[Idx++]);
|
2012-12-19 09:39:02 +08:00
|
|
|
E->setListInitialization(Record[Idx++]);
|
2014-07-17 13:12:35 +08:00
|
|
|
E->setStdInitListInitialization(Record[Idx++]);
|
2009-12-17 02:50:27 +08:00
|
|
|
E->setRequiresZeroInitialization(Record[Idx++]);
|
2010-05-15 08:13:29 +08:00
|
|
|
E->setConstructionKind((CXXConstructExpr::ConstructionKind)Record[Idx++]);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->ParenOrBraceRange = ReadSourceRange();
|
2009-09-10 07:08:42 +08:00
|
|
|
}
|
2009-04-27 13:14:47 +08:00
|
|
|
|
P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:
Replace inheriting constructors implementation with new approach, voted into
C++ last year as a DR against C++11.
Instead of synthesizing a set of derived class constructors for each inherited
base class constructor, we make the constructors of the base class visible to
constructor lookup in the derived class, using the normal rules for
using-declarations.
For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived
class that tracks the requisite additional information. We create shadow
constructors (not found by name lookup) in the derived class to model the
actual initialization, and have a new expression node,
CXXInheritedCtorInitExpr, to model the initialization of a base class from such
a constructor. (This initialization is special because it performs real perfect
forwarding of arguments.)
In cases where argument forwarding is not possible (for inalloca calls,
variadic calls, and calls with callee parameter cleanup), the shadow inheriting
constructor is not emitted and instead we directly emit the initialization code
into the caller of the inherited constructor.
Note that this new model is not perfectly compatible with the old model in some
corner cases. In particular:
* if B inherits a private constructor from A, and C uses that constructor to
construct a B, then we previously required that A befriends B and B
befriends C, but the new rules require A to befriend C directly, and
* if a derived class has its own constructors (and so its implicit default
constructor is suppressed), it may still inherit a default constructor from
a base class
llvm-svn: 274049
2016-06-29 03:03:57 +08:00
|
|
|
void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Constructor = ReadDeclAs<CXXConstructorDecl>();
|
|
|
|
E->Loc = ReadSourceLocation();
|
P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:
Replace inheriting constructors implementation with new approach, voted into
C++ last year as a DR against C++11.
Instead of synthesizing a set of derived class constructors for each inherited
base class constructor, we make the constructors of the base class visible to
constructor lookup in the derived class, using the normal rules for
using-declarations.
For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived
class that tracks the requisite additional information. We create shadow
constructors (not found by name lookup) in the derived class to model the
actual initialization, and have a new expression node,
CXXInheritedCtorInitExpr, to model the initialization of a base class from such
a constructor. (This initialization is special because it performs real perfect
forwarding of arguments.)
In cases where argument forwarding is not possible (for inalloca calls,
variadic calls, and calls with callee parameter cleanup), the shadow inheriting
constructor is not emitted and instead we directly emit the initialization code
into the caller of the inherited constructor.
Note that this new model is not perfectly compatible with the old model in some
corner cases. In particular:
* if B inherits a private constructor from A, and C uses that constructor to
construct a B, then we previously required that A befriends B and B
befriends C, but the new rules require A to befriend C directly, and
* if a derived class has its own constructors (and so its implicit default
constructor is suppressed), it may still inherit a default constructor from
a base class
llvm-svn: 274049
2016-06-29 03:03:57 +08:00
|
|
|
E->ConstructsVirtualBase = Record[Idx++];
|
|
|
|
E->InheritedFromVirtualBase = Record[Idx++];
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
|
2010-07-10 19:46:15 +08:00
|
|
|
VisitCXXConstructExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Type = GetTypeSourceInfo();
|
2010-07-10 19:46:15 +08:00
|
|
|
}
|
|
|
|
|
2012-02-07 18:09:13 +08:00
|
|
|
void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
|
|
|
|
VisitExpr(E);
|
2012-02-15 01:54:36 +08:00
|
|
|
unsigned NumCaptures = Record[Idx++];
|
|
|
|
assert(NumCaptures == E->NumCaptures);(void)NumCaptures;
|
2016-12-16 04:53:26 +08:00
|
|
|
E->IntroducerRange = ReadSourceRange();
|
2012-02-15 01:54:36 +08:00
|
|
|
E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record[Idx++]);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->CaptureDefaultLoc = ReadSourceLocation();
|
2012-02-15 01:54:36 +08:00
|
|
|
E->ExplicitParams = Record[Idx++];
|
|
|
|
E->ExplicitResultType = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->ClosingBrace = ReadSourceLocation();
|
|
|
|
|
2012-02-15 01:54:36 +08:00
|
|
|
// Read capture initializers.
|
|
|
|
for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
|
|
|
|
CEnd = E->capture_init_end();
|
|
|
|
C != CEnd; ++C)
|
2016-12-16 04:53:26 +08:00
|
|
|
*C = Record.ReadSubExpr();
|
2012-02-07 18:09:13 +08:00
|
|
|
}
|
|
|
|
|
2013-06-13 06:31:48 +08:00
|
|
|
void
|
|
|
|
ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->SubExpr = Record.ReadSubExpr();
|
2013-06-13 06:31:48 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
|
2010-06-29 06:28:35 +08:00
|
|
|
VisitExplicitCastExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
SourceRange R = ReadSourceRange();
|
2011-01-13 06:41:29 +08:00
|
|
|
E->Loc = R.getBegin();
|
|
|
|
E->RParenLoc = R.getEnd();
|
2016-12-16 04:53:26 +08:00
|
|
|
R = ReadSourceRange();
|
2013-02-23 06:02:53 +08:00
|
|
|
E->AngleBrackets = R;
|
2010-01-17 05:21:01 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
|
2010-01-17 05:21:01 +08:00
|
|
|
return VisitCXXNamedCastExpr(E);
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
|
2010-01-17 05:21:01 +08:00
|
|
|
return VisitCXXNamedCastExpr(E);
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
|
2010-01-17 05:21:01 +08:00
|
|
|
return VisitCXXNamedCastExpr(E);
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
|
2010-01-17 05:21:01 +08:00
|
|
|
return VisitCXXNamedCastExpr(E);
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
|
2010-06-29 06:28:35 +08:00
|
|
|
VisitExplicitCastExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLParenLoc(ReadSourceLocation());
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
2010-01-17 05:21:01 +08:00
|
|
|
}
|
|
|
|
|
2012-03-07 16:35:16 +08:00
|
|
|
void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
|
|
|
|
VisitCallExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->UDSuffixLoc = ReadSourceLocation();
|
2012-03-07 16:35:16 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
|
2010-02-07 14:32:43 +08:00
|
|
|
VisitExpr(E);
|
|
|
|
E->setValue(Record[Idx++]);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLocation(ReadSourceLocation());
|
2010-02-07 14:32:43 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
|
2010-02-07 14:32:43 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLocation(ReadSourceLocation());
|
2010-02-07 14:32:43 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
|
2010-05-09 14:03:39 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setSourceRange(ReadSourceRange());
|
2010-05-09 14:03:39 +08:00
|
|
|
if (E->isTypeOperand()) { // typeid(int)
|
2010-07-23 06:43:28 +08:00
|
|
|
E->setTypeOperandSourceInfo(
|
2016-12-16 04:53:26 +08:00
|
|
|
GetTypeSourceInfo());
|
2010-06-29 06:28:35 +08:00
|
|
|
return;
|
2010-05-09 14:03:39 +08:00
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2010-05-09 14:03:39 +08:00
|
|
|
// typeid(42+2)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setExprOperand(Record.ReadSubExpr());
|
2010-05-09 14:03:39 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
|
2010-05-09 14:15:05 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLocation(ReadSourceLocation());
|
2010-05-09 14:15:05 +08:00
|
|
|
E->setImplicit(Record[Idx++]);
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
|
2010-05-09 14:15:05 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->ThrowLoc = ReadSourceLocation();
|
|
|
|
E->Op = Record.ReadSubExpr();
|
2011-07-07 06:04:06 +08:00
|
|
|
E->IsThrownVariableInScope = Record[Idx++];
|
2010-05-09 14:15:05 +08:00
|
|
|
}
|
2010-05-09 14:03:39 +08:00
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
|
2010-05-09 14:40:08 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Param = ReadDeclAs<ParmVarDecl>();
|
|
|
|
E->Loc = ReadSourceLocation();
|
2010-05-10 08:25:06 +08:00
|
|
|
}
|
|
|
|
|
2013-04-21 06:23:05 +08:00
|
|
|
void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Field = ReadDeclAs<FieldDecl>();
|
|
|
|
E->Loc = ReadSourceLocation();
|
2013-04-21 06:23:05 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
|
2010-05-10 08:25:06 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setTemporary(Record.ReadCXXTemporary(Idx));
|
|
|
|
E->setSubExpr(Record.ReadSubExpr());
|
2010-05-10 08:25:06 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
|
2010-05-10 09:22:27 +08:00
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->TypeInfo = GetTypeSourceInfo();
|
|
|
|
E->RParenLoc = ReadSourceLocation();
|
2010-05-10 09:22:27 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
|
2010-05-10 09:22:27 +08:00
|
|
|
VisitExpr(E);
|
2011-01-27 17:37:56 +08:00
|
|
|
E->GlobalNew = Record[Idx++];
|
2012-02-16 19:35:52 +08:00
|
|
|
bool isArray = Record[Idx++];
|
2016-10-11 02:54:32 +08:00
|
|
|
E->PassAlignment = Record[Idx++];
|
2012-02-16 20:22:20 +08:00
|
|
|
E->UsualArrayDeleteWantsSize = Record[Idx++];
|
2010-05-10 09:22:27 +08:00
|
|
|
unsigned NumPlacementArgs = Record[Idx++];
|
2012-02-16 20:22:20 +08:00
|
|
|
E->StoredInitializationStyle = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setOperatorNew(ReadDeclAs<FunctionDecl>());
|
|
|
|
E->setOperatorDelete(ReadDeclAs<FunctionDecl>());
|
|
|
|
E->AllocatedTypeInfo = GetTypeSourceInfo();
|
|
|
|
E->TypeIdParens = ReadSourceRange();
|
|
|
|
E->Range = ReadSourceRange();
|
|
|
|
E->DirectInitRange = ReadSourceRange();
|
|
|
|
|
|
|
|
E->AllocateArgsArray(Record.getContext(), isArray, NumPlacementArgs,
|
2012-02-16 20:22:20 +08:00
|
|
|
E->StoredInitializationStyle != 0);
|
2010-05-10 09:22:27 +08:00
|
|
|
|
|
|
|
// Install all the subexpressions.
|
|
|
|
for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),e = E->raw_arg_end();
|
|
|
|
I != e; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
*I = Record.ReadSubStmt();
|
2010-05-10 09:22:27 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
|
2010-06-23 01:07:59 +08:00
|
|
|
VisitExpr(E);
|
2010-09-14 04:15:40 +08:00
|
|
|
E->GlobalDelete = Record[Idx++];
|
|
|
|
E->ArrayForm = Record[Idx++];
|
2010-09-14 04:15:54 +08:00
|
|
|
E->ArrayFormAsWritten = Record[Idx++];
|
2011-01-27 17:37:56 +08:00
|
|
|
E->UsualArrayDeleteWantsSize = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->OperatorDelete = ReadDeclAs<FunctionDecl>();
|
|
|
|
E->Argument = Record.ReadSubExpr();
|
|
|
|
E->Loc = ReadSourceLocation();
|
2010-06-23 01:07:59 +08:00
|
|
|
}
|
2010-05-10 08:25:06 +08:00
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
|
2010-06-28 17:32:03 +08:00
|
|
|
VisitExpr(E);
|
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Base = Record.ReadSubExpr();
|
2011-02-26 02:19:59 +08:00
|
|
|
E->IsArrow = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->OperatorLoc = ReadSourceLocation();
|
|
|
|
E->QualifierLoc = Record.ReadNestedNameSpecifierLoc(Idx);
|
|
|
|
E->ScopeType = GetTypeSourceInfo();
|
|
|
|
E->ColonColonLoc = ReadSourceLocation();
|
|
|
|
E->TildeLoc = ReadSourceLocation();
|
|
|
|
|
|
|
|
IdentifierInfo *II = Record.GetIdentifierInfo(Idx);
|
2010-06-28 17:32:03 +08:00
|
|
|
if (II)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setDestroyedType(II, ReadSourceLocation());
|
2010-06-28 17:32:03 +08:00
|
|
|
else
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setDestroyedType(GetTypeSourceInfo());
|
2010-06-28 17:32:03 +08:00
|
|
|
}
|
|
|
|
|
2010-12-06 16:20:24 +08:00
|
|
|
void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
|
2010-05-10 08:25:06 +08:00
|
|
|
VisitExpr(E);
|
2011-11-10 13:35:25 +08:00
|
|
|
|
|
|
|
unsigned NumObjects = Record[Idx++];
|
|
|
|
assert(NumObjects == E->getNumObjects());
|
|
|
|
for (unsigned i = 0; i != NumObjects; ++i)
|
2015-12-31 12:18:25 +08:00
|
|
|
E->getTrailingObjects<BlockDecl *>()[i] =
|
2016-12-16 04:53:26 +08:00
|
|
|
ReadDeclAs<BlockDecl>();
|
2011-11-10 13:35:25 +08:00
|
|
|
|
2016-06-22 04:29:17 +08:00
|
|
|
E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->SubExpr = Record.ReadSubExpr();
|
2010-05-09 14:40:08 +08:00
|
|
|
}
|
|
|
|
|
2010-06-29 06:28:35 +08:00
|
|
|
void
|
2010-08-19 07:56:52 +08:00
|
|
|
ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
|
2010-06-24 16:57:31 +08:00
|
|
|
VisitExpr(E);
|
2012-01-27 17:46:47 +08:00
|
|
|
|
|
|
|
if (Record[Idx++]) // HasTemplateKWAndArgsInfo
|
2015-12-30 02:15:14 +08:00
|
|
|
ReadTemplateKWAndArgsInfo(
|
|
|
|
*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
|
|
|
|
E->getTrailingObjects<TemplateArgumentLoc>(),
|
|
|
|
/*NumTemplateArgs=*/Record[Idx++]);
|
2010-06-24 16:57:31 +08:00
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Base = Record.ReadSubExpr();
|
|
|
|
E->BaseType = Record.readType(Idx);
|
2011-03-01 02:50:33 +08:00
|
|
|
E->IsArrow = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->OperatorLoc = ReadSourceLocation();
|
|
|
|
E->QualifierLoc = Record.ReadNestedNameSpecifierLoc(Idx);
|
|
|
|
E->FirstQualifierFoundInScope = ReadDeclAs<NamedDecl>();
|
|
|
|
ReadDeclarationNameInfo(E->MemberNameInfo);
|
2010-06-24 16:57:31 +08:00
|
|
|
}
|
|
|
|
|
2010-06-29 06:28:35 +08:00
|
|
|
void
|
2010-08-19 07:56:52 +08:00
|
|
|
ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
|
2010-06-28 17:31:56 +08:00
|
|
|
VisitExpr(E);
|
2012-01-27 17:46:47 +08:00
|
|
|
|
|
|
|
if (Record[Idx++]) // HasTemplateKWAndArgsInfo
|
2015-12-30 02:15:14 +08:00
|
|
|
ReadTemplateKWAndArgsInfo(
|
|
|
|
*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
|
|
|
|
E->getTrailingObjects<TemplateArgumentLoc>(),
|
|
|
|
/*NumTemplateArgs=*/Record[Idx++]);
|
2011-02-26 04:49:16 +08:00
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
E->QualifierLoc = Record.ReadNestedNameSpecifierLoc(Idx);
|
|
|
|
ReadDeclarationNameInfo(E->NameInfo);
|
2010-06-28 17:31:56 +08:00
|
|
|
}
|
|
|
|
|
2010-06-29 06:28:35 +08:00
|
|
|
void
|
2010-08-19 07:56:52 +08:00
|
|
|
ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
|
2010-06-24 16:57:31 +08:00
|
|
|
VisitExpr(E);
|
|
|
|
assert(Record[Idx] == E->arg_size() && "Read wrong record during creation ?");
|
|
|
|
++Idx; // NumArgs;
|
|
|
|
for (unsigned I = 0, N = E->arg_size(); I != N; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setArg(I, Record.ReadSubExpr());
|
|
|
|
E->Type = GetTypeSourceInfo();
|
|
|
|
E->setLParenLoc(ReadSourceLocation());
|
|
|
|
E->setRParenLoc(ReadSourceLocation());
|
2010-06-24 16:57:31 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
|
2010-06-25 17:03:26 +08:00
|
|
|
VisitExpr(E);
|
2012-01-27 17:46:47 +08:00
|
|
|
|
|
|
|
if (Record[Idx++]) // HasTemplateKWAndArgsInfo
|
2015-12-30 02:15:14 +08:00
|
|
|
ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(),
|
|
|
|
E->getTrailingTemplateArgumentLoc(),
|
2012-01-27 17:46:47 +08:00
|
|
|
/*NumTemplateArgs=*/Record[Idx++]);
|
2010-06-25 17:03:26 +08:00
|
|
|
|
|
|
|
unsigned NumDecls = Record[Idx++];
|
|
|
|
UnresolvedSet<8> Decls;
|
|
|
|
for (unsigned i = 0; i != NumDecls; ++i) {
|
2016-12-16 04:53:26 +08:00
|
|
|
NamedDecl *D = ReadDeclAs<NamedDecl>();
|
2010-06-25 17:03:26 +08:00
|
|
|
AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
|
|
|
|
Decls.addDecl(D, AS);
|
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
E->initializeResults(Record.getContext(), Decls.begin(), Decls.end());
|
2010-06-25 17:03:26 +08:00
|
|
|
|
2016-12-16 04:53:26 +08:00
|
|
|
ReadDeclarationNameInfo(E->NameInfo);
|
|
|
|
E->QualifierLoc = Record.ReadNestedNameSpecifierLoc(Idx);
|
2010-06-25 17:03:26 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
|
2010-06-29 06:28:35 +08:00
|
|
|
VisitOverloadExpr(E);
|
2011-03-01 04:01:57 +08:00
|
|
|
E->IsArrow = Record[Idx++];
|
|
|
|
E->HasUnresolvedUsing = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Base = Record.ReadSubExpr();
|
|
|
|
E->BaseType = Record.readType(Idx);
|
|
|
|
E->OperatorLoc = ReadSourceLocation();
|
2010-06-25 17:03:26 +08:00
|
|
|
}
|
|
|
|
|
2010-08-19 07:56:52 +08:00
|
|
|
void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
|
2010-06-29 06:28:35 +08:00
|
|
|
VisitOverloadExpr(E);
|
2011-03-01 04:01:57 +08:00
|
|
|
E->RequiresADL = Record[Idx++];
|
|
|
|
E->Overloaded = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->NamingClass = ReadDeclAs<CXXRecordDecl>();
|
2010-06-25 17:03:34 +08:00
|
|
|
}
|
|
|
|
|
2012-02-24 15:38:34 +08:00
|
|
|
void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
E->TypeTraitExprBits.NumArgs = Record[Idx++];
|
|
|
|
E->TypeTraitExprBits.Kind = Record[Idx++];
|
|
|
|
E->TypeTraitExprBits.Value = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
SourceRange Range = ReadSourceRange();
|
2013-12-20 09:26:47 +08:00
|
|
|
E->Loc = Range.getBegin();
|
|
|
|
E->RParenLoc = Range.getEnd();
|
|
|
|
|
2015-12-31 12:18:25 +08:00
|
|
|
TypeSourceInfo **Args = E->getTrailingObjects<TypeSourceInfo *>();
|
2012-02-24 15:38:34 +08:00
|
|
|
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
Args[I] = GetTypeSourceInfo();
|
2012-02-24 15:38:34 +08:00
|
|
|
}
|
|
|
|
|
2011-04-28 08:16:57 +08:00
|
|
|
void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
E->ATT = (ArrayTypeTrait)Record[Idx++];
|
|
|
|
E->Value = (unsigned int)Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
SourceRange Range = ReadSourceRange();
|
2011-04-28 08:16:57 +08:00
|
|
|
E->Loc = Range.getBegin();
|
|
|
|
E->RParen = Range.getEnd();
|
2016-12-16 04:53:26 +08:00
|
|
|
E->QueriedType = GetTypeSourceInfo();
|
|
|
|
E->Dimension = Record.ReadSubExpr();
|
2011-04-28 08:16:57 +08:00
|
|
|
}
|
|
|
|
|
2011-04-25 14:54:41 +08:00
|
|
|
void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
E->ET = (ExpressionTrait)Record[Idx++];
|
|
|
|
E->Value = (bool)Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
SourceRange Range = ReadSourceRange();
|
|
|
|
E->QueriedExpression = Record.ReadSubExpr();
|
2011-04-25 14:54:41 +08:00
|
|
|
E->Loc = Range.getBegin();
|
|
|
|
E->RParen = Range.getEnd();
|
|
|
|
}
|
|
|
|
|
2010-09-11 04:55:54 +08:00
|
|
|
void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
|
|
|
|
VisitExpr(E);
|
2010-09-11 06:34:40 +08:00
|
|
|
E->Value = (bool)Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Range = ReadSourceRange();
|
|
|
|
E->Operand = Record.ReadSubExpr();
|
2010-09-11 04:55:54 +08:00
|
|
|
}
|
|
|
|
|
2011-01-04 01:17:50 +08:00
|
|
|
void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->EllipsisLoc = ReadSourceLocation();
|
2011-01-15 05:20:45 +08:00
|
|
|
E->NumExpansions = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Pattern = Record.ReadSubExpr();
|
2011-01-04 01:17:50 +08:00
|
|
|
}
|
|
|
|
|
2011-01-05 01:33:58 +08:00
|
|
|
void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
|
|
|
|
VisitExpr(E);
|
2015-09-24 05:41:42 +08:00
|
|
|
unsigned NumPartialArgs = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->OperatorLoc = ReadSourceLocation();
|
|
|
|
E->PackLoc = ReadSourceLocation();
|
|
|
|
E->RParenLoc = ReadSourceLocation();
|
|
|
|
E->Pack = Record.ReadDeclAs<NamedDecl>(Idx);
|
2015-09-24 05:41:42 +08:00
|
|
|
if (E->isPartiallySubstituted()) {
|
|
|
|
assert(E->Length == NumPartialArgs);
|
2015-12-31 12:18:25 +08:00
|
|
|
for (auto *I = E->getTrailingObjects<TemplateArgument>(),
|
2015-09-24 05:41:42 +08:00
|
|
|
*E = I + NumPartialArgs;
|
|
|
|
I != E; ++I)
|
2016-12-16 04:53:26 +08:00
|
|
|
new (I) TemplateArgument(Record.ReadTemplateArgument(Idx));
|
2015-09-24 05:41:42 +08:00
|
|
|
} else if (!E->isValueDependent()) {
|
|
|
|
E->Length = Record[Idx++];
|
|
|
|
}
|
2011-01-05 01:33:58 +08:00
|
|
|
}
|
|
|
|
|
2011-07-15 15:00:14 +08:00
|
|
|
void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
|
|
|
|
SubstNonTypeTemplateParmExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Param = ReadDeclAs<NonTypeTemplateParmDecl>();
|
|
|
|
E->NameLoc = ReadSourceLocation();
|
|
|
|
E->Replacement = Record.ReadSubExpr();
|
2011-07-15 15:00:14 +08:00
|
|
|
}
|
|
|
|
|
2011-01-15 09:15:58 +08:00
|
|
|
void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
|
|
|
|
SubstNonTypeTemplateParmPackExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->Param = ReadDeclAs<NonTypeTemplateParmDecl>();
|
|
|
|
TemplateArgument ArgPack = Record.ReadTemplateArgument(Idx);
|
2011-01-15 09:15:58 +08:00
|
|
|
if (ArgPack.getKind() != TemplateArgument::Pack)
|
|
|
|
return;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2011-01-15 09:15:58 +08:00
|
|
|
E->Arguments = ArgPack.pack_begin();
|
|
|
|
E->NumArguments = ArgPack.pack_size();
|
2016-12-16 04:53:26 +08:00
|
|
|
E->NameLoc = ReadSourceLocation();
|
2011-01-15 09:15:58 +08:00
|
|
|
}
|
|
|
|
|
2012-09-12 08:56:43 +08:00
|
|
|
void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
E->NumParameters = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
E->ParamPack = ReadDeclAs<ParmVarDecl>();
|
|
|
|
E->NameLoc = ReadSourceLocation();
|
2015-12-31 12:18:25 +08:00
|
|
|
ParmVarDecl **Parms = E->getTrailingObjects<ParmVarDecl *>();
|
2012-09-12 08:56:43 +08:00
|
|
|
for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Parms[i] = ReadDeclAs<ParmVarDecl>();
|
2012-09-12 08:56:43 +08:00
|
|
|
}
|
|
|
|
|
2011-06-22 01:03:29 +08:00
|
|
|
void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->State = Record.ReadSubExpr();
|
|
|
|
auto VD = ReadDeclAs<ValueDecl>();
|
2014-05-02 01:50:17 +08:00
|
|
|
unsigned ManglingNumber = Record[Idx++];
|
|
|
|
E->setExtendingDecl(VD, ManglingNumber);
|
2011-06-22 01:03:29 +08:00
|
|
|
}
|
|
|
|
|
2014-11-08 13:07:16 +08:00
|
|
|
void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->LParenLoc = ReadSourceLocation();
|
|
|
|
E->EllipsisLoc = ReadSourceLocation();
|
|
|
|
E->RParenLoc = ReadSourceLocation();
|
|
|
|
E->SubExprs[0] = Record.ReadSubExpr();
|
|
|
|
E->SubExprs[1] = Record.ReadSubExpr();
|
2014-11-08 13:07:16 +08:00
|
|
|
E->Opcode = (BinaryOperatorKind)Record[Idx++];
|
|
|
|
}
|
|
|
|
|
2010-11-16 07:31:06 +08:00
|
|
|
void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->SourceExpr = Record.ReadSubExpr();
|
|
|
|
E->Loc = ReadSourceLocation();
|
2010-11-16 07:31:06 +08:00
|
|
|
}
|
|
|
|
|
2014-10-28 02:07:20 +08:00
|
|
|
void ASTStmtReader::VisitTypoExpr(TypoExpr *E) {
|
|
|
|
llvm_unreachable("Cannot read TypoExpr nodes");
|
|
|
|
}
|
|
|
|
|
2011-07-15 15:00:14 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Microsoft Expressions and Statements
|
|
|
|
//===----------------------------------------------------------------------===//
|
2013-04-16 15:28:30 +08:00
|
|
|
void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
|
|
|
|
VisitExpr(E);
|
|
|
|
E->IsArrow = (Record[Idx++] != 0);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->BaseExpr = Record.ReadSubExpr();
|
|
|
|
E->QualifierLoc = Record.ReadNestedNameSpecifierLoc(Idx);
|
|
|
|
E->MemberLoc = ReadSourceLocation();
|
|
|
|
E->TheDecl = ReadDeclAs<MSPropertyDecl>();
|
2013-04-16 15:28:30 +08:00
|
|
|
}
|
|
|
|
|
2015-11-25 20:01:00 +08:00
|
|
|
void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setBase(Record.ReadSubExpr());
|
|
|
|
E->setIdx(Record.ReadSubExpr());
|
|
|
|
E->setRBracketLoc(ReadSourceLocation());
|
2015-11-25 20:01:00 +08:00
|
|
|
}
|
|
|
|
|
2011-07-15 15:00:14 +08:00
|
|
|
void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setSourceRange(ReadSourceRange());
|
|
|
|
std::string UuidStr = ReadString();
|
|
|
|
E->setUuidStr(StringRef(UuidStr).copy(Record.getContext()));
|
2011-07-15 15:00:14 +08:00
|
|
|
if (E->isTypeOperand()) { // __uuidof(ComType)
|
|
|
|
E->setTypeOperandSourceInfo(
|
2016-12-16 04:53:26 +08:00
|
|
|
GetTypeSourceInfo());
|
2011-07-15 15:00:14 +08:00
|
|
|
return;
|
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2011-07-15 15:00:14 +08:00
|
|
|
// __uuidof(expr)
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setExprOperand(Record.ReadSubExpr());
|
2011-07-15 15:00:14 +08:00
|
|
|
}
|
|
|
|
|
2014-07-07 08:12:30 +08:00
|
|
|
void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
|
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->setLeaveLoc(ReadSourceLocation());
|
2014-07-07 08:12:30 +08:00
|
|
|
}
|
|
|
|
|
2011-07-15 15:00:14 +08:00
|
|
|
void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
|
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->Loc = ReadSourceLocation();
|
|
|
|
S->Children[SEHExceptStmt::FILTER_EXPR] = Record.ReadSubStmt();
|
|
|
|
S->Children[SEHExceptStmt::BLOCK] = Record.ReadSubStmt();
|
2011-07-15 15:00:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
|
|
|
|
VisitStmt(S);
|
2016-12-16 04:53:26 +08:00
|
|
|
S->Loc = ReadSourceLocation();
|
|
|
|
S->Block = Record.ReadSubStmt();
|
2011-07-15 15:00:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
|
|
|
|
VisitStmt(S);
|
|
|
|
S->IsCXXTry = Record[Idx++];
|
2016-12-16 04:53:26 +08:00
|
|
|
S->TryLoc = ReadSourceLocation();
|
|
|
|
S->Children[SEHTryStmt::TRY] = Record.ReadSubStmt();
|
|
|
|
S->Children[SEHTryStmt::HANDLER] = Record.ReadSubStmt();
|
2011-07-15 15:00:14 +08:00
|
|
|
}
|
|
|
|
|
2011-02-10 05:07:24 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// CUDA Expressions and Statements
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
|
|
|
|
VisitCallExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setConfig(cast<CallExpr>(Record.ReadSubExpr()));
|
2011-02-10 05:07:24 +08:00
|
|
|
}
|
|
|
|
|
2011-07-15 15:00:14 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// OpenCL Expressions and Statements.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
|
|
|
|
VisitExpr(E);
|
2016-12-16 04:53:26 +08:00
|
|
|
E->BuiltinLoc = ReadSourceLocation();
|
|
|
|
E->RParenLoc = ReadSourceLocation();
|
|
|
|
E->SrcExpr = Record.ReadSubExpr();
|
2011-07-15 15:00:14 +08:00
|
|
|
}
|
|
|
|
|
2013-07-19 11:13:43 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// OpenMP Clauses.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
class OMPClauseReader : public OMPClauseVisitor<OMPClauseReader> {
|
|
|
|
ASTStmtReader *Reader;
|
|
|
|
ASTContext &Context;
|
|
|
|
unsigned &Idx;
|
|
|
|
public:
|
2016-12-16 04:53:26 +08:00
|
|
|
OMPClauseReader(ASTStmtReader *R, ASTRecordReader &Record, unsigned &Idx)
|
|
|
|
: Reader(R), Context(Record.getContext()), Idx(Idx) {}
|
2016-02-17 21:19:37 +08:00
|
|
|
#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *C);
|
2013-07-19 11:13:43 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
OMPClause *readClause();
|
2016-02-16 19:18:12 +08:00
|
|
|
void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C);
|
2016-02-25 13:25:57 +08:00
|
|
|
void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C);
|
2013-07-19 11:13:43 +08:00
|
|
|
};
|
2015-06-23 07:07:51 +08:00
|
|
|
}
|
2013-07-19 11:13:43 +08:00
|
|
|
|
|
|
|
OMPClause *OMPClauseReader::readClause() {
|
|
|
|
OMPClause *C;
|
2016-12-16 04:53:26 +08:00
|
|
|
switch (Reader->Record[Idx++]) {
|
2014-02-13 13:29:23 +08:00
|
|
|
case OMPC_if:
|
|
|
|
C = new (Context) OMPIfClause();
|
|
|
|
break;
|
2014-07-17 15:32:53 +08:00
|
|
|
case OMPC_final:
|
|
|
|
C = new (Context) OMPFinalClause();
|
|
|
|
break;
|
2014-03-06 14:15:19 +08:00
|
|
|
case OMPC_num_threads:
|
|
|
|
C = new (Context) OMPNumThreadsClause();
|
|
|
|
break;
|
2014-03-21 12:51:18 +08:00
|
|
|
case OMPC_safelen:
|
|
|
|
C = new (Context) OMPSafelenClause();
|
|
|
|
break;
|
2015-08-21 19:14:16 +08:00
|
|
|
case OMPC_simdlen:
|
|
|
|
C = new (Context) OMPSimdlenClause();
|
|
|
|
break;
|
2014-05-27 23:12:19 +08:00
|
|
|
case OMPC_collapse:
|
|
|
|
C = new (Context) OMPCollapseClause();
|
|
|
|
break;
|
2013-07-19 11:13:43 +08:00
|
|
|
case OMPC_default:
|
|
|
|
C = new (Context) OMPDefaultClause();
|
|
|
|
break;
|
2014-05-06 14:04:14 +08:00
|
|
|
case OMPC_proc_bind:
|
|
|
|
C = new (Context) OMPProcBindClause();
|
|
|
|
break;
|
2014-06-20 15:16:17 +08:00
|
|
|
case OMPC_schedule:
|
|
|
|
C = new (Context) OMPScheduleClause();
|
|
|
|
break;
|
2014-06-20 17:44:06 +08:00
|
|
|
case OMPC_ordered:
|
|
|
|
C = new (Context) OMPOrderedClause();
|
|
|
|
break;
|
2014-06-20 19:19:47 +08:00
|
|
|
case OMPC_nowait:
|
|
|
|
C = new (Context) OMPNowaitClause();
|
|
|
|
break;
|
2014-07-17 20:19:31 +08:00
|
|
|
case OMPC_untied:
|
|
|
|
C = new (Context) OMPUntiedClause();
|
|
|
|
break;
|
2014-07-17 20:47:03 +08:00
|
|
|
case OMPC_mergeable:
|
|
|
|
C = new (Context) OMPMergeableClause();
|
|
|
|
break;
|
2014-07-23 10:27:21 +08:00
|
|
|
case OMPC_read:
|
|
|
|
C = new (Context) OMPReadClause();
|
|
|
|
break;
|
2014-07-23 15:46:59 +08:00
|
|
|
case OMPC_write:
|
|
|
|
C = new (Context) OMPWriteClause();
|
|
|
|
break;
|
2014-07-23 18:25:33 +08:00
|
|
|
case OMPC_update:
|
|
|
|
C = new (Context) OMPUpdateClause();
|
|
|
|
break;
|
2014-07-24 14:46:57 +08:00
|
|
|
case OMPC_capture:
|
|
|
|
C = new (Context) OMPCaptureClause();
|
|
|
|
break;
|
2014-07-24 16:55:34 +08:00
|
|
|
case OMPC_seq_cst:
|
|
|
|
C = new (Context) OMPSeqCstClause();
|
|
|
|
break;
|
2015-09-25 18:37:12 +08:00
|
|
|
case OMPC_threads:
|
|
|
|
C = new (Context) OMPThreadsClause();
|
|
|
|
break;
|
2015-09-28 14:39:35 +08:00
|
|
|
case OMPC_simd:
|
|
|
|
C = new (Context) OMPSIMDClause();
|
|
|
|
break;
|
2015-12-07 18:51:44 +08:00
|
|
|
case OMPC_nogroup:
|
|
|
|
C = new (Context) OMPNogroupClause();
|
|
|
|
break;
|
2013-07-19 11:13:43 +08:00
|
|
|
case OMPC_private:
|
2016-12-16 04:53:26 +08:00
|
|
|
C = OMPPrivateClause::CreateEmpty(Context, Reader->Record[Idx++]);
|
2013-07-19 11:13:43 +08:00
|
|
|
break;
|
2013-10-01 13:32:34 +08:00
|
|
|
case OMPC_firstprivate:
|
2016-12-16 04:53:26 +08:00
|
|
|
C = OMPFirstprivateClause::CreateEmpty(Context, Reader->Record[Idx++]);
|
2013-10-01 13:32:34 +08:00
|
|
|
break;
|
2014-06-04 21:06:39 +08:00
|
|
|
case OMPC_lastprivate:
|
2016-12-16 04:53:26 +08:00
|
|
|
C = OMPLastprivateClause::CreateEmpty(Context, Reader->Record[Idx++]);
|
2014-06-04 21:06:39 +08:00
|
|
|
break;
|
2013-09-07 02:03:48 +08:00
|
|
|
case OMPC_shared:
|
2016-12-16 04:53:26 +08:00
|
|
|
C = OMPSharedClause::CreateEmpty(Context, Reader->Record[Idx++]);
|
2013-09-07 02:03:48 +08:00
|
|
|
break;
|
2014-06-16 15:08:35 +08:00
|
|
|
case OMPC_reduction:
|
2016-12-16 04:53:26 +08:00
|
|
|
C = OMPReductionClause::CreateEmpty(Context, Reader->Record[Idx++]);
|
2014-06-16 15:08:35 +08:00
|
|
|
break;
|
2014-04-22 21:09:42 +08:00
|
|
|
case OMPC_linear:
|
2016-12-16 04:53:26 +08:00
|
|
|
C = OMPLinearClause::CreateEmpty(Context, Reader->Record[Idx++]);
|
2014-04-22 21:09:42 +08:00
|
|
|
break;
|
2014-05-29 22:36:25 +08:00
|
|
|
case OMPC_aligned:
|
2016-12-16 04:53:26 +08:00
|
|
|
C = OMPAlignedClause::CreateEmpty(Context, Reader->Record[Idx++]);
|
2014-05-29 22:36:25 +08:00
|
|
|
break;
|
2014-03-31 11:36:38 +08:00
|
|
|
case OMPC_copyin:
|
2016-12-16 04:53:26 +08:00
|
|
|
C = OMPCopyinClause::CreateEmpty(Context, Reader->Record[Idx++]);
|
2014-03-31 11:36:38 +08:00
|
|
|
break;
|
2014-06-27 18:37:06 +08:00
|
|
|
case OMPC_copyprivate:
|
2016-12-16 04:53:26 +08:00
|
|
|
C = OMPCopyprivateClause::CreateEmpty(Context, Reader->Record[Idx++]);
|
2014-06-27 18:37:06 +08:00
|
|
|
break;
|
2014-07-21 19:26:11 +08:00
|
|
|
case OMPC_flush:
|
2016-12-16 04:53:26 +08:00
|
|
|
C = OMPFlushClause::CreateEmpty(Context, Reader->Record[Idx++]);
|
2014-07-21 19:26:11 +08:00
|
|
|
break;
|
2015-06-23 22:25:19 +08:00
|
|
|
case OMPC_depend:
|
2016-12-16 04:53:26 +08:00
|
|
|
C = OMPDependClause::CreateEmpty(Context, Reader->Record[Idx++]);
|
2015-06-23 22:25:19 +08:00
|
|
|
break;
|
2015-08-08 00:16:36 +08:00
|
|
|
case OMPC_device:
|
|
|
|
C = new (Context) OMPDeviceClause();
|
|
|
|
break;
|
2016-04-26 22:54:23 +08:00
|
|
|
case OMPC_map: {
|
2016-12-16 04:53:26 +08:00
|
|
|
unsigned NumVars = Reader->Record[Idx++];
|
|
|
|
unsigned NumDeclarations = Reader->Record[Idx++];
|
|
|
|
unsigned NumLists = Reader->Record[Idx++];
|
|
|
|
unsigned NumComponents = Reader->Record[Idx++];
|
2016-04-26 22:54:23 +08:00
|
|
|
C = OMPMapClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists,
|
|
|
|
NumComponents);
|
2015-11-23 13:32:03 +08:00
|
|
|
break;
|
2016-04-26 22:54:23 +08:00
|
|
|
}
|
2015-11-25 04:50:12 +08:00
|
|
|
case OMPC_num_teams:
|
|
|
|
C = new (Context) OMPNumTeamsClause();
|
|
|
|
break;
|
2015-11-28 02:47:36 +08:00
|
|
|
case OMPC_thread_limit:
|
|
|
|
C = new (Context) OMPThreadLimitClause();
|
|
|
|
break;
|
2015-12-01 18:17:31 +08:00
|
|
|
case OMPC_priority:
|
|
|
|
C = new (Context) OMPPriorityClause();
|
|
|
|
break;
|
2015-12-07 20:52:51 +08:00
|
|
|
case OMPC_grainsize:
|
|
|
|
C = new (Context) OMPGrainsizeClause();
|
|
|
|
break;
|
2015-12-08 20:06:20 +08:00
|
|
|
case OMPC_num_tasks:
|
|
|
|
C = new (Context) OMPNumTasksClause();
|
|
|
|
break;
|
2015-12-15 16:19:24 +08:00
|
|
|
case OMPC_hint:
|
|
|
|
C = new (Context) OMPHintClause();
|
|
|
|
break;
|
2016-01-16 02:50:31 +08:00
|
|
|
case OMPC_dist_schedule:
|
|
|
|
C = new (Context) OMPDistScheduleClause();
|
|
|
|
break;
|
2016-01-27 00:37:23 +08:00
|
|
|
case OMPC_defaultmap:
|
|
|
|
C = new (Context) OMPDefaultmapClause();
|
|
|
|
break;
|
2016-05-27 01:39:58 +08:00
|
|
|
case OMPC_to: {
|
2016-12-16 04:53:26 +08:00
|
|
|
unsigned NumVars = Reader->Record[Idx++];
|
|
|
|
unsigned NumDeclarations = Reader->Record[Idx++];
|
|
|
|
unsigned NumLists = Reader->Record[Idx++];
|
|
|
|
unsigned NumComponents = Reader->Record[Idx++];
|
2016-05-27 01:39:58 +08:00
|
|
|
C = OMPToClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists,
|
|
|
|
NumComponents);
|
|
|
|
break;
|
|
|
|
}
|
2016-05-27 01:49:04 +08:00
|
|
|
case OMPC_from: {
|
2016-12-16 04:53:26 +08:00
|
|
|
unsigned NumVars = Reader->Record[Idx++];
|
|
|
|
unsigned NumDeclarations = Reader->Record[Idx++];
|
|
|
|
unsigned NumLists = Reader->Record[Idx++];
|
|
|
|
unsigned NumComponents = Reader->Record[Idx++];
|
2016-05-27 01:49:04 +08:00
|
|
|
C = OMPFromClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists,
|
|
|
|
NumComponents);
|
|
|
|
break;
|
|
|
|
}
|
2016-07-28 22:23:26 +08:00
|
|
|
case OMPC_use_device_ptr: {
|
2016-12-16 04:53:26 +08:00
|
|
|
unsigned NumVars = Reader->Record[Idx++];
|
|
|
|
unsigned NumDeclarations = Reader->Record[Idx++];
|
|
|
|
unsigned NumLists = Reader->Record[Idx++];
|
|
|
|
unsigned NumComponents = Reader->Record[Idx++];
|
2016-07-28 22:23:26 +08:00
|
|
|
C = OMPUseDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations,
|
|
|
|
NumLists, NumComponents);
|
2016-07-13 23:37:16 +08:00
|
|
|
break;
|
2016-07-28 22:23:26 +08:00
|
|
|
}
|
2016-07-28 22:25:09 +08:00
|
|
|
case OMPC_is_device_ptr: {
|
2016-12-16 04:53:26 +08:00
|
|
|
unsigned NumVars = Reader->Record[Idx++];
|
|
|
|
unsigned NumDeclarations = Reader->Record[Idx++];
|
|
|
|
unsigned NumLists = Reader->Record[Idx++];
|
|
|
|
unsigned NumComponents = Reader->Record[Idx++];
|
2016-07-28 22:25:09 +08:00
|
|
|
C = OMPIsDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations,
|
|
|
|
NumLists, NumComponents);
|
2016-07-14 01:16:49 +08:00
|
|
|
break;
|
2013-07-19 11:13:43 +08:00
|
|
|
}
|
2016-07-28 22:25:09 +08:00
|
|
|
}
|
2013-07-19 11:13:43 +08:00
|
|
|
Visit(C);
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLocStart(Reader->ReadSourceLocation());
|
|
|
|
C->setLocEnd(Reader->ReadSourceLocation());
|
2013-07-19 11:13:43 +08:00
|
|
|
|
|
|
|
return C;
|
|
|
|
}
|
|
|
|
|
2016-02-16 19:18:12 +08:00
|
|
|
void OMPClauseReader::VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setPreInitStmt(Reader->Record.ReadSubStmt());
|
2016-02-16 19:18:12 +08:00
|
|
|
}
|
|
|
|
|
2016-02-25 13:25:57 +08:00
|
|
|
void OMPClauseReader::VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C) {
|
2016-03-04 15:21:16 +08:00
|
|
|
VisitOMPClauseWithPreInit(C);
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setPostUpdateExpr(Reader->Record.ReadSubExpr());
|
2016-02-25 13:25:57 +08:00
|
|
|
}
|
|
|
|
|
2014-02-13 13:29:23 +08:00
|
|
|
void OMPClauseReader::VisitOMPIfClause(OMPIfClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setNameModifier(static_cast<OpenMPDirectiveKind>(Reader->Record[Idx++]));
|
|
|
|
C->setNameModifierLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setColonLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setCondition(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2014-02-13 13:29:23 +08:00
|
|
|
}
|
|
|
|
|
2014-07-17 15:32:53 +08:00
|
|
|
void OMPClauseReader::VisitOMPFinalClause(OMPFinalClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setCondition(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2014-07-17 15:32:53 +08:00
|
|
|
}
|
|
|
|
|
2014-03-06 14:15:19 +08:00
|
|
|
void OMPClauseReader::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setNumThreads(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2014-03-06 14:15:19 +08:00
|
|
|
}
|
|
|
|
|
2014-03-21 12:51:18 +08:00
|
|
|
void OMPClauseReader::VisitOMPSafelenClause(OMPSafelenClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setSafelen(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2014-03-21 12:51:18 +08:00
|
|
|
}
|
|
|
|
|
2015-08-21 19:14:16 +08:00
|
|
|
void OMPClauseReader::VisitOMPSimdlenClause(OMPSimdlenClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setSimdlen(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2015-08-21 19:14:16 +08:00
|
|
|
}
|
|
|
|
|
2014-05-27 23:12:19 +08:00
|
|
|
void OMPClauseReader::VisitOMPCollapseClause(OMPCollapseClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setNumForLoops(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2014-05-27 23:12:19 +08:00
|
|
|
}
|
|
|
|
|
2013-07-19 11:13:43 +08:00
|
|
|
void OMPClauseReader::VisitOMPDefaultClause(OMPDefaultClause *C) {
|
|
|
|
C->setDefaultKind(
|
2016-12-16 04:53:26 +08:00
|
|
|
static_cast<OpenMPDefaultClauseKind>(Reader->Record[Idx++]));
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setDefaultKindKwLoc(Reader->ReadSourceLocation());
|
2013-07-19 11:13:43 +08:00
|
|
|
}
|
|
|
|
|
2014-05-06 14:04:14 +08:00
|
|
|
void OMPClauseReader::VisitOMPProcBindClause(OMPProcBindClause *C) {
|
|
|
|
C->setProcBindKind(
|
2016-12-16 04:53:26 +08:00
|
|
|
static_cast<OpenMPProcBindClauseKind>(Reader->Record[Idx++]));
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setProcBindKindKwLoc(Reader->ReadSourceLocation());
|
2014-05-06 14:04:14 +08:00
|
|
|
}
|
|
|
|
|
2014-06-20 15:16:17 +08:00
|
|
|
void OMPClauseReader::VisitOMPScheduleClause(OMPScheduleClause *C) {
|
2016-02-16 19:18:12 +08:00
|
|
|
VisitOMPClauseWithPreInit(C);
|
2014-06-20 15:16:17 +08:00
|
|
|
C->setScheduleKind(
|
2016-12-16 04:53:26 +08:00
|
|
|
static_cast<OpenMPScheduleClauseKind>(Reader->Record[Idx++]));
|
2015-12-28 15:25:51 +08:00
|
|
|
C->setFirstScheduleModifier(
|
2016-12-16 04:53:26 +08:00
|
|
|
static_cast<OpenMPScheduleClauseModifier>(Reader->Record[Idx++]));
|
2015-12-28 15:25:51 +08:00
|
|
|
C->setSecondScheduleModifier(
|
2016-12-16 04:53:26 +08:00
|
|
|
static_cast<OpenMPScheduleClauseModifier>(Reader->Record[Idx++]));
|
|
|
|
C->setChunkSize(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setFirstScheduleModifierLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setSecondScheduleModifierLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setScheduleKindLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setCommaLoc(Reader->ReadSourceLocation());
|
2014-06-20 15:16:17 +08:00
|
|
|
}
|
|
|
|
|
2015-07-30 19:36:16 +08:00
|
|
|
void OMPClauseReader::VisitOMPOrderedClause(OMPOrderedClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setNumForLoops(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2015-07-30 19:36:16 +08:00
|
|
|
}
|
2014-06-20 17:44:06 +08:00
|
|
|
|
2014-06-20 19:19:47 +08:00
|
|
|
void OMPClauseReader::VisitOMPNowaitClause(OMPNowaitClause *) {}
|
|
|
|
|
2014-07-17 20:19:31 +08:00
|
|
|
void OMPClauseReader::VisitOMPUntiedClause(OMPUntiedClause *) {}
|
|
|
|
|
2014-07-17 20:47:03 +08:00
|
|
|
void OMPClauseReader::VisitOMPMergeableClause(OMPMergeableClause *) {}
|
|
|
|
|
2014-07-23 10:27:21 +08:00
|
|
|
void OMPClauseReader::VisitOMPReadClause(OMPReadClause *) {}
|
|
|
|
|
2014-07-23 15:46:59 +08:00
|
|
|
void OMPClauseReader::VisitOMPWriteClause(OMPWriteClause *) {}
|
|
|
|
|
2014-07-23 18:25:33 +08:00
|
|
|
void OMPClauseReader::VisitOMPUpdateClause(OMPUpdateClause *) {}
|
|
|
|
|
2014-07-24 14:46:57 +08:00
|
|
|
void OMPClauseReader::VisitOMPCaptureClause(OMPCaptureClause *) {}
|
|
|
|
|
2014-07-24 16:55:34 +08:00
|
|
|
void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
|
|
|
|
|
2015-09-25 18:37:12 +08:00
|
|
|
void OMPClauseReader::VisitOMPThreadsClause(OMPThreadsClause *) {}
|
|
|
|
|
2015-09-28 14:39:35 +08:00
|
|
|
void OMPClauseReader::VisitOMPSIMDClause(OMPSIMDClause *) {}
|
|
|
|
|
2015-12-07 18:51:44 +08:00
|
|
|
void OMPClauseReader::VisitOMPNogroupClause(OMPNogroupClause *) {}
|
|
|
|
|
2013-07-19 11:13:43 +08:00
|
|
|
void OMPClauseReader::VisitOMPPrivateClause(OMPPrivateClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2013-07-19 11:13:43 +08:00
|
|
|
unsigned NumVars = C->varlist_size();
|
|
|
|
SmallVector<Expr *, 16> Vars;
|
2013-10-01 13:32:34 +08:00
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2013-10-01 13:32:34 +08:00
|
|
|
C->setVarRefs(Vars);
|
2014-10-21 11:16:40 +08:00
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2014-10-21 11:16:40 +08:00
|
|
|
C->setPrivateCopies(Vars);
|
2013-10-01 13:32:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void OMPClauseReader::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) {
|
2016-02-17 21:19:37 +08:00
|
|
|
VisitOMPClauseWithPreInit(C);
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2013-10-01 13:32:34 +08:00
|
|
|
unsigned NumVars = C->varlist_size();
|
|
|
|
SmallVector<Expr *, 16> Vars;
|
2013-07-19 11:13:43 +08:00
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2013-07-19 11:13:43 +08:00
|
|
|
C->setVarRefs(Vars);
|
2014-10-08 22:01:46 +08:00
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2014-10-08 22:01:46 +08:00
|
|
|
C->setPrivateCopies(Vars);
|
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2014-10-08 22:01:46 +08:00
|
|
|
C->setInits(Vars);
|
2013-07-19 11:13:43 +08:00
|
|
|
}
|
|
|
|
|
2014-06-04 21:06:39 +08:00
|
|
|
void OMPClauseReader::VisitOMPLastprivateClause(OMPLastprivateClause *C) {
|
2016-02-25 13:25:57 +08:00
|
|
|
VisitOMPClauseWithPostUpdate(C);
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2014-06-04 21:06:39 +08:00
|
|
|
unsigned NumVars = C->varlist_size();
|
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2014-06-04 21:06:39 +08:00
|
|
|
C->setVarRefs(Vars);
|
2015-04-16 12:54:05 +08:00
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2015-04-16 12:54:05 +08:00
|
|
|
C->setPrivateCopies(Vars);
|
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2015-04-16 12:54:05 +08:00
|
|
|
C->setSourceExprs(Vars);
|
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2015-04-16 12:54:05 +08:00
|
|
|
C->setDestinationExprs(Vars);
|
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2015-04-16 12:54:05 +08:00
|
|
|
C->setAssignmentOps(Vars);
|
2014-06-04 21:06:39 +08:00
|
|
|
}
|
|
|
|
|
2013-09-07 02:03:48 +08:00
|
|
|
void OMPClauseReader::VisitOMPSharedClause(OMPSharedClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2013-09-07 02:03:48 +08:00
|
|
|
unsigned NumVars = C->varlist_size();
|
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
2014-03-31 11:36:38 +08:00
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2014-03-31 11:36:38 +08:00
|
|
|
C->setVarRefs(Vars);
|
|
|
|
}
|
|
|
|
|
2014-06-16 15:08:35 +08:00
|
|
|
void OMPClauseReader::VisitOMPReductionClause(OMPReductionClause *C) {
|
2016-03-02 12:57:40 +08:00
|
|
|
VisitOMPClauseWithPostUpdate(C);
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setColonLoc(Reader->ReadSourceLocation());
|
|
|
|
NestedNameSpecifierLoc NNSL = Reader->Record.ReadNestedNameSpecifierLoc(Idx);
|
2014-06-16 15:08:35 +08:00
|
|
|
DeclarationNameInfo DNI;
|
2016-12-16 04:53:26 +08:00
|
|
|
Reader->ReadDeclarationNameInfo(DNI);
|
2014-06-16 15:08:35 +08:00
|
|
|
C->setQualifierLoc(NNSL);
|
|
|
|
C->setNameInfo(DNI);
|
|
|
|
|
|
|
|
unsigned NumVars = C->varlist_size();
|
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2014-06-16 15:08:35 +08:00
|
|
|
C->setVarRefs(Vars);
|
[OPENMP] Codegen for 'reduction' clause in 'parallel' directive.
Emit a code for reduction clause. Next code should be emitted for reductions:
static kmp_critical_name lock = { 0 };
void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
...
*(Type<i> *)lhs[i] = RedOp<i>(*(Type<i> *)lhs[i], *(Type<i> *)rhs[i]);
...
}
... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n> - 1]};
switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
case 1:
...
<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]);
...
__kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
break;
case 2:
...
Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]));
...
break;
default:
;
}
Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation.
Differential Revision: http://reviews.llvm.org/D8915
llvm-svn: 234583
2015-04-10 18:43:45 +08:00
|
|
|
Vars.clear();
|
2015-10-08 17:10:53 +08:00
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2015-10-08 17:10:53 +08:00
|
|
|
C->setPrivates(Vars);
|
|
|
|
Vars.clear();
|
[OPENMP] Codegen for 'reduction' clause in 'parallel' directive.
Emit a code for reduction clause. Next code should be emitted for reductions:
static kmp_critical_name lock = { 0 };
void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
...
*(Type<i> *)lhs[i] = RedOp<i>(*(Type<i> *)lhs[i], *(Type<i> *)rhs[i]);
...
}
... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n> - 1]};
switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
case 1:
...
<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]);
...
__kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
break;
case 2:
...
Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]));
...
break;
default:
;
}
Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation.
Differential Revision: http://reviews.llvm.org/D8915
llvm-svn: 234583
2015-04-10 18:43:45 +08:00
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
[OPENMP] Codegen for 'reduction' clause in 'parallel' directive.
Emit a code for reduction clause. Next code should be emitted for reductions:
static kmp_critical_name lock = { 0 };
void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
...
*(Type<i> *)lhs[i] = RedOp<i>(*(Type<i> *)lhs[i], *(Type<i> *)rhs[i]);
...
}
... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n> - 1]};
switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
case 1:
...
<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]);
...
__kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
break;
case 2:
...
Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]));
...
break;
default:
;
}
Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation.
Differential Revision: http://reviews.llvm.org/D8915
llvm-svn: 234583
2015-04-10 18:43:45 +08:00
|
|
|
C->setLHSExprs(Vars);
|
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
[OPENMP] Codegen for 'reduction' clause in 'parallel' directive.
Emit a code for reduction clause. Next code should be emitted for reductions:
static kmp_critical_name lock = { 0 };
void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
...
*(Type<i> *)lhs[i] = RedOp<i>(*(Type<i> *)lhs[i], *(Type<i> *)rhs[i]);
...
}
... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n> - 1]};
switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
case 1:
...
<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]);
...
__kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
break;
case 2:
...
Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]));
...
break;
default:
;
}
Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation.
Differential Revision: http://reviews.llvm.org/D8915
llvm-svn: 234583
2015-04-10 18:43:45 +08:00
|
|
|
C->setRHSExprs(Vars);
|
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
[OPENMP] Codegen for 'reduction' clause in 'parallel' directive.
Emit a code for reduction clause. Next code should be emitted for reductions:
static kmp_critical_name lock = { 0 };
void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
...
*(Type<i> *)lhs[i] = RedOp<i>(*(Type<i> *)lhs[i], *(Type<i> *)rhs[i]);
...
}
... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n> - 1]};
switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
case 1:
...
<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]);
...
__kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
break;
case 2:
...
Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]));
...
break;
default:
;
}
Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation.
Differential Revision: http://reviews.llvm.org/D8915
llvm-svn: 234583
2015-04-10 18:43:45 +08:00
|
|
|
C->setReductionOps(Vars);
|
2014-06-16 15:08:35 +08:00
|
|
|
}
|
|
|
|
|
2014-04-22 21:09:42 +08:00
|
|
|
void OMPClauseReader::VisitOMPLinearClause(OMPLinearClause *C) {
|
2016-03-09 17:49:00 +08:00
|
|
|
VisitOMPClauseWithPostUpdate(C);
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setColonLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setModifier(static_cast<OpenMPLinearClauseKind>(Reader->Record[Idx++]));
|
|
|
|
C->setModifierLoc(Reader->ReadSourceLocation());
|
2014-04-22 21:09:42 +08:00
|
|
|
unsigned NumVars = C->varlist_size();
|
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2014-04-22 21:09:42 +08:00
|
|
|
C->setVarRefs(Vars);
|
2015-03-21 18:12:56 +08:00
|
|
|
Vars.clear();
|
2015-08-18 14:47:21 +08:00
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2015-08-18 14:47:21 +08:00
|
|
|
C->setPrivates(Vars);
|
|
|
|
Vars.clear();
|
2015-03-21 18:12:56 +08:00
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2015-03-21 18:12:56 +08:00
|
|
|
C->setInits(Vars);
|
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2015-03-21 18:12:56 +08:00
|
|
|
C->setUpdates(Vars);
|
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2015-03-21 18:12:56 +08:00
|
|
|
C->setFinals(Vars);
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setStep(Reader->Record.ReadSubExpr());
|
|
|
|
C->setCalcStep(Reader->Record.ReadSubExpr());
|
2014-04-22 21:09:42 +08:00
|
|
|
}
|
|
|
|
|
2014-05-29 22:36:25 +08:00
|
|
|
void OMPClauseReader::VisitOMPAlignedClause(OMPAlignedClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setColonLoc(Reader->ReadSourceLocation());
|
2014-05-29 22:36:25 +08:00
|
|
|
unsigned NumVars = C->varlist_size();
|
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2014-05-29 22:36:25 +08:00
|
|
|
C->setVarRefs(Vars);
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setAlignment(Reader->Record.ReadSubExpr());
|
2014-05-29 22:36:25 +08:00
|
|
|
}
|
|
|
|
|
2014-03-31 11:36:38 +08:00
|
|
|
void OMPClauseReader::VisitOMPCopyinClause(OMPCopyinClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2014-03-31 11:36:38 +08:00
|
|
|
unsigned NumVars = C->varlist_size();
|
2015-04-16 13:39:01 +08:00
|
|
|
SmallVector<Expr *, 16> Exprs;
|
|
|
|
Exprs.reserve(NumVars);
|
2013-09-07 02:03:48 +08:00
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Exprs.push_back(Reader->Record.ReadSubExpr());
|
2015-04-16 13:39:01 +08:00
|
|
|
C->setVarRefs(Exprs);
|
|
|
|
Exprs.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Exprs.push_back(Reader->Record.ReadSubExpr());
|
2015-04-16 13:39:01 +08:00
|
|
|
C->setSourceExprs(Exprs);
|
|
|
|
Exprs.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Exprs.push_back(Reader->Record.ReadSubExpr());
|
2015-04-16 13:39:01 +08:00
|
|
|
C->setDestinationExprs(Exprs);
|
|
|
|
Exprs.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Exprs.push_back(Reader->Record.ReadSubExpr());
|
2015-04-16 13:39:01 +08:00
|
|
|
C->setAssignmentOps(Exprs);
|
2013-09-07 02:03:48 +08:00
|
|
|
}
|
|
|
|
|
2014-06-27 18:37:06 +08:00
|
|
|
void OMPClauseReader::VisitOMPCopyprivateClause(OMPCopyprivateClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2014-06-27 18:37:06 +08:00
|
|
|
unsigned NumVars = C->varlist_size();
|
2015-03-23 14:18:07 +08:00
|
|
|
SmallVector<Expr *, 16> Exprs;
|
|
|
|
Exprs.reserve(NumVars);
|
2014-06-27 18:37:06 +08:00
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Exprs.push_back(Reader->Record.ReadSubExpr());
|
2015-03-23 14:18:07 +08:00
|
|
|
C->setVarRefs(Exprs);
|
|
|
|
Exprs.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Exprs.push_back(Reader->Record.ReadSubExpr());
|
2015-03-23 14:18:07 +08:00
|
|
|
C->setSourceExprs(Exprs);
|
|
|
|
Exprs.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Exprs.push_back(Reader->Record.ReadSubExpr());
|
2015-03-23 14:18:07 +08:00
|
|
|
C->setDestinationExprs(Exprs);
|
|
|
|
Exprs.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Exprs.push_back(Reader->Record.ReadSubExpr());
|
2015-03-23 14:18:07 +08:00
|
|
|
C->setAssignmentOps(Exprs);
|
2014-06-27 18:37:06 +08:00
|
|
|
}
|
|
|
|
|
2014-07-21 19:26:11 +08:00
|
|
|
void OMPClauseReader::VisitOMPFlushClause(OMPFlushClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2014-07-21 19:26:11 +08:00
|
|
|
unsigned NumVars = C->varlist_size();
|
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2014-07-21 19:26:11 +08:00
|
|
|
C->setVarRefs(Vars);
|
|
|
|
}
|
|
|
|
|
2015-06-23 22:25:19 +08:00
|
|
|
void OMPClauseReader::VisitOMPDependClause(OMPDependClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setDependencyKind(
|
|
|
|
static_cast<OpenMPDependClauseKind>(Reader->Record[Idx++]));
|
|
|
|
C->setDependencyLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setColonLoc(Reader->ReadSourceLocation());
|
2015-06-23 22:25:19 +08:00
|
|
|
unsigned NumVars = C->varlist_size();
|
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2015-06-23 22:25:19 +08:00
|
|
|
C->setVarRefs(Vars);
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setCounterValue(Reader->Record.ReadSubExpr());
|
2015-06-23 22:25:19 +08:00
|
|
|
}
|
|
|
|
|
2015-08-08 00:16:36 +08:00
|
|
|
void OMPClauseReader::VisitOMPDeviceClause(OMPDeviceClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setDevice(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2015-08-08 00:16:36 +08:00
|
|
|
}
|
|
|
|
|
2015-11-23 13:32:03 +08:00
|
|
|
void OMPClauseReader::VisitOMPMapClause(OMPMapClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2015-11-23 13:32:03 +08:00
|
|
|
C->setMapTypeModifier(
|
2016-12-16 04:53:26 +08:00
|
|
|
static_cast<OpenMPMapClauseKind>(Reader->Record[Idx++]));
|
2015-11-23 13:32:03 +08:00
|
|
|
C->setMapType(
|
2016-12-16 04:53:26 +08:00
|
|
|
static_cast<OpenMPMapClauseKind>(Reader->Record[Idx++]));
|
|
|
|
C->setMapLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setColonLoc(Reader->ReadSourceLocation());
|
2015-11-23 13:32:03 +08:00
|
|
|
auto NumVars = C->varlist_size();
|
2016-04-26 22:54:23 +08:00
|
|
|
auto UniqueDecls = C->getUniqueDeclarationsNum();
|
|
|
|
auto TotalLists = C->getTotalComponentListNum();
|
|
|
|
auto TotalComponents = C->getTotalComponentsNum();
|
|
|
|
|
2015-11-23 13:32:03 +08:00
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
2016-04-26 22:54:23 +08:00
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2015-11-23 13:32:03 +08:00
|
|
|
C->setVarRefs(Vars);
|
2016-04-26 22:54:23 +08:00
|
|
|
|
|
|
|
SmallVector<ValueDecl *, 16> Decls;
|
|
|
|
Decls.reserve(UniqueDecls);
|
|
|
|
for (unsigned i = 0; i < UniqueDecls; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Decls.push_back(Reader->Record.ReadDeclAs<ValueDecl>(Idx));
|
2016-04-26 22:54:23 +08:00
|
|
|
C->setUniqueDecls(Decls);
|
|
|
|
|
|
|
|
SmallVector<unsigned, 16> ListsPerDecl;
|
|
|
|
ListsPerDecl.reserve(UniqueDecls);
|
|
|
|
for (unsigned i = 0; i < UniqueDecls; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
ListsPerDecl.push_back(Reader->Record[Idx++]);
|
2016-04-26 22:54:23 +08:00
|
|
|
C->setDeclNumLists(ListsPerDecl);
|
|
|
|
|
|
|
|
SmallVector<unsigned, 32> ListSizes;
|
|
|
|
ListSizes.reserve(TotalLists);
|
|
|
|
for (unsigned i = 0; i < TotalLists; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
ListSizes.push_back(Reader->Record[Idx++]);
|
2016-04-26 22:54:23 +08:00
|
|
|
C->setComponentListSizes(ListSizes);
|
|
|
|
|
|
|
|
SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
|
|
|
|
Components.reserve(TotalComponents);
|
|
|
|
for (unsigned i = 0; i < TotalComponents; ++i) {
|
2016-12-16 04:53:26 +08:00
|
|
|
Expr *AssociatedExpr = Reader->Record.ReadSubExpr();
|
|
|
|
ValueDecl *AssociatedDecl = Reader->Record.ReadDeclAs<ValueDecl>(Idx);
|
2016-04-26 22:54:23 +08:00
|
|
|
Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
|
|
|
|
AssociatedExpr, AssociatedDecl));
|
|
|
|
}
|
|
|
|
C->setComponents(Components, ListSizes);
|
2015-11-23 13:32:03 +08:00
|
|
|
}
|
|
|
|
|
2015-11-25 04:50:12 +08:00
|
|
|
void OMPClauseReader::VisitOMPNumTeamsClause(OMPNumTeamsClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setNumTeams(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2015-11-25 04:50:12 +08:00
|
|
|
}
|
|
|
|
|
2015-11-28 02:47:36 +08:00
|
|
|
void OMPClauseReader::VisitOMPThreadLimitClause(OMPThreadLimitClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setThreadLimit(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2015-11-28 02:47:36 +08:00
|
|
|
}
|
|
|
|
|
2015-12-01 18:17:31 +08:00
|
|
|
void OMPClauseReader::VisitOMPPriorityClause(OMPPriorityClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setPriority(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2015-12-01 18:17:31 +08:00
|
|
|
}
|
|
|
|
|
2015-12-07 20:52:51 +08:00
|
|
|
void OMPClauseReader::VisitOMPGrainsizeClause(OMPGrainsizeClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setGrainsize(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2015-12-07 20:52:51 +08:00
|
|
|
}
|
|
|
|
|
2015-12-08 20:06:20 +08:00
|
|
|
void OMPClauseReader::VisitOMPNumTasksClause(OMPNumTasksClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setNumTasks(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2015-12-08 20:06:20 +08:00
|
|
|
}
|
|
|
|
|
2015-12-15 16:19:24 +08:00
|
|
|
void OMPClauseReader::VisitOMPHintClause(OMPHintClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setHint(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2015-12-15 16:19:24 +08:00
|
|
|
}
|
|
|
|
|
2016-01-16 02:50:31 +08:00
|
|
|
void OMPClauseReader::VisitOMPDistScheduleClause(OMPDistScheduleClause *C) {
|
2016-02-16 19:18:12 +08:00
|
|
|
VisitOMPClauseWithPreInit(C);
|
2016-01-16 02:50:31 +08:00
|
|
|
C->setDistScheduleKind(
|
2016-12-16 04:53:26 +08:00
|
|
|
static_cast<OpenMPDistScheduleClauseKind>(Reader->Record[Idx++]));
|
|
|
|
C->setChunkSize(Reader->Record.ReadSubExpr());
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setDistScheduleKindLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setCommaLoc(Reader->ReadSourceLocation());
|
2016-01-16 02:50:31 +08:00
|
|
|
}
|
|
|
|
|
2016-01-27 00:37:23 +08:00
|
|
|
void OMPClauseReader::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) {
|
|
|
|
C->setDefaultmapKind(
|
2016-12-16 04:53:26 +08:00
|
|
|
static_cast<OpenMPDefaultmapClauseKind>(Reader->Record[Idx++]));
|
2016-01-27 00:37:23 +08:00
|
|
|
C->setDefaultmapModifier(
|
2016-12-16 04:53:26 +08:00
|
|
|
static_cast<OpenMPDefaultmapClauseModifier>(Reader->Record[Idx++]));
|
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setDefaultmapModifierLoc(Reader->ReadSourceLocation());
|
|
|
|
C->setDefaultmapKindLoc(Reader->ReadSourceLocation());
|
2016-01-27 00:37:23 +08:00
|
|
|
}
|
|
|
|
|
2016-05-27 01:39:58 +08:00
|
|
|
void OMPClauseReader::VisitOMPToClause(OMPToClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2016-05-27 01:39:58 +08:00
|
|
|
auto NumVars = C->varlist_size();
|
|
|
|
auto UniqueDecls = C->getUniqueDeclarationsNum();
|
|
|
|
auto TotalLists = C->getTotalComponentListNum();
|
|
|
|
auto TotalComponents = C->getTotalComponentsNum();
|
|
|
|
|
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2016-05-27 01:39:58 +08:00
|
|
|
C->setVarRefs(Vars);
|
|
|
|
|
|
|
|
SmallVector<ValueDecl *, 16> Decls;
|
|
|
|
Decls.reserve(UniqueDecls);
|
|
|
|
for (unsigned i = 0; i < UniqueDecls; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Decls.push_back(Reader->Record.ReadDeclAs<ValueDecl>(Idx));
|
2016-05-27 01:39:58 +08:00
|
|
|
C->setUniqueDecls(Decls);
|
|
|
|
|
2016-05-27 01:49:04 +08:00
|
|
|
SmallVector<unsigned, 16> ListsPerDecl;
|
|
|
|
ListsPerDecl.reserve(UniqueDecls);
|
|
|
|
for (unsigned i = 0; i < UniqueDecls; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
ListsPerDecl.push_back(Reader->Record[Idx++]);
|
2016-05-27 01:49:04 +08:00
|
|
|
C->setDeclNumLists(ListsPerDecl);
|
|
|
|
|
|
|
|
SmallVector<unsigned, 32> ListSizes;
|
|
|
|
ListSizes.reserve(TotalLists);
|
|
|
|
for (unsigned i = 0; i < TotalLists; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
ListSizes.push_back(Reader->Record[Idx++]);
|
2016-05-27 01:49:04 +08:00
|
|
|
C->setComponentListSizes(ListSizes);
|
|
|
|
|
|
|
|
SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
|
|
|
|
Components.reserve(TotalComponents);
|
|
|
|
for (unsigned i = 0; i < TotalComponents; ++i) {
|
2016-12-16 04:53:26 +08:00
|
|
|
Expr *AssociatedExpr = Reader->Record.ReadSubExpr();
|
|
|
|
ValueDecl *AssociatedDecl = Reader->Record.ReadDeclAs<ValueDecl>(Idx);
|
2016-05-27 01:49:04 +08:00
|
|
|
Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
|
|
|
|
AssociatedExpr, AssociatedDecl));
|
|
|
|
}
|
|
|
|
C->setComponents(Components, ListSizes);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OMPClauseReader::VisitOMPFromClause(OMPFromClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2016-05-27 01:49:04 +08:00
|
|
|
auto NumVars = C->varlist_size();
|
|
|
|
auto UniqueDecls = C->getUniqueDeclarationsNum();
|
|
|
|
auto TotalLists = C->getTotalComponentListNum();
|
|
|
|
auto TotalComponents = C->getTotalComponentsNum();
|
|
|
|
|
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2016-05-27 01:49:04 +08:00
|
|
|
C->setVarRefs(Vars);
|
|
|
|
|
|
|
|
SmallVector<ValueDecl *, 16> Decls;
|
|
|
|
Decls.reserve(UniqueDecls);
|
|
|
|
for (unsigned i = 0; i < UniqueDecls; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Decls.push_back(Reader->Record.ReadDeclAs<ValueDecl>(Idx));
|
2016-05-27 01:49:04 +08:00
|
|
|
C->setUniqueDecls(Decls);
|
|
|
|
|
2016-05-27 01:39:58 +08:00
|
|
|
SmallVector<unsigned, 16> ListsPerDecl;
|
|
|
|
ListsPerDecl.reserve(UniqueDecls);
|
|
|
|
for (unsigned i = 0; i < UniqueDecls; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
ListsPerDecl.push_back(Reader->Record[Idx++]);
|
2016-05-27 01:39:58 +08:00
|
|
|
C->setDeclNumLists(ListsPerDecl);
|
|
|
|
|
|
|
|
SmallVector<unsigned, 32> ListSizes;
|
|
|
|
ListSizes.reserve(TotalLists);
|
|
|
|
for (unsigned i = 0; i < TotalLists; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
ListSizes.push_back(Reader->Record[Idx++]);
|
2016-05-27 01:39:58 +08:00
|
|
|
C->setComponentListSizes(ListSizes);
|
|
|
|
|
|
|
|
SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
|
|
|
|
Components.reserve(TotalComponents);
|
|
|
|
for (unsigned i = 0; i < TotalComponents; ++i) {
|
2016-12-16 04:53:26 +08:00
|
|
|
Expr *AssociatedExpr = Reader->Record.ReadSubExpr();
|
|
|
|
ValueDecl *AssociatedDecl = Reader->Record.ReadDeclAs<ValueDecl>(Idx);
|
2016-05-27 01:39:58 +08:00
|
|
|
Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
|
|
|
|
AssociatedExpr, AssociatedDecl));
|
|
|
|
}
|
|
|
|
C->setComponents(Components, ListSizes);
|
|
|
|
}
|
|
|
|
|
2016-07-13 23:37:16 +08:00
|
|
|
void OMPClauseReader::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2016-07-28 22:23:26 +08:00
|
|
|
auto NumVars = C->varlist_size();
|
|
|
|
auto UniqueDecls = C->getUniqueDeclarationsNum();
|
|
|
|
auto TotalLists = C->getTotalComponentListNum();
|
|
|
|
auto TotalComponents = C->getTotalComponentsNum();
|
|
|
|
|
2016-07-13 23:37:16 +08:00
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2016-07-13 23:37:16 +08:00
|
|
|
C->setVarRefs(Vars);
|
|
|
|
Vars.clear();
|
2016-07-28 22:23:26 +08:00
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2016-07-28 22:23:26 +08:00
|
|
|
C->setPrivateCopies(Vars);
|
|
|
|
Vars.clear();
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2016-07-28 22:23:26 +08:00
|
|
|
C->setInits(Vars);
|
|
|
|
|
|
|
|
SmallVector<ValueDecl *, 16> Decls;
|
|
|
|
Decls.reserve(UniqueDecls);
|
|
|
|
for (unsigned i = 0; i < UniqueDecls; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Decls.push_back(Reader->Record.ReadDeclAs<ValueDecl>(Idx));
|
2016-07-28 22:23:26 +08:00
|
|
|
C->setUniqueDecls(Decls);
|
|
|
|
|
|
|
|
SmallVector<unsigned, 16> ListsPerDecl;
|
|
|
|
ListsPerDecl.reserve(UniqueDecls);
|
|
|
|
for (unsigned i = 0; i < UniqueDecls; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
ListsPerDecl.push_back(Reader->Record[Idx++]);
|
2016-07-28 22:23:26 +08:00
|
|
|
C->setDeclNumLists(ListsPerDecl);
|
|
|
|
|
|
|
|
SmallVector<unsigned, 32> ListSizes;
|
|
|
|
ListSizes.reserve(TotalLists);
|
|
|
|
for (unsigned i = 0; i < TotalLists; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
ListSizes.push_back(Reader->Record[Idx++]);
|
2016-07-28 22:23:26 +08:00
|
|
|
C->setComponentListSizes(ListSizes);
|
|
|
|
|
|
|
|
SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
|
|
|
|
Components.reserve(TotalComponents);
|
|
|
|
for (unsigned i = 0; i < TotalComponents; ++i) {
|
2016-12-16 04:53:26 +08:00
|
|
|
Expr *AssociatedExpr = Reader->Record.ReadSubExpr();
|
|
|
|
ValueDecl *AssociatedDecl = Reader->Record.ReadDeclAs<ValueDecl>(Idx);
|
2016-07-28 22:23:26 +08:00
|
|
|
Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
|
|
|
|
AssociatedExpr, AssociatedDecl));
|
|
|
|
}
|
|
|
|
C->setComponents(Components, ListSizes);
|
2016-07-13 23:37:16 +08:00
|
|
|
}
|
|
|
|
|
2016-07-14 01:16:49 +08:00
|
|
|
void OMPClauseReader::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) {
|
2016-12-16 04:53:26 +08:00
|
|
|
C->setLParenLoc(Reader->ReadSourceLocation());
|
2016-07-28 22:25:09 +08:00
|
|
|
auto NumVars = C->varlist_size();
|
|
|
|
auto UniqueDecls = C->getUniqueDeclarationsNum();
|
|
|
|
auto TotalLists = C->getTotalComponentListNum();
|
|
|
|
auto TotalComponents = C->getTotalComponentsNum();
|
|
|
|
|
2016-07-14 01:16:49 +08:00
|
|
|
SmallVector<Expr *, 16> Vars;
|
|
|
|
Vars.reserve(NumVars);
|
|
|
|
for (unsigned i = 0; i != NumVars; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Vars.push_back(Reader->Record.ReadSubExpr());
|
2016-07-14 01:16:49 +08:00
|
|
|
C->setVarRefs(Vars);
|
|
|
|
Vars.clear();
|
2016-07-28 22:25:09 +08:00
|
|
|
|
|
|
|
SmallVector<ValueDecl *, 16> Decls;
|
|
|
|
Decls.reserve(UniqueDecls);
|
|
|
|
for (unsigned i = 0; i < UniqueDecls; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Decls.push_back(Reader->Record.ReadDeclAs<ValueDecl>(Idx));
|
2016-07-28 22:25:09 +08:00
|
|
|
C->setUniqueDecls(Decls);
|
|
|
|
|
|
|
|
SmallVector<unsigned, 16> ListsPerDecl;
|
|
|
|
ListsPerDecl.reserve(UniqueDecls);
|
|
|
|
for (unsigned i = 0; i < UniqueDecls; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
ListsPerDecl.push_back(Reader->Record[Idx++]);
|
2016-07-28 22:25:09 +08:00
|
|
|
C->setDeclNumLists(ListsPerDecl);
|
|
|
|
|
|
|
|
SmallVector<unsigned, 32> ListSizes;
|
|
|
|
ListSizes.reserve(TotalLists);
|
|
|
|
for (unsigned i = 0; i < TotalLists; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
ListSizes.push_back(Reader->Record[Idx++]);
|
2016-07-28 22:25:09 +08:00
|
|
|
C->setComponentListSizes(ListSizes);
|
|
|
|
|
|
|
|
SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
|
|
|
|
Components.reserve(TotalComponents);
|
|
|
|
for (unsigned i = 0; i < TotalComponents; ++i) {
|
2016-12-16 04:53:26 +08:00
|
|
|
Expr *AssociatedExpr = Reader->Record.ReadSubExpr();
|
|
|
|
ValueDecl *AssociatedDecl = Reader->Record.ReadDeclAs<ValueDecl>(Idx);
|
2016-07-28 22:25:09 +08:00
|
|
|
Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
|
|
|
|
AssociatedExpr, AssociatedDecl));
|
|
|
|
}
|
|
|
|
C->setComponents(Components, ListSizes);
|
2016-07-14 01:16:49 +08:00
|
|
|
}
|
|
|
|
|
2013-07-19 11:13:43 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// OpenMP Directives.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setLocStart(ReadSourceLocation());
|
|
|
|
E->setLocEnd(ReadSourceLocation());
|
|
|
|
OMPClauseReader ClauseReader(this, Record, Idx);
|
2013-07-19 11:13:43 +08:00
|
|
|
SmallVector<OMPClause *, 5> Clauses;
|
|
|
|
for (unsigned i = 0; i < E->getNumClauses(); ++i)
|
|
|
|
Clauses.push_back(ClauseReader.readClause());
|
|
|
|
E->setClauses(Clauses);
|
2014-07-18 15:47:19 +08:00
|
|
|
if (E->hasAssociatedStmt())
|
2016-12-16 04:53:26 +08:00
|
|
|
E->setAssociatedStmt(Record.ReadSubStmt());
|
2013-07-19 11:13:43 +08:00
|
|
|
}
|
|
|
|
|
2014-08-19 19:27:13 +08:00
|
|
|
void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
// Two fields (NumClauses and CollapsedNum) were read in ReadStmtFromStream.
|
|
|
|
Idx += 2;
|
|
|
|
VisitOMPExecutableDirective(D);
|
2016-12-16 04:53:26 +08:00
|
|
|
D->setIterationVariable(Record.ReadSubExpr());
|
|
|
|
D->setLastIteration(Record.ReadSubExpr());
|
|
|
|
D->setCalcLastIteration(Record.ReadSubExpr());
|
|
|
|
D->setPreCond(Record.ReadSubExpr());
|
|
|
|
D->setCond(Record.ReadSubExpr());
|
|
|
|
D->setInit(Record.ReadSubExpr());
|
|
|
|
D->setInc(Record.ReadSubExpr());
|
|
|
|
D->setPreInits(Record.ReadSubStmt());
|
2016-02-16 19:18:12 +08:00
|
|
|
if (isOpenMPWorksharingDirective(D->getDirectiveKind()) ||
|
2016-03-08 00:04:49 +08:00
|
|
|
isOpenMPTaskLoopDirective(D->getDirectiveKind()) ||
|
|
|
|
isOpenMPDistributeDirective(D->getDirectiveKind())) {
|
2016-12-16 04:53:26 +08:00
|
|
|
D->setIsLastIterVariable(Record.ReadSubExpr());
|
|
|
|
D->setLowerBoundVariable(Record.ReadSubExpr());
|
|
|
|
D->setUpperBoundVariable(Record.ReadSubExpr());
|
|
|
|
D->setStrideVariable(Record.ReadSubExpr());
|
|
|
|
D->setEnsureUpperBound(Record.ReadSubExpr());
|
|
|
|
D->setNextLowerBound(Record.ReadSubExpr());
|
|
|
|
D->setNextUpperBound(Record.ReadSubExpr());
|
|
|
|
D->setNumIterations(Record.ReadSubExpr());
|
2014-12-15 15:07:06 +08:00
|
|
|
}
|
2016-06-27 22:55:37 +08:00
|
|
|
if (isOpenMPLoopBoundSharingDirective(D->getDirectiveKind())) {
|
2016-12-16 04:53:26 +08:00
|
|
|
D->setPrevLowerBoundVariable(Record.ReadSubExpr());
|
|
|
|
D->setPrevUpperBoundVariable(Record.ReadSubExpr());
|
2016-06-27 22:55:37 +08:00
|
|
|
}
|
2014-10-01 14:03:56 +08:00
|
|
|
SmallVector<Expr *, 4> Sub;
|
|
|
|
unsigned CollapsedNum = D->getCollapsedNumber();
|
|
|
|
Sub.reserve(CollapsedNum);
|
|
|
|
for (unsigned i = 0; i < CollapsedNum; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Sub.push_back(Record.ReadSubExpr());
|
2014-10-01 14:03:56 +08:00
|
|
|
D->setCounters(Sub);
|
|
|
|
Sub.clear();
|
2015-08-06 20:30:57 +08:00
|
|
|
for (unsigned i = 0; i < CollapsedNum; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Sub.push_back(Record.ReadSubExpr());
|
2015-08-06 20:30:57 +08:00
|
|
|
D->setPrivateCounters(Sub);
|
|
|
|
Sub.clear();
|
2015-08-14 20:25:37 +08:00
|
|
|
for (unsigned i = 0; i < CollapsedNum; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Sub.push_back(Record.ReadSubExpr());
|
2015-08-14 20:25:37 +08:00
|
|
|
D->setInits(Sub);
|
|
|
|
Sub.clear();
|
2014-10-01 14:03:56 +08:00
|
|
|
for (unsigned i = 0; i < CollapsedNum; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Sub.push_back(Record.ReadSubExpr());
|
2014-10-01 14:03:56 +08:00
|
|
|
D->setUpdates(Sub);
|
|
|
|
Sub.clear();
|
|
|
|
for (unsigned i = 0; i < CollapsedNum; ++i)
|
2016-12-16 04:53:26 +08:00
|
|
|
Sub.push_back(Record.ReadSubExpr());
|
2014-10-01 14:03:56 +08:00
|
|
|
D->setFinals(Sub);
|
2014-08-19 19:27:13 +08:00
|
|
|
}
|
|
|
|
|
2013-07-19 11:13:43 +08:00
|
|
|
void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
|
2014-02-27 16:29:12 +08:00
|
|
|
VisitStmt(D);
|
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
2015-09-15 20:52:43 +08:00
|
|
|
D->setHasCancel(Record[Idx++]);
|
2014-02-27 16:29:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
|
2014-08-19 19:27:13 +08:00
|
|
|
VisitOMPLoopDirective(D);
|
2013-07-19 11:13:43 +08:00
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:57 +08:00
|
|
|
void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
|
2014-08-19 19:27:13 +08:00
|
|
|
VisitOMPLoopDirective(D);
|
2015-09-15 20:52:43 +08:00
|
|
|
D->setHasCancel(Record[Idx++]);
|
2014-06-18 12:14:57 +08:00
|
|
|
}
|
|
|
|
|
2014-09-18 13:12:34 +08:00
|
|
|
void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2014-06-25 19:44:49 +08:00
|
|
|
void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
2015-09-15 20:52:43 +08:00
|
|
|
D->setHasCancel(Record[Idx++]);
|
2014-06-25 19:44:49 +08:00
|
|
|
}
|
|
|
|
|
2014-06-26 16:21:58 +08:00
|
|
|
void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
VisitOMPExecutableDirective(D);
|
2015-09-15 20:52:43 +08:00
|
|
|
D->setHasCancel(Record[Idx++]);
|
2014-06-26 16:21:58 +08:00
|
|
|
}
|
|
|
|
|
2014-06-26 20:05:45 +08:00
|
|
|
void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2014-07-17 16:54:58 +08:00
|
|
|
void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2014-07-21 17:42:05 +08:00
|
|
|
void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
|
|
|
|
VisitStmt(D);
|
2015-12-15 16:19:24 +08:00
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
2014-07-21 17:42:05 +08:00
|
|
|
VisitOMPExecutableDirective(D);
|
2016-12-16 04:53:26 +08:00
|
|
|
ReadDeclarationNameInfo(D->DirName);
|
2014-07-21 17:42:05 +08:00
|
|
|
}
|
|
|
|
|
2014-07-07 21:01:15 +08:00
|
|
|
void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
|
2014-08-19 19:27:13 +08:00
|
|
|
VisitOMPLoopDirective(D);
|
2015-09-15 20:52:43 +08:00
|
|
|
D->setHasCancel(Record[Idx++]);
|
2014-07-07 21:01:15 +08:00
|
|
|
}
|
|
|
|
|
2014-09-23 17:33:00 +08:00
|
|
|
void ASTStmtReader::VisitOMPParallelForSimdDirective(
|
|
|
|
OMPParallelForSimdDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2014-07-08 16:12:03 +08:00
|
|
|
void ASTStmtReader::VisitOMPParallelSectionsDirective(
|
|
|
|
OMPParallelSectionsDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
2015-09-15 20:52:43 +08:00
|
|
|
D->setHasCancel(Record[Idx++]);
|
2014-07-08 16:12:03 +08:00
|
|
|
}
|
|
|
|
|
2014-07-11 19:25:16 +08:00
|
|
|
void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
2015-09-15 20:52:43 +08:00
|
|
|
D->setHasCancel(Record[Idx++]);
|
2014-07-11 19:25:16 +08:00
|
|
|
}
|
|
|
|
|
2014-07-18 15:47:19 +08:00
|
|
|
void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2014-07-18 17:11:51 +08:00
|
|
|
void ASTStmtReader::VisitOMPBarrierDirective(OMPBarrierDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2014-07-18 18:17:07 +08:00
|
|
|
void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2015-06-18 20:14:09 +08:00
|
|
|
void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2014-07-21 19:26:11 +08:00
|
|
|
void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2014-07-22 14:45:04 +08:00
|
|
|
void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
|
|
|
|
VisitStmt(D);
|
2015-09-25 18:37:12 +08:00
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
2014-07-22 14:45:04 +08:00
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2014-07-22 18:10:35 +08:00
|
|
|
void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
2016-12-16 04:53:26 +08:00
|
|
|
D->setX(Record.ReadSubExpr());
|
|
|
|
D->setV(Record.ReadSubExpr());
|
|
|
|
D->setExpr(Record.ReadSubExpr());
|
|
|
|
D->setUpdateExpr(Record.ReadSubExpr());
|
2015-03-30 13:20:59 +08:00
|
|
|
D->IsXLHSInRHSPart = Record[Idx++] != 0;
|
2015-04-01 11:33:17 +08:00
|
|
|
D->IsPostfixUpdate = Record[Idx++] != 0;
|
2014-07-22 18:10:35 +08:00
|
|
|
}
|
|
|
|
|
2014-09-19 16:19:49 +08:00
|
|
|
void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2015-07-21 21:44:28 +08:00
|
|
|
void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-01-20 03:15:56 +08:00
|
|
|
void ASTStmtReader::VisitOMPTargetEnterDataDirective(
|
|
|
|
OMPTargetEnterDataDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-01-20 04:04:50 +08:00
|
|
|
void ASTStmtReader::VisitOMPTargetExitDataDirective(
|
|
|
|
OMPTargetExitDataDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-01-27 02:48:41 +08:00
|
|
|
void ASTStmtReader::VisitOMPTargetParallelDirective(
|
|
|
|
OMPTargetParallelDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-02-03 23:46:42 +08:00
|
|
|
void ASTStmtReader::VisitOMPTargetParallelForDirective(
|
|
|
|
OMPTargetParallelForDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
D->setHasCancel(Record[Idx++]);
|
|
|
|
}
|
|
|
|
|
2014-10-09 12:18:56 +08:00
|
|
|
void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
|
|
|
|
2015-07-01 14:57:41 +08:00
|
|
|
void ASTStmtReader::VisitOMPCancellationPointDirective(
|
|
|
|
OMPCancellationPointDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record[Idx++]));
|
|
|
|
}
|
|
|
|
|
2015-07-02 19:25:17 +08:00
|
|
|
void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
|
|
|
|
VisitStmt(D);
|
2015-09-18 16:07:34 +08:00
|
|
|
// The NumClauses field was read in ReadStmtFromStream.
|
|
|
|
++Idx;
|
2015-07-02 19:25:17 +08:00
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record[Idx++]));
|
|
|
|
}
|
|
|
|
|
2015-12-01 12:18:41 +08:00
|
|
|
void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2015-12-03 17:40:15 +08:00
|
|
|
void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2015-12-14 22:51:25 +08:00
|
|
|
void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-05-27 01:30:50 +08:00
|
|
|
void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
|
|
|
|
VisitStmt(D);
|
|
|
|
++Idx;
|
|
|
|
VisitOMPExecutableDirective(D);
|
|
|
|
}
|
2016-06-27 22:55:37 +08:00
|
|
|
void ASTStmtReader::VisitOMPDistributeParallelForDirective(
|
|
|
|
OMPDistributeParallelForDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
2016-05-27 01:30:50 +08:00
|
|
|
|
2016-07-05 13:00:15 +08:00
|
|
|
void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
|
|
|
|
OMPDistributeParallelForSimdDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-07-06 12:45:38 +08:00
|
|
|
void ASTStmtReader::VisitOMPDistributeSimdDirective(
|
|
|
|
OMPDistributeSimdDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-07-14 10:54:56 +08:00
|
|
|
void ASTStmtReader::VisitOMPTargetParallelForSimdDirective(
|
|
|
|
OMPTargetParallelForSimdDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-07-21 06:57:10 +08:00
|
|
|
void ASTStmtReader::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-08-05 22:37:37 +08:00
|
|
|
void ASTStmtReader::VisitOMPTeamsDistributeDirective(
|
|
|
|
OMPTeamsDistributeDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-10-25 20:50:55 +08:00
|
|
|
void ASTStmtReader::VisitOMPTeamsDistributeSimdDirective(
|
|
|
|
OMPTeamsDistributeSimdDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-12-01 07:51:03 +08:00
|
|
|
void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
|
|
|
|
OMPTeamsDistributeParallelForSimdDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2016-12-09 11:24:30 +08:00
|
|
|
void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
|
|
|
|
OMPTeamsDistributeParallelForDirective *D) {
|
|
|
|
VisitOMPLoopDirective(D);
|
|
|
|
}
|
|
|
|
|
2011-07-15 15:00:14 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ASTReader Implementation
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-12-01 07:21:26 +08:00
|
|
|
Stmt *ASTReader::ReadStmt(ModuleFile &F) {
|
2010-06-29 06:28:35 +08:00
|
|
|
switch (ReadingKind) {
|
2013-07-31 08:26:46 +08:00
|
|
|
case Read_None:
|
|
|
|
llvm_unreachable("should not call this when not reading anything");
|
2010-06-29 06:28:35 +08:00
|
|
|
case Read_Decl:
|
|
|
|
case Read_Type:
|
2010-10-05 23:59:54 +08:00
|
|
|
return ReadStmtFromStream(F);
|
2010-06-29 06:28:35 +08:00
|
|
|
case Read_Stmt:
|
2010-06-30 06:46:25 +08:00
|
|
|
return ReadSubStmt();
|
2010-06-29 06:28:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
llvm_unreachable("ReadingKind not set ?");
|
|
|
|
}
|
|
|
|
|
2011-12-01 07:21:26 +08:00
|
|
|
Expr *ASTReader::ReadExpr(ModuleFile &F) {
|
2010-10-05 23:59:54 +08:00
|
|
|
return cast_or_null<Expr>(ReadStmt(F));
|
2010-06-29 06:28:35 +08:00
|
|
|
}
|
2010-05-09 14:40:08 +08:00
|
|
|
|
2010-08-19 07:56:43 +08:00
|
|
|
Expr *ASTReader::ReadSubExpr() {
|
2010-06-30 06:46:25 +08:00
|
|
|
return cast_or_null<Expr>(ReadSubStmt());
|
|
|
|
}
|
|
|
|
|
2009-04-27 13:41:06 +08:00
|
|
|
// Within the bitstream, expressions are stored in Reverse Polish
|
|
|
|
// Notation, with each of the subexpressions preceding the
|
2010-06-29 06:28:35 +08:00
|
|
|
// expression they are stored in. Subexpressions are stored from last to first.
|
|
|
|
// To evaluate expressions, we continue reading expressions and placing them on
|
|
|
|
// the stack, with expressions having operands removing those operands from the
|
2009-04-27 13:41:06 +08:00
|
|
|
// stack. Evaluation terminates when we see a STMT_STOP record, and
|
|
|
|
// the single remaining expression on the stack is our result.
|
2011-12-01 07:21:26 +08:00
|
|
|
Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
2010-06-29 06:28:35 +08:00
|
|
|
|
|
|
|
ReadingKindTracker ReadingKind(Read_Stmt, *this);
|
2010-10-05 23:59:54 +08:00
|
|
|
llvm::BitstreamCursor &Cursor = F.DeclsCursor;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2011-10-22 07:02:28 +08:00
|
|
|
// Map of offset to previously deserialized stmt. The offset points
|
|
|
|
/// just after the stmt record.
|
|
|
|
llvm::DenseMap<uint64_t, Stmt *> StmtEntries;
|
2010-10-05 23:59:54 +08:00
|
|
|
|
2010-06-29 06:28:35 +08:00
|
|
|
#ifndef NDEBUG
|
|
|
|
unsigned PrevNumStmts = StmtStack.size();
|
|
|
|
#endif
|
|
|
|
|
2009-04-27 13:14:47 +08:00
|
|
|
RecordData Record;
|
|
|
|
unsigned Idx;
|
2010-10-05 23:59:54 +08:00
|
|
|
ASTStmtReader Reader(*this, F, Cursor, Record, Idx);
|
2009-04-27 13:14:47 +08:00
|
|
|
Stmt::EmptyShell Empty;
|
|
|
|
|
|
|
|
while (true) {
|
2013-01-20 10:38:54 +08:00
|
|
|
llvm::BitstreamEntry Entry = Cursor.advanceSkippingSubblocks();
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2013-01-20 10:38:54 +08:00
|
|
|
switch (Entry.Kind) {
|
|
|
|
case llvm::BitstreamEntry::SubBlock: // Handled for us already.
|
|
|
|
case llvm::BitstreamEntry::Error:
|
|
|
|
Error("malformed block record in AST file");
|
2014-05-22 13:54:18 +08:00
|
|
|
return nullptr;
|
2013-01-20 10:38:54 +08:00
|
|
|
case llvm::BitstreamEntry::EndBlock:
|
|
|
|
goto Done;
|
|
|
|
case llvm::BitstreamEntry::Record:
|
|
|
|
// The interesting case.
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-05-22 13:54:18 +08:00
|
|
|
Stmt *S = nullptr;
|
2009-04-27 13:14:47 +08:00
|
|
|
Idx = 0;
|
|
|
|
Record.clear();
|
|
|
|
bool Finished = false;
|
2011-10-22 07:02:28 +08:00
|
|
|
bool IsStmtReference = false;
|
2013-01-20 10:38:54 +08:00
|
|
|
switch ((StmtCode)Cursor.readRecord(Entry.ID, Record)) {
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_STOP:
|
2009-04-27 13:14:47 +08:00
|
|
|
Finished = true;
|
|
|
|
break;
|
|
|
|
|
2011-10-22 07:02:28 +08:00
|
|
|
case STMT_REF_PTR:
|
|
|
|
IsStmtReference = true;
|
|
|
|
assert(StmtEntries.find(Record[0]) != StmtEntries.end() &&
|
|
|
|
"No stmt was recorded for this offset reference!");
|
|
|
|
S = StmtEntries[Record[Idx++]];
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_NULL_PTR:
|
2014-05-22 13:54:18 +08:00
|
|
|
S = nullptr;
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_NULL:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) NullStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_COMPOUND:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) CompoundStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_CASE:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) CaseStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_DEFAULT:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) DefaultStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_LABEL:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) LabelStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2012-04-14 08:33:13 +08:00
|
|
|
case STMT_ATTRIBUTED:
|
2012-07-09 18:04:07 +08:00
|
|
|
S = AttributedStmt::CreateEmpty(
|
|
|
|
Context,
|
|
|
|
/*NumAttrs*/Record[ASTStmtReader::NumStmtFields]);
|
2012-04-14 08:33:13 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_IF:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) IfStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_SWITCH:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) SwitchStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_WHILE:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) WhileStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_DO:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) DoStmt(Empty);
|
|
|
|
break;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_FOR:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ForStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_GOTO:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) GotoStmt(Empty);
|
|
|
|
break;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_INDIRECT_GOTO:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) IndirectGotoStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_CONTINUE:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ContinueStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_BREAK:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) BreakStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_RETURN:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ReturnStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_DECL:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) DeclStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2012-08-25 08:11:56 +08:00
|
|
|
case STMT_GCCASM:
|
|
|
|
S = new (Context) GCCAsmStmt(Empty);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
|
|
|
|
2012-08-25 07:51:02 +08:00
|
|
|
case STMT_MSASM:
|
|
|
|
S = new (Context) MSAsmStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2013-04-17 02:53:08 +08:00
|
|
|
case STMT_CAPTURED:
|
2013-05-04 03:20:19 +08:00
|
|
|
S = CapturedStmt::CreateDeserialized(Context,
|
2013-07-19 11:13:43 +08:00
|
|
|
Record[ASTStmtReader::NumStmtFields]);
|
2013-04-17 02:53:08 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_PREDEFINED:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) PredefinedExpr(Empty);
|
|
|
|
break;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_DECL_REF:
|
Add an optional field attached to a DeclRefExpr which points back to the
Decl actually found via name lookup & overload resolution when that Decl
is different from the ValueDecl which is actually referenced by the
expression.
This can be used by AST consumers to correctly attribute references to
the spelling location of a using declaration, and otherwise gain insight
into the name resolution performed by Clang.
The public interface to DRE is kept as narrow as possible: we provide
a getFoundDecl() which always returns a NamedDecl, either the ValueDecl
referenced or the new, more precise NamedDecl if present. This way AST
clients can code against getFoundDecl without know when exactly the AST
has a split representation.
For an example of the data this provides consider:
% cat x.cc
namespace N1 {
struct S {};
void f(const S&);
}
void test(N1::S s) {
f(s);
using N1::f;
f(s);
}
% ./bin/clang -fsyntax-only -Xclang -ast-dump x.cc
[...]
void test(N1::S s) (CompoundStmt 0x5b02010 <x.cc:5:20, line:9:1>
(CallExpr 0x5b01df0 <line:6:3, col:6> 'void'
(ImplicitCastExpr 0x5b01dd8 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01d80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)'))
(ImplicitCastExpr 0x5b01e20 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01d58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S')))
(DeclStmt 0x5b01ee0 <line:7:3, col:14>
0x5b01e40 "UsingN1::;")
(CallExpr 0x5b01fc8 <line:8:3, col:6> 'void'
(ImplicitCastExpr 0x5b01fb0 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01f80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)' (UsingShadow 0x5b01ea0 'f')))
(ImplicitCastExpr 0x5b01ff8 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01f58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S'))))
Now we can tell that the second call is 'using' (no pun intended) the using
declaration, and *which* using declaration it sees. Without this, we can
mistake calls that go through using declarations for ADL calls, and have no way
to attribute names looked up with using declarations to the appropriate
UsingDecl.
llvm-svn: 130670
2011-05-02 07:48:14 +08:00
|
|
|
S = DeclRefExpr::CreateEmpty(
|
2011-09-10 05:34:22 +08:00
|
|
|
Context,
|
Add an optional field attached to a DeclRefExpr which points back to the
Decl actually found via name lookup & overload resolution when that Decl
is different from the ValueDecl which is actually referenced by the
expression.
This can be used by AST consumers to correctly attribute references to
the spelling location of a using declaration, and otherwise gain insight
into the name resolution performed by Clang.
The public interface to DRE is kept as narrow as possible: we provide
a getFoundDecl() which always returns a NamedDecl, either the ValueDecl
referenced or the new, more precise NamedDecl if present. This way AST
clients can code against getFoundDecl without know when exactly the AST
has a split representation.
For an example of the data this provides consider:
% cat x.cc
namespace N1 {
struct S {};
void f(const S&);
}
void test(N1::S s) {
f(s);
using N1::f;
f(s);
}
% ./bin/clang -fsyntax-only -Xclang -ast-dump x.cc
[...]
void test(N1::S s) (CompoundStmt 0x5b02010 <x.cc:5:20, line:9:1>
(CallExpr 0x5b01df0 <line:6:3, col:6> 'void'
(ImplicitCastExpr 0x5b01dd8 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01d80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)'))
(ImplicitCastExpr 0x5b01e20 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01d58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S')))
(DeclStmt 0x5b01ee0 <line:7:3, col:14>
0x5b01e40 "UsingN1::;")
(CallExpr 0x5b01fc8 <line:8:3, col:6> 'void'
(ImplicitCastExpr 0x5b01fb0 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01f80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)' (UsingShadow 0x5b01ea0 'f')))
(ImplicitCastExpr 0x5b01ff8 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01f58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S'))))
Now we can tell that the second call is 'using' (no pun intended) the using
declaration, and *which* using declaration it sees. Without this, we can
mistake calls that go through using declarations for ADL calls, and have no way
to attribute names looked up with using declarations to the appropriate
UsingDecl.
llvm-svn: 130670
2011-05-02 07:48:14 +08:00
|
|
|
/*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
|
|
|
|
/*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
|
2012-01-27 17:46:47 +08:00
|
|
|
/*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2],
|
Add an optional field attached to a DeclRefExpr which points back to the
Decl actually found via name lookup & overload resolution when that Decl
is different from the ValueDecl which is actually referenced by the
expression.
This can be used by AST consumers to correctly attribute references to
the spelling location of a using declaration, and otherwise gain insight
into the name resolution performed by Clang.
The public interface to DRE is kept as narrow as possible: we provide
a getFoundDecl() which always returns a NamedDecl, either the ValueDecl
referenced or the new, more precise NamedDecl if present. This way AST
clients can code against getFoundDecl without know when exactly the AST
has a split representation.
For an example of the data this provides consider:
% cat x.cc
namespace N1 {
struct S {};
void f(const S&);
}
void test(N1::S s) {
f(s);
using N1::f;
f(s);
}
% ./bin/clang -fsyntax-only -Xclang -ast-dump x.cc
[...]
void test(N1::S s) (CompoundStmt 0x5b02010 <x.cc:5:20, line:9:1>
(CallExpr 0x5b01df0 <line:6:3, col:6> 'void'
(ImplicitCastExpr 0x5b01dd8 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01d80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)'))
(ImplicitCastExpr 0x5b01e20 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01d58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S')))
(DeclStmt 0x5b01ee0 <line:7:3, col:14>
0x5b01e40 "UsingN1::;")
(CallExpr 0x5b01fc8 <line:8:3, col:6> 'void'
(ImplicitCastExpr 0x5b01fb0 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
(DeclRefExpr 0x5b01f80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)' (UsingShadow 0x5b01ea0 'f')))
(ImplicitCastExpr 0x5b01ff8 <col:5> 'const struct N1::S' lvalue <NoOp>
(DeclRefExpr 0x5b01f58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S'))))
Now we can tell that the second call is 'using' (no pun intended) the using
declaration, and *which* using declaration it sees. Without this, we can
mistake calls that go through using declarations for ADL calls, and have no way
to attribute names looked up with using declarations to the appropriate
UsingDecl.
llvm-svn: 130670
2011-05-02 07:48:14 +08:00
|
|
|
/*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ?
|
2012-03-10 17:33:50 +08:00
|
|
|
Record[ASTStmtReader::NumExprFields + 5] : 0);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_INTEGER_LITERAL:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = IntegerLiteral::Create(Context, Empty);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_FLOATING_LITERAL:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = FloatingLiteral::Create(Context, Empty);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_IMAGINARY_LITERAL:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ImaginaryLiteral(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_STRING_LITERAL:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = StringLiteral::CreateEmpty(Context,
|
2010-08-19 07:56:52 +08:00
|
|
|
Record[ASTStmtReader::NumExprFields + 1]);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CHARACTER_LITERAL:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) CharacterLiteral(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_PAREN:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ParenExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_PAREN_LIST:
|
2010-06-30 16:49:18 +08:00
|
|
|
S = new (Context) ParenListExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_UNARY_OPERATOR:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) UnaryOperator(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_OFFSETOF:
|
2016-12-16 04:53:26 +08:00
|
|
|
S = OffsetOfExpr::CreateEmpty(Context,
|
2010-08-19 07:56:52 +08:00
|
|
|
Record[ASTStmtReader::NumExprFields],
|
|
|
|
Record[ASTStmtReader::NumExprFields + 1]);
|
Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-29 06:16:22 +08:00
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_SIZEOF_ALIGN_OF:
|
2011-03-12 03:24:49 +08:00
|
|
|
S = new (Context) UnaryExprOrTypeTraitExpr(Empty);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_ARRAY_SUBSCRIPT:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ArraySubscriptExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2015-08-25 22:24:04 +08:00
|
|
|
case EXPR_OMP_ARRAY_SECTION:
|
|
|
|
S = new (Context) OMPArraySectionExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CALL:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = new (Context) CallExpr(Context, Stmt::CallExprClass, Empty);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_MEMBER: {
|
2010-07-08 21:09:47 +08:00
|
|
|
// We load everything here and fully initialize it at creation.
|
|
|
|
// That way we can use MemberExpr::Create and don't have to duplicate its
|
|
|
|
// logic with a MemberExpr::CreateEmpty.
|
|
|
|
|
|
|
|
assert(Idx == 0);
|
2011-03-01 05:54:11 +08:00
|
|
|
NestedNameSpecifierLoc QualifierLoc;
|
2010-07-08 21:09:47 +08:00
|
|
|
if (Record[Idx++]) { // HasQualifier.
|
2011-03-01 05:54:11 +08:00
|
|
|
QualifierLoc = ReadNestedNameSpecifierLoc(F, Record, Idx);
|
2010-07-08 21:09:47 +08:00
|
|
|
}
|
|
|
|
|
2012-01-27 17:46:47 +08:00
|
|
|
SourceLocation TemplateKWLoc;
|
2010-07-08 21:09:47 +08:00
|
|
|
TemplateArgumentListInfo ArgInfo;
|
2012-01-27 17:46:47 +08:00
|
|
|
bool HasTemplateKWAndArgsInfo = Record[Idx++];
|
|
|
|
if (HasTemplateKWAndArgsInfo) {
|
|
|
|
TemplateKWLoc = ReadSourceLocation(F, Record, Idx);
|
2011-02-04 20:01:24 +08:00
|
|
|
unsigned NumTemplateArgs = Record[Idx++];
|
2010-10-05 23:59:54 +08:00
|
|
|
ArgInfo.setLAngleLoc(ReadSourceLocation(F, Record, Idx));
|
|
|
|
ArgInfo.setRAngleLoc(ReadSourceLocation(F, Record, Idx));
|
2010-07-08 21:09:47 +08:00
|
|
|
for (unsigned i = 0; i != NumTemplateArgs; ++i)
|
2010-10-05 23:59:54 +08:00
|
|
|
ArgInfo.addArgument(ReadTemplateArgumentLoc(F, Record, Idx));
|
2010-07-08 21:09:47 +08:00
|
|
|
}
|
2011-10-05 15:56:41 +08:00
|
|
|
|
|
|
|
bool HadMultipleCandidates = Record[Idx++];
|
|
|
|
|
2011-07-22 06:35:25 +08:00
|
|
|
NamedDecl *FoundD = ReadDeclAs<NamedDecl>(F, Record, Idx);
|
2010-07-08 21:09:47 +08:00
|
|
|
AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
|
|
|
|
DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS);
|
|
|
|
|
2011-07-22 08:38:23 +08:00
|
|
|
QualType T = readType(F, Record, Idx);
|
2010-11-18 14:31:45 +08:00
|
|
|
ExprValueKind VK = static_cast<ExprValueKind>(Record[Idx++]);
|
|
|
|
ExprObjectKind OK = static_cast<ExprObjectKind>(Record[Idx++]);
|
2010-07-08 21:09:47 +08:00
|
|
|
Expr *Base = ReadSubExpr();
|
2011-07-22 06:35:25 +08:00
|
|
|
ValueDecl *MemberD = ReadDeclAs<ValueDecl>(F, Record, Idx);
|
2015-05-01 10:04:32 +08:00
|
|
|
SourceLocation MemberLoc = ReadSourceLocation(F, Record, Idx);
|
|
|
|
DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
|
|
|
|
bool IsArrow = Record[Idx++];
|
|
|
|
SourceLocation OperatorLoc = ReadSourceLocation(F, Record, Idx);
|
|
|
|
|
|
|
|
S = MemberExpr::Create(Context, Base, IsArrow, OperatorLoc, QualifierLoc,
|
|
|
|
TemplateKWLoc, MemberD, FoundDecl, MemberNameInfo,
|
|
|
|
HasTemplateKWAndArgsInfo ? &ArgInfo : nullptr, T,
|
|
|
|
VK, OK);
|
|
|
|
ReadDeclarationNameLoc(F, cast<MemberExpr>(S)->MemberDNLoc,
|
|
|
|
MemberD->getDeclName(), Record, Idx);
|
|
|
|
if (HadMultipleCandidates)
|
2011-10-05 15:56:41 +08:00
|
|
|
cast<MemberExpr>(S)->setHadMultipleCandidates(true);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
2010-07-08 21:09:47 +08:00
|
|
|
}
|
2009-04-27 13:14:47 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_BINARY_OPERATOR:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) BinaryOperator(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_COMPOUND_ASSIGN_OPERATOR:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) CompoundAssignOperator(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CONDITIONAL_OPERATOR:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ConditionalOperator(Empty);
|
|
|
|
break;
|
|
|
|
|
2011-02-17 18:25:35 +08:00
|
|
|
case EXPR_BINARY_CONDITIONAL_OPERATOR:
|
|
|
|
S = new (Context) BinaryConditionalOperator(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_IMPLICIT_CAST:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = ImplicitCastExpr::CreateEmpty(Context,
|
2010-08-19 07:56:52 +08:00
|
|
|
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CSTYLE_CAST:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = CStyleCastExpr::CreateEmpty(Context,
|
2010-08-19 07:56:52 +08:00
|
|
|
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_COMPOUND_LITERAL:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) CompoundLiteralExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_EXT_VECTOR_ELEMENT:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ExtVectorElementExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_INIT_LIST:
|
2012-11-28 11:56:16 +08:00
|
|
|
S = new (Context) InitListExpr(Empty);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_DESIGNATED_INIT:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = DesignatedInitExpr::CreateEmpty(Context,
|
2010-08-19 07:56:52 +08:00
|
|
|
Record[ASTStmtReader::NumExprFields] - 1);
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
|
|
|
|
2015-06-10 08:27:52 +08:00
|
|
|
case EXPR_DESIGNATED_INIT_UPDATE:
|
|
|
|
S = new (Context) DesignatedInitUpdateExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_IMPLICIT_VALUE_INIT:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ImplicitValueInitExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2015-06-10 08:27:52 +08:00
|
|
|
case EXPR_NO_INIT:
|
|
|
|
S = new (Context) NoInitExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2016-12-12 10:53:20 +08:00
|
|
|
case EXPR_ARRAY_INIT_LOOP:
|
|
|
|
S = new (Context) ArrayInitLoopExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EXPR_ARRAY_INIT_INDEX:
|
|
|
|
S = new (Context) ArrayInitIndexExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_VA_ARG:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) VAArgExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_ADDR_LABEL:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) AddrLabelExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_STMT:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) StmtExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CHOOSE:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ChooseExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_GNU_NULL:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) GNUNullExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_SHUFFLE_VECTOR:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ShuffleVectorExpr(Empty);
|
|
|
|
break;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2013-09-18 11:29:45 +08:00
|
|
|
case EXPR_CONVERT_VECTOR:
|
|
|
|
S = new (Context) ConvertVectorExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_BLOCK:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) BlockExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2011-04-15 08:35:48 +08:00
|
|
|
case EXPR_GENERIC_SELECTION:
|
|
|
|
S = new (Context) GenericSelectionExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_OBJC_STRING_LITERAL:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ObjCStringLiteral(Empty);
|
|
|
|
break;
|
2012-04-19 08:25:12 +08:00
|
|
|
case EXPR_OBJC_BOXED_EXPRESSION:
|
|
|
|
S = new (Context) ObjCBoxedExpr(Empty);
|
2012-03-07 04:05:56 +08:00
|
|
|
break;
|
|
|
|
case EXPR_OBJC_ARRAY_LITERAL:
|
|
|
|
S = ObjCArrayLiteral::CreateEmpty(Context,
|
|
|
|
Record[ASTStmtReader::NumExprFields]);
|
|
|
|
break;
|
|
|
|
case EXPR_OBJC_DICTIONARY_LITERAL:
|
|
|
|
S = ObjCDictionaryLiteral::CreateEmpty(Context,
|
|
|
|
Record[ASTStmtReader::NumExprFields],
|
|
|
|
Record[ASTStmtReader::NumExprFields + 1]);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_OBJC_ENCODE:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ObjCEncodeExpr(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_OBJC_SELECTOR_EXPR:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ObjCSelectorExpr(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_OBJC_PROTOCOL_EXPR:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ObjCProtocolExpr(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_OBJC_IVAR_REF_EXPR:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ObjCIvarRefExpr(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_OBJC_PROPERTY_REF_EXPR:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ObjCPropertyRefExpr(Empty);
|
|
|
|
break;
|
2012-03-07 04:05:56 +08:00
|
|
|
case EXPR_OBJC_SUBSCRIPT_REF_EXPR:
|
|
|
|
S = new (Context) ObjCSubscriptRefExpr(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_OBJC_KVC_REF_EXPR:
|
2010-12-02 09:19:52 +08:00
|
|
|
llvm_unreachable("mismatching AST file");
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_OBJC_MESSAGE_EXPR:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = ObjCMessageExpr::CreateEmpty(Context,
|
2011-10-03 14:36:51 +08:00
|
|
|
Record[ASTStmtReader::NumExprFields],
|
|
|
|
Record[ASTStmtReader::NumExprFields + 1]);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_OBJC_ISA:
|
2009-07-25 01:54:45 +08:00
|
|
|
S = new (Context) ObjCIsaExpr(Empty);
|
|
|
|
break;
|
2011-06-16 07:02:42 +08:00
|
|
|
case EXPR_OBJC_INDIRECT_COPY_RESTORE:
|
|
|
|
S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
|
|
|
|
break;
|
|
|
|
case EXPR_OBJC_BRIDGED_CAST:
|
|
|
|
S = new (Context) ObjCBridgedCastExpr(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_OBJC_FOR_COLLECTION:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ObjCForCollectionStmt(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_OBJC_CATCH:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ObjCAtCatchStmt(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_OBJC_FINALLY:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ObjCAtFinallyStmt(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_OBJC_AT_TRY:
|
2016-12-16 04:53:26 +08:00
|
|
|
S = ObjCAtTryStmt::CreateEmpty(Context,
|
2010-08-19 07:56:52 +08:00
|
|
|
Record[ASTStmtReader::NumStmtFields],
|
|
|
|
Record[ASTStmtReader::NumStmtFields + 1]);
|
2009-04-27 13:14:47 +08:00
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_OBJC_AT_SYNCHRONIZED:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ObjCAtSynchronizedStmt(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_OBJC_AT_THROW:
|
2009-04-27 13:14:47 +08:00
|
|
|
S = new (Context) ObjCAtThrowStmt(Empty);
|
|
|
|
break;
|
2011-06-16 07:02:42 +08:00
|
|
|
case STMT_OBJC_AUTORELEASE_POOL:
|
|
|
|
S = new (Context) ObjCAutoreleasePoolStmt(Empty);
|
|
|
|
break;
|
2012-03-07 04:05:56 +08:00
|
|
|
case EXPR_OBJC_BOOL_LITERAL:
|
|
|
|
S = new (Context) ObjCBoolLiteralExpr(Empty);
|
|
|
|
break;
|
2016-07-16 08:35:23 +08:00
|
|
|
case EXPR_OBJC_AVAILABILITY_CHECK:
|
|
|
|
S = new (Context) ObjCAvailabilityCheckExpr(Empty);
|
|
|
|
break;
|
2014-07-07 08:12:30 +08:00
|
|
|
case STMT_SEH_LEAVE:
|
|
|
|
S = new (Context) SEHLeaveStmt(Empty);
|
|
|
|
break;
|
2011-07-15 15:00:14 +08:00
|
|
|
case STMT_SEH_EXCEPT:
|
|
|
|
S = new (Context) SEHExceptStmt(Empty);
|
|
|
|
break;
|
|
|
|
case STMT_SEH_FINALLY:
|
|
|
|
S = new (Context) SEHFinallyStmt(Empty);
|
|
|
|
break;
|
|
|
|
case STMT_SEH_TRY:
|
|
|
|
S = new (Context) SEHTryStmt(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_CXX_CATCH:
|
2010-07-23 00:03:56 +08:00
|
|
|
S = new (Context) CXXCatchStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case STMT_CXX_TRY:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = CXXTryStmt::Create(Context, Empty,
|
2010-08-19 07:56:52 +08:00
|
|
|
/*NumHandlers=*/Record[ASTStmtReader::NumStmtFields]);
|
2010-07-23 00:03:56 +08:00
|
|
|
break;
|
|
|
|
|
2011-04-15 06:09:26 +08:00
|
|
|
case STMT_CXX_FOR_RANGE:
|
|
|
|
S = new (Context) CXXForRangeStmt(Empty);
|
|
|
|
break;
|
|
|
|
|
2011-10-25 09:33:02 +08:00
|
|
|
case STMT_MS_DEPENDENT_EXISTS:
|
|
|
|
S = new (Context) MSDependentExistsStmt(SourceLocation(), true,
|
|
|
|
NestedNameSpecifierLoc(),
|
|
|
|
DeclarationNameInfo(),
|
2014-05-22 13:54:18 +08:00
|
|
|
nullptr);
|
2011-10-25 09:33:02 +08:00
|
|
|
break;
|
2014-02-27 16:29:12 +08:00
|
|
|
|
2013-07-19 11:13:43 +08:00
|
|
|
case STMT_OMP_PARALLEL_DIRECTIVE:
|
|
|
|
S =
|
|
|
|
OMPParallelDirective::CreateEmpty(Context,
|
|
|
|
Record[ASTStmtReader::NumStmtFields],
|
|
|
|
Empty);
|
|
|
|
break;
|
2014-02-27 16:29:12 +08:00
|
|
|
|
|
|
|
case STMT_OMP_SIMD_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
|
|
|
|
CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:57 +08:00
|
|
|
case STMT_OMP_FOR_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
|
|
|
|
Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-09-18 13:12:34 +08:00
|
|
|
case STMT_OMP_FOR_SIMD_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
|
|
|
|
Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-06-25 19:44:49 +08:00
|
|
|
case STMT_OMP_SECTIONS_DIRECTIVE:
|
|
|
|
S = OMPSectionsDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2014-06-26 16:21:58 +08:00
|
|
|
case STMT_OMP_SECTION_DIRECTIVE:
|
|
|
|
S = OMPSectionDirective::CreateEmpty(Context, Empty);
|
|
|
|
break;
|
|
|
|
|
2014-06-26 20:05:45 +08:00
|
|
|
case STMT_OMP_SINGLE_DIRECTIVE:
|
|
|
|
S = OMPSingleDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2014-07-17 16:54:58 +08:00
|
|
|
case STMT_OMP_MASTER_DIRECTIVE:
|
|
|
|
S = OMPMasterDirective::CreateEmpty(Context, Empty);
|
|
|
|
break;
|
|
|
|
|
2014-07-21 17:42:05 +08:00
|
|
|
case STMT_OMP_CRITICAL_DIRECTIVE:
|
2015-12-15 16:19:24 +08:00
|
|
|
S = OMPCriticalDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
2014-07-21 17:42:05 +08:00
|
|
|
break;
|
|
|
|
|
2014-07-07 21:01:15 +08:00
|
|
|
case STMT_OMP_PARALLEL_FOR_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
|
|
|
|
CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-09-23 17:33:00 +08:00
|
|
|
case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
|
|
|
|
CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-07-08 16:12:03 +08:00
|
|
|
case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE:
|
|
|
|
S = OMPParallelSectionsDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2014-07-11 19:25:16 +08:00
|
|
|
case STMT_OMP_TASK_DIRECTIVE:
|
|
|
|
S = OMPTaskDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2014-07-18 15:47:19 +08:00
|
|
|
case STMT_OMP_TASKYIELD_DIRECTIVE:
|
|
|
|
S = OMPTaskyieldDirective::CreateEmpty(Context, Empty);
|
|
|
|
break;
|
|
|
|
|
2014-07-18 17:11:51 +08:00
|
|
|
case STMT_OMP_BARRIER_DIRECTIVE:
|
|
|
|
S = OMPBarrierDirective::CreateEmpty(Context, Empty);
|
|
|
|
break;
|
|
|
|
|
2014-07-18 18:17:07 +08:00
|
|
|
case STMT_OMP_TASKWAIT_DIRECTIVE:
|
|
|
|
S = OMPTaskwaitDirective::CreateEmpty(Context, Empty);
|
|
|
|
break;
|
|
|
|
|
2015-06-18 20:14:09 +08:00
|
|
|
case STMT_OMP_TASKGROUP_DIRECTIVE:
|
|
|
|
S = OMPTaskgroupDirective::CreateEmpty(Context, Empty);
|
|
|
|
break;
|
|
|
|
|
2014-07-21 19:26:11 +08:00
|
|
|
case STMT_OMP_FLUSH_DIRECTIVE:
|
|
|
|
S = OMPFlushDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2014-07-22 14:45:04 +08:00
|
|
|
case STMT_OMP_ORDERED_DIRECTIVE:
|
2015-09-25 18:37:12 +08:00
|
|
|
S = OMPOrderedDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
2014-07-22 14:45:04 +08:00
|
|
|
break;
|
|
|
|
|
2014-07-22 18:10:35 +08:00
|
|
|
case STMT_OMP_ATOMIC_DIRECTIVE:
|
|
|
|
S = OMPAtomicDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2014-09-19 16:19:49 +08:00
|
|
|
case STMT_OMP_TARGET_DIRECTIVE:
|
|
|
|
S = OMPTargetDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2015-07-21 21:44:28 +08:00
|
|
|
case STMT_OMP_TARGET_DATA_DIRECTIVE:
|
|
|
|
S = OMPTargetDataDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2016-01-20 03:15:56 +08:00
|
|
|
case STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE:
|
|
|
|
S = OMPTargetEnterDataDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2016-01-20 04:04:50 +08:00
|
|
|
case STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE:
|
|
|
|
S = OMPTargetExitDataDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2016-01-27 02:48:41 +08:00
|
|
|
case STMT_OMP_TARGET_PARALLEL_DIRECTIVE:
|
|
|
|
S = OMPTargetParallelDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2016-02-03 23:46:42 +08:00
|
|
|
case STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
|
|
|
|
CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-05-27 01:30:50 +08:00
|
|
|
case STMT_OMP_TARGET_UPDATE_DIRECTIVE:
|
|
|
|
S = OMPTargetUpdateDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2014-10-09 12:18:56 +08:00
|
|
|
case STMT_OMP_TEAMS_DIRECTIVE:
|
|
|
|
S = OMPTeamsDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
|
|
|
break;
|
|
|
|
|
2015-07-01 14:57:41 +08:00
|
|
|
case STMT_OMP_CANCELLATION_POINT_DIRECTIVE:
|
|
|
|
S = OMPCancellationPointDirective::CreateEmpty(Context, Empty);
|
|
|
|
break;
|
|
|
|
|
2015-07-02 19:25:17 +08:00
|
|
|
case STMT_OMP_CANCEL_DIRECTIVE:
|
2015-09-18 16:07:34 +08:00
|
|
|
S = OMPCancelDirective::CreateEmpty(
|
|
|
|
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
2015-07-02 19:25:17 +08:00
|
|
|
break;
|
|
|
|
|
2015-12-01 12:18:41 +08:00
|
|
|
case STMT_OMP_TASKLOOP_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
|
|
|
|
Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-12-03 17:40:15 +08:00
|
|
|
case STMT_OMP_TASKLOOP_SIMD_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
|
|
|
|
CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-12-14 22:51:25 +08:00
|
|
|
case STMT_OMP_DISTRIBUTE_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
|
|
|
|
Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-06-27 22:55:37 +08:00
|
|
|
case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
|
|
|
|
CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-07-05 13:00:15 +08:00
|
|
|
case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPDistributeParallelForSimdDirective::CreateEmpty(Context, NumClauses,
|
|
|
|
CollapsedNum,
|
|
|
|
Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-07-06 12:45:38 +08:00
|
|
|
case STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
|
|
|
|
CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-07-14 10:54:56 +08:00
|
|
|
case STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
|
|
|
|
CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-07-21 06:57:10 +08:00
|
|
|
case STMT_OMP_TARGET_SIMD_DIRECTIVE: {
|
|
|
|
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
|
|
|
|
Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-08-05 22:37:37 +08:00
|
|
|
case STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE: {
|
|
|
|
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
|
|
|
|
CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-10-25 20:50:55 +08:00
|
|
|
case STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
|
|
|
|
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
|
|
|
|
CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-12-01 07:51:03 +08:00
|
|
|
case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
|
|
|
|
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(
|
|
|
|
Context, NumClauses, CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-12-09 11:24:30 +08:00
|
|
|
case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
|
|
|
|
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
|
|
|
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
|
|
|
S = OMPTeamsDistributeParallelForDirective::CreateEmpty(
|
|
|
|
Context, NumClauses, CollapsedNum, Empty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_OPERATOR_CALL:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = new (Context) CXXOperatorCallExpr(Context, Empty);
|
2009-07-14 11:19:21 +08:00
|
|
|
break;
|
2010-05-09 13:36:05 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_MEMBER_CALL:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = new (Context) CXXMemberCallExpr(Context, Empty);
|
2010-05-09 13:36:05 +08:00
|
|
|
break;
|
2014-02-27 16:29:12 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_CONSTRUCT:
|
2010-07-10 19:46:15 +08:00
|
|
|
S = new (Context) CXXConstructExpr(Empty);
|
|
|
|
break;
|
2014-02-27 16:29:12 +08:00
|
|
|
|
P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:
Replace inheriting constructors implementation with new approach, voted into
C++ last year as a DR against C++11.
Instead of synthesizing a set of derived class constructors for each inherited
base class constructor, we make the constructors of the base class visible to
constructor lookup in the derived class, using the normal rules for
using-declarations.
For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived
class that tracks the requisite additional information. We create shadow
constructors (not found by name lookup) in the derived class to model the
actual initialization, and have a new expression node,
CXXInheritedCtorInitExpr, to model the initialization of a base class from such
a constructor. (This initialization is special because it performs real perfect
forwarding of arguments.)
In cases where argument forwarding is not possible (for inalloca calls,
variadic calls, and calls with callee parameter cleanup), the shadow inheriting
constructor is not emitted and instead we directly emit the initialization code
into the caller of the inherited constructor.
Note that this new model is not perfectly compatible with the old model in some
corner cases. In particular:
* if B inherits a private constructor from A, and C uses that constructor to
construct a B, then we previously required that A befriends B and B
befriends C, but the new rules require A to befriend C directly, and
* if a derived class has its own constructors (and so its implicit default
constructor is suppressed), it may still inherit a default constructor from
a base class
llvm-svn: 274049
2016-06-29 03:03:57 +08:00
|
|
|
case EXPR_CXX_INHERITED_CTOR_INIT:
|
|
|
|
S = new (Context) CXXInheritedCtorInitExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_TEMPORARY_OBJECT:
|
2010-07-10 19:46:15 +08:00
|
|
|
S = new (Context) CXXTemporaryObjectExpr(Empty);
|
2009-09-10 07:08:42 +08:00
|
|
|
break;
|
2010-01-17 05:21:01 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_STATIC_CAST:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = CXXStaticCastExpr::CreateEmpty(Context,
|
2010-08-19 07:56:52 +08:00
|
|
|
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
|
2010-01-17 05:21:01 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_DYNAMIC_CAST:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = CXXDynamicCastExpr::CreateEmpty(Context,
|
2010-08-19 07:56:52 +08:00
|
|
|
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
|
2010-01-17 05:21:01 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_REINTERPRET_CAST:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = CXXReinterpretCastExpr::CreateEmpty(Context,
|
2010-08-19 07:56:52 +08:00
|
|
|
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
|
2010-01-17 05:21:01 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_CONST_CAST:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = CXXConstCastExpr::CreateEmpty(Context);
|
2010-01-17 05:21:01 +08:00
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_FUNCTIONAL_CAST:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = CXXFunctionalCastExpr::CreateEmpty(Context,
|
2010-08-19 07:56:52 +08:00
|
|
|
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
|
2010-01-17 05:21:01 +08:00
|
|
|
break;
|
|
|
|
|
2012-03-07 16:35:16 +08:00
|
|
|
case EXPR_USER_DEFINED_LITERAL:
|
|
|
|
S = new (Context) UserDefinedLiteral(Context, Empty);
|
|
|
|
break;
|
|
|
|
|
2013-06-13 06:31:48 +08:00
|
|
|
case EXPR_CXX_STD_INITIALIZER_LIST:
|
|
|
|
S = new (Context) CXXStdInitializerListExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_BOOL_LITERAL:
|
2010-02-07 14:32:43 +08:00
|
|
|
S = new (Context) CXXBoolLiteralExpr(Empty);
|
|
|
|
break;
|
2010-01-17 05:21:01 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_NULL_PTR_LITERAL:
|
2010-02-07 14:32:43 +08:00
|
|
|
S = new (Context) CXXNullPtrLiteralExpr(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_TYPEID_EXPR:
|
2010-05-09 14:03:39 +08:00
|
|
|
S = new (Context) CXXTypeidExpr(Empty, true);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_TYPEID_TYPE:
|
2010-05-09 14:03:39 +08:00
|
|
|
S = new (Context) CXXTypeidExpr(Empty, false);
|
|
|
|
break;
|
2010-09-08 20:20:18 +08:00
|
|
|
case EXPR_CXX_UUIDOF_EXPR:
|
|
|
|
S = new (Context) CXXUuidofExpr(Empty, true);
|
|
|
|
break;
|
2013-04-16 15:28:30 +08:00
|
|
|
case EXPR_CXX_PROPERTY_REF_EXPR:
|
|
|
|
S = new (Context) MSPropertyRefExpr(Empty);
|
|
|
|
break;
|
2015-11-25 20:01:00 +08:00
|
|
|
case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR:
|
|
|
|
S = new (Context) MSPropertySubscriptExpr(Empty);
|
|
|
|
break;
|
2010-09-08 20:20:18 +08:00
|
|
|
case EXPR_CXX_UUIDOF_TYPE:
|
|
|
|
S = new (Context) CXXUuidofExpr(Empty, false);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_THIS:
|
2010-05-09 14:15:05 +08:00
|
|
|
S = new (Context) CXXThisExpr(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_THROW:
|
2010-05-09 14:15:05 +08:00
|
|
|
S = new (Context) CXXThrowExpr(Empty);
|
|
|
|
break;
|
2016-01-07 06:34:54 +08:00
|
|
|
case EXPR_CXX_DEFAULT_ARG:
|
|
|
|
S = new (Context) CXXDefaultArgExpr(Empty);
|
2010-05-09 14:40:08 +08:00
|
|
|
break;
|
2013-04-21 06:23:05 +08:00
|
|
|
case EXPR_CXX_DEFAULT_INIT:
|
|
|
|
S = new (Context) CXXDefaultInitExpr(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_BIND_TEMPORARY:
|
2010-05-10 08:25:06 +08:00
|
|
|
S = new (Context) CXXBindTemporaryExpr(Empty);
|
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_SCALAR_VALUE_INIT:
|
2010-07-08 14:14:04 +08:00
|
|
|
S = new (Context) CXXScalarValueInitExpr(Empty);
|
2010-05-10 09:22:27 +08:00
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_NEW:
|
2010-05-10 09:22:27 +08:00
|
|
|
S = new (Context) CXXNewExpr(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_DELETE:
|
2010-06-23 01:07:59 +08:00
|
|
|
S = new (Context) CXXDeleteExpr(Empty);
|
|
|
|
break;
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_PSEUDO_DESTRUCTOR:
|
2010-06-28 17:32:03 +08:00
|
|
|
S = new (Context) CXXPseudoDestructorExpr(Empty);
|
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2010-12-06 16:20:24 +08:00
|
|
|
case EXPR_EXPR_WITH_CLEANUPS:
|
2011-11-10 13:35:25 +08:00
|
|
|
S = ExprWithCleanups::Create(Context, Empty,
|
|
|
|
Record[ASTStmtReader::NumExprFields]);
|
2010-05-10 08:25:06 +08:00
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_DEPENDENT_SCOPE_MEMBER:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = CXXDependentScopeMemberExpr::CreateEmpty(Context,
|
2012-01-27 17:46:47 +08:00
|
|
|
/*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
|
2011-02-04 20:01:24 +08:00
|
|
|
/*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
|
2016-12-16 04:53:26 +08:00
|
|
|
? Record[ASTStmtReader::NumExprFields + 1]
|
2011-02-04 20:01:24 +08:00
|
|
|
: 0);
|
2010-06-24 16:57:31 +08:00
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = DependentScopeDeclRefExpr::CreateEmpty(Context,
|
2012-01-27 17:46:47 +08:00
|
|
|
/*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
|
2011-02-04 20:01:24 +08:00
|
|
|
/*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
|
2016-12-16 04:53:26 +08:00
|
|
|
? Record[ASTStmtReader::NumExprFields + 1]
|
2011-02-04 20:01:24 +08:00
|
|
|
: 0);
|
2010-06-28 17:31:56 +08:00
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_UNRESOLVED_CONSTRUCT:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = CXXUnresolvedConstructExpr::CreateEmpty(Context,
|
2010-08-19 07:56:52 +08:00
|
|
|
/*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
|
2010-06-25 17:03:26 +08:00
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_UNRESOLVED_MEMBER:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = UnresolvedMemberExpr::CreateEmpty(Context,
|
2012-01-27 17:46:47 +08:00
|
|
|
/*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
|
2011-02-04 20:01:24 +08:00
|
|
|
/*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
|
2016-12-16 04:53:26 +08:00
|
|
|
? Record[ASTStmtReader::NumExprFields + 1]
|
2011-02-04 20:01:24 +08:00
|
|
|
: 0);
|
2010-06-24 16:57:31 +08:00
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2010-08-19 07:57:32 +08:00
|
|
|
case EXPR_CXX_UNRESOLVED_LOOKUP:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = UnresolvedLookupExpr::CreateEmpty(Context,
|
2012-01-27 17:46:47 +08:00
|
|
|
/*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
|
2011-02-04 20:01:24 +08:00
|
|
|
/*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
|
2016-12-16 04:53:26 +08:00
|
|
|
? Record[ASTStmtReader::NumExprFields + 1]
|
2011-02-04 20:01:24 +08:00
|
|
|
: 0);
|
2010-06-25 17:03:34 +08:00
|
|
|
break;
|
2010-09-11 04:55:54 +08:00
|
|
|
|
2012-02-24 15:38:34 +08:00
|
|
|
case EXPR_TYPE_TRAIT:
|
2016-12-16 04:53:26 +08:00
|
|
|
S = TypeTraitExpr::CreateDeserialized(Context,
|
2012-02-24 15:38:34 +08:00
|
|
|
Record[ASTStmtReader::NumExprFields]);
|
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2011-04-28 08:16:57 +08:00
|
|
|
case EXPR_ARRAY_TYPE_TRAIT:
|
|
|
|
S = new (Context) ArrayTypeTraitExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2011-04-25 14:54:41 +08:00
|
|
|
case EXPR_CXX_EXPRESSION_TRAIT:
|
|
|
|
S = new (Context) ExpressionTraitExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2010-09-11 04:55:54 +08:00
|
|
|
case EXPR_CXX_NOEXCEPT:
|
|
|
|
S = new (Context) CXXNoexceptExpr(Empty);
|
|
|
|
break;
|
2010-11-16 07:31:06 +08:00
|
|
|
|
2011-01-04 01:17:50 +08:00
|
|
|
case EXPR_PACK_EXPANSION:
|
|
|
|
S = new (Context) PackExpansionExpr(Empty);
|
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2011-01-05 01:33:58 +08:00
|
|
|
case EXPR_SIZEOF_PACK:
|
2015-09-24 05:41:42 +08:00
|
|
|
S = SizeOfPackExpr::CreateDeserialized(
|
|
|
|
Context,
|
|
|
|
/*NumPartialArgs=*/Record[ASTStmtReader::NumExprFields]);
|
2011-01-05 01:33:58 +08:00
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2011-07-15 15:00:14 +08:00
|
|
|
case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM:
|
|
|
|
S = new (Context) SubstNonTypeTemplateParmExpr(Empty);
|
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2011-01-15 09:15:58 +08:00
|
|
|
case EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK:
|
|
|
|
S = new (Context) SubstNonTypeTemplateParmPackExpr(Empty);
|
|
|
|
break;
|
2012-09-12 08:56:43 +08:00
|
|
|
|
|
|
|
case EXPR_FUNCTION_PARM_PACK:
|
|
|
|
S = FunctionParmPackExpr::CreateEmpty(Context,
|
|
|
|
Record[ASTStmtReader::NumExprFields]);
|
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2011-06-22 01:03:29 +08:00
|
|
|
case EXPR_MATERIALIZE_TEMPORARY:
|
|
|
|
S = new (Context) MaterializeTemporaryExpr(Empty);
|
|
|
|
break;
|
2014-11-08 13:07:16 +08:00
|
|
|
|
|
|
|
case EXPR_CXX_FOLD:
|
|
|
|
S = new (Context) CXXFoldExpr(Empty);
|
|
|
|
break;
|
|
|
|
|
2011-12-03 11:49:52 +08:00
|
|
|
case EXPR_OPAQUE_VALUE:
|
|
|
|
S = new (Context) OpaqueValueExpr(Empty);
|
2010-11-16 07:31:06 +08:00
|
|
|
break;
|
2011-02-10 05:07:24 +08:00
|
|
|
|
|
|
|
case EXPR_CUDA_KERNEL_CALL:
|
2011-09-10 05:34:22 +08:00
|
|
|
S = new (Context) CUDAKernelCallExpr(Context, Empty);
|
2011-02-10 05:07:24 +08:00
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2011-06-04 08:47:47 +08:00
|
|
|
case EXPR_ASTYPE:
|
|
|
|
S = new (Context) AsTypeExpr(Empty);
|
|
|
|
break;
|
2011-10-11 10:20:01 +08:00
|
|
|
|
2011-11-06 17:01:30 +08:00
|
|
|
case EXPR_PSEUDO_OBJECT: {
|
|
|
|
unsigned numSemanticExprs = Record[ASTStmtReader::NumExprFields];
|
|
|
|
S = PseudoObjectExpr::Create(Context, Empty, numSemanticExprs);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-10-11 10:20:01 +08:00
|
|
|
case EXPR_ATOMIC:
|
|
|
|
S = new (Context) AtomicExpr(Empty);
|
|
|
|
break;
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2012-02-15 01:54:36 +08:00
|
|
|
case EXPR_LAMBDA: {
|
|
|
|
unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];
|
2016-12-14 08:03:17 +08:00
|
|
|
S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
|
2012-02-15 01:54:36 +08:00
|
|
|
break;
|
|
|
|
}
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|
2016-12-16 04:53:26 +08:00
|
|
|
|
2009-04-27 13:14:47 +08:00
|
|
|
// We hit a STMT_STOP, so we're done with this expression.
|
|
|
|
if (Finished)
|
|
|
|
break;
|
|
|
|
|
|
|
|
++NumStatementsRead;
|
|
|
|
|
2011-10-22 07:02:28 +08:00
|
|
|
if (S && !IsStmtReference) {
|
2010-06-29 06:28:35 +08:00
|
|
|
Reader.Visit(S);
|
2011-10-22 07:02:28 +08:00
|
|
|
StmtEntries[Cursor.GetCurrentBitNo()] = S;
|
|
|
|
}
|
|
|
|
|
2009-04-27 13:14:47 +08:00
|
|
|
|
|
|
|
assert(Idx == Record.size() && "Invalid deserialization of statement");
|
|
|
|
StmtStack.push_back(S);
|
|
|
|
}
|
2013-01-20 10:38:54 +08:00
|
|
|
Done:
|
2013-12-07 01:56:43 +08:00
|
|
|
assert(StmtStack.size() > PrevNumStmts && "Read too many sub-stmts!");
|
2010-06-29 06:28:35 +08:00
|
|
|
assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!");
|
|
|
|
return StmtStack.pop_back_val();
|
2009-04-27 13:14:47 +08:00
|
|
|
}
|