[cfe-commits] r58000 - in /cfe/trunk/lib: AST/Expr.cpp Sema/SemaExpr.cpp

Argiris Kirtzidis akyrtzi at gmail.com
Wed Oct 22 14:00:29 PDT 2008


Author: akirtzidis
Date: Wed Oct 22 16:00:29 2008
New Revision: 58000

URL: http://llvm.org/viewvc/llvm-project?rev=58000&view=rev
Log:
Now that DeclRefExpr accepts a NamedDecl, use a DeclRefExpr for when a CXXFieldDecl is referenced inside a method.

Modified:
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=58000&r1=57999&r2=58000&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Wed Oct 22 16:00:29 2008
@@ -325,7 +325,7 @@
 /// DeclCanBeLvalue - Determine whether the given declaration can be
 /// an lvalue. This is a helper routine for isLvalue.
 static bool DeclCanBeLvalue(const NamedDecl *Decl, ASTContext &Ctx) {
-  return isa<VarDecl>(Decl) || 
+  return isa<VarDecl>(Decl) || isa<CXXFieldDecl>(Decl) ||
     // C++ 3.10p2: An lvalue refers to an object or function.
     (Ctx.getLangOptions().CPlusPlus &&
      (isa<FunctionDecl>(Decl) || isa<OverloadedFunctionDecl>(Decl)));

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=58000&r1=57999&r2=58000&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Oct 22 16:00:29 2008
@@ -402,10 +402,7 @@
       if (FD->isInvalidDecl())
         return true;
 
-      // FIXME: Use DeclRefExpr or a new Expr for a direct CXXField reference.
-      ExprResult ThisExpr = ActOnCXXThis(SourceLocation());
-      return new MemberExpr(static_cast<Expr*>(ThisExpr.Val),
-                            true, FD, Loc, FD->getType());
+      return new DeclRefExpr(FD, FD->getType(), Loc);
     }
 
     return Diag(Loc, diag::err_invalid_non_static_member_use, FD->getName());





More information about the cfe-commits mailing list