[cfe-commits] r108157 - in /cfe/trunk: include/clang/AST/Expr.h lib/Sema/SemaExpr.cpp

Fariborz Jahanian fjahanian at apple.com
Mon Jul 12 10:26:57 PDT 2010


Author: fjahanian
Date: Mon Jul 12 12:26:57 2010
New Revision: 108157

URL: http://llvm.org/viewvc/llvm-project?rev=108157&view=rev
Log:
Move setting of Dependent Type to BlockDeclRefExpr's
constructor.

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

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=108157&r1=108156&r2=108157&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Mon Jul 12 12:26:57 2010
@@ -3398,8 +3398,10 @@
   // FIXME: Fix type/value dependence!
   BlockDeclRefExpr(ValueDecl *d, QualType t, SourceLocation l, bool ByRef,
                    bool constAdded = false,
-                   Stmt *copyConstructorVal = 0)
-  : Expr(BlockDeclRefExprClass, t, false, false), D(d), Loc(l), IsByRef(ByRef),
+                   Stmt *copyConstructorVal = 0,
+                   bool hasDependentType = false)
+  : Expr(BlockDeclRefExprClass, t, hasDependentType, false), 
+    D(d), Loc(l), IsByRef(ByRef),
     ConstQualAdded(constAdded),  CopyConstructorVal(copyConstructorVal) {}
 
   // \brief Build an empty reference to a declared variable in a

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=108157&r1=108156&r2=108157&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Jul 12 12:26:57 2010
@@ -1744,10 +1744,11 @@
     // Variable will be bound by-copy, make it const within the closure.
 
     ExprTy.addConst();
+    QualType T = VD->getType();
     BlockDeclRefExpr *BDRE = new (Context) BlockDeclRefExpr(VD, 
                                                             ExprTy, Loc, false,
-                                                            constAdded);
-    QualType T = VD->getType();
+                                                            constAdded, 0,
+                          (getLangOptions().CPlusPlus && T->isDependentType()));
     if (getLangOptions().CPlusPlus) {
       if (!T->isDependentType() && !T->isReferenceType()) {
         Expr *E = new (Context) 
@@ -1765,8 +1766,6 @@
           BDRE->setCopyConstructorExpr(Init);
         }
       }
-      else if (T->isDependentType())
-        BDRE->setTypeDependent(true);
     }
     return Owned(BDRE);
   }





More information about the cfe-commits mailing list