mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
really fix 6473 by handling weakref in constant expressions.
llvm-svn: 97750
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -52,3 +52,11 @@ void test6_h(void) {
|
||||
void test6_foo(void) {
|
||||
test6_f();
|
||||
}
|
||||
|
||||
// CHECK: declare extern_weak void @test7_f()
|
||||
void test7_f(void);
|
||||
static void test7_g(void) __attribute__((weakref("test7_f")));
|
||||
static void *const test7_zed = (void *) &test7_g;
|
||||
void* test7_h(void) {
|
||||
return test7_zed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user