]> granicus.if.org Git - clang/commitdiff
Move setting of Dependent Type to BlockDeclRefExpr's
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 12 Jul 2010 17:26:57 +0000 (17:26 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 12 Jul 2010 17:26:57 +0000 (17:26 +0000)
constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108157 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Expr.h
lib/Sema/SemaExpr.cpp

index 9d1ba48a3567d77aadc150916a608b1d5b282002..5cf285bad05a73972275f2a4651eb8c97c47c712 100644 (file)
@@ -3398,8 +3398,10 @@ public:
   // 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
index 57b4232294e8b8988d144b6a10b4f59ec3194cae..53886e108e2a964cf8836a57ac95978610f03aeb 100644 (file)
@@ -1744,10 +1744,11 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
     // 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 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
           BDRE->setCopyConstructorExpr(Init);
         }
       }
-      else if (T->isDependentType())
-        BDRE->setTypeDependent(true);
     }
     return Owned(BDRE);
   }