clang  6.0.0svn
Enumerations | Functions | Variables
CGObjCMac.cpp File Reference
#include "CGBlocks.h"
#include "CGCleanup.h"
#include "CGObjCRuntime.h"
#include "CGRecordLayout.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "clang/CodeGen/ConstantInitBuilder.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/StmtObjC.h"
#include "clang/Basic/LangOptions.h"
#include "clang/CodeGen/CGFunctionInfo.h"
#include "clang/Frontend/CodeGenOptions.h"
#include "llvm/ADT/CachedHashString.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdio>
Include dependency graph for CGObjCMac.cpp:

Go to the source code of this file.

Enumerations

enum  ObjCLabelType
 
enum  MethodListType
 
enum  { kCFTaggedObjectID_Integer = (1 << 1) + 1 }
 
enum  FragileClassFlags {
  FragileABI_Class_Factory = 0x00001, FragileABI_Class_Meta = 0x00002, FragileABI_Class_HasCXXStructors = 0x02000, FragileABI_Class_Hidden = 0x20000,
  FragileABI_Class_CompiledByARC = 0x04000000, FragileABI_Class_HasMRCWeakIvars = 0x08000000
}
 
enum  NonFragileClassFlags {
  NonFragileABI_Class_Meta = 0x00001, NonFragileABI_Class_Root = 0x00002, NonFragileABI_Class_HasCXXStructors = 0x00004, NonFragileABI_Class_Hidden = 0x00010,
  NonFragileABI_Class_Exception = 0x00020, NonFragileABI_Class_HasIvarReleaser = 0x00040, NonFragileABI_Class_CompiledByARC = 0x00080, NonFragileABI_Class_HasCXXDestructorOnly = 0x00100,
  NonFragileABI_Class_HasMRCWeakIvars = 0x00200
}
 
enum  ImageInfoFlags {
  eImageInfo_FixAndContinue = (1 << 0), eImageInfo_GarbageCollected = (1 << 1), eImageInfo_GCOnly = (1 << 2), eImageInfo_OptimizedByDyld = (1 << 3),
  eImageInfo_CorrectedSynthesize = (1 << 4), eImageInfo_ImageIsSimulated = (1 << 5), eImageInfo_ClassProperties = (1 << 6)
}
 EmitImageInfo - Emit the image info marker used to encode some module level information. More...
 

Functions

static llvm::Constant * getConstantGEP (llvm::LLVMContext &VMContext, llvm::GlobalVariable *C, unsigned idx0, unsigned idx1)
 getConstantGEP() - Help routine to construct simple GEPs. More...
 
static bool hasObjCExceptionAttribute (ASTContext &Context, const ObjCInterfaceDecl *OID)
 hasObjCExceptionAttribute - Return true if this class or any super class has the objc_exception attribute. More...
 
static llvm::StringMapEntry< llvm::GlobalVariable * > & GetConstantStringEntry (llvm::StringMap< llvm::GlobalVariable *> &Map, const StringLiteral *Literal, unsigned &StringLength)
 
static bool isWeakLinkedClass (const ObjCInterfaceDecl *ID)
 
static Qualifiers::GC GetGCAttrTypeForType (ASTContext &Ctx, QualType FQT, bool pointee=false)
 
static void PushProtocolProperties (llvm::SmallPtrSet< const IdentifierInfo *, 16 > &PropertySet, SmallVectorImpl< const ObjCPropertyDecl *> &Properties, const ObjCProtocolDecl *Proto, bool IsClassProperty)
 
static bool hasWeakMember (QualType type)
 
static bool hasMRCWeakIvars (CodeGenModule &CGM, const ObjCImplementationDecl *ID)
 For compatibility, we only want to set the "HasMRCWeakIvars" flag (and actually fill in a layout string) if we really do have any __weak ivars. More...
 
static void addIfPresent (llvm::DenseSet< llvm::Value *> &S, llvm::Value *V)
 
static void addIfPresent (llvm::DenseSet< llvm::Value *> &S, Address V)
 
static llvm::GlobalValue::DLLStorageClassTypes getStorage (CodeGenModule &CGM, StringRef Name)
 

Variables

static const int ModuleVersion = 7
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kCFTaggedObjectID_Integer 

Definition at line 1976 of file CGObjCMac.cpp.

◆ FragileClassFlags

Enumerator
FragileABI_Class_Factory 

Apparently: is not a meta-class.

FragileABI_Class_Meta 

Is a meta-class.

FragileABI_Class_HasCXXStructors 

Has a non-trivial constructor or destructor.

FragileABI_Class_Hidden 

Has hidden visibility.

FragileABI_Class_CompiledByARC 

Class implementation was compiled under ARC.

FragileABI_Class_HasMRCWeakIvars 

Class implementation was compiled under MRC and has MRC weak ivars.

Exclusive with CompiledByARC.

Definition at line 3300 of file CGObjCMac.cpp.

◆ ImageInfoFlags

EmitImageInfo - Emit the image info marker used to encode some module level information.

See: <rdr://4810609&4810587&4810587> struct IMAGE_INFO { unsigned version; unsigned flags; };

Enumerator
eImageInfo_FixAndContinue 
eImageInfo_GarbageCollected 
eImageInfo_GCOnly 
eImageInfo_OptimizedByDyld 
eImageInfo_CorrectedSynthesize 
eImageInfo_ImageIsSimulated 
eImageInfo_ClassProperties 

Definition at line 4831 of file CGObjCMac.cpp.

◆ MethodListType

enum MethodListType
strong

Definition at line 1095 of file CGObjCMac.cpp.

◆ NonFragileClassFlags

Enumerator
NonFragileABI_Class_Meta 

Is a meta-class.

NonFragileABI_Class_Root 

Is a root class.

NonFragileABI_Class_HasCXXStructors 

Has a non-trivial constructor or destructor.

NonFragileABI_Class_Hidden 

Has hidden visibility.

NonFragileABI_Class_Exception 

Has the exception attribute.

NonFragileABI_Class_HasIvarReleaser 

(Obsolete) ARC-specific: this class has a .release_ivars method

NonFragileABI_Class_CompiledByARC 

Class implementation was compiled under ARC.

NonFragileABI_Class_HasCXXDestructorOnly 

Class has non-trivial destructors, but zero-initialization is okay.

NonFragileABI_Class_HasMRCWeakIvars 

Class implementation was compiled under MRC and has MRC weak ivars.

Exclusive with CompiledByARC.

Definition at line 3321 of file CGObjCMac.cpp.

◆ ObjCLabelType

enum ObjCLabelType
strong

Definition at line 734 of file CGObjCMac.cpp.

Function Documentation

◆ addIfPresent() [1/2]

static void addIfPresent ( llvm::DenseSet< llvm::Value *> &  S,
llvm::Value V 
)
static

Definition at line 4182 of file CGObjCMac.cpp.

Referenced by addIfPresent().

◆ addIfPresent() [2/2]

static void addIfPresent ( llvm::DenseSet< llvm::Value *> &  S,
Address  V 
)
static

◆ getConstantGEP()

static llvm::Constant* getConstantGEP ( llvm::LLVMContext &  VMContext,
llvm::GlobalVariable *  C,
unsigned  idx0,
unsigned  idx1 
)
static

getConstantGEP() - Help routine to construct simple GEPs.

Definition at line 1781 of file CGObjCMac.cpp.

Referenced by GetGCAttrTypeForType().

◆ GetConstantStringEntry()

static llvm::StringMapEntry<llvm::GlobalVariable *>& GetConstantStringEntry ( llvm::StringMap< llvm::GlobalVariable *> &  Map,
const StringLiteral Literal,
unsigned &  StringLength 
)
static

◆ GetGCAttrTypeForType()

static Qualifiers::GC GetGCAttrTypeForType ( ASTContext Ctx,
QualType  FQT,
bool  pointee = false 
)
static

Definition at line 2182 of file CGObjCMac.cpp.

References clang::CodeGen::CodeGenModule::addCompilerUsedGlobal(), clang::CodeGen::ConstantInitBuilderTemplateBase< Traits >::beginStruct(), clang::CodeGen::CGBlockInfo::BlockHeaderForcedGapOffset, clang::CodeGen::CGBlockInfo::BlockHeaderForcedGapSize, clang::CodeGen::CGBlockInfo::BlockSize, clang::CodeGen::CodeGenFunction::Builder, clang::BlockDecl::captures(), clang::CodeGen::CodeGenFunction::CGM, clang::ASTContext::CharTy, clang::CodeGen::CodeGenTypes::ConvertType(), clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CGBuilderTy::CreateBitCast(), dump(), clang::RecordDecl::fields(), clang::CharUnits::fromQuantity(), clang::Qualifiers::GCNone, clang::IdentifierTable::get(), clang::CodeGen::CodeGenModule::GetAddrOfConstantCString(), clang::Type::getAs(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getASTRecordLayout(), clang::FieldDecl::getBitWidthValue(), clang::CodeGen::CGBlockInfo::getBlockDecl(), clang::CodeGen::CGBlockInfo::getCapture(), clang::TargetInfo::getCharWidth(), getConstantGEP(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getDataLayout(), clang::RecordType::getDecl(), clang::ObjCProtocolDecl::getDefinition(), clang::ArrayType::getElementType(), clang::ASTRecordLayout::getFieldOffset(), clang::NamedDecl::getIdentifier(), clang::CodeGen::CGBlockInfo::Capture::getIndex(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::ASTContext::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::NamedDecl::getName(), clang::QualType::getObjCLifetime(), clang::ObjCInterfaceDecl::getObjCRuntimeNameAsString(), clang::ObjCProtocolDecl::getObjCRuntimeNameAsString(), clang::CodeGen::CGBlockInfo::Capture::getOffset(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), clang::ASTContext::getPointerType(), clang::TargetInfo::getPointerWidth(), clang::CharUnits::getQuantity(), clang::ConstantArrayType::getSize(), clang::CodeGen::CodeGenModule::getTarget(), clang::CodeGen::CodeGenModule::getTriple(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::ASTContext::getTypeSize(), clang::ASTContext::getTypeSizeInChars(), clang::ASTContext::Idents, clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::CodeGenTypeCache::IntPtrTy, clang::Type::isArrayType(), clang::FieldDecl::isBitField(), clang::Type::isBlockPointerType(), clang::CodeGen::CGBlockInfo::Capture::isConstant(), clang::QualType::isObjCGCStrong(), clang::QualType::isObjCGCWeak(), clang::Type::isObjCObjectPointerType(), clang::Type::isRecordType(), clang::TagDecl::isUnion(), clang::Type::isUnionType(), clang::LangOptions::NonGC, clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, clang::operator<(), printf(), clang::ObjCProtocolDecl::protocol_begin(), clang::ObjCProtocolDecl::protocol_end(), clang::Qualifiers::Strong, clang::CodeGen::CGBlockInfo::StructureType, clang::ASTContext::toCharUnitsFromBits(), clang::CodeGen::Type, clang::ast_matchers::type, clang::Qualifiers::Weak, clang::CanQual< T >::withConst(), and clang::CharUnits::Zero().

◆ getStorage()

static llvm::GlobalValue::DLLStorageClassTypes getStorage ( CodeGenModule CGM,
StringRef  Name 
)
static

◆ hasMRCWeakIvars()

static bool hasMRCWeakIvars ( CodeGenModule CGM,
const ObjCImplementationDecl ID 
)
static

For compatibility, we only want to set the "HasMRCWeakIvars" flag (and actually fill in a layout string) if we really do have any __weak ivars.

Definition at line 3369 of file CGObjCMac.cpp.

References clang::ObjCInterfaceDecl::all_declared_ivar_begin(), clang::ObjCInterfaceDecl::all_referenced_protocol_begin(), clang::ObjCInterfaceDecl::all_referenced_protocol_end(), clang::CodeGen::ConstantInitBuilderTemplateBase< Traits >::beginStruct(), FragileABI_Class_CompiledByARC, FragileABI_Class_Factory, FragileABI_Class_HasCXXStructors, FragileABI_Class_HasMRCWeakIvars, FragileABI_Class_Hidden, clang::ASTContext::getASTObjCImplementationLayout(), clang::ObjCImplDecl::getClassInterface(), clang::CodeGen::CodeGenModule::getContext(), clang::ObjCPropertyDecl::getGetterMethodDecl(), clang::ObjCImplementationDecl::getIdentifier(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::ObjCImplementationDecl::getName(), clang::ObjCImplementationDecl::getNameAsString(), clang::ObjCIvarDecl::getNextIvar(), clang::ObjCImplementationDecl::getObjCRuntimeNameAsString(), clang::CharUnits::getQuantity(), clang::ObjCPropertyDecl::getSetterMethodDecl(), clang::ASTRecordLayout::getSize(), clang::ObjCInterfaceDecl::getSuperClass(), clang::NamedDecl::getVisibility(), clang::ObjCImplementationDecl::hasDestructors(), clang::ObjCImplementationDecl::hasNonZeroConstructors(), hasWeakMember(), clang::HiddenVisibility, clang::ObjCContainerDecl::methods(), clang::LangOptions::NonGC, clang::ObjCImplDecl::property_impls(), clang::ObjCPropertyImplDecl::Synthesize, and clang::CharUnits::Zero().

◆ hasObjCExceptionAttribute()

static bool hasObjCExceptionAttribute ( ASTContext Context,
const ObjCInterfaceDecl OID 
)
static

hasObjCExceptionAttribute - Return true if this class or any super class has the objc_exception attribute.

Definition at line 1793 of file CGObjCMac.cpp.

◆ hasWeakMember()

static bool hasWeakMember ( QualType  type)
static

◆ isWeakLinkedClass()

static bool isWeakLinkedClass ( const ObjCInterfaceDecl ID)
static

◆ PushProtocolProperties()

static void PushProtocolProperties ( llvm::SmallPtrSet< const IdentifierInfo *, 16 > &  PropertySet,
SmallVectorImpl< const ObjCPropertyDecl *> &  Properties,
const ObjCProtocolDecl Proto,
bool  IsClassProperty 
)
static

Variable Documentation

◆ ModuleVersion

const int ModuleVersion = 7
static

Definition at line 4908 of file CGObjCMac.cpp.