diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-02-13 22:08:43 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-02-13 22:08:43 +0000 |
commit | 5c61d97ad442b2c0bbecb617c8f21857ce1fff6d (patch) | |
tree | 3bc1e1cdf7efbcc53a69fe846418e8c821c00ab5 /lib/CodeGen/CGDecl.cpp | |
parent | 56cd21bd52aed7a32f3ff11b7e480f664d0b4262 (diff) |
IRgen support for attribute used.
- PR3566
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64492 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | lib/CodeGen/CGDecl.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index abcd547be9..ddc68d68c5 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -138,6 +138,9 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) { if (const SectionAttr *SA = D.getAttr<SectionAttr>()) GV->setSection(SA->getName()); + if (D.getAttr<UsedAttr>()) + 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<llvm::GlobalVariable *>(GV), &D); } - } /// EmitLocalBlockVarDecl - Emit code and set up an entry in LocalDeclMap for a |