Fix 80 col violations, assert on assumptions.

llvm-svn: 52755
This commit is contained in:
Chris Lattner 2008-06-26 04:10:42 +00:00
parent 64d8d074a8
commit 63dd337fc2
2 changed files with 23 additions and 22 deletions

View File

@ -57,7 +57,9 @@ llvm::Value *CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) {
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 @@ llvm::Value *CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) {
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 @@ void CodeGenFunction::GenerateObjCMethod(const ObjCMethodDecl *OMD) {
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,

View File

@ -766,25 +766,23 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
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 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
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();