[cfe-dev] Objective-C top-level constructs code generation

Mike Stump mrs at apple.com
Mon Aug 11 15:41:50 PDT 2008


On May 24, 2008, at 10:56 AM, David Chisnall wrote:
> I've started splitting the Objective-C code generation stuff up into  
> smaller diffs.

So, this generates:

CodeGenModule.cpp: In member function ‘void  
clang::CodeGen::CodeGenModule::EmitObjCClassImplementation(const  
clang::ObjCImplementationDecl*)’:
CodeGenModule.cpp:334: warning: ‘ObjTy’ may be used uninitialized in  
this function

the code looks like:

   const llvm::Type *ObjTy;
   if (!Runtime->LateBoundIVars()) {
     ObjTy = getTypes().ConvertType(Context.getObjCInterfaceType 
(ClassDecl));
     instanceSize = TheTargetData.getABITypeSize(ObjTy);
   }

   // Collect information about instance variables.
   llvm::SmallVector<llvm::Constant*, 16> IvarNames;
   llvm::SmallVector<llvm::Constant*, 16> IvarTypes;
   llvm::SmallVector<llvm::Constant*, 16> IvarOffsets;
   const llvm::StructLayout *Layout =
     TheTargetData.getStructLayout(cast<llvm::StructType>(ObjTy));

So, would initializing this to 0 be appropriate?



More information about the cfe-dev mailing list