#include "CGCXXABI.h"
#include "CGCleanup.h"
#include "CGObjCRuntime.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "CodeGenTypes.h"
#include "SanitizerMetadata.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/StmtObjC.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/CodeGen/ConstantInitBuilder.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ConvertUTF.h"
#include <cctype>
usingnamespaceclang;
usingnamespaceCodeGen;
namespace {
class LazyRuntimeFunction { … };
class CGObjCGNU : public CGObjCRuntime { … };
class CGObjCGCC : public CGObjCGNU { … };
class CGObjCGNUstep : public CGObjCGNU { … };
class CGObjCGNUstep2 : public CGObjCGNUstep { … };
const char *const CGObjCGNUstep2::SectionsBaseNames[8] = …;
const char *const CGObjCGNUstep2::PECOFFSectionsBaseNames[8] = …;
class CGObjCObjFW: public CGObjCGNU { … };
}
void CGObjCGNU::EmitClassRef(const std::string &className) { … }
CGObjCGNU::CGObjCGNU(CodeGenModule &cgm, unsigned runtimeABIVersion,
unsigned protocolClassVersion, unsigned classABI)
: … { … }
llvm::Value *CGObjCGNU::GetClassNamed(CodeGenFunction &CGF,
const std::string &Name, bool isWeak) { … }
llvm::Value *CGObjCGNU::GetClass(CodeGenFunction &CGF,
const ObjCInterfaceDecl *OID) { … }
llvm::Value *CGObjCGNU::EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) { … }
llvm::Value *CGObjCGNU::GetTypedSelector(CodeGenFunction &CGF, Selector Sel,
const std::string &TypeEncoding) { … }
Address CGObjCGNU::GetAddrOfSelector(CodeGenFunction &CGF, Selector Sel) { … }
llvm::Value *CGObjCGNU::GetSelector(CodeGenFunction &CGF, Selector Sel) { … }
llvm::Value *CGObjCGNU::GetSelector(CodeGenFunction &CGF,
const ObjCMethodDecl *Method) { … }
llvm::Constant *CGObjCGNU::GetEHType(QualType T) { … }
llvm::Constant *CGObjCGNUstep::GetEHType(QualType T) { … }
ConstantAddress CGObjCGNU::GenerateConstantString(const StringLiteral *SL) { … }
RValue
CGObjCGNU::GenerateMessageSendSuper(CodeGenFunction &CGF,
ReturnValueSlot Return,
QualType ResultType,
Selector Sel,
const ObjCInterfaceDecl *Class,
bool isCategoryImpl,
llvm::Value *Receiver,
bool IsClassMessage,
const CallArgList &CallArgs,
const ObjCMethodDecl *Method) { … }
RValue
CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF,
ReturnValueSlot Return,
QualType ResultType,
Selector Sel,
llvm::Value *Receiver,
const CallArgList &CallArgs,
const ObjCInterfaceDecl *Class,
const ObjCMethodDecl *Method) { … }
llvm::Constant *CGObjCGNU::
GenerateMethodList(StringRef ClassName,
StringRef CategoryName,
ArrayRef<const ObjCMethodDecl*> Methods,
bool isClassMethodList) { … }
llvm::Constant *CGObjCGNU::
GenerateIvarList(ArrayRef<llvm::Constant *> IvarNames,
ArrayRef<llvm::Constant *> IvarTypes,
ArrayRef<llvm::Constant *> IvarOffsets,
ArrayRef<llvm::Constant *> IvarAlign,
ArrayRef<Qualifiers::ObjCLifetime> IvarOwnership) { … }
llvm::Constant *CGObjCGNU::GenerateClassStructure(
llvm::Constant *MetaClass,
llvm::Constant *SuperClass,
unsigned info,
const char *Name,
llvm::Constant *Version,
llvm::Constant *InstanceSize,
llvm::Constant *IVars,
llvm::Constant *Methods,
llvm::Constant *Protocols,
llvm::Constant *IvarOffsets,
llvm::Constant *Properties,
llvm::Constant *StrongIvarBitmap,
llvm::Constant *WeakIvarBitmap,
bool isMeta) { … }
llvm::Constant *CGObjCGNU::
GenerateProtocolMethodList(ArrayRef<const ObjCMethodDecl*> Methods) { … }
llvm::Constant *
CGObjCGNU::GenerateProtocolList(ArrayRef<std::string> Protocols) { … }
llvm::Value *CGObjCGNU::GenerateProtocolRef(CodeGenFunction &CGF,
const ObjCProtocolDecl *PD) { … }
llvm::Constant *CGObjCGNU::GenerateProtocolRef(const ObjCProtocolDecl *PD) { … }
llvm::Constant *
CGObjCGNU::GenerateEmptyProtocol(StringRef ProtocolName) { … }
void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { … }
void CGObjCGNU::GenerateProtocolHolderCategory() { … }
llvm::Constant *CGObjCGNU::MakeBitField(ArrayRef<bool> bits) { … }
llvm::Constant *CGObjCGNU::GenerateCategoryProtocolList(const
ObjCCategoryDecl *OCD) { … }
void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { … }
llvm::Constant *CGObjCGNU::GeneratePropertyList(const Decl *Container,
const ObjCContainerDecl *OCD,
bool isClassProperty,
bool protocolOptionalProperties) { … }
void CGObjCGNU::RegisterAlias(const ObjCCompatibleAliasDecl *OAD) { … }
void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { … }
llvm::Function *CGObjCGNU::ModuleInitFunction() { … }
llvm::Function *CGObjCGNU::GenerateMethod(const ObjCMethodDecl *OMD,
const ObjCContainerDecl *CD) { … }
void CGObjCGNU::GenerateDirectMethodPrologue(CodeGenFunction &CGF,
llvm::Function *Fn,
const ObjCMethodDecl *OMD,
const ObjCContainerDecl *CD) { … }
llvm::FunctionCallee CGObjCGNU::GetPropertyGetFunction() { … }
llvm::FunctionCallee CGObjCGNU::GetPropertySetFunction() { … }
llvm::FunctionCallee CGObjCGNU::GetOptimizedPropertySetFunction(bool atomic,
bool copy) { … }
llvm::FunctionCallee CGObjCGNU::GetGetStructFunction() { … }
llvm::FunctionCallee CGObjCGNU::GetSetStructFunction() { … }
llvm::FunctionCallee CGObjCGNU::GetCppAtomicObjectGetFunction() { … }
llvm::FunctionCallee CGObjCGNU::GetCppAtomicObjectSetFunction() { … }
llvm::FunctionCallee CGObjCGNU::EnumerationMutationFunction() { … }
void CGObjCGNU::EmitSynchronizedStmt(CodeGenFunction &CGF,
const ObjCAtSynchronizedStmt &S) { … }
void CGObjCGNU::EmitTryStmt(CodeGenFunction &CGF,
const ObjCAtTryStmt &S) { … }
void CGObjCGNU::EmitThrowStmt(CodeGenFunction &CGF,
const ObjCAtThrowStmt &S,
bool ClearInsertionPoint) { … }
llvm::Value * CGObjCGNU::EmitObjCWeakRead(CodeGenFunction &CGF,
Address AddrWeakObj) { … }
void CGObjCGNU::EmitObjCWeakAssign(CodeGenFunction &CGF,
llvm::Value *src, Address dst) { … }
void CGObjCGNU::EmitObjCGlobalAssign(CodeGenFunction &CGF,
llvm::Value *src, Address dst,
bool threadlocal) { … }
void CGObjCGNU::EmitObjCIvarAssign(CodeGenFunction &CGF,
llvm::Value *src, Address dst,
llvm::Value *ivarOffset) { … }
void CGObjCGNU::EmitObjCStrongCastAssign(CodeGenFunction &CGF,
llvm::Value *src, Address dst) { … }
void CGObjCGNU::EmitGCMemmoveCollectable(CodeGenFunction &CGF,
Address DestPtr,
Address SrcPtr,
llvm::Value *Size) { … }
llvm::GlobalVariable *CGObjCGNU::ObjCIvarOffsetVariable(
const ObjCInterfaceDecl *ID,
const ObjCIvarDecl *Ivar) { … }
LValue CGObjCGNU::EmitObjCValueForIvar(CodeGenFunction &CGF,
QualType ObjectTy,
llvm::Value *BaseValue,
const ObjCIvarDecl *Ivar,
unsigned CVRQualifiers) { … }
static const ObjCInterfaceDecl *FindIvarInterface(ASTContext &Context,
const ObjCInterfaceDecl *OID,
const ObjCIvarDecl *OIVD) { … }
llvm::Value *CGObjCGNU::EmitIvarOffset(CodeGenFunction &CGF,
const ObjCInterfaceDecl *Interface,
const ObjCIvarDecl *Ivar) { … }
CGObjCRuntime *
clang::CodeGen::CreateGNUObjCRuntime(CodeGenModule &CGM) { … }