[cfe-commits] r38948 - in /cfe/cfe/trunk: AST/Expr.cpp AST/Sema.cpp Parse/ParseExpr.cpp Sema/Sema.cpp include/clang/AST/Expr.h include/clang/Parse/Action.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:26:07 PDT 2007
Author: sabre
Date: Wed Jul 11 11:26:07 2007
New Revision: 38948
URL: http://llvm.org/viewvc/llvm-project?rev=38948&view=rev
Log:
switch MemberExpr to holding a field decl instead of a raw identifier.
Modified:
cfe/cfe/trunk/AST/Expr.cpp
cfe/cfe/trunk/AST/Sema.cpp
cfe/cfe/trunk/Parse/ParseExpr.cpp
cfe/cfe/trunk/Sema/Sema.cpp
cfe/cfe/trunk/include/clang/AST/Expr.h
cfe/cfe/trunk/include/clang/Parse/Action.h
Modified: cfe/cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Expr.cpp?rev=38948&r1=38947&r2=38948&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/Expr.cpp (original)
+++ cfe/cfe/trunk/AST/Expr.cpp Wed Jul 11 11:26:07 2007
@@ -119,7 +119,11 @@
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
Modified: cfe/cfe/trunk/AST/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.cpp?rev=38948&r1=38947&r2=38948&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/Sema.cpp (original)
+++ cfe/cfe/trunk/AST/Sema.cpp Wed Jul 11 11:26:07 2007
@@ -211,11 +211,13 @@
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.
Modified: cfe/cfe/trunk/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseExpr.cpp?rev=38948&r1=38947&r2=38948&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseExpr.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseExpr.cpp Wed Jul 11 11:26:07 2007
@@ -559,7 +559,6 @@
/// 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.
Modified: cfe/cfe/trunk/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.cpp?rev=38948&r1=38947&r2=38948&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/Sema.cpp (original)
+++ cfe/cfe/trunk/Sema/Sema.cpp Wed Jul 11 11:26:07 2007
@@ -211,11 +211,13 @@
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.
Modified: cfe/cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Expr.h?rev=38948&r1=38947&r2=38948&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Expr.h Wed Jul 11 11:26:07 2007
@@ -177,12 +177,11 @@
///
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 @@
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){
}
};
Modified: cfe/cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/Action.h?rev=38948&r1=38947&r2=38948&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Action.h Wed Jul 11 11:26:07 2007
@@ -57,6 +57,8 @@
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;
More information about the cfe-commits
mailing list