From 128a138a5783ee152eda2bf0633553470b35f8eb Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 13 Feb 2009 22:08:43 +0000 Subject: IRgen support for attribute used. - PR3566 llvm-svn: 64492 --- clang/lib/CodeGen/CGDecl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CGDecl.cpp') diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index abcd547be99..ddc68d68c5e 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -138,6 +138,9 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) { if (const SectionAttr *SA = D.getAttr()) GV->setSection(SA->getName()); + if (D.getAttr()) + CGM.AddUsedGlobal(GV); + const llvm::Type *LTy = CGM.getTypes().ConvertTypeForMem(D.getType()); const llvm::Type *LPtrTy = llvm::PointerType::get(LTy, D.getType().getAddressSpace()); @@ -149,7 +152,6 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) { DI->setLocation(D.getLocation()); DI->EmitGlobalVariable(static_cast(GV), &D); } - } /// EmitLocalBlockVarDecl - Emit code and set up an entry in LocalDeclMap for a -- cgit v1.2.3