clang 8.0.0

Macros | Enumerations | Functions
RewriteModernObjC.cpp File Reference
`#include "clang/Rewrite/Frontend/ASTConsumers.h"`
`#include "clang/AST/AST.h"`
`#include "clang/AST/ASTConsumer.h"`
`#include "clang/AST/Attr.h"`
`#include "clang/AST/ParentMap.h"`
`#include "clang/Basic/CharInfo.h"`
`#include "clang/Basic/Diagnostic.h"`
`#include "clang/Basic/IdentifierTable.h"`
`#include "clang/Basic/SourceManager.h"`
`#include "clang/Basic/TargetInfo.h"`
`#include "clang/Config/config.h"`
`#include "clang/Lex/Lexer.h"`
`#include "clang/Rewrite/Core/Rewriter.h"`
`#include "llvm/ADT/DenseSet.h"`
`#include "llvm/ADT/SmallPtrSet.h"`
`#include "llvm/ADT/StringExtras.h"`
`#include "llvm/Support/MemoryBuffer.h"`
`#include "llvm/Support/raw_ostream.h"`
`#include <memory>`
Include dependency graph for RewriteModernObjC.cpp:

Go to the source code of this file.

## Macros
#define | SKIP_BITFIELDS(IX, ENDIX, VEC)

## Enumerations
enum | MetaDataDlags { CLS = 0x0, CLS_META = 0x1, CLS_ROOT = 0x2, OBJC2_CLS_HIDDEN = 0x10, CLS_EXCEPTION = 0x20, CLS_HAS_IVAR_RELEASER = 0x40, CLS_COMPILED_BY_ARC = 0x80 }

## Functions
static bool | IsHeaderFile (const std::string &Filename)
static void | WriteInternalIvarName (const ObjCInterfaceDecl *IDecl, ObjCIvarDecl *IvarDecl, std::string &Result)
static bool | mustSynthesizeSetterGetterMethod (ObjCImplementationDecl *IMP, ObjCPropertyDecl *PD, bool getter)
| mustSynthesizeSetterGetterMethod - returns true if setter or getter has not been found in the class implementation. More...
static void | RewriteOneForwardClassDecl (ObjCInterfaceDecl *ForwardDecl, std::string &typedefString)
static void | Write_RethrowObject (std::string &buf)
static bool | scanForProtocolRefs (const char *startBuf, const char *endBuf, const char *&startRef, const char *&endRef)
static void | scanToNextArgument (const char *&argRef)
static SourceLocation | getFunctionSourceLocation (RewriteModernObjC &R, FunctionDecl *FD)
| getFunctionSourceLocation - returns start location of a function definition. More...
static bool | HasLocalVariableExternalStorage (ValueDecl *VD)
static void | BuildUniqueMethodName (std::string &Name, ObjCMethodDecl *MD)
static void | Write_ProtocolExprReferencedMetadata (ASTContext *Context, ObjCProtocolDecl *PDecl, std::string &Result)
| Write_ProtocolExprReferencedMetadata - This routine writer out the protocol reference symbols in the for of: struct _protocol_t *PROTOCOL_REF = &PROTOCOL_METADATA. More...
static void | WriteModernMetadataDeclarations (ASTContext *Context, std::string &Result)
| WriteModernMetadataDeclarations - Writes out metadata declarations for modern ABI. More...
static void | Write_protocol_list_t_TypeDecl (std::string &Result, long super_protocol_count)
static void | Write_method_list_t_TypeDecl (std::string &Result, unsigned int method_count)
static void | Write__prop_list_t_TypeDecl (std::string &Result, unsigned int property_count)
static void | Write__ivar_list_t_TypeDecl (std::string &Result, unsigned int ivar_count)
static void | Write_protocol_list_initializer (ASTContext *Context, std::string &Result, ArrayRef< ObjCProtocolDecl *> SuperProtocols, StringRef VarName, StringRef ProtocolName)
static void | Write_method_list_t_initializer (RewriteModernObjC &RewriteObj, ASTContext *Context, std::string &Result, ArrayRef< ObjCMethodDecl *> Methods, StringRef VarName, StringRef TopLevelDeclName, bool MethodImpl)
static void | Write_prop_list_t_initializer (RewriteModernObjC &RewriteObj, ASTContext *Context, std::string &Result, ArrayRef< ObjCPropertyDecl *> Properties, const Decl *Container, StringRef VarName, StringRef ProtocolName)
static void | Write__class_ro_t_initializer (ASTContext *Context, std::string &Result, unsigned int flags, const std::string &InstanceStart, const std::string &InstanceSize, ArrayRef< ObjCMethodDecl *>baseMethods, ArrayRef< ObjCProtocolDecl *>baseProtocols, ArrayRef< ObjCIvarDecl *>ivars, ArrayRef< ObjCPropertyDecl *>Properties, StringRef VarName, StringRef ClassName)
static void | Write_class_t (ASTContext *Context, std::string &Result, StringRef VarName, const ObjCInterfaceDecl *CDecl, bool metaclass)
static void | Write_category_t (RewriteModernObjC &RewriteObj, ASTContext *Context, std::string &Result, ObjCCategoryDecl *CatDecl, ObjCInterfaceDecl *ClassDecl, ArrayRef< ObjCMethodDecl *> InstanceMethods, ArrayRef< ObjCMethodDecl *> ClassMethods, ArrayRef< ObjCProtocolDecl *> RefedProtocols, ArrayRef< ObjCPropertyDecl *> ClassProperties)
static void | Write__extendedMethodTypes_initializer (RewriteModernObjC &RewriteObj, ASTContext *Context, std::string &Result, ArrayRef< ObjCMethodDecl *> Methods, StringRef VarName, StringRef ProtocolName)
static void | Write_IvarOffsetVar (RewriteModernObjC &RewriteObj, ASTContext *Context, std::string &Result, ArrayRef< ObjCIvarDecl *> Ivars, ObjCInterfaceDecl *CDecl)
static void | Write__ivar_list_t_initializer (RewriteModernObjC &RewriteObj, ASTContext *Context, std::string &Result, ArrayRef< ObjCIvarDecl *> OriginalIvars, StringRef VarName, ObjCInterfaceDecl *CDecl)
static bool | hasObjCExceptionAttribute (ASTContext &Context, const ObjCInterfaceDecl *OID)
| hasObjCExceptionAttribute - Return true if this class or any super class has the objc_exception attribute. More...

## Macro Definition Documentation

## ◆ SKIP_BITFIELDS

#define SKIP_BITFIELDS | ( |  | IX,
|  |  | ENDIX,
|  |  | VEC
| ) |  |

Value:
{ \
while ((IX < ENDIX) && VEC[IX]->isBitField()) \
++IX; \
if (IX < ENDIX) \
--IX; \
}

Definition at line 3869 of file RewriteModernObjC.cpp.

Referenced by Write__ivar_list_t_initializer(), and Write_IvarOffsetVar().

## Enumeration Type Documentation

## ◆ MetaDataDlags

enum MetaDataDlags

Enumerator
CLS |
CLS_META |
CLS_ROOT |
OBJC2_CLS_HIDDEN |
CLS_EXCEPTION |
CLS_HAS_IVAR_RELEASER | (Obsolete) ARC-specific: this class has a .release_ivars method
CLS_COMPILED_BY_ARC | class was compiled with -fobjc-arr

Definition at line 6395 of file RewriteModernObjC.cpp.

## Function Documentation

## ◆ BuildUniqueMethodName()

static void BuildUniqueMethodName | ( | std::string & | Name,
|  | ObjCMethodDecl * | MD
| ) |  |
| static

Definition at line 4442 of file RewriteModernObjC.cpp.

References clang::Stmt::children(), clang::Type::getAs(), clang::Selector::getAsString(), clang::ObjCMethodDecl::getBeginLoc(), clang::ObjCMethodDecl::getClassInterface(), clang::NamedDecl::getName(), clang::PointerType::getPointeeType(), clang::ASTContext::getPointerType(), clang::FunctionType::getReturnType(), clang::ObjCMethodDecl::getSelector(), HasLocalVariableExternalStorage(), clang::Type::isFunctionPointerType(), and clang::FunctionProtoType::param_types().

## ◆ getFunctionSourceLocation()

static SourceLocation getFunctionSourceLocation | ( | RewriteModernObjC & | R,
|  | FunctionDecl * | FD
| ) |  |
| static

getFunctionSourceLocation - returns start location of a function definition.

Complication arises when function has declared as extern "C" or extern "C" {...}

Definition at line 3036 of file RewriteModernObjC.cpp.

References clang::FunctionDecl::Create(), clang::IdentifierTable::get(), clang::QualType::getAsString(), clang::ObjCMethodDecl::getBeginLoc(), clang::Decl::getBeginLoc(), clang::Decl::getDeclContext(), clang::PresumedLoc::getFilename(), clang::PresumedLoc::getLine(), clang::Decl::getLocation(), clang::ASTContext::getPointerType(), clang::SourceManager::getPresumedLoc(), clang::ASTContext::getPrintingPolicy(), clang::FunctionDecl::getStorageClass(), clang::DeclaratorDecl::getTypeSpecStartLoc(), clang::ASTContext::Idents, clang::FunctionDecl::isExternC(), clang::SourceLocation::isFileID(), clang::FunctionDecl::isMain(), clang::ObjCMethodDecl::isVariadic(), clang::SC_Extern, clang::SC_None, llvm::str(), and clang::Lexer::Stringify().

## ◆ HasLocalVariableExternalStorage()

static bool HasLocalVariableExternalStorage | ( | ValueDecl * | VD | ) |
| static

Definition at line 4035 of file RewriteModernObjC.cpp.

References clang::Expr::getExprLoc(), clang::BlockExpr::getFunctionType(), and clang::FunctionType::getReturnType().

Referenced by BuildUniqueMethodName().

## ◆ 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.

FIXME. Move this to ASTContext.cpp as it is also used for IRGen.

Definition at line 6995 of file RewriteModernObjC.cpp.

References clang::ObjCInterfaceDecl::all_declared_ivar_begin(), clang::ObjCList< T >::begin(), clang::ObjCContainerDecl::class_methods(), CLS, CLS_EXCEPTION, CLS_META, CLS_ROOT, distance(), clang::ObjCPropertyImplDecl::Dynamic, clang::ObjCList< T >::end(), clang::ObjCInterfaceDecl::FindCategoryDeclaration(), clang::ObjCIvarRefExpr::getBase(), clang::ObjCCategoryImplDecl::getCategoryDecl(), clang::ObjCImplDecl::getClassInterface(), clang::ObjCPropertyDecl::getGetterMethodDecl(), clang::NamedDecl::getIdentifier(), clang::NamedDecl::getName(), clang::NamedDecl::getNameAsString(), clang::ObjCImplementationDecl::getNameAsString(), clang::ObjCIvarDecl::getNextIvar(), clang::ASTContext::getObjCEncodingForMethodDecl(), clang::ObjCInterfaceDecl::getReferencedProtocols(), clang::ObjCPropertyDecl::getSetterMethodDecl(), clang::Stmt::getSourceRange(), clang::ObjCInterfaceDecl::getSuperClass(), clang::NamedDecl::getVisibility(), clang::Decl::hasAttr(), clang::HiddenVisibility, clang::ObjCContainerDecl::instance_methods(), clang::ObjCContainerDecl::instance_properties(), clang::ObjCInterfaceDecl::isImplicitInterfaceDecl(), clang::ObjCPropertyDecl::isReadOnly(), mustSynthesizeSetterGetterMethod(), OBJC2_CLS_HIDDEN, clang::ObjCImplDecl::property_impls(), clang::ObjCCategoryDecl::protocols(), Write__class_ro_t_initializer(), Write__ivar_list_t_initializer(), Write_category_t(), Write_class_t(), Write_method_list_t_initializer(), Write_prop_list_t_initializer(), Write_protocol_list_initializer(), and WriteModernMetadataDeclarations().

## ◆ IsHeaderFile()

static bool IsHeaderFile | ( | const std::string & | Filename | ) |
| static

Definition at line 628 of file RewriteModernObjC.cpp.

References clang::DiagnosticsEngine::getCustomDiagID(), and clang::DiagnosticsEngine::Warning.

Referenced by clang::Preprocessor::HandlePragmaOnce(), and ParseFrontendArgs().

## ◆ mustSynthesizeSetterGetterMethod()

static bool mustSynthesizeSetterGetterMethod | ( | ObjCImplementationDecl * | IMP,
|  | ObjCPropertyDecl * | PD,
|  | bool | getter
| ) |  |
| static

mustSynthesizeSetterGetterMethod - returns true if setter or getter has not been found in the class implementation.

In this case, it must be synthesized.

Definition at line 911 of file RewriteModernObjC.cpp.

References clang::ObjCPropertyImplDecl::Dynamic, clang::ObjCPropertyImplDecl::getBeginLoc(), clang::SourceManager::getCharacterData(), clang::ObjCIvarDecl::getContainingInterface(), clang::Decl::getEndLoc(), clang::ObjCPropertyDecl::getGetterMethodDecl(), clang::ObjCPropertyDecl::getGetterName(), clang::ObjCContainerDecl::getInstanceMethod(), getIvarAccessString(), clang::SourceLocation::getLocWithOffset(), clang::NamedDecl::getName(), clang::ASTContext::getPrintingPolicy(), clang::ObjCPropertyDecl::getPropertyAttributes(), clang::ObjCPropertyImplDecl::getPropertyDecl(), clang::ObjCPropertyImplDecl::getPropertyImplementation(), clang::ObjCPropertyImplDecl::getPropertyIvarDecl(), clang::ObjCMethodDecl::getReturnType(), clang::ObjCPropertyDecl::getSetterMethodDecl(), clang::ObjCPropertyDecl::getSetterName(), clang::ObjCPropertyDecl::isReadOnly(), clang::SourceLocation::isValid(), clang::ObjCPropertyDecl::OBJC_PR_copy, clang::ObjCPropertyDecl::OBJC_PR_nonatomic, and clang::ObjCPropertyDecl::OBJC_PR_retain.

Referenced by hasObjCExceptionAttribute().

## ◆ RewriteOneForwardClassDecl()

static void RewriteOneForwardClassDecl | ( | ObjCInterfaceDecl * | ForwardDecl,
|  | std::string & | typedefString
| ) |  |
| static

Definition at line 1045 of file RewriteModernObjC.cpp.

References clang::DeclGroupRef::begin(), clang::ObjCContainerDecl::class_methods(), clang::DeclGroupRef::end(), clang::Type::getAs(), clang::Selector::getAsString(), clang::QualType::getAsString(), clang::ObjCContainerDecl::getAtEndRange(), clang::ObjCPropertyDecl::getAtLoc(), clang::SourceRange::getBegin(), clang::ObjCMethodDecl::getBeginLoc(), clang::Decl::getBeginLoc(), clang::SourceManager::getCharacterData(), clang::Decl::getDeclContext(), clang::ObjCMethodDecl::getEndLoc(), clang::SourceManager::getExpansionLineNumber(), clang::ObjCCategoryDecl::getIvarRBraceLoc(), clang::SourceLocation::getLocWithOffset(), clang::NamedDecl::getNameAsString(), clang::ASTContext::getObjCClassType(), clang::ASTContext::getObjCInterfaceType(), clang::ASTContext::getObjCSelType(), clang::Type::getPointeeType(), clang::PointerType::getPointeeType(), clang::ASTContext::getPointerType(), clang::ASTContext::getPrintingPolicy(), clang::ObjCMethodDecl::getReturnType(), clang::FunctionType::getReturnType(), clang::ObjCMethodDecl::getSelector(), clang::ObjCContainerDecl::instance_methods(), clang::ObjCContainerDecl::instance_properties(), clang::Type::isBlockPointerType(), clang::Type::isFunctionPointerType(), clang::Decl::isImplicit(), clang::ObjCMethodDecl::isInstanceMethod(), clang::SourceLocation::isInvalid(), clang::Type::isObjCQualifiedIdType(), clang::ObjCProtocolDecl::isThisDeclarationADefinition(), clang::SourceLocation::isValid(), and clang::ObjCMethodDecl::parameters().

## ◆ scanForProtocolRefs()

static bool scanForProtocolRefs | ( | const char * | startBuf,
|  | const char * | endBuf,
|  | const char *& | startRef,
|  | const char *& | endRef
| ) |  |
| static

Definition at line 2115 of file RewriteModernObjC.cpp.

Referenced by scanToNextArgument().

## ◆ scanToNextArgument()

static void scanToNextArgument | ( | const char *& | argRef | ) |
| static

Definition at line 2132 of file RewriteModernObjC.cpp.

References clang::Type::getAs(), clang::QualType::getAsString(), clang::ASTContext::getBaseElementType(), clang::Stmt::getBeginLoc(), clang::SourceManager::getCharacterData(), clang::Stmt::getEndLoc(), clang::VarDecl::getInit(), clang::Decl::getLocation(), clang::SourceLocation::getLocWithOffset(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::Type::getPointeeType(), clang::PointerType::getPointeeType(), clang::ASTContext::getPrintingPolicy(), clang::FunctionType::getReturnType(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::DeclaratorDecl::getTypeSpecStartLoc(), clang::TypeOfExprType::getUnderlyingExpr(), clang::Type::isArrayType(), clang::SourceLocation::isInvalid(), clang::Type::isObjCObjectPointerType(), clang::Type::isObjCQualifiedIdType(), clang::Type::isObjCQualifiedInterfaceType(), and scanForProtocolRefs().

## ◆ Write__class_ro_t_initializer()

static void Write__class_ro_t_initializer | ( | ASTContext * | Context,
|  | std::string & | Result,
|  | unsigned int | flags,
|  | const std::string & | InstanceStart,
|  | const std::string & | InstanceSize,
|  | ArrayRef< ObjCMethodDecl *> | baseMethods,
|  | ArrayRef< ObjCProtocolDecl *> | baseProtocols,
|  | ArrayRef< ObjCIvarDecl *> | ivars,
|  | ArrayRef< ObjCPropertyDecl *> | Properties,
|  | StringRef | VarName,
|  | StringRef | ClassName
| ) |  |
| static

Definition at line 6408 of file RewriteModernObjC.cpp.

References CLS_META, clang::ASTContext::getTargetInfo(), and clang::TargetInfo::getTriple().

Referenced by hasObjCExceptionAttribute().

## ◆ Write__extendedMethodTypes_initializer()

static void Write__extendedMethodTypes_initializer | ( | RewriteModernObjC & | RewriteObj,
|  | ASTContext * | Context,
|  | std::string & | Result,
|  | ArrayRef< ObjCMethodDecl *> | Methods,
|  | StringRef | VarName,
|  | StringRef | ProtocolName
| ) |  |
| static

Definition at line 6697 of file RewriteModernObjC.cpp.

References clang::ASTContext::getObjCEncodingForMethodDecl().

Referenced by Write__ivar_list_t_initializer().

## ◆ Write__ivar_list_t_initializer()

static void Write__ivar_list_t_initializer | ( | RewriteModernObjC & | RewriteObj,
|  | ASTContext * | Context,
|  | std::string & | Result,
|  | ArrayRef< ObjCIvarDecl *> | OriginalIvars,
|  | StringRef | VarName,
|  | ObjCInterfaceDecl * | CDecl
| ) |  |
| static

Definition at line 6767 of file RewriteModernObjC.cpp.

References clang::ObjCContainerDecl::class_methods(), clang::ObjCProtocolDecl::getCanonicalDecl(), clang::ObjCProtocolDecl::getDefinition(), clang::ObjCMethodDecl::getImplementationControl(), clang::NamedDecl::getName(), clang::NamedDecl::getNameAsString(), clang::ASTContext::getObjCEncodingForType(), clang::CharUnits::getQuantity(), clang::ValueDecl::getType(), clang::ASTContext::getTypeAlign(), clang::ASTContext::getTypeSizeInChars(), clang::ObjCContainerDecl::instance_methods(), clang::ObjCContainerDecl::instance_properties(), clang::FieldDecl::isBitField(), clang::ObjCMethodDecl::Optional, clang::ObjCProtocolDecl::protocols(), SKIP_BITFIELDS, Write__extendedMethodTypes_initializer(), Write__ivar_list_t_TypeDecl(), Write_IvarOffsetVar(), Write_method_list_t_initializer(), Write_prop_list_t_initializer(), Write_protocol_list_initializer(), WriteInternalIvarName(), and WriteModernMetadataDeclarations().

Referenced by hasObjCExceptionAttribute().

## ◆ Write__ivar_list_t_TypeDecl()

static void Write__ivar_list_t_TypeDecl | ( | std::string & | Result,
|  | unsigned int | ivar_count
| ) |  |
| static

Definition at line 6286 of file RewriteModernObjC.cpp.

Referenced by Write__ivar_list_t_initializer().

## ◆ Write__prop_list_t_TypeDecl()

static void Write__prop_list_t_TypeDecl | ( | std::string & | Result,
|  | unsigned int | property_count
| ) |  |
| static

Definition at line 6276 of file RewriteModernObjC.cpp.

## ◆ Write_category_t()

static void Write_category_t | ( | RewriteModernObjC & | RewriteObj,
|  | ASTContext * | Context,
|  | std::string & | Result,
|  | ObjCCategoryDecl * | CatDecl,
|  | ObjCInterfaceDecl * | ClassDecl,
|  | ArrayRef< ObjCMethodDecl *> | InstanceMethods,
|  | ArrayRef< ObjCMethodDecl *> | ClassMethods,
|  | ArrayRef< ObjCProtocolDecl *> | RefedProtocols,
|  | ArrayRef< ObjCPropertyDecl *> | ClassProperties
| ) |  |
| static

Definition at line 6615 of file RewriteModernObjC.cpp.

References clang::ObjCInterfaceDecl::getImplementation(), clang::NamedDecl::getName(), and clang::NamedDecl::getNameAsString().

Referenced by hasObjCExceptionAttribute().

## ◆ Write_class_t()

static void Write_class_t | ( | ASTContext * | Context,
|  | std::string & | Result,
|  | StringRef | VarName,
|  | const ObjCInterfaceDecl * | CDecl,
|  | bool | metaclass
| ) |  |
| static

Definition at line 6475 of file RewriteModernObjC.cpp.

References clang::ObjCInterfaceDecl::getImplementation(), clang::NamedDecl::getNameAsString(), and clang::ObjCInterfaceDecl::getSuperClass().

Referenced by hasObjCExceptionAttribute().

## ◆ Write_IvarOffsetVar()

static void Write_IvarOffsetVar | ( | RewriteModernObjC & | RewriteObj,
|  | ASTContext * | Context,
|  | std::string & | Result,
|  | ArrayRef< ObjCIvarDecl *> | Ivars,
|  | ObjCInterfaceDecl * | CDecl
| ) |  |
| static

if (Ivar->getAccessControl() == ObjCIvarDecl::Private || Ivar->getAccessControl() == ObjCIvarDecl::Package || Class->getVisibility() == HiddenVisibility) Visibility should be: HiddenVisibility; else Visibility should be: DefaultVisibility;

Definition at line 6724 of file RewriteModernObjC.cpp.

References clang::ObjCIvarDecl::getAccessControl(), clang::ASTContext::getLangOpts(), clang::ObjCIvarDecl::Package, clang::ObjCIvarDecl::Private, SKIP_BITFIELDS, and WriteInternalIvarName().

Referenced by Write__ivar_list_t_initializer().

## ◆ Write_method_list_t_initializer()

static void Write_method_list_t_initializer | ( | RewriteModernObjC & | RewriteObj,
|  | ASTContext * | Context,
|  | std::string & | Result,
|  | ArrayRef< ObjCMethodDecl *> | Methods,
|  | StringRef | VarName,
|  | StringRef | TopLevelDeclName,
|  | bool | MethodImpl
| ) |  |
| static

Definition at line 6319 of file RewriteModernObjC.cpp.

References clang::ASTContext::getObjCEncodingForMethodDecl(), and Write_method_list_t_TypeDecl().

Referenced by hasObjCExceptionAttribute(), and Write__ivar_list_t_initializer().

## ◆ Write_method_list_t_TypeDecl()

static void Write_method_list_t_TypeDecl | ( | std::string & | Result,
|  | unsigned int | method_count
| ) |  |
| static

Definition at line 6266 of file RewriteModernObjC.cpp.

Referenced by Write_method_list_t_initializer().

## ◆ Write_prop_list_t_initializer()

static void Write_prop_list_t_initializer | ( | RewriteModernObjC & | RewriteObj,
|  | ASTContext * | Context,
|  | std::string & | Result,
|  | ArrayRef< ObjCPropertyDecl *> | Properties,
|  | const Decl * | Container,
|  | StringRef | VarName,
|  | StringRef | ProtocolName
| ) |  |
| static

Definition at line 6359 of file RewriteModernObjC.cpp.

Referenced by hasObjCExceptionAttribute(), and Write__ivar_list_t_initializer().

## ◆ Write_protocol_list_initializer()

static void Write_protocol_list_initializer | ( | ASTContext * | Context,
|  | std::string & | Result,
|  | ArrayRef< ObjCProtocolDecl *> | SuperProtocols,
|  | StringRef | VarName,
|  | StringRef | ProtocolName
| ) |  |
| static

Definition at line 6296 of file RewriteModernObjC.cpp.

References clang::NamedDecl::getNameAsString(), and Write_protocol_list_t_TypeDecl().

Referenced by hasObjCExceptionAttribute(), and Write__ivar_list_t_initializer().

## ◆ Write_protocol_list_t_TypeDecl()

static void Write_protocol_list_t_TypeDecl | ( | std::string & | Result,
|  | long | super_protocol_count
| ) |  |
| static

Definition at line 6257 of file RewriteModernObjC.cpp.

Referenced by Write_protocol_list_initializer().

## ◆ Write_ProtocolExprReferencedMetadata()

static void Write_ProtocolExprReferencedMetadata | ( | ASTContext * | Context,
|  | ObjCProtocolDecl * | PDecl,
|  | std::string & | Result
| ) |  |
| static

Write_ProtocolExprReferencedMetadata - This routine writer out the protocol reference symbols in the for of: struct _protocol_t *PROTOCOL_REF = &PROTOCOL_METADATA.

Definition at line 5813 of file RewriteModernObjC.cpp.

References clang::C, clang::ObjCIvarDecl::getContainingInterface(), clang::ASTContext::getLangOpts(), clang::SourceManager::getLocForStartOfFile(), clang::NamedDecl::getNameAsString(), clang::Rewriter::getRewriteBufferFor(), clang::DiagnosticsEngine::hasErrorOccurred(), clang::FieldDecl::isBitField(), and clang::Preamble.

## ◆ Write_RethrowObject()

static void Write_RethrowObject | ( | std::string & | buf | ) |
| static

Definition at line 1847 of file RewriteModernObjC.cpp.

References clang::Stmt::children(), clang::Type::getAs(), clang::Selector::getAsString(), clang::ObjCAutoreleasePoolStmt::getAtLoc(), clang::ObjCAtSynchronizedStmt::getAtSynchronizedLoc(), clang::ObjCAtTryStmt::getAtTryLoc(), clang::ObjCAtCatchStmt::getBeginLoc(), clang::ObjCAtFinallyStmt::getBeginLoc(), clang::ObjCAtTryStmt::getBeginLoc(), clang::ObjCAtSynchronizedStmt::getBeginLoc(), clang::ObjCAtThrowStmt::getBeginLoc(), clang::Stmt::getBeginLoc(), clang::CompoundStmt::getBeginLoc(), clang::ObjCAtCatchStmt::getCatchBody(), clang::ObjCAtCatchStmt::getCatchParamDecl(), clang::ObjCAtTryStmt::getCatchStmt(), clang::SourceManager::getCharacterData(), clang::ObjCEncodeExpr::getEncodedType(), clang::ObjCAtThrowStmt::getEndLoc(), clang::Stmt::getEndLoc(), clang::CompoundStmt::getEndLoc(), clang::ObjCAtFinallyStmt::getFinallyBody(), clang::ObjCAtTryStmt::getFinallyStmt(), clang::ASTContext::getFullLoc(), clang::SourceLocation::getLocWithOffset(), clang::NamedDecl::getNameAsString(), clang::ObjCAtTryStmt::getNumCatchStmts(), clang::ASTContext::getObjCEncodingForType(), clang::ObjCAtCatchStmt::getRParenLoc(), clang::ObjCSelectorExpr::getSelector(), clang::ObjCAutoreleasePoolStmt::getSubStmt(), clang::ObjCAtSynchronizedStmt::getSynchBody(), clang::ObjCAtThrowStmt::getThrowExpr(), clang::ObjCAtTryStmt::getTryBody(), clang::ValueDecl::getType(), clang::DiagnosticsEngine::Report(), and clang::Result.

## ◆ WriteInternalIvarName()

static void WriteInternalIvarName | ( | const ObjCInterfaceDecl * | IDecl,
|  | ObjCIvarDecl * | IvarDecl,
|  | std::string & | Result
| ) |  |
| static

Definition at line 831 of file RewriteModernObjC.cpp.

References clang::ObjCIvarDecl::getContainingInterface(), getIvarAccessString(), clang::NamedDecl::getName(), and clang::FieldDecl::isBitField().

Referenced by Write__ivar_list_t_initializer(), and Write_IvarOffsetVar().

## ◆ WriteModernMetadataDeclarations()

static void WriteModernMetadataDeclarations | ( | ASTContext * | Context,
|  | std::string & | Result
| ) |  |
| static

WriteModernMetadataDeclarations - Writes out metadata declarations for modern ABI.

struct _prop_t { const char *name; char *attributes; } struct _prop_list_t { uint32_t entsize; // sizeof(struct _prop_t) uint32_t count_of_properties; struct _prop_t prop_list[count_of_properties]; } struct _protocol_t; struct _protocol_list_t { long protocol_count; // Note, this is 32/64 bit struct _protocol_t * protocol_list[protocol_count]; } struct _objc_method { SEL _cmd; const char *method_type; char *_imp; } struct _method_list_t { uint32_t entsize; // sizeof(struct _objc_method) uint32_t method_count; struct _objc_method method_list[method_count]; } struct _protocol_t { id isa; // NULL const char *protocol_name; const struct _protocol_list_t * protocol_list; // super protocols const struct method_list_t *instance_methods; const struct method_list_t *class_methods; const struct method_list_t *optionalInstanceMethods; const struct method_list_t *optionalClassMethods; const struct _prop_list_t * properties; const uint32_t size; // sizeof(struct _protocol_t) const uint32_t flags; // = 0 const char ** extendedMethodTypes; } struct _ivar_t { unsigned long int *offset; // pointer to ivar offset location const char *name; const char *type; uint32_t alignment; uint32_t size; } struct _ivar_list_t { uint32 entsize; // sizeof(struct _ivar_t) uint32 count; struct _ivar_t list[count]; } struct _class_ro_t { uint32_t flags; uint32_t instanceStart; uint32_t instanceSize; uint32_t reserved; // only when building for 64bit targets const uint8_t *ivarLayout; const char *name; const struct _method_list_t *baseMethods; const struct _protocol_list_t *baseProtocols; const struct _ivar_list_t *ivars; const uint8_t *weakIvarLayout; const struct _prop_list_t *properties; } struct _class_t { struct _class_t *isa; struct _class_t *superclass; void *cache; IMP *vtable; struct _class_ro_t *ro; } struct _category_t { const char *name; struct _class_t *cls; const struct _method_list_t *instance_methods; const struct _method_list_t *class_methods; const struct _protocol_list_t *protocols; const struct _prop_list_t *properties; } MessageRefTy - LLVM for: struct _message_ref_t { IMP messenger; SEL name; }; SuperMessageRefTy - LLVM for: struct _super_message_ref_t { SUPER_IMP messenger; SEL name; };

Definition at line 6179 of file RewriteModernObjC.cpp.

References clang::ASTContext::getTargetInfo(), and clang::TargetInfo::getTriple().

Referenced by hasObjCExceptionAttribute(), and Write__ivar_list_t_initializer().