[cfe-commits] r52755 - in /cfe/trunk/lib/CodeGen: CGObjC.cpp CGObjCGNU.cpp
Chris Lattner
sabre at nondot.org
Wed Jun 25 21:10:43 PDT 2008
Author: lattner
Date: Wed Jun 25 23:10:42 2008
New Revision: 52755
URL: http://llvm.org/viewvc/llvm-project?rev=52755&view=rev
Log:
Fix 80 col violations, assert on assumptions.
Modified:
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=52755&r1=52754&r2=52755&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Wed Jun 25 23:10:42 2008
@@ -57,7 +57,9 @@
llvm::Value *ClassName = CGM.GetAddrOfConstantString(classname);
ClassName = Builder.CreateStructGEP(ClassName, 0);
Receiver = Runtime->LookupClass(Builder, ClassName);
- } else if (dyn_cast<PreDefinedExpr>(E->getReceiver())) {
+ } else if (isa<PreDefinedExpr>(E->getReceiver())) {
+ assert(cast<PreDefinedExpr>(E->getReceiver())->getIdentType() ==
+ PreDefinedExpr::ObjCSuper);
isSuperMessage = true;
Receiver = LoadObjCSelf();
} else {
@@ -93,11 +95,12 @@
if (isSuperMessage) {
const ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(CurFuncDecl);
assert(OMD && "super is only valid in an Objective-C method");
- const char *SuperClass = OMD->getClassInterface()->getSuperClass()->getName();
+ const char *SuperClass =
+ OMD->getClassInterface()->getSuperClass()->getName();
return Runtime->GenerateMessageSendSuper(Builder, ConvertType(E->getType()),
- Receiver, SuperClass,
- Receiver, SelPtr,
- &Args[0], Args.size());
+ Receiver, SuperClass,
+ Receiver, SelPtr,
+ &Args[0], Args.size());
}
return Runtime->GenerateMessageSend(Builder, ConvertType(E->getType()),
LoadObjCSelf(),
@@ -122,9 +125,10 @@
dyn_cast<ObjCCategoryImplDecl>(OMD->getMethodContext())) {
CategoryName = OCD->getName();
}
- const llvm::Type *ReturnTy = CGM.getTypes().ConvertReturnType(OMD->getResultType());
+ const llvm::Type *ReturnTy =
+ CGM.getTypes().ConvertReturnType(OMD->getResultType());
CurFn = CGM.getObjCRuntime()->MethodPreamble(
- OMD->getClassInterface()->getName(),
+ OMD->getClassInterface()->getName(),
CategoryName,
OMD->getSelector().getName(),
ReturnTy,
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=52755&r1=52754&r2=52755&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Jun 25 23:10:42 2008
@@ -766,25 +766,23 @@
Elements.push_back(llvm::ConstantArray::get(StaticsArrayTy, ConstantStrings));
llvm::StructType *StaticsListTy =
llvm::StructType::get(PtrToInt8Ty, StaticsArrayTy, NULL);
+ llvm::Type *StaticsListPtrTy = llvm::PointerType::getUnqual(StaticsListTy);
llvm::Constant *Statics =
MakeGlobal(StaticsListTy, Elements, ".objc_statics");
llvm::ArrayType *StaticsListArrayTy =
- llvm::ArrayType::get(llvm::PointerType::getUnqual(StaticsListTy), 2);
+ llvm::ArrayType::get(StaticsListPtrTy, 2);
Elements.clear();
Elements.push_back(Statics);
- Elements.push_back(llvm::ConstantPointerNull::get(llvm::PointerType::getUnqual(StaticsListTy)));
+ Elements.push_back(llvm::Constant::getNullValue(StaticsListPtrTy));
Statics = MakeGlobal(StaticsListArrayTy, Elements, ".objc_statics_ptr");
Statics = llvm::ConstantExpr::getBitCast(Statics, PtrTy);
// Array of classes, categories, and constant objects
llvm::ArrayType *ClassListTy = llvm::ArrayType::get(PtrToInt8Ty,
Classes.size() + Categories.size() + 2);
- llvm::StructType *SymTabTy = llvm::StructType::get(
- LongTy,
- SelectorTy,
- llvm::Type::Int16Ty,
- llvm::Type::Int16Ty,
- ClassListTy,
- NULL);
+ llvm::StructType *SymTabTy = llvm::StructType::get(LongTy, SelectorTy,
+ llvm::Type::Int16Ty,
+ llvm::Type::Int16Ty,
+ ClassListTy, NULL);
Elements.clear();
// Pointer to an array of selectors used in this module.
@@ -792,18 +790,17 @@
for (std::map<TypedSelector, llvm::GlobalAlias*>::iterator
iter = TypedSelectors.begin(), iterEnd = TypedSelectors.end();
iter != iterEnd ; ++iter) {
- Elements.push_back(MakeConstantString((*iter).first.first,
- ".objc_sel_name"));
- Elements.push_back(MakeConstantString((*iter).first.second,
- ".objc_sel_types"));
+ Elements.push_back(MakeConstantString(iter->first.first, ".objc_sel_name"));
+ Elements.push_back(MakeConstantString(iter->first.second,
+ ".objc_sel_types"));
Selectors.push_back(llvm::ConstantStruct::get(SelStructTy, Elements));
Elements.clear();
}
for (llvm::StringMap<llvm::GlobalAlias*>::iterator
iter = UntypedSelectors.begin(), iterEnd = UntypedSelectors.end();
- iter != iterEnd; iter++) {
+ iter != iterEnd; ++iter) {
Elements.push_back(
- MakeConstantString((*iter).getKeyData(), ".objc_sel_name"));
+ MakeConstantString(iter->getKeyData(), ".objc_sel_name"));
Elements.push_back(NULLPtr);
Selectors.push_back(llvm::ConstantStruct::get(SelStructTy, Elements));
Elements.clear();
More information about the cfe-commits
mailing list