#include "clang/Sema/SemaObjC.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/EvaluatedExprVisitor.h"
#include "clang/AST/StmtObjC.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Attr.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/ParsedAttr.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/TemplateDeduction.h"
#include "llvm/Support/ConvertUTF.h"
namespace clang {
SemaObjC::SemaObjC(Sema &S)
: … { … }
StmtResult SemaObjC::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
Stmt *First, Expr *collection,
SourceLocation RParenLoc) { … }
ExprResult SemaObjC::CheckObjCForCollectionOperand(SourceLocation forLoc,
Expr *collection) { … }
StmtResult SemaObjC::FinishObjCForCollectionStmt(Stmt *S, Stmt *B) { … }
StmtResult SemaObjC::ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen, Decl *Parm,
Stmt *Body) { … }
StmtResult SemaObjC::ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body) { … }
StmtResult SemaObjC::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try,
MultiStmtArg CatchStmts,
Stmt *Finally) { … }
StmtResult SemaObjC::BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw) { … }
StmtResult SemaObjC::ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw,
Scope *CurScope) { … }
ExprResult SemaObjC::ActOnObjCAtSynchronizedOperand(SourceLocation atLoc,
Expr *operand) { … }
StmtResult SemaObjC::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
Expr *SyncExpr,
Stmt *SyncBody) { … }
StmtResult SemaObjC::ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc,
Stmt *Body) { … }
TypeResult SemaObjC::actOnObjCProtocolQualifierType(
SourceLocation lAngleLoc, ArrayRef<Decl *> protocols,
ArrayRef<SourceLocation> protocolLocs, SourceLocation rAngleLoc) { … }
TypeResult SemaObjC::actOnObjCTypeArgsAndProtocolQualifiers(
Scope *S, SourceLocation Loc, ParsedType BaseType,
SourceLocation TypeArgsLAngleLoc, ArrayRef<ParsedType> TypeArgs,
SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc,
ArrayRef<Decl *> Protocols, ArrayRef<SourceLocation> ProtocolLocs,
SourceLocation ProtocolRAngleLoc) { … }
QualType SemaObjC::BuildObjCTypeParamType(
const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc,
ArrayRef<ObjCProtocolDecl *> Protocols,
ArrayRef<SourceLocation> ProtocolLocs, SourceLocation ProtocolRAngleLoc,
bool FailOnError) { … }
static QualType applyObjCTypeArgs(Sema &S, SourceLocation loc, QualType type,
ArrayRef<TypeSourceInfo *> typeArgs,
SourceRange typeArgsRange, bool failOnError,
bool rebuilding) { … }
QualType SemaObjC::BuildObjCObjectType(
QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc,
ArrayRef<TypeSourceInfo *> TypeArgs, SourceLocation TypeArgsRAngleLoc,
SourceLocation ProtocolLAngleLoc, ArrayRef<ObjCProtocolDecl *> Protocols,
ArrayRef<SourceLocation> ProtocolLocs, SourceLocation ProtocolRAngleLoc,
bool FailOnError, bool Rebuilding) { … }
ParsedType SemaObjC::ActOnObjCInstanceType(SourceLocation Loc) { … }
namespace {
struct RetainCycleOwner { … };
}
static bool considerVariable(VarDecl *var, Expr *ref, RetainCycleOwner &owner) { … }
static bool findRetainCycleOwner(Sema &S, Expr *e, RetainCycleOwner &owner) { … }
namespace {
struct FindCaptureVisitor : EvaluatedExprVisitor<FindCaptureVisitor> { … };
}
static Expr *findCapturingExpr(Sema &S, Expr *e, RetainCycleOwner &owner) { … }
static void diagnoseRetainCycle(Sema &S, Expr *capturer,
RetainCycleOwner &owner) { … }
static bool isSetterLikeSelector(Selector sel) { … }
static std::optional<int>
GetNSMutableArrayArgumentIndex(SemaObjC &S, ObjCMessageExpr *Message) { … }
static std::optional<int>
GetNSMutableDictionaryArgumentIndex(SemaObjC &S, ObjCMessageExpr *Message) { … }
static std::optional<int> GetNSSetArgumentIndex(SemaObjC &S,
ObjCMessageExpr *Message) { … }
void SemaObjC::CheckObjCCircularContainer(ObjCMessageExpr *Message) { … }
void SemaObjC::checkRetainCycles(ObjCMessageExpr *msg) { … }
void SemaObjC::checkRetainCycles(Expr *receiver, Expr *argument) { … }
void SemaObjC::checkRetainCycles(VarDecl *Var, Expr *Init) { … }
bool SemaObjC::CheckObjCString(Expr *Arg) { … }
bool SemaObjC::CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation lbrac,
ArrayRef<const Expr *> Args) { … }
const DeclContext *SemaObjC::getCurObjCLexicalContext() const { … }
IdentifierInfo *SemaObjC::getNSErrorIdent() { … }
void SemaObjC::ActOnObjCContainerStartDefinition(ObjCContainerDecl *IDecl) { … }
void SemaObjC::ActOnObjCContainerFinishDefinition() { … }
void SemaObjC::ActOnObjCTemporaryExitContainerContext(
ObjCContainerDecl *ObjCCtx) { … }
void SemaObjC::ActOnObjCReenterContainerContext(ObjCContainerDecl *ObjCCtx) { … }
ObjCProtocolDecl *SemaObjC::LookupProtocol(IdentifierInfo *II,
SourceLocation IdLoc,
RedeclarationKind Redecl) { … }
bool SemaObjC::isObjCWritebackConversion(QualType FromType, QualType ToType,
QualType &ConvertedType) { … }
SemaObjC::ObjCSubscriptKind SemaObjC::CheckSubscriptingKind(Expr *FromE) { … }
void SemaObjC::AddCFAuditedAttribute(Decl *D) { … }
bool SemaObjC::isCFError(RecordDecl *RD) { … }
bool SemaObjC::isNSStringType(QualType T, bool AllowNSAttributedString) { … }
bool SemaObjC::isCFStringType(QualType T) { … }
static bool checkIBOutletCommon(Sema &S, Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleIBOutlet(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleIBOutletCollection(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleSuppresProtocolAttr(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleDirectAttr(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleDirectMembersAttr(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleMethodFamilyAttr(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleNSObject(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleIndependentClass(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleBlocksAttr(Decl *D, const ParsedAttr &AL) { … }
static bool isValidSubjectOfNSReturnsRetainedAttribute(QualType QT) { … }
static bool isValidSubjectOfNSAttribute(QualType QT) { … }
static bool isValidSubjectOfCFAttribute(QualType QT) { … }
static bool isValidSubjectOfOSAttribute(QualType QT) { … }
void SemaObjC::AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI,
Sema::RetainOwnershipKind K,
bool IsTemplateInstantiation) { … }
Sema::RetainOwnershipKind
SemaObjC::parsedAttrToRetainOwnershipKind(const ParsedAttr &AL) { … }
bool SemaObjC::checkNSReturnsRetainedReturnType(SourceLocation Loc,
QualType QT) { … }
bool SemaObjC::isValidOSObjectOutParameter(const Decl *D) { … }
void SemaObjC::handleXReturnsXRetainedAttr(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleReturnsInnerPointerAttr(Decl *D, const ParsedAttr &Attrs) { … }
void SemaObjC::handleRequiresSuperAttr(Decl *D, const ParsedAttr &Attrs) { … }
void SemaObjC::handleNSErrorDomain(Decl *D, const ParsedAttr &Attr) { … }
void SemaObjC::handleBridgeAttr(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleBridgeMutableAttr(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleBridgeRelatedAttr(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleDesignatedInitializer(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleRuntimeName(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleBoxable(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handleOwnershipAttr(Decl *D, const ParsedAttr &AL) { … }
void SemaObjC::handlePreciseLifetimeAttr(Decl *D, const ParsedAttr &AL) { … }
static bool tryMakeVariablePseudoStrong(Sema &S, VarDecl *VD,
bool DiagnoseFailure) { … }
void SemaObjC::handleExternallyRetainedAttr(Decl *D, const ParsedAttr &AL) { … }
bool SemaObjC::GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx) { … }
void SemaObjC::DiagnoseCStringFormatDirectiveInCFAPI(const NamedDecl *FDecl,
Expr **Args,
unsigned NumArgs) { … }
bool SemaObjC::isSignedCharBool(QualType Ty) { … }
void SemaObjC::adornBoolConversionDiagWithTernaryFixit(
Expr *SourceExpr, const Sema::SemaDiagnosticBuilder &Builder) { … }
static void checkCollectionLiteralElement(Sema &S, QualType TargetElementType,
Expr *Element, unsigned ElementKind) { … }
void SemaObjC::checkArrayLiteral(QualType TargetType,
ObjCArrayLiteral *ArrayLiteral) { … }
void SemaObjC::checkDictionaryLiteral(
QualType TargetType, ObjCDictionaryLiteral *DictionaryLiteral) { … }
}