aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-03-04 21:26:03 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-03-04 21:26:03 +0000
commitda1826102fcadb5d3c5d2d20dfa51f0e77489004 (patch)
tree7e5e22fe31aa816ebd69624129b476e418ceff3b /lib/CodeGen/CGExprConstant.cpp
parent3a47c4e0a3e8d13ee4fb06cc3a98f9cfa9982400 (diff)
really fix 6473 by handling weakref in constant expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97750 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--lib/CodeGen/CGExprConstant.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 3df552d75b..f0d82a8f0d 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -761,7 +761,9 @@ public:
return C;
}
case Expr::DeclRefExprClass: {
- NamedDecl *Decl = cast<DeclRefExpr>(E)->getDecl();
+ ValueDecl *Decl = cast<DeclRefExpr>(E)->getDecl();
+ if (Decl->hasAttr<WeakRefAttr>())
+ return CGM.GetWeakRefReference(Decl);
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(Decl))
return CGM.GetAddrOfFunction(FD);
if (const VarDecl* VD = dyn_cast<VarDecl>(Decl)) {