]> granicus.if.org Git - clang/commitdiff
Set alignment on __cstring metadata variables to 1 (matching
authorDaniel Dunbar <daniel@zuster.org>
Tue, 14 Apr 2009 23:14:47 +0000 (23:14 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 14 Apr 2009 23:14:47 +0000 (23:14 +0000)
llvm-gcc).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69097 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjCMac.cpp
test/CodeGenObjC/metadata_symbols.m

index a0a8524fa5aa39a78d69bd2f4d233ff1bc631895..dd55e655ce3f040a181eccd95c87e48b9827c195 100644 (file)
@@ -2534,7 +2534,7 @@ llvm::Constant *CGObjCCommonMac::GetClassName(IdentifierInfo *Ident) {
     Entry = CreateMetadataVar("\01L_OBJC_CLASS_NAME_", 
                               llvm::ConstantArray::get(Ident->getName()), 
                               "__TEXT,__cstring,cstring_literals",
-                              0, true);
+                              1, true);
 
   return getConstantGEP(Entry, 0, 0);
 }
@@ -2939,7 +2939,7 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout(
   llvm::GlobalVariable * Entry = CreateMetadataVar("\01L_OBJC_CLASS_NAME_",
                                       llvm::ConstantArray::get(BitMap.c_str()),
                                       "__TEXT,__cstring,cstring_literals",
-                                      0, true);
+                                      1, true);
   // FIXME. Need a commomand-line option for this eventually.
   if (ForStrongLayout)
     printf("\nstrong ivar layout: ");
@@ -2964,7 +2964,7 @@ llvm::Constant *CGObjCCommonMac::GetMethodVarName(Selector Sel) {
     Entry = CreateMetadataVar("\01L_OBJC_METH_VAR_NAME_", 
                               llvm::ConstantArray::get(Sel.getAsString()),
                               "__TEXT,__cstring,cstring_literals",
-                              0, true);
+                              1, true);
 
   return getConstantGEP(Entry, 0, 0);
 }
@@ -2989,7 +2989,7 @@ llvm::Constant *CGObjCCommonMac::GetMethodVarType(FieldDecl *Field) {
     Entry = CreateMetadataVar("\01L_OBJC_METH_VAR_TYPE_",
                               llvm::ConstantArray::get(TypeStr),
                               "__TEXT,__cstring,cstring_literals",
-                              0, true);
+                              1, true);
     
   return getConstantGEP(Entry, 0, 0);
 }
@@ -3001,16 +3001,11 @@ llvm::Constant *CGObjCCommonMac::GetMethodVarType(const ObjCMethodDecl *D) {
 
   llvm::GlobalVariable *&Entry = MethodVarTypes[TypeStr];
 
-  if (!Entry) {
-    llvm::Constant *C = llvm::ConstantArray::get(TypeStr);
-    Entry = 
-      new llvm::GlobalVariable(C->getType(), false, 
-                               llvm::GlobalValue::InternalLinkage,
-                               C, "\01L_OBJC_METH_VAR_TYPE_", 
-                               &CGM.getModule());
-    Entry->setSection("__TEXT,__cstring,cstring_literals");
-    UsedGlobals.push_back(Entry);
-  }
+  if (!Entry)
+    Entry = CreateMetadataVar("\01L_OBJC_METH_VAR_TYPE_",
+                              llvm::ConstantArray::get(TypeStr),
+                              "__TEXT,__cstring,cstring_literals",
+                              1, true);
 
   return getConstantGEP(Entry, 0, 0);
 }
@@ -3023,7 +3018,7 @@ llvm::Constant *CGObjCCommonMac::GetPropertyName(IdentifierInfo *Ident) {
     Entry = CreateMetadataVar("\01L_OBJC_PROP_NAME_ATTR_", 
                               llvm::ConstantArray::get(Ident->getName()),
                               "__TEXT,__cstring,cstring_literals",
-                              0, true);
+                              1, true);
 
   return getConstantGEP(Entry, 0, 0);
 }
index 0edd9e899fed8cb333041cfa73efc1a5fa9df63d..55dc5a38f594fc6bf93e3145c3a2eaea690e9b04 100644 (file)
@@ -6,6 +6,7 @@
 // RUN: grep '@"OBJC_EHTYPE_$_EH2" = external global' %t &&
 // RUN: grep '@"OBJC_EHTYPE_$_EH3" = global .*section "__DATA,__objc_const", align 8' %t &&
 // RUN: grep '@"OBJC_EHTYPE_$_EH3"' %t | count 3 &&
+// RUN: grep '@"\\01L_OBJC_CLASS_NAME_" =.*section "__TEXT,__cstring,cstring_literals", align 1' %t | count 1 &&
 // RUN: grep -F 'define internal void @"\01-[A im0]"' %t &&
 // FIXME: Should include category name.
 // RUN: grep -F 'define internal void @"\01-[A im1]"' %t &&