#include "clang/AST/DeclObjC.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/ODRHash.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <queue>
#include <utility>
usingnamespaceclang;
void ObjCListBase::set(void *const* InList, unsigned Elts, ASTContext &Ctx) { … }
void ObjCProtocolList::set(ObjCProtocolDecl* const* InList, unsigned Elts,
const SourceLocation *Locs, ASTContext &Ctx) { … }
ObjCContainerDecl::ObjCContainerDecl(Kind DK, DeclContext *DC,
const IdentifierInfo *Id,
SourceLocation nameLoc,
SourceLocation atStartLoc)
: … { … }
void ObjCContainerDecl::anchor() { … }
ObjCIvarDecl *
ObjCContainerDecl::getIvarDecl(IdentifierInfo *Id) const { … }
ObjCMethodDecl *
ObjCContainerDecl::getMethod(Selector Sel, bool isInstance,
bool AllowHidden) const { … }
bool ObjCContainerDecl::HasUserDeclaredSetterMethod(
const ObjCPropertyDecl *Property) const { … }
ObjCPropertyDecl *
ObjCPropertyDecl::findPropertyDecl(const DeclContext *DC,
const IdentifierInfo *propertyID,
ObjCPropertyQueryKind queryKind) { … }
IdentifierInfo *
ObjCPropertyDecl::getDefaultSynthIvarName(ASTContext &Ctx) const { … }
ObjCPropertyDecl *ObjCContainerDecl::getProperty(const IdentifierInfo *Id,
bool IsInstance) const { … }
ObjCPropertyDecl *ObjCContainerDecl::FindPropertyDeclaration(
const IdentifierInfo *PropertyId,
ObjCPropertyQueryKind QueryKind) const { … }
void ObjCInterfaceDecl::anchor() { … }
ObjCTypeParamList *ObjCInterfaceDecl::getTypeParamList() const { … }
void ObjCInterfaceDecl::setTypeParamList(ObjCTypeParamList *TPL) { … }
ObjCInterfaceDecl *ObjCInterfaceDecl::getSuperClass() const { … }
SourceLocation ObjCInterfaceDecl::getSuperClassLoc() const { … }
ObjCPropertyDecl *ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass(
const IdentifierInfo *PropertyId, ObjCPropertyQueryKind QueryKind) const { … }
void ObjCInterfaceDecl::collectPropertiesToImplement(PropertyMap &PM) const { … }
bool ObjCInterfaceDecl::isArcWeakrefUnavailable() const { … }
const ObjCInterfaceDecl *ObjCInterfaceDecl::isObjCRequiresPropertyDefs() const { … }
void ObjCInterfaceDecl::mergeClassExtensionProtocolList(
ObjCProtocolDecl *const* ExtList, unsigned ExtNum,
ASTContext &C) { … }
const ObjCInterfaceDecl *
ObjCInterfaceDecl::findInterfaceWithDesignatedInitializers() const { … }
static bool isIntroducingInitializers(const ObjCInterfaceDecl *D) { … }
bool ObjCInterfaceDecl::inheritsDesignatedInitializers() const { … }
void ObjCInterfaceDecl::getDesignatedInitializers(
llvm::SmallVectorImpl<const ObjCMethodDecl *> &Methods) const { … }
bool ObjCInterfaceDecl::isDesignatedInitializer(Selector Sel,
const ObjCMethodDecl **InitMethod) const { … }
void ObjCInterfaceDecl::allocateDefinitionData() { … }
void ObjCInterfaceDecl::startDefinition() { … }
void ObjCInterfaceDecl::startDuplicateDefinitionForComparison() { … }
void ObjCInterfaceDecl::mergeDuplicateDefinitionWithCommon(
const ObjCInterfaceDecl *Definition) { … }
ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable(IdentifierInfo *ID,
ObjCInterfaceDecl *&clsDeclared) { … }
ObjCInterfaceDecl *ObjCInterfaceDecl::lookupInheritedClass(
const IdentifierInfo*ICName) { … }
ObjCProtocolDecl *
ObjCInterfaceDecl::lookupNestedProtocol(IdentifierInfo *Name) { … }
ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel,
bool isInstance,
bool shallowCategoryLookup,
bool followSuper,
const ObjCCategoryDecl *C) const
{ … }
ObjCMethodDecl *ObjCInterfaceDecl::lookupPrivateMethod(
const Selector &Sel,
bool Instance) const { … }
unsigned ObjCInterfaceDecl::getODRHash() { … }
bool ObjCInterfaceDecl::hasODRHash() const { … }
void ObjCInterfaceDecl::setHasODRHash(bool HasHash) { … }
ObjCMethodDecl::ObjCMethodDecl(
SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo,
QualType T, TypeSourceInfo *ReturnTInfo, DeclContext *contextDecl,
bool isInstance, bool isVariadic, bool isPropertyAccessor,
bool isSynthesizedAccessorStub, bool isImplicitlyDeclared, bool isDefined,
ObjCImplementationControl impControl, bool HasRelatedResultType)
: … { … }
ObjCMethodDecl *ObjCMethodDecl::Create(
ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc,
Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo,
DeclContext *contextDecl, bool isInstance, bool isVariadic,
bool isPropertyAccessor, bool isSynthesizedAccessorStub,
bool isImplicitlyDeclared, bool isDefined,
ObjCImplementationControl impControl, bool HasRelatedResultType) { … }
ObjCMethodDecl *ObjCMethodDecl::CreateDeserialized(ASTContext &C,
GlobalDeclID ID) { … }
bool ObjCMethodDecl::isDirectMethod() const { … }
bool ObjCMethodDecl::isThisDeclarationADesignatedInitializer() const { … }
bool ObjCMethodDecl::definedInNSObject(const ASTContext &Ctx) const { … }
bool ObjCMethodDecl::isDesignatedInitializerForTheInterface(
const ObjCMethodDecl **InitMethod) const { … }
bool ObjCMethodDecl::hasParamDestroyedInCallee() const { … }
Stmt *ObjCMethodDecl::getBody() const { … }
void ObjCMethodDecl::setAsRedeclaration(const ObjCMethodDecl *PrevMethod) { … }
void ObjCMethodDecl::setParamsAndSelLocs(ASTContext &C,
ArrayRef<ParmVarDecl*> Params,
ArrayRef<SourceLocation> SelLocs) { … }
void ObjCMethodDecl::getSelectorLocs(
SmallVectorImpl<SourceLocation> &SelLocs) const { … }
void ObjCMethodDecl::setMethodParams(ASTContext &C,
ArrayRef<ParmVarDecl*> Params,
ArrayRef<SourceLocation> SelLocs) { … }
ObjCMethodDecl *ObjCMethodDecl::getNextRedeclarationImpl() { … }
ObjCMethodDecl *ObjCMethodDecl::getCanonicalDecl() { … }
SourceLocation ObjCMethodDecl::getEndLoc() const { … }
ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const { … }
QualType ObjCMethodDecl::getSelfType(ASTContext &Context,
const ObjCInterfaceDecl *OID,
bool &selfIsPseudoStrong,
bool &selfIsConsumed) const { … }
void ObjCMethodDecl::createImplicitParams(ASTContext &Context,
const ObjCInterfaceDecl *OID) { … }
ObjCInterfaceDecl *ObjCMethodDecl::getClassInterface() { … }
ObjCCategoryDecl *ObjCMethodDecl::getCategory() { … }
SourceRange ObjCMethodDecl::getReturnTypeSourceRange() const { … }
QualType ObjCMethodDecl::getSendResultType() const { … }
QualType ObjCMethodDecl::getSendResultType(QualType receiverType) const { … }
static void CollectOverriddenMethodsRecurse(const ObjCContainerDecl *Container,
const ObjCMethodDecl *Method,
SmallVectorImpl<const ObjCMethodDecl *> &Methods,
bool MovedToSuper) { … }
static inline void CollectOverriddenMethods(const ObjCContainerDecl *Container,
const ObjCMethodDecl *Method,
SmallVectorImpl<const ObjCMethodDecl *> &Methods) { … }
static void collectOverriddenMethodsSlow(const ObjCMethodDecl *Method,
SmallVectorImpl<const ObjCMethodDecl *> &overridden) { … }
void ObjCMethodDecl::getOverriddenMethods(
SmallVectorImpl<const ObjCMethodDecl *> &Overridden) const { … }
const ObjCPropertyDecl *
ObjCMethodDecl::findPropertyDecl(bool CheckOverrides) const { … }
void ObjCTypeParamDecl::anchor() { … }
ObjCTypeParamDecl *ObjCTypeParamDecl::Create(ASTContext &ctx, DeclContext *dc,
ObjCTypeParamVariance variance,
SourceLocation varianceLoc,
unsigned index,
SourceLocation nameLoc,
IdentifierInfo *name,
SourceLocation colonLoc,
TypeSourceInfo *boundInfo) { … }
ObjCTypeParamDecl *ObjCTypeParamDecl::CreateDeserialized(ASTContext &ctx,
GlobalDeclID ID) { … }
SourceRange ObjCTypeParamDecl::getSourceRange() const { … }
ObjCTypeParamList::ObjCTypeParamList(SourceLocation lAngleLoc,
ArrayRef<ObjCTypeParamDecl *> typeParams,
SourceLocation rAngleLoc)
: … { … }
ObjCTypeParamList *ObjCTypeParamList::create(
ASTContext &ctx,
SourceLocation lAngleLoc,
ArrayRef<ObjCTypeParamDecl *> typeParams,
SourceLocation rAngleLoc) { … }
void ObjCTypeParamList::gatherDefaultTypeArgs(
SmallVectorImpl<QualType> &typeArgs) const { … }
ObjCInterfaceDecl *ObjCInterfaceDecl::Create(
const ASTContext &C, DeclContext *DC, SourceLocation atLoc,
const IdentifierInfo *Id, ObjCTypeParamList *typeParamList,
ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc, bool isInternal) { … }
ObjCInterfaceDecl *ObjCInterfaceDecl::CreateDeserialized(const ASTContext &C,
GlobalDeclID ID) { … }
ObjCInterfaceDecl::ObjCInterfaceDecl(
const ASTContext &C, DeclContext *DC, SourceLocation AtLoc,
const IdentifierInfo *Id, ObjCTypeParamList *typeParamList,
SourceLocation CLoc, ObjCInterfaceDecl *PrevDecl, bool IsInternal)
: … { … }
void ObjCInterfaceDecl::LoadExternalDefinition() const { … }
void ObjCInterfaceDecl::setExternallyCompleted() { … }
void ObjCInterfaceDecl::setHasDesignatedInitializers() { … }
bool ObjCInterfaceDecl::hasDesignatedInitializers() const { … }
StringRef
ObjCInterfaceDecl::getObjCRuntimeNameAsString() const { … }
StringRef
ObjCImplementationDecl::getObjCRuntimeNameAsString() const { … }
ObjCImplementationDecl *ObjCInterfaceDecl::getImplementation() const { … }
void ObjCInterfaceDecl::setImplementation(ObjCImplementationDecl *ImplD) { … }
namespace {
struct SynthesizeIvarChunk { … };
bool operator<(const SynthesizeIvarChunk & LHS,
const SynthesizeIvarChunk &RHS) { … }
}
ObjCIvarDecl *ObjCInterfaceDecl::all_declared_ivar_begin() { … }
ObjCCategoryDecl *ObjCInterfaceDecl::FindCategoryDeclaration(
const IdentifierInfo *CategoryId) const { … }
ObjCMethodDecl *
ObjCInterfaceDecl::getCategoryInstanceMethod(Selector Sel) const { … }
ObjCMethodDecl *ObjCInterfaceDecl::getCategoryClassMethod(Selector Sel) const { … }
bool ObjCInterfaceDecl::ClassImplementsProtocol(ObjCProtocolDecl *lProto,
bool lookupCategory,
bool RHSIsQualifiedID) { … }
void ObjCIvarDecl::anchor() { … }
ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, ObjCContainerDecl *DC,
SourceLocation StartLoc,
SourceLocation IdLoc,
const IdentifierInfo *Id, QualType T,
TypeSourceInfo *TInfo, AccessControl ac,
Expr *BW, bool synthesized) { … }
ObjCIvarDecl *ObjCIvarDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { … }
ObjCInterfaceDecl *ObjCIvarDecl::getContainingInterface() { … }
QualType ObjCIvarDecl::getUsageType(QualType objectType) const { … }
void ObjCAtDefsFieldDecl::anchor() { … }
ObjCAtDefsFieldDecl
*ObjCAtDefsFieldDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation StartLoc, SourceLocation IdLoc,
IdentifierInfo *Id, QualType T, Expr *BW) { … }
ObjCAtDefsFieldDecl *ObjCAtDefsFieldDecl::CreateDeserialized(ASTContext &C,
GlobalDeclID ID) { … }
void ObjCProtocolDecl::anchor() { … }
ObjCProtocolDecl::ObjCProtocolDecl(ASTContext &C, DeclContext *DC,
IdentifierInfo *Id, SourceLocation nameLoc,
SourceLocation atStartLoc,
ObjCProtocolDecl *PrevDecl)
: … { … }
ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, DeclContext *DC,
IdentifierInfo *Id,
SourceLocation nameLoc,
SourceLocation atStartLoc,
ObjCProtocolDecl *PrevDecl) { … }
ObjCProtocolDecl *ObjCProtocolDecl::CreateDeserialized(ASTContext &C,
GlobalDeclID ID) { … }
bool ObjCProtocolDecl::isNonRuntimeProtocol() const { … }
void ObjCProtocolDecl::getImpliedProtocols(
llvm::DenseSet<const ObjCProtocolDecl *> &IPs) const { … }
ObjCProtocolDecl *ObjCProtocolDecl::lookupProtocolNamed(IdentifierInfo *Name) { … }
ObjCMethodDecl *ObjCProtocolDecl::lookupMethod(Selector Sel,
bool isInstance) const { … }
void ObjCProtocolDecl::allocateDefinitionData() { … }
void ObjCProtocolDecl::startDefinition() { … }
void ObjCProtocolDecl::startDuplicateDefinitionForComparison() { … }
void ObjCProtocolDecl::mergeDuplicateDefinitionWithCommon(
const ObjCProtocolDecl *Definition) { … }
void ObjCProtocolDecl::collectPropertiesToImplement(PropertyMap &PM) const { … }
void ObjCProtocolDecl::collectInheritedProtocolProperties(
const ObjCPropertyDecl *Property, ProtocolPropertySet &PS,
PropertyDeclOrder &PO) const { … }
StringRef
ObjCProtocolDecl::getObjCRuntimeNameAsString() const { … }
unsigned ObjCProtocolDecl::getODRHash() { … }
bool ObjCProtocolDecl::hasODRHash() const { … }
void ObjCProtocolDecl::setHasODRHash(bool HasHash) { … }
void ObjCCategoryDecl::anchor() { … }
ObjCCategoryDecl::ObjCCategoryDecl(
DeclContext *DC, SourceLocation AtLoc, SourceLocation ClassNameLoc,
SourceLocation CategoryNameLoc, const IdentifierInfo *Id,
ObjCInterfaceDecl *IDecl, ObjCTypeParamList *typeParamList,
SourceLocation IvarLBraceLoc, SourceLocation IvarRBraceLoc)
: … { … }
ObjCCategoryDecl *ObjCCategoryDecl::Create(
ASTContext &C, DeclContext *DC, SourceLocation AtLoc,
SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc,
const IdentifierInfo *Id, ObjCInterfaceDecl *IDecl,
ObjCTypeParamList *typeParamList, SourceLocation IvarLBraceLoc,
SourceLocation IvarRBraceLoc) { … }
ObjCCategoryDecl *ObjCCategoryDecl::CreateDeserialized(ASTContext &C,
GlobalDeclID ID) { … }
ObjCCategoryImplDecl *ObjCCategoryDecl::getImplementation() const { … }
void ObjCCategoryDecl::setImplementation(ObjCCategoryImplDecl *ImplD) { … }
void ObjCCategoryDecl::setTypeParamList(ObjCTypeParamList *TPL) { … }
void ObjCCategoryImplDecl::anchor() { … }
ObjCCategoryImplDecl *ObjCCategoryImplDecl::Create(
ASTContext &C, DeclContext *DC, const IdentifierInfo *Id,
ObjCInterfaceDecl *ClassInterface, SourceLocation nameLoc,
SourceLocation atStartLoc, SourceLocation CategoryNameLoc) { … }
ObjCCategoryImplDecl *
ObjCCategoryImplDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { … }
ObjCCategoryDecl *ObjCCategoryImplDecl::getCategoryDecl() const { … }
void ObjCImplDecl::anchor() { … }
void ObjCImplDecl::addPropertyImplementation(ObjCPropertyImplDecl *property) { … }
void ObjCImplDecl::setClassInterface(ObjCInterfaceDecl *IFace) { … }
ObjCPropertyImplDecl *ObjCImplDecl::
FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const { … }
ObjCPropertyImplDecl *ObjCImplDecl::
FindPropertyImplDecl(IdentifierInfo *Id,
ObjCPropertyQueryKind QueryKind) const { … }
raw_ostream &clang::operator<<(raw_ostream &OS,
const ObjCCategoryImplDecl &CID) { … }
void ObjCImplementationDecl::anchor() { … }
ObjCImplementationDecl *
ObjCImplementationDecl::Create(ASTContext &C, DeclContext *DC,
ObjCInterfaceDecl *ClassInterface,
ObjCInterfaceDecl *SuperDecl,
SourceLocation nameLoc,
SourceLocation atStartLoc,
SourceLocation superLoc,
SourceLocation IvarLBraceLoc,
SourceLocation IvarRBraceLoc) { … }
ObjCImplementationDecl *
ObjCImplementationDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { … }
void ObjCImplementationDecl::setIvarInitializers(ASTContext &C,
CXXCtorInitializer ** initializers,
unsigned numInitializers) { … }
ObjCImplementationDecl::init_const_iterator
ObjCImplementationDecl::init_begin() const { … }
raw_ostream &clang::operator<<(raw_ostream &OS,
const ObjCImplementationDecl &ID) { … }
void ObjCCompatibleAliasDecl::anchor() { … }
ObjCCompatibleAliasDecl *
ObjCCompatibleAliasDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
IdentifierInfo *Id,
ObjCInterfaceDecl* AliasedClass) { … }
ObjCCompatibleAliasDecl *
ObjCCompatibleAliasDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { … }
void ObjCPropertyDecl::anchor() { … }
ObjCPropertyDecl *
ObjCPropertyDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
const IdentifierInfo *Id, SourceLocation AtLoc,
SourceLocation LParenLoc, QualType T,
TypeSourceInfo *TSI, PropertyControl propControl) { … }
ObjCPropertyDecl *ObjCPropertyDecl::CreateDeserialized(ASTContext &C,
GlobalDeclID ID) { … }
QualType ObjCPropertyDecl::getUsageType(QualType objectType) const { … }
bool ObjCPropertyDecl::isDirectProperty() const { … }
ObjCPropertyImplDecl *ObjCPropertyImplDecl::Create(ASTContext &C,
DeclContext *DC,
SourceLocation atLoc,
SourceLocation L,
ObjCPropertyDecl *property,
Kind PK,
ObjCIvarDecl *ivar,
SourceLocation ivarLoc) { … }
ObjCPropertyImplDecl *
ObjCPropertyImplDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { … }
SourceRange ObjCPropertyImplDecl::getSourceRange() const { … }