forked from OSchip/llvm-project
switch MemberExpr to holding a field decl instead of a raw identifier.
llvm-svn: 38948
This commit is contained in:
parent
98286a4551
commit
6f3a117f81
|
@ -119,7 +119,11 @@ CallExprLOC::CallExprLOC(Expr *Fn, SourceLocation lparenloc, Expr **Args,
|
|||
|
||||
void MemberExpr::dump_impl() const {
|
||||
Base->dump();
|
||||
std::cerr << (isArrow ? "->" : ".") << MemberII->getName();
|
||||
std::cerr << (isArrow ? "->" : ".");
|
||||
|
||||
if (MemberDecl)
|
||||
/*TODO: Print MemberDecl*/;
|
||||
std::cerr << "member";
|
||||
}
|
||||
|
||||
/// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
|
||||
|
|
|
@ -211,11 +211,13 @@ Action::ExprResult ASTBuilder::
|
|||
ParseMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
|
||||
tok::TokenKind OpKind, SourceLocation MemberLoc,
|
||||
IdentifierInfo &Member) {
|
||||
Decl *MemberDecl = 0;
|
||||
// TODO: Look up MemberDecl.
|
||||
if (!FullLocInfo)
|
||||
return new MemberExpr((Expr*)Base, OpKind == tok::arrow, Member);
|
||||
return new MemberExpr((Expr*)Base, OpKind == tok::arrow, MemberDecl);
|
||||
else
|
||||
return new MemberExprLOC((Expr*)Base, OpLoc, OpKind == tok::arrow,
|
||||
MemberLoc, Member);
|
||||
MemberLoc, MemberDecl);
|
||||
}
|
||||
|
||||
/// ParseCallExpr - Handle a call to Fn with the specified array of arguments.
|
||||
|
|
|
@ -559,7 +559,6 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
|
|||
/// argument-expression-list ',' assignment-expression
|
||||
///
|
||||
Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
|
||||
assert(!LHS.isInvalid && "LHS is invalid already!");
|
||||
|
||||
// Now that the primary-expression piece of the postfix-expression has been
|
||||
// parsed, see if there are any postfix-expression pieces here.
|
||||
|
|
|
@ -211,11 +211,13 @@ Action::ExprResult ASTBuilder::
|
|||
ParseMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
|
||||
tok::TokenKind OpKind, SourceLocation MemberLoc,
|
||||
IdentifierInfo &Member) {
|
||||
Decl *MemberDecl = 0;
|
||||
// TODO: Look up MemberDecl.
|
||||
if (!FullLocInfo)
|
||||
return new MemberExpr((Expr*)Base, OpKind == tok::arrow, Member);
|
||||
return new MemberExpr((Expr*)Base, OpKind == tok::arrow, MemberDecl);
|
||||
else
|
||||
return new MemberExprLOC((Expr*)Base, OpLoc, OpKind == tok::arrow,
|
||||
MemberLoc, Member);
|
||||
MemberLoc, MemberDecl);
|
||||
}
|
||||
|
||||
/// ParseCallExpr - Handle a call to Fn with the specified array of arguments.
|
||||
|
|
|
@ -177,12 +177,11 @@ public:
|
|||
///
|
||||
class MemberExpr : public Expr {
|
||||
Expr *Base;
|
||||
// TODO: union { Decl *MemberDecl; IdentifierInfo *MemberII; };
|
||||
IdentifierInfo *MemberII;
|
||||
Decl *MemberDecl;
|
||||
bool isArrow; // True if this is "X->F", false if this is "X.F".
|
||||
public:
|
||||
MemberExpr(Expr *base, bool isarrow, IdentifierInfo &memberii)
|
||||
: Base(base), MemberII(&memberii), isArrow(isarrow) {
|
||||
MemberExpr(Expr *base, bool isarrow, Decl *memberdecl)
|
||||
: Base(base), MemberDecl(memberdecl), isArrow(isarrow) {
|
||||
}
|
||||
virtual void dump_impl() const;
|
||||
};
|
||||
|
@ -191,8 +190,8 @@ class MemberExprLOC : public MemberExpr {
|
|||
SourceLocation OpLoc, MemberLoc;
|
||||
public:
|
||||
MemberExprLOC(Expr *Base, SourceLocation oploc, bool isArrow,
|
||||
SourceLocation memberLoc, IdentifierInfo &MemberII)
|
||||
: MemberExpr(Base, isArrow, MemberII), OpLoc(oploc), MemberLoc(memberLoc) {
|
||||
SourceLocation memberLoc, Decl *MemberDecl)
|
||||
: MemberExpr(Base, isArrow, MemberDecl), OpLoc(oploc), MemberLoc(memberLoc){
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -57,6 +57,8 @@ public:
|
|||
bool isInvalid;
|
||||
|
||||
ExprResult(bool Invalid = false) : Val(0), isInvalid(Invalid) {}
|
||||
template<typename ActualExprTy>
|
||||
ExprResult(ActualExprTy *val) : Val(val), isInvalid(false) {}
|
||||
|
||||
const ExprResult &operator=(ExprTy *RHS) {
|
||||
Val = RHS;
|
||||
|
|
Loading…
Reference in New Issue