[cfe-commits] r69097 - in /cfe/trunk: lib/CodeGen/CGObjCMac.cpp test/CodeGenObjC/metadata_symbols.m

Daniel Dunbar daniel at zuster.org
Tue Apr 14 16:14:48 PDT 2009


Author: ddunbar
Date: Tue Apr 14 18:14:47 2009
New Revision: 69097

URL: http://llvm.org/viewvc/llvm-project?rev=69097&view=rev
Log:
Set alignment on __cstring metadata variables to 1 (matching
llvm-gcc).

Modified:
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/test/CodeGenObjC/metadata_symbols.m

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=69097&r1=69096&r2=69097&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Apr 14 18:14:47 2009
@@ -2534,7 +2534,7 @@
     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::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 @@
     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 @@
     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::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 @@
     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);
 }

Modified: cfe/trunk/test/CodeGenObjC/metadata_symbols.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/metadata_symbols.m?rev=69097&r1=69096&r2=69097&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenObjC/metadata_symbols.m (original)
+++ cfe/trunk/test/CodeGenObjC/metadata_symbols.m Tue Apr 14 18:14:47 2009
@@ -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 &&





More information about the cfe-commits mailing list