forked from OSchip/llvm-project
remove full locinfo AST nodes for now. They just clutter the implementation
and should be implemented with an ASTBuilder subclass anyway. llvm-svn: 39107
This commit is contained in:
parent
2ebe646f00
commit
72b7d39d78
|
@ -23,8 +23,8 @@ namespace {
|
|||
Parser P;
|
||||
std::vector<Decl*> LastInGroupList;
|
||||
public:
|
||||
ASTStreamer(Preprocessor &PP, unsigned MainFileID, bool FullLocInfo)
|
||||
: P(PP, *new ASTBuilder(PP, FullLocInfo, LastInGroupList)) {
|
||||
ASTStreamer(Preprocessor &PP, unsigned MainFileID)
|
||||
: P(PP, *new ASTBuilder(PP, LastInGroupList)) {
|
||||
PP.EnterSourceFile(MainFileID, 0, true);
|
||||
|
||||
// Initialize the parser.
|
||||
|
@ -80,9 +80,8 @@ namespace {
|
|||
/// ASTStreamer_Init - Create an ASTStreamer with the specified preprocessor
|
||||
/// and FileID.
|
||||
ASTStreamerTy *llvm::clang::ASTStreamer_Init(Preprocessor &PP,
|
||||
unsigned MainFileID,
|
||||
bool FullLocInfo) {
|
||||
return new ASTStreamer(PP, MainFileID, FullLocInfo);
|
||||
unsigned MainFileID) {
|
||||
return new ASTStreamer(PP, MainFileID);
|
||||
}
|
||||
|
||||
/// ASTStreamer_ReadTopLevelDecl - Parse and return one top-level declaration. This
|
||||
|
|
|
@ -148,20 +148,6 @@ void CallExpr::dump_impl() const {
|
|||
std::cerr << ")";
|
||||
}
|
||||
|
||||
CallExprLOC::CallExprLOC(Expr *Fn, SourceLocation lparenloc, Expr **Args,
|
||||
unsigned NumArgs, SourceLocation *commalocs,
|
||||
SourceLocation rparenloc)
|
||||
: CallExpr(Fn, Args, NumArgs), LParenLoc(lparenloc), RParenLoc(rparenloc) {
|
||||
unsigned NumCommas = getNumCommas();
|
||||
if (NumCommas)
|
||||
CommaLocs = new SourceLocation[NumCommas];
|
||||
else
|
||||
CommaLocs = 0;
|
||||
|
||||
for (unsigned i = 0; i != NumCommas; ++i)
|
||||
CommaLocs[i] = commalocs[i];
|
||||
}
|
||||
|
||||
|
||||
void MemberExpr::dump_impl() const {
|
||||
Base->dump();
|
||||
|
|
|
@ -91,7 +91,7 @@ void ASTBuilder::PopScope(SourceLocation Loc, Scope *S) {
|
|||
Action::StmtResult
|
||||
ASTBuilder::ParseCompoundStmt(SourceLocation L, SourceLocation R,
|
||||
StmtTy **Elts, unsigned NumElts) {
|
||||
if (FullLocInfo || NumElts > 1)
|
||||
if (NumElts > 1)
|
||||
return new CompoundStmt((Stmt**)Elts, NumElts);
|
||||
else if (NumElts == 1)
|
||||
return Elts[0]; // {stmt} -> stmt
|
||||
|
@ -146,9 +146,7 @@ Action::ExprResult ASTBuilder::ParseFloatingConstant(SourceLocation Loc) {
|
|||
Action::ExprResult ASTBuilder::ParseParenExpr(SourceLocation L,
|
||||
SourceLocation R,
|
||||
ExprTy *Val) {
|
||||
if (!FullLocInfo) return Val;
|
||||
|
||||
return new ParenExpr(L, R, (Expr*)Val);
|
||||
return Val;
|
||||
}
|
||||
|
||||
/// ParseStringExpr - This accepts a string after semantic analysis. This string
|
||||
|
@ -159,11 +157,7 @@ Action::ExprResult ASTBuilder::
|
|||
ParseStringExpr(const char *StrData, unsigned StrLen, bool isWide,
|
||||
SourceLocation *TokLocs, unsigned NumToks) {
|
||||
assert(NumToks && "Must have at least one string!");
|
||||
|
||||
if (!FullLocInfo)
|
||||
return new StringExpr(StrData, StrLen, isWide);
|
||||
else
|
||||
return new StringExprLOC(StrData, StrLen, isWide, TokLocs, NumToks);
|
||||
return new StringExpr(StrData, StrLen, isWide);
|
||||
}
|
||||
|
||||
|
||||
|
@ -188,26 +182,19 @@ Action::ExprResult ASTBuilder::ParseUnaryOp(SourceLocation OpLoc,
|
|||
case tok::kw___imag: Opc = UnaryOperator::Imag; break;
|
||||
case tok::ampamp: Opc = UnaryOperator::AddrLabel; break;
|
||||
case tok::kw___extension__:
|
||||
if (!FullLocInfo) return Input;
|
||||
Opc = UnaryOperator::Extension;
|
||||
break;
|
||||
return Input;
|
||||
//Opc = UnaryOperator::Extension;
|
||||
//break;
|
||||
}
|
||||
|
||||
if (!FullLocInfo)
|
||||
return new UnaryOperator((Expr*)Input, Opc);
|
||||
else
|
||||
return new UnaryOperatorLOC(OpLoc, (Expr*)Input, Opc);
|
||||
return new UnaryOperator((Expr*)Input, Opc);
|
||||
}
|
||||
|
||||
Action::ExprResult ASTBuilder::
|
||||
ParseSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof,
|
||||
SourceLocation LParenLoc, TypeTy *Ty,
|
||||
SourceLocation RParenLoc) {
|
||||
if (!FullLocInfo)
|
||||
return new SizeOfAlignOfTypeExpr(isSizeof, (Type*)Ty);
|
||||
else
|
||||
return new SizeOfAlignOfTypeExprLOC(OpLoc, isSizeof, LParenLoc, (Type*)Ty,
|
||||
RParenLoc);
|
||||
return new SizeOfAlignOfTypeExpr(isSizeof, (Type*)Ty);
|
||||
}
|
||||
|
||||
|
||||
|
@ -221,19 +208,13 @@ Action::ExprResult ASTBuilder::ParsePostfixUnaryOp(SourceLocation OpLoc,
|
|||
case tok::minusminus: Opc = UnaryOperator::PostDec; break;
|
||||
}
|
||||
|
||||
if (!FullLocInfo)
|
||||
return new UnaryOperator((Expr*)Input, Opc);
|
||||
else
|
||||
return new UnaryOperatorLOC(OpLoc, (Expr*)Input, Opc);
|
||||
return new UnaryOperator((Expr*)Input, Opc);
|
||||
}
|
||||
|
||||
Action::ExprResult ASTBuilder::
|
||||
ParseArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
|
||||
ExprTy *Idx, SourceLocation RLoc) {
|
||||
if (!FullLocInfo)
|
||||
return new ArraySubscriptExpr((Expr*)Base, (Expr*)Idx);
|
||||
else
|
||||
return new ArraySubscriptExprLOC((Expr*)Base, LLoc, (Expr*)Idx, RLoc);
|
||||
return new ArraySubscriptExpr((Expr*)Base, (Expr*)Idx);
|
||||
}
|
||||
|
||||
Action::ExprResult ASTBuilder::
|
||||
|
@ -242,11 +223,7 @@ ParseMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
|
|||
IdentifierInfo &Member) {
|
||||
Decl *MemberDecl = 0;
|
||||
// TODO: Look up MemberDecl.
|
||||
if (!FullLocInfo)
|
||||
return new MemberExpr((Expr*)Base, OpKind == tok::arrow, MemberDecl);
|
||||
else
|
||||
return new MemberExprLOC((Expr*)Base, OpLoc, OpKind == tok::arrow,
|
||||
MemberLoc, MemberDecl);
|
||||
return new MemberExpr((Expr*)Base, OpKind == tok::arrow, MemberDecl);
|
||||
}
|
||||
|
||||
/// ParseCallExpr - Handle a call to Fn with the specified array of arguments.
|
||||
|
@ -256,20 +233,13 @@ Action::ExprResult ASTBuilder::
|
|||
ParseCallExpr(ExprTy *Fn, SourceLocation LParenLoc,
|
||||
ExprTy **Args, unsigned NumArgs,
|
||||
SourceLocation *CommaLocs, SourceLocation RParenLoc) {
|
||||
if (!FullLocInfo)
|
||||
return new CallExpr((Expr*)Fn, (Expr**)Args, NumArgs);
|
||||
else
|
||||
return new CallExprLOC((Expr*)Fn, LParenLoc, (Expr**)Args, NumArgs,
|
||||
CommaLocs, RParenLoc);
|
||||
return new CallExpr((Expr*)Fn, (Expr**)Args, NumArgs);
|
||||
}
|
||||
|
||||
Action::ExprResult ASTBuilder::
|
||||
ParseCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
|
||||
SourceLocation RParenLoc, ExprTy *Op) {
|
||||
if (!FullLocInfo)
|
||||
return new CastExpr((Type*)Ty, (Expr*)Op);
|
||||
else
|
||||
return new CastExprLOC(LParenLoc, (Type*)Ty, RParenLoc, (Expr*)Op);
|
||||
return new CastExpr((Type*)Ty, (Expr*)Op);
|
||||
}
|
||||
|
||||
|
||||
|
@ -313,10 +283,7 @@ Action::ExprResult ASTBuilder::ParseBinOp(SourceLocation TokLoc,
|
|||
case tok::comma: Opc = BinaryOperator::Comma; break;
|
||||
}
|
||||
|
||||
if (!FullLocInfo)
|
||||
return new BinaryOperator((Expr*)LHS, (Expr*)RHS, Opc);
|
||||
else
|
||||
return new BinaryOperatorLOC((Expr*)LHS, TokLoc, (Expr*)RHS, Opc);
|
||||
return new BinaryOperator((Expr*)LHS, (Expr*)RHS, Opc);
|
||||
}
|
||||
|
||||
/// ParseConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
|
||||
|
@ -325,10 +292,6 @@ Action::ExprResult ASTBuilder::ParseConditionalOp(SourceLocation QuestionLoc,
|
|||
SourceLocation ColonLoc,
|
||||
ExprTy *Cond, ExprTy *LHS,
|
||||
ExprTy *RHS) {
|
||||
if (!FullLocInfo)
|
||||
return new ConditionalOperator((Expr*)Cond, (Expr*)LHS, (Expr*)RHS);
|
||||
else
|
||||
return new ConditionalOperatorLOC((Expr*)Cond, QuestionLoc, (Expr*)LHS,
|
||||
ColonLoc, (Expr*)RHS);
|
||||
return new ConditionalOperator((Expr*)Cond, (Expr*)LHS, (Expr*)RHS);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,19 +29,14 @@ namespace clang {
|
|||
class ASTBuilder : public Action {
|
||||
Preprocessor &PP;
|
||||
|
||||
/// FullLocInfo - If this is true, the ASTBuilder constructs AST Nodes that
|
||||
/// capture maximal location information for each source-language construct.
|
||||
bool FullLocInfo;
|
||||
|
||||
/// LastInGroupList - This vector is populated when there are multiple
|
||||
/// declarators in a single decl group (e.g. "int A, B, C"). In this case,
|
||||
/// all but the last decl will be entered into this. This is used by the
|
||||
/// ASTStreamer.
|
||||
std::vector<Decl*> &LastInGroupList;
|
||||
public:
|
||||
ASTBuilder(Preprocessor &pp, bool fullLocInfo,
|
||||
std::vector<Decl*> &prevInGroup)
|
||||
: PP(pp), FullLocInfo(fullLocInfo), LastInGroupList(prevInGroup) {}
|
||||
ASTBuilder(Preprocessor &pp, std::vector<Decl*> &prevInGroup)
|
||||
: PP(pp), LastInGroupList(prevInGroup) {}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Symbol table tracking callbacks.
|
||||
|
@ -59,7 +54,6 @@ public:
|
|||
virtual StmtResult ParseCompoundStmt(SourceLocation L, SourceLocation R,
|
||||
StmtTy **Elts, unsigned NumElts);
|
||||
virtual StmtResult ParseExprStmt(ExprTy *Expr) {
|
||||
// TODO: Full info should track this with a node.
|
||||
return Expr; // Exprs are Stmts.
|
||||
}
|
||||
|
||||
|
|
|
@ -785,7 +785,7 @@ static void ParseFile(Preprocessor &PP, Action *PA, unsigned MainFileID) {
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static void PrintASTs(Preprocessor &PP, unsigned MainFileID) {
|
||||
ASTStreamerTy *Streamer = ASTStreamer_Init(PP, MainFileID, true);
|
||||
ASTStreamerTy *Streamer = ASTStreamer_Init(PP, MainFileID);
|
||||
|
||||
while (Decl *D = ASTStreamer_ReadTopLevelDecl(Streamer)) {
|
||||
std::cerr << "Read top-level decl: '";
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace {
|
|||
Parser P;
|
||||
std::vector<Decl*> LastInGroupList;
|
||||
public:
|
||||
ASTStreamer(Preprocessor &PP, unsigned MainFileID, bool FullLocInfo)
|
||||
: P(PP, *new ASTBuilder(PP, FullLocInfo, LastInGroupList)) {
|
||||
ASTStreamer(Preprocessor &PP, unsigned MainFileID)
|
||||
: P(PP, *new ASTBuilder(PP, LastInGroupList)) {
|
||||
PP.EnterSourceFile(MainFileID, 0, true);
|
||||
|
||||
// Initialize the parser.
|
||||
|
@ -80,9 +80,8 @@ namespace {
|
|||
/// ASTStreamer_Init - Create an ASTStreamer with the specified preprocessor
|
||||
/// and FileID.
|
||||
ASTStreamerTy *llvm::clang::ASTStreamer_Init(Preprocessor &PP,
|
||||
unsigned MainFileID,
|
||||
bool FullLocInfo) {
|
||||
return new ASTStreamer(PP, MainFileID, FullLocInfo);
|
||||
unsigned MainFileID) {
|
||||
return new ASTStreamer(PP, MainFileID);
|
||||
}
|
||||
|
||||
/// ASTStreamer_ReadTopLevelDecl - Parse and return one top-level declaration. This
|
||||
|
|
|
@ -91,7 +91,7 @@ void ASTBuilder::PopScope(SourceLocation Loc, Scope *S) {
|
|||
Action::StmtResult
|
||||
ASTBuilder::ParseCompoundStmt(SourceLocation L, SourceLocation R,
|
||||
StmtTy **Elts, unsigned NumElts) {
|
||||
if (FullLocInfo || NumElts > 1)
|
||||
if (NumElts > 1)
|
||||
return new CompoundStmt((Stmt**)Elts, NumElts);
|
||||
else if (NumElts == 1)
|
||||
return Elts[0]; // {stmt} -> stmt
|
||||
|
@ -146,9 +146,7 @@ Action::ExprResult ASTBuilder::ParseFloatingConstant(SourceLocation Loc) {
|
|||
Action::ExprResult ASTBuilder::ParseParenExpr(SourceLocation L,
|
||||
SourceLocation R,
|
||||
ExprTy *Val) {
|
||||
if (!FullLocInfo) return Val;
|
||||
|
||||
return new ParenExpr(L, R, (Expr*)Val);
|
||||
return Val;
|
||||
}
|
||||
|
||||
/// ParseStringExpr - This accepts a string after semantic analysis. This string
|
||||
|
@ -159,11 +157,7 @@ Action::ExprResult ASTBuilder::
|
|||
ParseStringExpr(const char *StrData, unsigned StrLen, bool isWide,
|
||||
SourceLocation *TokLocs, unsigned NumToks) {
|
||||
assert(NumToks && "Must have at least one string!");
|
||||
|
||||
if (!FullLocInfo)
|
||||
return new StringExpr(StrData, StrLen, isWide);
|
||||
else
|
||||
return new StringExprLOC(StrData, StrLen, isWide, TokLocs, NumToks);
|
||||
return new StringExpr(StrData, StrLen, isWide);
|
||||
}
|
||||
|
||||
|
||||
|
@ -188,26 +182,19 @@ Action::ExprResult ASTBuilder::ParseUnaryOp(SourceLocation OpLoc,
|
|||
case tok::kw___imag: Opc = UnaryOperator::Imag; break;
|
||||
case tok::ampamp: Opc = UnaryOperator::AddrLabel; break;
|
||||
case tok::kw___extension__:
|
||||
if (!FullLocInfo) return Input;
|
||||
Opc = UnaryOperator::Extension;
|
||||
break;
|
||||
return Input;
|
||||
//Opc = UnaryOperator::Extension;
|
||||
//break;
|
||||
}
|
||||
|
||||
if (!FullLocInfo)
|
||||
return new UnaryOperator((Expr*)Input, Opc);
|
||||
else
|
||||
return new UnaryOperatorLOC(OpLoc, (Expr*)Input, Opc);
|
||||
return new UnaryOperator((Expr*)Input, Opc);
|
||||
}
|
||||
|
||||
Action::ExprResult ASTBuilder::
|
||||
ParseSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof,
|
||||
SourceLocation LParenLoc, TypeTy *Ty,
|
||||
SourceLocation RParenLoc) {
|
||||
if (!FullLocInfo)
|
||||
return new SizeOfAlignOfTypeExpr(isSizeof, (Type*)Ty);
|
||||
else
|
||||
return new SizeOfAlignOfTypeExprLOC(OpLoc, isSizeof, LParenLoc, (Type*)Ty,
|
||||
RParenLoc);
|
||||
return new SizeOfAlignOfTypeExpr(isSizeof, (Type*)Ty);
|
||||
}
|
||||
|
||||
|
||||
|
@ -221,19 +208,13 @@ Action::ExprResult ASTBuilder::ParsePostfixUnaryOp(SourceLocation OpLoc,
|
|||
case tok::minusminus: Opc = UnaryOperator::PostDec; break;
|
||||
}
|
||||
|
||||
if (!FullLocInfo)
|
||||
return new UnaryOperator((Expr*)Input, Opc);
|
||||
else
|
||||
return new UnaryOperatorLOC(OpLoc, (Expr*)Input, Opc);
|
||||
return new UnaryOperator((Expr*)Input, Opc);
|
||||
}
|
||||
|
||||
Action::ExprResult ASTBuilder::
|
||||
ParseArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
|
||||
ExprTy *Idx, SourceLocation RLoc) {
|
||||
if (!FullLocInfo)
|
||||
return new ArraySubscriptExpr((Expr*)Base, (Expr*)Idx);
|
||||
else
|
||||
return new ArraySubscriptExprLOC((Expr*)Base, LLoc, (Expr*)Idx, RLoc);
|
||||
return new ArraySubscriptExpr((Expr*)Base, (Expr*)Idx);
|
||||
}
|
||||
|
||||
Action::ExprResult ASTBuilder::
|
||||
|
@ -242,11 +223,7 @@ ParseMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
|
|||
IdentifierInfo &Member) {
|
||||
Decl *MemberDecl = 0;
|
||||
// TODO: Look up MemberDecl.
|
||||
if (!FullLocInfo)
|
||||
return new MemberExpr((Expr*)Base, OpKind == tok::arrow, MemberDecl);
|
||||
else
|
||||
return new MemberExprLOC((Expr*)Base, OpLoc, OpKind == tok::arrow,
|
||||
MemberLoc, MemberDecl);
|
||||
return new MemberExpr((Expr*)Base, OpKind == tok::arrow, MemberDecl);
|
||||
}
|
||||
|
||||
/// ParseCallExpr - Handle a call to Fn with the specified array of arguments.
|
||||
|
@ -256,20 +233,13 @@ Action::ExprResult ASTBuilder::
|
|||
ParseCallExpr(ExprTy *Fn, SourceLocation LParenLoc,
|
||||
ExprTy **Args, unsigned NumArgs,
|
||||
SourceLocation *CommaLocs, SourceLocation RParenLoc) {
|
||||
if (!FullLocInfo)
|
||||
return new CallExpr((Expr*)Fn, (Expr**)Args, NumArgs);
|
||||
else
|
||||
return new CallExprLOC((Expr*)Fn, LParenLoc, (Expr**)Args, NumArgs,
|
||||
CommaLocs, RParenLoc);
|
||||
return new CallExpr((Expr*)Fn, (Expr**)Args, NumArgs);
|
||||
}
|
||||
|
||||
Action::ExprResult ASTBuilder::
|
||||
ParseCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
|
||||
SourceLocation RParenLoc, ExprTy *Op) {
|
||||
if (!FullLocInfo)
|
||||
return new CastExpr((Type*)Ty, (Expr*)Op);
|
||||
else
|
||||
return new CastExprLOC(LParenLoc, (Type*)Ty, RParenLoc, (Expr*)Op);
|
||||
return new CastExpr((Type*)Ty, (Expr*)Op);
|
||||
}
|
||||
|
||||
|
||||
|
@ -313,10 +283,7 @@ Action::ExprResult ASTBuilder::ParseBinOp(SourceLocation TokLoc,
|
|||
case tok::comma: Opc = BinaryOperator::Comma; break;
|
||||
}
|
||||
|
||||
if (!FullLocInfo)
|
||||
return new BinaryOperator((Expr*)LHS, (Expr*)RHS, Opc);
|
||||
else
|
||||
return new BinaryOperatorLOC((Expr*)LHS, TokLoc, (Expr*)RHS, Opc);
|
||||
return new BinaryOperator((Expr*)LHS, (Expr*)RHS, Opc);
|
||||
}
|
||||
|
||||
/// ParseConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
|
||||
|
@ -325,10 +292,6 @@ Action::ExprResult ASTBuilder::ParseConditionalOp(SourceLocation QuestionLoc,
|
|||
SourceLocation ColonLoc,
|
||||
ExprTy *Cond, ExprTy *LHS,
|
||||
ExprTy *RHS) {
|
||||
if (!FullLocInfo)
|
||||
return new ConditionalOperator((Expr*)Cond, (Expr*)LHS, (Expr*)RHS);
|
||||
else
|
||||
return new ConditionalOperatorLOC((Expr*)Cond, QuestionLoc, (Expr*)LHS,
|
||||
ColonLoc, (Expr*)RHS);
|
||||
return new ConditionalOperator((Expr*)Cond, (Expr*)LHS, (Expr*)RHS);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,19 +29,14 @@ namespace clang {
|
|||
class ASTBuilder : public Action {
|
||||
Preprocessor &PP;
|
||||
|
||||
/// FullLocInfo - If this is true, the ASTBuilder constructs AST Nodes that
|
||||
/// capture maximal location information for each source-language construct.
|
||||
bool FullLocInfo;
|
||||
|
||||
/// LastInGroupList - This vector is populated when there are multiple
|
||||
/// declarators in a single decl group (e.g. "int A, B, C"). In this case,
|
||||
/// all but the last decl will be entered into this. This is used by the
|
||||
/// ASTStreamer.
|
||||
std::vector<Decl*> &LastInGroupList;
|
||||
public:
|
||||
ASTBuilder(Preprocessor &pp, bool fullLocInfo,
|
||||
std::vector<Decl*> &prevInGroup)
|
||||
: PP(pp), FullLocInfo(fullLocInfo), LastInGroupList(prevInGroup) {}
|
||||
ASTBuilder(Preprocessor &pp, std::vector<Decl*> &prevInGroup)
|
||||
: PP(pp), LastInGroupList(prevInGroup) {}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Symbol table tracking callbacks.
|
||||
|
@ -59,7 +54,6 @@ public:
|
|||
virtual StmtResult ParseCompoundStmt(SourceLocation L, SourceLocation R,
|
||||
StmtTy **Elts, unsigned NumElts);
|
||||
virtual StmtResult ParseExprStmt(ExprTy *Expr) {
|
||||
// TODO: Full info should track this with a node.
|
||||
return Expr; // Exprs are Stmts.
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
DE345B500AFB1CFE00DBC861 /* ASTBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE345B4F0AFB1CFE00DBC861 /* ASTBuilder.cpp */; };
|
||||
DE345C1A0AFC658B00DBC861 /* StmtVisitor.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE345C190AFC658B00DBC861 /* StmtVisitor.h */; };
|
||||
DE345C570AFC69E800DBC861 /* StmtVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE345C560AFC69E800DBC861 /* StmtVisitor.cpp */; };
|
||||
DE345C780AFC6BE600DBC861 /* ASTBuilder.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE345C770AFC6BE600DBC861 /* ASTBuilder.h */; };
|
||||
DE46BF280AE0A82D00CC047C /* TargetInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE46BF270AE0A82D00CC047C /* TargetInfo.h */; };
|
||||
DE5932D10AD60FF400BC794C /* clang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5932CD0AD60FF400BC794C /* clang.cpp */; };
|
||||
DE5932D20AD60FF400BC794C /* clang.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE5932CE0AD60FF400BC794C /* clang.h */; };
|
||||
|
@ -116,6 +117,7 @@
|
|||
DE3450D70AEB543100DBC861 /* DirectoryLookup.h in CopyFiles */,
|
||||
DE3452810AEF1B1800DBC861 /* Stmt.h in CopyFiles */,
|
||||
DE345C1A0AFC658B00DBC861 /* StmtVisitor.h in CopyFiles */,
|
||||
DE345C780AFC6BE600DBC861 /* ASTBuilder.h in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
|
@ -146,6 +148,7 @@
|
|||
DE345B4F0AFB1CFE00DBC861 /* ASTBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ASTBuilder.cpp; path = AST/ASTBuilder.cpp; sourceTree = "<group>"; };
|
||||
DE345C190AFC658B00DBC861 /* StmtVisitor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = StmtVisitor.h; path = clang/AST/StmtVisitor.h; sourceTree = "<group>"; };
|
||||
DE345C560AFC69E800DBC861 /* StmtVisitor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = StmtVisitor.cpp; path = AST/StmtVisitor.cpp; sourceTree = "<group>"; };
|
||||
DE345C770AFC6BE600DBC861 /* ASTBuilder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ASTBuilder.h; path = clang/AST/ASTBuilder.h; sourceTree = "<group>"; };
|
||||
DE46BF270AE0A82D00CC047C /* TargetInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TargetInfo.h; sourceTree = "<group>"; };
|
||||
DE5932CD0AD60FF400BC794C /* clang.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = clang.cpp; path = Driver/clang.cpp; sourceTree = "<group>"; };
|
||||
DE5932CE0AD60FF400BC794C /* clang.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = clang.h; path = Driver/clang.h; sourceTree = "<group>"; };
|
||||
|
@ -284,6 +287,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
DEC8D9A30A94346E00353FCA /* AST.h */,
|
||||
DE345C770AFC6BE600DBC861 /* ASTBuilder.h */,
|
||||
DEC8DABF0A94402500353FCA /* ASTStreamer.h */,
|
||||
DEC8D9900A9433CD00353FCA /* Decl.h */,
|
||||
DE0FCA620A95859D00248FD5 /* Expr.h */,
|
||||
|
|
|
@ -27,8 +27,7 @@ namespace clang {
|
|||
/// and FileID. If FullLocInfo is true, full location information is captured
|
||||
/// in the AST nodes. This takes more space, but allows for very accurate
|
||||
/// position reporting.
|
||||
ASTStreamerTy *ASTStreamer_Init(Preprocessor &PP, unsigned MainFileID,
|
||||
bool FullLocInfo = false);
|
||||
ASTStreamerTy *ASTStreamer_Init(Preprocessor &PP, unsigned MainFileID);
|
||||
|
||||
/// ASTStreamer_ReadTopLevelDecl - Parse and return one top-level declaration.
|
||||
/// This returns null at end of file.
|
||||
|
|
|
@ -78,16 +78,6 @@ public:
|
|||
virtual void visit(StmtVisitor *Visitor);
|
||||
};
|
||||
|
||||
class StringExprLOC : public StringExpr {
|
||||
// Locations for the string tokens before string concatenation.
|
||||
SmallVector<SourceLocation, 4> Locs;
|
||||
public:
|
||||
StringExprLOC(const char *StrData, unsigned ByteLength, bool isWide,
|
||||
SourceLocation *L, unsigned NumLocs)
|
||||
: StringExpr(StrData, ByteLength, isWide), Locs(L, L+NumLocs) {
|
||||
}
|
||||
};
|
||||
|
||||
/// ParenExpr - This represents a parethesized expression, e.g. "(1)". This
|
||||
/// AST node is only formed if full location information is requested.
|
||||
class ParenExpr : public Expr {
|
||||
|
@ -133,13 +123,6 @@ private:
|
|||
Opcode Opc;
|
||||
};
|
||||
|
||||
class UnaryOperatorLOC : public UnaryOperator {
|
||||
SourceLocation Loc;
|
||||
public:
|
||||
UnaryOperatorLOC(SourceLocation loc, Expr *Input, Opcode Opc)
|
||||
: UnaryOperator(Input, Opc), Loc(loc) {}
|
||||
};
|
||||
|
||||
/// SizeOfAlignOfTypeExpr - [C99 6.5.3.4] - This is only for sizeof/alignof of
|
||||
/// *types*. sizeof(expr) is handled by UnaryOperator.
|
||||
class SizeOfAlignOfTypeExpr : public Expr {
|
||||
|
@ -153,17 +136,6 @@ public:
|
|||
virtual void visit(StmtVisitor *Visitor);
|
||||
};
|
||||
|
||||
class SizeOfAlignOfTypeExprLOC : public SizeOfAlignOfTypeExpr {
|
||||
SourceLocation OpLoc, LParenLoc, RParenLoc;
|
||||
public:
|
||||
SizeOfAlignOfTypeExprLOC(SourceLocation oploc, bool isSizeof,
|
||||
SourceLocation lparenloc, Type *Ty,
|
||||
SourceLocation rparenloc)
|
||||
: SizeOfAlignOfTypeExpr(isSizeof, Ty), OpLoc(oploc), LParenLoc(lparenloc),
|
||||
RParenLoc(rparenloc) {
|
||||
}
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Postfix Operators.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -179,14 +151,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class ArraySubscriptExprLOC : public ArraySubscriptExpr {
|
||||
SourceLocation LLoc, RLoc;
|
||||
public:
|
||||
ArraySubscriptExprLOC(Expr *Base, SourceLocation lloc, Expr *Idx,
|
||||
SourceLocation rloc)
|
||||
: ArraySubscriptExpr(Base, Idx), LLoc(lloc), RLoc(rloc) {}
|
||||
};
|
||||
|
||||
/// CallExpr - [C99 6.5.2.2] Function Calls.
|
||||
///
|
||||
class CallExpr : public Expr {
|
||||
|
@ -217,17 +181,6 @@ public:
|
|||
virtual void visit(StmtVisitor *Visitor);
|
||||
};
|
||||
|
||||
class CallExprLOC : public CallExpr {
|
||||
SourceLocation LParenLoc, RParenLoc;
|
||||
SourceLocation *CommaLocs;
|
||||
public:
|
||||
CallExprLOC(Expr *Fn, SourceLocation lparenloc, Expr **Args, unsigned NumArgs,
|
||||
SourceLocation *commalocs, SourceLocation rparenloc);
|
||||
~CallExprLOC() {
|
||||
delete [] CommaLocs;
|
||||
}
|
||||
};
|
||||
|
||||
/// MemberExpr - [C99 6.5.2.3] Structure and Union Members.
|
||||
///
|
||||
class MemberExpr : public Expr {
|
||||
|
@ -242,16 +195,6 @@ public:
|
|||
virtual void visit(StmtVisitor *Visitor);
|
||||
};
|
||||
|
||||
class MemberExprLOC : public MemberExpr {
|
||||
SourceLocation OpLoc, MemberLoc;
|
||||
public:
|
||||
MemberExprLOC(Expr *Base, SourceLocation oploc, bool isArrow,
|
||||
SourceLocation memberLoc, Decl *MemberDecl)
|
||||
: MemberExpr(Base, isArrow, MemberDecl), OpLoc(oploc), MemberLoc(memberLoc){
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/// CastExpr - [C99 6.5.4] Cast Operators.
|
||||
///
|
||||
class CastExpr : public Expr {
|
||||
|
@ -264,15 +207,6 @@ public:
|
|||
virtual void visit(StmtVisitor *Visitor);
|
||||
};
|
||||
|
||||
class CastExprLOC : public CastExpr {
|
||||
SourceLocation LParenLoc, RParenLoc;
|
||||
public:
|
||||
CastExprLOC(SourceLocation lparenloc, Type *Ty, SourceLocation rparenloc,
|
||||
Expr *Op)
|
||||
: CastExpr(Ty, Op), LParenLoc(lparenloc), RParenLoc(rparenloc) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class BinaryOperator : public Expr {
|
||||
public:
|
||||
|
@ -312,14 +246,6 @@ private:
|
|||
Opcode Opc;
|
||||
};
|
||||
|
||||
class BinaryOperatorLOC : public BinaryOperator {
|
||||
SourceLocation OperatorLoc;
|
||||
public:
|
||||
BinaryOperatorLOC(Expr *LHS, SourceLocation OpLoc, Expr *RHS, Opcode Opc)
|
||||
: BinaryOperator(LHS, RHS, Opc), OperatorLoc(OpLoc) {
|
||||
}
|
||||
};
|
||||
|
||||
/// ConditionalOperator - The ?: operator. Note that LHS may be null when the
|
||||
/// GNU "missing LHS" extension is in use.
|
||||
///
|
||||
|
@ -332,16 +258,6 @@ public:
|
|||
virtual void visit(StmtVisitor *Visitor);
|
||||
};
|
||||
|
||||
/// ConditionalOperatorLOC - ConditionalOperator with full location info.
|
||||
///
|
||||
class ConditionalOperatorLOC : public ConditionalOperator {
|
||||
SourceLocation QuestionLoc, ColonLoc;
|
||||
public:
|
||||
ConditionalOperatorLOC(Expr *Cond, SourceLocation QLoc, Expr *LHS,
|
||||
SourceLocation CLoc, Expr *RHS)
|
||||
: ConditionalOperator(Cond, LHS, RHS), QuestionLoc(QLoc), ColonLoc(CLoc) {}
|
||||
};
|
||||
|
||||
|
||||
} // end namespace clang
|
||||
} // end namespace llvm
|
||||
|
|
|
@ -27,8 +27,7 @@ namespace clang {
|
|||
/// and FileID. If FullLocInfo is true, full location information is captured
|
||||
/// in the AST nodes. This takes more space, but allows for very accurate
|
||||
/// position reporting.
|
||||
ASTStreamerTy *ASTStreamer_Init(Preprocessor &PP, unsigned MainFileID,
|
||||
bool FullLocInfo = false);
|
||||
ASTStreamerTy *ASTStreamer_Init(Preprocessor &PP, unsigned MainFileID);
|
||||
|
||||
/// ASTStreamer_ReadTopLevelDecl - Parse and return one top-level declaration.
|
||||
/// This returns null at end of file.
|
||||
|
|
Loading…
Reference in New Issue