[cfe-commits] r51840 - /cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
Eli Friedman
eli.friedman at gmail.com
Sun Jun 1 09:00:02 PDT 2008
Author: efriedma
Date: Sun Jun 1 11:00:02 2008
New Revision: 51840
URL: http://llvm.org/viewvc/llvm-project?rev=51840&view=rev
Log:
Don't name the ObjC types if there aren't any ObjC objects in the file.
Patch by David Chisnall.
Modified:
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=51840&r1=51839&r2=51840&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Sun Jun 1 11:00:02 2008
@@ -183,7 +183,6 @@
PtrToInt8Ty,
NULL);
SelectorTy = llvm::PointerType::getUnqual(SelStructTy);
- M.addTypeName(".objc_selector", SelectorTy);
PtrToIntTy = llvm::PointerType::getUnqual(IntTy);
PtrTy = PtrToInt8Ty;
@@ -194,14 +193,12 @@
llvm::cast<llvm::OpaqueType>(OpaqueObjTy.get())->refineAbstractTypeTo(IdTy);
IdTy = llvm::cast<llvm::StructType>(OpaqueObjTy.get());
IdTy = llvm::PointerType::getUnqual(IdTy);
- M.addTypeName(".objc_id", IdTy);
// IMP type
std::vector<const llvm::Type*> IMPArgs;
IMPArgs.push_back(IdTy);
IMPArgs.push_back(SelectorTy);
IMPTy = llvm::FunctionType::get(IdTy, IMPArgs, true);
- M.addTypeName(".objc_imp", IMPTy);
}
// This has to perform the lookup every time, since posing and related
// techniques can modify the name -> class mapping.
@@ -734,7 +731,12 @@
ExistingProtocols.empty() && TypedSelectors.empty() &&
UntypedSelectors.empty())
return NULL;
-
+
+ // Name the ObjC types to make the IR a bit easier to read
+ TheModule.addTypeName(".objc_selector", SelectorTy);
+ TheModule.addTypeName(".objc_id", IdTy);
+ TheModule.addTypeName(".objc_imp", IMPTy);
+
std::vector<llvm::Constant*> Elements;
// Generate statics list:
llvm::ArrayType *StaticsArrayTy = llvm::ArrayType::get(PtrToInt8Ty,
More information about the cfe-commits
mailing list