aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-09 20:50:13 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-09 20:50:13 +0000
commit35bd763b9438b53f7920521ed19c1ef74c7a6795 (patch)
treefc5193c4b666ec57e82cb311bda3ee6dd7a23e0f /lib/CodeGen/CGObjCMac.cpp
parenta6681ae9bb1578b7a5be65eb34e22b026ecbe884 (diff)
Tweak CreateMetadataVar, take the exact alignment instead of relying
on LLVM TargetData. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66455 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--lib/CodeGen/CGObjCMac.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 5ae32e8737..d1d4308378 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -436,11 +436,19 @@ protected:
/// This is a convenience wrapper which not only creates the
/// variable, but also sets the section and alignment and adds the
/// global to the UsedGlobals list.
+ ///
+ /// \param Name - The variable name.
+ /// \param Init - The variable initializer; this is also used to
+ /// define the type of the variable.
+ /// \param Section - The section the variable should go into, or 0.
+ /// \param Align - The alignment for the variable, or 0.
+ /// \param AddToUsed - Whether the variable should be added to
+ /// llvm.
llvm::GlobalVariable *CreateMetadataVar(const std::string &Name,
llvm::Constant *Init,
const char *Section,
- bool SetAlignment,
- bool IsUsed);
+ unsigned Align,
+ bool AddToUsed);
public:
CGObjCCommonMac(CodeGen::CodeGenModule &cgm) : CGM(cgm)
@@ -1857,8 +1865,8 @@ llvm::GlobalVariable *
CGObjCCommonMac::CreateMetadataVar(const std::string &Name,
llvm::Constant *Init,
const char *Section,
- bool SetAlignment,
- bool IsUsed) {
+ unsigned Align,
+ bool AddToUsed) {
const llvm::Type *Ty = Init->getType();
llvm::GlobalVariable *GV =
new llvm::GlobalVariable(Ty, false,
@@ -1868,9 +1876,9 @@ CGObjCCommonMac::CreateMetadataVar(const std::string &Name,
&CGM.getModule());
if (Section)
GV->setSection(Section);
- if (SetAlignment)
- GV->setAlignment(CGM.getTargetData().getPrefTypeAlignment(Ty));
- if (IsUsed)
+ if (Align)
+ GV->setAlignment(Align);
+ if (AddToUsed)
UsedGlobals.push_back(GV);
return GV;
}