llvm/clang/lib/Sema/SemaDeclObjC.cpp

//===--- SemaDeclObjC.cpp - Semantic Analysis for ObjC Declarations -------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
//  This file implements semantic analysis for Objective C declarations.
//
//===----------------------------------------------------------------------===//

#include "TypeLocBuilder.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/DelayedDiagnostic.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/SemaObjC.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"

usingnamespaceclang;

/// Check whether the given method, which must be in the 'init'
/// family, is a valid member of that family.
///
/// \param receiverTypeIfCall - if null, check this as if declaring it;
///   if non-null, check this as if making a call to it with the given
///   receiver type
///
/// \return true to indicate that there was an error and appropriate
///   actions were taken
bool SemaObjC::checkInitMethod(ObjCMethodDecl *method,
                               QualType receiverTypeIfCall) {}

/// Issue a warning if the parameter of the overridden method is non-escaping
/// but the parameter of the overriding method is not.
static bool diagnoseNoescape(const ParmVarDecl *NewD, const ParmVarDecl *OldD,
                             Sema &S) {}

/// Produce additional diagnostics if a category conforms to a protocol that
/// defines a method taking a non-escaping parameter.
static void diagnoseNoescape(const ParmVarDecl *NewD, const ParmVarDecl *OldD,
                             const ObjCCategoryDecl *CD,
                             const ObjCProtocolDecl *PD, Sema &S) {}

void SemaObjC::CheckObjCMethodOverride(ObjCMethodDecl *NewMethod,
                                       const ObjCMethodDecl *Overridden) {}

/// Check a method declaration for compatibility with the Objective-C
/// ARC conventions.
bool SemaObjC::CheckARCMethodDecl(ObjCMethodDecl *method) {}

static void DiagnoseObjCImplementedDeprecations(Sema &S, const NamedDecl *ND,
                                                SourceLocation ImplLoc) {}

/// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
/// pool.
void SemaObjC::AddAnyMethodToGlobalPool(Decl *D) {}

/// HasExplicitOwnershipAttr - returns true when pointer to ObjC pointer
/// has explicit ownership attribute; false otherwise.
static bool
HasExplicitOwnershipAttr(Sema &S, ParmVarDecl *Param) {}

/// ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible
/// and user declared, in the method definition's AST.
void SemaObjC::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {}

namespace {

// Callback to only accept typo corrections that are Objective-C classes.
// If an ObjCInterfaceDecl* is given to the constructor, then the validation
// function will reject corrections to that class.
class ObjCInterfaceValidatorCCC final : public CorrectionCandidateCallback {};

} // end anonymous namespace

static void diagnoseUseOfProtocols(Sema &TheSema,
                                   ObjCContainerDecl *CD,
                                   ObjCProtocolDecl *const *ProtoRefs,
                                   unsigned NumProtoRefs,
                                   const SourceLocation *ProtoLocs) {}

void SemaObjC::ActOnSuperClassOfClassInterface(
    Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl,
    IdentifierInfo *ClassName, SourceLocation ClassLoc,
    IdentifierInfo *SuperName, SourceLocation SuperLoc,
    ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange) {}

DeclResult SemaObjC::actOnObjCTypeParam(
    Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc,
    unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc,
    SourceLocation colonLoc, ParsedType parsedTypeBound) {}

ObjCTypeParamList *
SemaObjC::actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc,
                                 ArrayRef<Decl *> typeParamsIn,
                                 SourceLocation rAngleLoc) {}

void SemaObjC::popObjCTypeParamList(Scope *S,
                                    ObjCTypeParamList *typeParamList) {}

namespace {
  /// The context in which an Objective-C type parameter list occurs, for use
  /// in diagnostics.
  enum class TypeParamListContext {};
} // end anonymous namespace

/// Check consistency between two Objective-C type parameter lists, e.g.,
/// between a category/extension and an \@interface or between an \@class and an
/// \@interface.
static bool checkTypeParamListConsistency(Sema &S,
                                          ObjCTypeParamList *prevTypeParams,
                                          ObjCTypeParamList *newTypeParams,
                                          TypeParamListContext newContext) {}

ObjCInterfaceDecl *SemaObjC::ActOnStartClassInterface(
    Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
    SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
    IdentifierInfo *SuperName, SourceLocation SuperLoc,
    ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange,
    Decl *const *ProtoRefs, unsigned NumProtoRefs,
    const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
    const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody) {}

/// ActOnTypedefedProtocols - this action finds protocol list as part of the
/// typedef'ed use for a qualified super class and adds them to the list
/// of the protocols.
void SemaObjC::ActOnTypedefedProtocols(
    SmallVectorImpl<Decl *> &ProtocolRefs,
    SmallVectorImpl<SourceLocation> &ProtocolLocs, IdentifierInfo *SuperName,
    SourceLocation SuperLoc) {}

/// ActOnCompatibilityAlias - this action is called after complete parsing of
/// a \@compatibility_alias declaration. It sets up the alias relationships.
Decl *SemaObjC::ActOnCompatibilityAlias(SourceLocation AtLoc,
                                        IdentifierInfo *AliasName,
                                        SourceLocation AliasLocation,
                                        IdentifierInfo *ClassName,
                                        SourceLocation ClassLocation) {}

bool SemaObjC::CheckForwardProtocolDeclarationForCircularDependency(
    IdentifierInfo *PName, SourceLocation &Ploc, SourceLocation PrevLoc,
    const ObjCList<ObjCProtocolDecl> &PList) {}

ObjCProtocolDecl *SemaObjC::ActOnStartProtocolInterface(
    SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName,
    SourceLocation ProtocolLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs,
    const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
    const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody) {}

static bool NestedProtocolHasNoDefinition(ObjCProtocolDecl *PDecl,
                                          ObjCProtocolDecl *&UndefinedProtocol) {}

/// FindProtocolDeclaration - This routine looks up protocols and
/// issues an error if they are not declared. It returns list of
/// protocol declarations in its 'Protocols' argument.
void SemaObjC::FindProtocolDeclaration(bool WarnOnDeclarations,
                                       bool ForObjCContainer,
                                       ArrayRef<IdentifierLocPair> ProtocolId,
                                       SmallVectorImpl<Decl *> &Protocols) {}

namespace {
// Callback to only accept typo corrections that are either
// Objective-C protocols or valid Objective-C type arguments.
class ObjCTypeArgOrProtocolValidatorCCC final
    : public CorrectionCandidateCallback {};
} // end anonymous namespace

void SemaObjC::DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId,
                                            SourceLocation ProtocolLoc,
                                            IdentifierInfo *TypeArgId,
                                            SourceLocation TypeArgLoc,
                                            bool SelectProtocolFirst) {}

void SemaObjC::actOnObjCTypeArgsOrProtocolQualifiers(
    Scope *S, ParsedType baseType, SourceLocation lAngleLoc,
    ArrayRef<IdentifierInfo *> identifiers,
    ArrayRef<SourceLocation> identifierLocs, SourceLocation rAngleLoc,
    SourceLocation &typeArgsLAngleLoc, SmallVectorImpl<ParsedType> &typeArgs,
    SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc,
    SmallVectorImpl<Decl *> &protocols, SourceLocation &protocolRAngleLoc,
    bool warnOnIncompleteProtocols) {}

/// DiagnoseClassExtensionDupMethods - Check for duplicate declaration of
/// a class method in its extension.
///
void SemaObjC::DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT,
                                                ObjCInterfaceDecl *ID) {}

/// ActOnForwardProtocolDeclaration - Handle \@protocol foo;
SemaObjC::DeclGroupPtrTy SemaObjC::ActOnForwardProtocolDeclaration(
    SourceLocation AtProtocolLoc, ArrayRef<IdentifierLocPair> IdentList,
    const ParsedAttributesView &attrList) {}

ObjCCategoryDecl *SemaObjC::ActOnStartCategoryInterface(
    SourceLocation AtInterfaceLoc, const IdentifierInfo *ClassName,
    SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
    const IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
    Decl *const *ProtoRefs, unsigned NumProtoRefs,
    const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
    const ParsedAttributesView &AttrList) {}

/// ActOnStartCategoryImplementation - Perform semantic checks on the
/// category implementation declaration and build an ObjCCategoryImplDecl
/// object.
ObjCCategoryImplDecl *SemaObjC::ActOnStartCategoryImplementation(
    SourceLocation AtCatImplLoc, const IdentifierInfo *ClassName,
    SourceLocation ClassLoc, const IdentifierInfo *CatName,
    SourceLocation CatLoc, const ParsedAttributesView &Attrs) {}

ObjCImplementationDecl *SemaObjC::ActOnStartClassImplementation(
    SourceLocation AtClassImplLoc, const IdentifierInfo *ClassName,
    SourceLocation ClassLoc, const IdentifierInfo *SuperClassname,
    SourceLocation SuperClassLoc, const ParsedAttributesView &Attrs) {}

SemaObjC::DeclGroupPtrTy
SemaObjC::ActOnFinishObjCImplementation(Decl *ObjCImpDecl,
                                        ArrayRef<Decl *> Decls) {}

void SemaObjC::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
                                        ObjCIvarDecl **ivars, unsigned numIvars,
                                        SourceLocation RBrace) {}

static bool shouldWarnUndefinedMethod(const ObjCMethodDecl *M) {}

static void WarnUndefinedMethod(Sema &S, ObjCImplDecl *Impl,
                                ObjCMethodDecl *method, bool &IncompleteImpl,
                                unsigned DiagID,
                                NamedDecl *NeededFor = nullptr) {}

/// Determines if type B can be substituted for type A.  Returns true if we can
/// guarantee that anything that the user will do to an object of type A can
/// also be done to an object of type B.  This is trivially true if the two
/// types are the same, or if B is a subclass of A.  It becomes more complex
/// in cases where protocols are involved.
///
/// Object types in Objective-C describe the minimum requirements for an
/// object, rather than providing a complete description of a type.  For
/// example, if A is a subclass of B, then B* may refer to an instance of A.
/// The principle of substitutability means that we may use an instance of A
/// anywhere that we may use an instance of B - it will implement all of the
/// ivars of B and all of the methods of B.
///
/// This substitutability is important when type checking methods, because
/// the implementation may have stricter type definitions than the interface.
/// The interface specifies minimum requirements, but the implementation may
/// have more accurate ones.  For example, a method may privately accept
/// instances of B, but only publish that it accepts instances of A.  Any
/// object passed to it will be type checked against B, and so will implicitly
/// by a valid A*.  Similarly, a method may return a subclass of the class that
/// it is declared as returning.
///
/// This is most important when considering subclassing.  A method in a
/// subclass must accept any object as an argument that its superclass's
/// implementation accepts.  It may, however, accept a more general type
/// without breaking substitutability (i.e. you can still use the subclass
/// anywhere that you can use the superclass, but not vice versa).  The
/// converse requirement applies to return types: the return type for a
/// subclass method must be a valid object of the kind that the superclass
/// advertises, but it may be specified more accurately.  This avoids the need
/// for explicit down-casting by callers.
///
/// Note: This is a stricter requirement than for assignment.
static bool isObjCTypeSubstitutable(ASTContext &Context,
                                    const ObjCObjectPointerType *A,
                                    const ObjCObjectPointerType *B,
                                    bool rejectId) {}

static SourceRange getTypeRange(TypeSourceInfo *TSI) {}

/// Determine whether two set of Objective-C declaration qualifiers conflict.
static bool objcModifiersConflict(Decl::ObjCDeclQualifier x,
                                  Decl::ObjCDeclQualifier y) {}

static bool CheckMethodOverrideReturn(Sema &S,
                                      ObjCMethodDecl *MethodImpl,
                                      ObjCMethodDecl *MethodDecl,
                                      bool IsProtocolMethodDecl,
                                      bool IsOverridingMode,
                                      bool Warn) {}

static bool CheckMethodOverrideParam(Sema &S,
                                     ObjCMethodDecl *MethodImpl,
                                     ObjCMethodDecl *MethodDecl,
                                     ParmVarDecl *ImplVar,
                                     ParmVarDecl *IfaceVar,
                                     bool IsProtocolMethodDecl,
                                     bool IsOverridingMode,
                                     bool Warn) {}

/// In ARC, check whether the conventional meanings of the two methods
/// match.  If they don't, it's a hard error.
static bool checkMethodFamilyMismatch(Sema &S, ObjCMethodDecl *impl,
                                      ObjCMethodDecl *decl) {}

void SemaObjC::WarnConflictingTypedMethods(ObjCMethodDecl *ImpMethodDecl,
                                           ObjCMethodDecl *MethodDecl,
                                           bool IsProtocolMethodDecl) {}

void SemaObjC::CheckConflictingOverridingMethod(ObjCMethodDecl *Method,
                                                ObjCMethodDecl *Overridden,
                                                bool IsProtocolMethodDecl) {}

/// WarnExactTypedMethods - This routine issues a warning if method
/// implementation declaration matches exactly that of its declaration.
void SemaObjC::WarnExactTypedMethods(ObjCMethodDecl *ImpMethodDecl,
                                     ObjCMethodDecl *MethodDecl,
                                     bool IsProtocolMethodDecl) {}

/// FIXME: Type hierarchies in Objective-C can be deep. We could most likely
/// improve the efficiency of selector lookups and type checking by associating
/// with each protocol / interface / category the flattened instance tables. If
/// we used an immutable set to keep the table then it wouldn't add significant
/// memory cost and it would be handy for lookups.

ProtocolNameSet;
LazyProtocolNameSet;

static void findProtocolsWithExplicitImpls(const ObjCProtocolDecl *PDecl,
                                           ProtocolNameSet &PNS) {}

/// Recursively populates a set with all conformed protocols in a class
/// hierarchy that have the 'objc_protocol_requires_explicit_implementation'
/// attribute.
static void findProtocolsWithExplicitImpls(const ObjCInterfaceDecl *Super,
                                           ProtocolNameSet &PNS) {}

/// CheckProtocolMethodDefs - This routine checks unimplemented methods
/// Declared in protocol, and those referenced by it.
static void CheckProtocolMethodDefs(
    Sema &S, ObjCImplDecl *Impl, ObjCProtocolDecl *PDecl, bool &IncompleteImpl,
    const SemaObjC::SelectorSet &InsMap, const SemaObjC::SelectorSet &ClsMap,
    ObjCContainerDecl *CDecl, LazyProtocolNameSet &ProtocolsExplictImpl) {}

/// MatchAllMethodDeclarations - Check methods declared in interface
/// or protocol against those declared in their implementations.
///
void SemaObjC::MatchAllMethodDeclarations(
    const SelectorSet &InsMap, const SelectorSet &ClsMap,
    SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl,
    ObjCContainerDecl *CDecl, bool &IncompleteImpl, bool ImmediateClass,
    bool WarnCategoryMethodImpl) {}

/// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
/// category matches with those implemented in its primary class and
/// warns each time an exact match is found.
void SemaObjC::CheckCategoryVsClassMethodMatches(
    ObjCCategoryImplDecl *CatIMPDecl) {}

void SemaObjC::ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl *IMPDecl,
                                         ObjCContainerDecl *CDecl,
                                         bool IncompleteImpl) {}

SemaObjC::DeclGroupPtrTy SemaObjC::ActOnForwardClassDeclaration(
    SourceLocation AtClassLoc, IdentifierInfo **IdentList,
    SourceLocation *IdentLocs, ArrayRef<ObjCTypeParamList *> TypeParamLists,
    unsigned NumElts) {}

static bool tryMatchRecordTypes(ASTContext &Context,
                                SemaObjC::MethodMatchStrategy strategy,
                                const Type *left, const Type *right);

static bool matchTypes(ASTContext &Context,
                       SemaObjC::MethodMatchStrategy strategy, QualType leftQT,
                       QualType rightQT) {}

static bool tryMatchRecordTypes(ASTContext &Context,
                                SemaObjC::MethodMatchStrategy strategy,
                                const Type *lt, const Type *rt) {}

/// MatchTwoMethodDeclarations - Checks that two methods have matching type and
/// returns true, or false, accordingly.
/// TODO: Handle protocol list; such as id<p1,p2> in type comparisons
bool SemaObjC::MatchTwoMethodDeclarations(const ObjCMethodDecl *left,
                                          const ObjCMethodDecl *right,
                                          MethodMatchStrategy strategy) {}

static bool isMethodContextSameForKindofLookup(ObjCMethodDecl *Method,
                                               ObjCMethodDecl *MethodInList) {}

void SemaObjC::addMethodToGlobalList(ObjCMethodList *List,
                                     ObjCMethodDecl *Method) {}

/// Read the contents of the method pool for a given selector from
/// external storage.
void SemaObjC::ReadMethodPool(Selector Sel) {}

void SemaObjC::updateOutOfDateSelector(Selector Sel) {}

void SemaObjC::AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl,
                                     bool instance) {}

/// Determines if this is an "acceptable" loose mismatch in the global
/// method pool.  This exists mostly as a hack to get around certain
/// global mismatches which we can't afford to make warnings / errors.
/// Really, what we want is a way to take a method out of the global
/// method pool.
static bool isAcceptableMethodMismatch(ObjCMethodDecl *chosen,
                                       ObjCMethodDecl *other) {}

/// Return true if the given method is wthin the type bound.
static bool FilterMethodsByTypeBound(ObjCMethodDecl *Method,
                                     const ObjCObjectType *TypeBound) {}

/// We first select the type of the method: Instance or Factory, then collect
/// all methods with that type.
bool SemaObjC::CollectMultipleMethodsInGlobalPool(
    Selector Sel, SmallVectorImpl<ObjCMethodDecl *> &Methods,
    bool InstanceFirst, bool CheckTheOther, const ObjCObjectType *TypeBound) {}

bool SemaObjC::AreMultipleMethodsInGlobalPool(
    Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R,
    bool receiverIdOrClass, SmallVectorImpl<ObjCMethodDecl *> &Methods) {}

ObjCMethodDecl *SemaObjC::LookupMethodInGlobalPool(Selector Sel, SourceRange R,
                                                   bool receiverIdOrClass,
                                                   bool instance) {}

void SemaObjC::DiagnoseMultipleMethodInGlobalPool(
    SmallVectorImpl<ObjCMethodDecl *> &Methods, Selector Sel, SourceRange R,
    bool receiverIdOrClass) {}

ObjCMethodDecl *SemaObjC::LookupImplementedMethodInGlobalPool(Selector Sel) {}

static void
HelperSelectorsForTypoCorrection(
                      SmallVectorImpl<const ObjCMethodDecl *> &BestMethod,
                      StringRef Typo, const ObjCMethodDecl * Method) {}

static bool HelperIsMethodInObjCType(Sema &S, Selector Sel,
                                     QualType ObjectType) {}

const ObjCMethodDecl *
SemaObjC::SelectorsForTypoCorrection(Selector Sel, QualType ObjectType) {}

/// DiagnoseDuplicateIvars -
/// Check for duplicate ivars in the entire class at the start of
/// \@implementation. This becomes necessary because class extension can
/// add ivars to a class in random order which will not be known until
/// class's \@implementation is seen.
void SemaObjC::DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID,
                                      ObjCInterfaceDecl *SID) {}

/// Diagnose attempts to define ARC-__weak ivars when __weak is disabled.
static void DiagnoseWeakIvars(Sema &S, ObjCImplementationDecl *ID) {}

/// Diagnose attempts to use flexible array member with retainable object type.
static void DiagnoseRetainableFlexibleArrayMember(Sema &S,
                                                  ObjCInterfaceDecl *ID) {}

SemaObjC::ObjCContainerKind SemaObjC::getObjCContainerKind() const {}

static bool IsVariableSizedType(QualType T) {}

static void DiagnoseVariableSizedIvars(Sema &S, ObjCContainerDecl *OCD) {}

static void DiagnoseCategoryDirectMembersProtocolConformance(
    Sema &S, ObjCProtocolDecl *PDecl, ObjCCategoryDecl *CDecl);

static void DiagnoseCategoryDirectMembersProtocolConformance(
    Sema &S, ObjCCategoryDecl *CDecl,
    const llvm::iterator_range<ObjCProtocolList::iterator> &Protocols) {}

static void DiagnoseCategoryDirectMembersProtocolConformance(
    Sema &S, ObjCProtocolDecl *PDecl, ObjCCategoryDecl *CDecl) {}

// Note: For class/category implementations, allMethods is always null.
Decl *SemaObjC::ActOnAtEnd(Scope *S, SourceRange AtEnd,
                           ArrayRef<Decl *> allMethods,
                           ArrayRef<DeclGroupPtrTy> allTUVars) {}

/// CvtQTToAstBitMask - utility routine to produce an AST bitmask for
/// objective-c's type qualifier from the parser version of the same info.
static Decl::ObjCDeclQualifier
CvtQTToAstBitMask(ObjCDeclSpec::ObjCDeclQualifier PQTVal) {}

/// Check whether the declared result type of the given Objective-C
/// method declaration is compatible with the method's class.
///
static SemaObjC::ResultTypeCompatibilityKind
CheckRelatedResultTypeCompatibility(Sema &S, ObjCMethodDecl *Method,
                                    ObjCInterfaceDecl *CurrentClass) {}

namespace {
/// A helper class for searching for methods which a particular method
/// overrides.
class OverrideSearch {};
} // end anonymous namespace

void SemaObjC::CheckObjCMethodDirectOverrides(ObjCMethodDecl *method,
                                              ObjCMethodDecl *overridden) {}

void SemaObjC::CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod,
                                        ObjCInterfaceDecl *CurrentClass,
                                        ResultTypeCompatibilityKind RTC) {}

/// Merge type nullability from for a redeclaration of the same entity,
/// producing the updated type of the redeclared entity.
static QualType mergeTypeNullabilityForRedecl(Sema &S, SourceLocation loc,
                                              QualType type,
                                              bool usesCSKeyword,
                                              SourceLocation prevLoc,
                                              QualType prevType,
                                              bool prevUsesCSKeyword) {}

/// Merge information from the declaration of a method in the \@interface
/// (or a category/extension) into the corresponding method in the
/// @implementation (for a class or category).
static void mergeInterfaceMethodToImpl(Sema &S,
                                       ObjCMethodDecl *method,
                                       ObjCMethodDecl *prevMethod) {}

/// Verify that the method parameters/return value have types that are supported
/// by the x86 target.
static void checkObjCMethodX86VectorTypes(Sema &SemaRef,
                                          const ObjCMethodDecl *Method) {}

static void mergeObjCDirectMembers(Sema &S, Decl *CD, ObjCMethodDecl *Method) {}

static void checkObjCDirectMethodClashes(Sema &S, ObjCInterfaceDecl *IDecl,
                                         ObjCMethodDecl *Method,
                                         ObjCImplDecl *ImpDecl = nullptr) {}

Decl *SemaObjC::ActOnMethodDeclaration(
    Scope *S, SourceLocation MethodLoc, SourceLocation EndLoc,
    tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
    ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
    // optional arguments. The number of types/arguments is obtained
    // from the Sel.getNumArgs().
    ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo,
    unsigned CNumArgs, // c-style args
    const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodDeclKind,
    bool isVariadic, bool MethodDefinition) {}

bool SemaObjC::CheckObjCDeclScope(Decl *D) {}

/// Called whenever \@defs(ClassName) is encountered in the source.  Inserts the
/// instance variables of ClassName into Decls.
void SemaObjC::ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
                         const IdentifierInfo *ClassName,
                         SmallVectorImpl<Decl *> &Decls) {}

/// Build a type-check a new Objective-C exception variable declaration.
VarDecl *SemaObjC::BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType T,
                                          SourceLocation StartLoc,
                                          SourceLocation IdLoc,
                                          const IdentifierInfo *Id,
                                          bool Invalid) {}

Decl *SemaObjC::ActOnObjCExceptionDecl(Scope *S, Declarator &D) {}

/// CollectIvarsToConstructOrDestruct - Collect those ivars which require
/// initialization.
void SemaObjC::CollectIvarsToConstructOrDestruct(
    ObjCInterfaceDecl *OI, SmallVectorImpl<ObjCIvarDecl *> &Ivars) {}

void SemaObjC::DiagnoseUseOfUnimplementedSelectors() {}

ObjCIvarDecl *
SemaObjC::GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method,
                                         const ObjCPropertyDecl *&PDecl) const {}

namespace {
/// Used by SemaObjC::DiagnoseUnusedBackingIvarInAccessor to check if a property
/// accessor references the backing ivar.
class UnusedBackingIvarChecker
    : public RecursiveASTVisitor<UnusedBackingIvarChecker> {};
} // end anonymous namespace

void SemaObjC::DiagnoseUnusedBackingIvarInAccessor(
    Scope *S, const ObjCImplementationDecl *ImplD) {}

QualType SemaObjC::AdjustParameterTypeForObjCAutoRefCount(
    QualType T, SourceLocation NameLoc, TypeSourceInfo *TSInfo) {}

ObjCInterfaceDecl *SemaObjC::getObjCInterfaceDecl(const IdentifierInfo *&Id,
                                                  SourceLocation IdLoc,
                                                  bool DoTypoCorrection) {}

bool SemaObjC::inferObjCARCLifetime(ValueDecl *decl) {}

ObjCContainerDecl *SemaObjC::getObjCDeclContext() const {}

void SemaObjC::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) {}

/// TranslateIvarVisibility - Translate visibility from a token ID to an
///  AST enum value.
static ObjCIvarDecl::AccessControl
TranslateIvarVisibility(tok::ObjCKeywordKind ivarVisibility) {}

/// ActOnIvar - Each ivar field of an objective-c class is passed into this
/// in order to create an IvarDecl object for it.
Decl *SemaObjC::ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D,
                          Expr *BitWidth, tok::ObjCKeywordKind Visibility) {}