A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://clang.llvm.org/doxygen/SemaObjC_8cpp_source.html below:

clang: lib/Sema/SemaObjC.cpp Source File

25#include "llvm/Support/ConvertUTF.h" 30

:

SemaBase

(S), NSNumberDecl(nullptr), NSValueDecl(nullptr),

31

NSStringDecl(nullptr), StringWithUTF8StringMethod(nullptr),

32

ValueWithBytesObjCTypeMethod(nullptr), NSArrayDecl(nullptr),

33

ArrayWithObjectsMethod(nullptr), NSDictionaryDecl(nullptr),

34

DictionaryWithObjectsMethod(nullptr) {}

48 if

(!DS->isSingleDecl())

50

diag::err_toomany_element_decls));

52 VarDecl

*

D

= dyn_cast<VarDecl>(DS->getSingleDecl());

53 if

(!

D

||

D

->isInvalidDecl())

56

FirstType =

D

->getType();

60 if

(!

D

->hasLocalStorage())

62 Diag

(

D

->getLocation(), diag::err_non_local_variable_decl_in_for));

68 Expr

*DeducedInit = &OpaqueId;

72 D

->getTypeSourceInfo()->getTypeLoc(), DeducedInit, FirstType, Info);

76 if

(FirstType.

isNull

()) {

81 D

->setType(FirstType);

85 D

->getTypeSourceInfo()->getTypeLoc().getBeginLoc();

86 Diag

(

Loc

, diag::warn_auto_var_is_id) <<

D

->getDeclName();

94 Diag

(

First

->getBeginLoc(), diag::err_selector_element_not_lvalue)

95

<<

First

->getSourceRange());

97

FirstType =

static_cast<Expr

*

>

(

First

)->getType();

99 Diag

(ForLoc, diag::err_selector_element_const_type)

100

<< FirstType <<

First

->getSourceRange();

105 return StmtError

(

Diag

(ForLoc, diag::err_selector_element_type)

106

<< FirstType <<

First

->getSourceRange());

118 nullptr

, ForLoc, RParenLoc);

130

collection = result.

get

();

140

collection = result.

get

();

147 return Diag

(forLoc, diag::err_collection_expr_type)

160

diag::err_arc_collection_forward,

165

}

else if

(iface || !objectType->

qual_empty

()) {

167

&Context.Idents.get(

"countByEnumeratingWithState"

),

168

&Context.Idents.get(

"objects"

), &Context.Idents.get(

"count"

)};

169 Selector

selector = Context.Selectors.getSelector(3, &selectorIdents[0]);

187 Diag

(forLoc, diag::warn_collection_expr_type)

211 VarDecl

*Var = cast_or_null<VarDecl>(Parm);

228 Diag

(AtLoc, diag::err_objc_exceptions_disabled) <<

"@try"

;

233 Diag

(AtLoc, diag::err_mixing_cxx_try_seh_try) << 1;

238 unsigned

NumCatchStmts = CatchStmts.size();

240

NumCatchStmts, Finally);

262 return StmtError

(

Diag

(AtLoc, diag::err_objc_throw_expects_object)

273 Diag

(AtLoc, diag::err_objc_exceptions_disabled) <<

"@throw"

;

278 Scope

*AtCatchParent = CurScope;

280

AtCatchParent = AtCatchParent->

getParent

();

282 return StmtError

(

Diag

(AtLoc, diag::err_rethrow_used_outside_catch));

292

operand = result.

get

();

296 if

(!

type

->isDependentType() && !

type

->isObjCObjectPointerType()) {

301

diag::err_incomplete_receiver_type))

302 return Diag

(atLoc, diag::err_objc_synchronized_expects_object)

310 return Diag

(atLoc, diag::err_objc_synchronized_expects_object)

313

operand = result.

get

();

315 return Diag

(atLoc, diag::err_objc_synchronized_expects_object)

347

Context.ObjCBuiltinIdTy, {},

369

ObjCObjectTL.setProtocolLAngleLoc(lAngleLoc);

370

ObjCObjectTL.setProtocolRAngleLoc(rAngleLoc);

371 for

(

unsigned

i = 0, n = protocols.size(); i != n; ++i)

372

ObjCObjectTL.setProtocolLoc(i, protocolLocs[i]);

392

BaseTypeInfo = Context.getTrivialTypeSourceInfo(

T

,

Loc

);

396 for

(

unsigned

i = 0, n = TypeArgs.size(); i != n; ++i) {

400

ActualTypeArgInfos.clear();

404

assert(TypeArgInfo &&

"No type source info?"

);

405

ActualTypeArgInfos.push_back(TypeArgInfo);

411

TypeArgsLAngleLoc, ActualTypeArgInfos, TypeArgsRAngleLoc,

415

ProtocolLocs, ProtocolRAngleLoc,

431

ResultTL = ObjCObjectPointerTL.getPointeeLoc();

436 if

(OTPTL.getNumProtocols() > 0) {

437

assert(OTPTL.getNumProtocols() == Protocols.size());

438

OTPTL.setProtocolLAngleLoc(ProtocolLAngleLoc);

439

OTPTL.setProtocolRAngleLoc(ProtocolRAngleLoc);

440 for

(

unsigned

i = 0, n = Protocols.size(); i != n; ++i)

441

OTPTL.setProtocolLoc(i, ProtocolLocs[i]);

451 if

(ObjCObjectTL.getNumTypeArgs() > 0) {

452

assert(ObjCObjectTL.getNumTypeArgs() == ActualTypeArgInfos.size());

453

ObjCObjectTL.setTypeArgsLAngleLoc(TypeArgsLAngleLoc);

454

ObjCObjectTL.setTypeArgsRAngleLoc(TypeArgsRAngleLoc);

455 for

(

unsigned

i = 0, n = ActualTypeArgInfos.size(); i != n; ++i)

456

ObjCObjectTL.setTypeArgTInfo(i, ActualTypeArgInfos[i]);

463 if

(ObjCObjectTL.getNumProtocols() > 0) {

464

assert(ObjCObjectTL.getNumProtocols() == Protocols.size());

465

ObjCObjectTL.setProtocolLAngleLoc(ProtocolLAngleLoc);

466

ObjCObjectTL.setProtocolRAngleLoc(ProtocolRAngleLoc);

467 for

(

unsigned

i = 0, n = Protocols.size(); i != n; ++i)

468

ObjCObjectTL.setProtocolLoc(i, ProtocolLocs[i]);

475

ObjCObjectTL.setHasBaseTypeAsWritten(

true

);

476 if

(ObjCObjectTL.getType() ==

T

)

477

ObjCObjectTL.getBaseLoc().initializeFullCopy(BaseTypeInfo->

getTypeLoc

());

479

ObjCObjectTL.getBaseLoc().initialize(Context,

Loc

);

492 if

(!Protocols.empty()) {

494 Result

= Context.applyObjCProtocolQualifiers(

Result

, Protocols, HasError);

497

<<

SourceRange

(ProtocolLAngleLoc, ProtocolRAngleLoc);

501 if

(FailOnError &&

Result

.isNull())

515 if

(!objcObjectType || !objcObjectType->getInterface()) {

516

S.

Diag

(loc, diag::err_objc_type_args_non_class) <<

type

<< typeArgsRange;

527

S.

Diag

(loc, diag::err_objc_type_args_non_parameterized_class)

537 if

(objcObjectType->isSpecialized()) {

538

S.

Diag

(loc, diag::err_objc_type_args_specialized_class)

549 unsigned

numTypeParams = typeParams->

size

();

550 bool

anyPackExpansions =

false

;

551 for

(

unsigned

i = 0, n = typeArgs.size(); i != n; ++i) {

559 bool

diagnosed =

false

;

562

rangeToRemove =

attr

.getLocalSourceRange();

563 if

(

attr

.getTypePtr()->getImmediateNullability()) {

564

typeArg =

attr

.getTypePtr()->getModifiedType();

566

diag::err_objc_type_arg_explicit_nullability)

574 if

(!rebuilding && !diagnosed) {

575

S.

Diag

(qual.getBeginLoc(), diag::err_objc_type_arg_qualified)

584

finalTypeArgs.push_back(typeArg);

587

anyPackExpansions =

true

;

591 if

(!anyPackExpansions) {

592 if

(i < numTypeParams) {

593

typeParam = typeParams->

begin

()[i];

596

S.

Diag

(loc, diag::err_objc_type_args_wrong_arity)

599

S.

Diag

(objcClass->

getLocation

(), diag::note_previous_decl) << objcClass;

614

assert(anyPackExpansions &&

"Too many arguments?"

);

623 if

(typeArgObjC->isObjCIdType()) {

626 if

(boundObjC->isObjCIdType())

635

diag::err_objc_type_arg_does_not_match_bound)

652

assert(anyPackExpansions &&

"Too many arguments?"

);

663

diag::err_objc_type_arg_does_not_match_bound)

686

diag::err_objc_type_arg_not_id_compatible)

696 if

(!anyPackExpansions && finalTypeArgs.size() != numTypeParams) {

697

S.

Diag

(loc, diag::err_objc_type_args_wrong_arity)

698

<< (typeArgs.size() < typeParams->

size

()) << objcClass->

getDeclName

()

700

S.

Diag

(objcClass->

getLocation

(), diag::note_previous_decl) << objcClass;

717 bool

FailOnError,

bool

Rebuilding) {

720 if

(!TypeArgs.empty()) {

723 SourceRange

(TypeArgsLAngleLoc, TypeArgsRAngleLoc),

724

FailOnError, Rebuilding);

725 if

(FailOnError &&

Result

.isNull())

729 if

(!Protocols.empty()) {

731 Result

= Context.applyObjCProtocolQualifiers(

Result

, Protocols, HasError);

733 Diag

(

Loc

, diag::err_invalid_protocol_qualifiers)

734

<<

SourceRange

(ProtocolLAngleLoc, ProtocolRAngleLoc);

738 if

(FailOnError &&

Result

.isNull())

747 QualType T

= Context.getObjCInstanceType();

756struct

RetainCycleOwner {

757

VarDecl *Variable =

nullptr

;

762

RetainCycleOwner() =

default

;

764 void

setLocsFrom(Expr *e) {

765 Loc

= e->getExprLoc();

766 Range

= e->getSourceRange();

781

owner.Variable = var;

783

owner.setLocsFrom(ref);

791 switch

(

cast

->getCastKind()) {

793 case

CK_LValueBitCast:

794 case

CK_LValueToRValue:

795 case

CK_ARCReclaimReturnedObject:

796

e =

cast

->getSubExpr();

813 if

(ref->isFreeIvar())

814

owner.setLocsFrom(ref);

815

owner.Indirect =

true

;

819 if

(

DeclRefExpr

*ref = dyn_cast<DeclRefExpr>(e)) {

820 VarDecl

*var = dyn_cast<VarDecl>(ref->getDecl());

826 if

(

MemberExpr

*member = dyn_cast<MemberExpr>(e)) {

827 if

(member->isArrow())

831

e = member->getBase();

838

pseudo->getSyntacticForm()->IgnoreParens());

844 if

(!property->isRetaining() &&

845

!(property->getPropertyIvarDecl() &&

846

property->getPropertyIvarDecl()->getType().getObjCLifetime() ==

850

owner.Indirect =

true

;

859

e =

const_cast<Expr

*

>

(

860

cast<OpaqueValueExpr>(pre->

getBase

())->getSourceExpr());

872struct

FindCaptureVisitor : EvaluatedExprVisitor<FindCaptureVisitor> {

877

FindCaptureVisitor(ASTContext &Context, VarDecl *variable)

878

: EvaluatedExprVisitor<FindCaptureVisitor>(Context), Variable(variable) {}

880 void

VisitDeclRefExpr(DeclRefExpr *ref) {

881 if

(ref->getDecl() == Variable && !Capturer)

885 void

VisitObjCIvarRefExpr(ObjCIvarRefExpr *ref) {

888

Visit(ref->getBase());

889 if

(Capturer && ref->isFreeIvar())

893 void

VisitBlockExpr(BlockExpr *block) {

895 if

(block->getBlockDecl()->capturesVariable(Variable))

896

Visit(block->getBlockDecl()->getBody());

899 void

VisitOpaqueValueExpr(OpaqueValueExpr *OVE) {

902 if

(OVE->getSourceExpr())

903

Visit(OVE->getSourceExpr());

906 void

VisitBinaryOperator(BinaryOperator *BinOp) {

907 if

(!Variable || VarWillBeReased || BinOp->getOpcode() != BO_Assign)

909

Expr *LHS = BinOp->getLHS();

910 if

(

const

DeclRefExpr *DRE = dyn_cast_or_null<DeclRefExpr>(LHS)) {

911 if

(DRE->getDecl() != Variable)

913 if

(Expr *RHS = BinOp->getRHS()) {

914

RHS = RHS->IgnoreParenCasts();

915

std::optional<llvm::APSInt>

Value

;

917

(RHS && (

Value

= RHS->getIntegerConstantExpr(Context)) &&

929

assert(owner.Variable && owner.Loc.isValid());

936 if

(

Cmd

.isUnarySelector() &&

Cmd

.getNameForSlot(0) ==

"copy"

) {

937

e = ME->getInstanceReceiver();

942

}

else if

(

CallExpr

*CE = dyn_cast<CallExpr>(e)) {

943 if

(CE->getNumArgs() == 1) {

944 FunctionDecl

*Fn = dyn_cast_or_null<FunctionDecl>(CE->getCalleeDecl());

947 if

(FnI && FnI->

isStr

(

"_Block_copy"

)) {

954 BlockExpr

*block = dyn_cast<BlockExpr>(e);

958

FindCaptureVisitor visitor(S.

Context

, owner.Variable);

960 return

visitor.VarWillBeReased ? nullptr : visitor.Capturer;

964

RetainCycleOwner &owner) {

966

assert(owner.Variable && owner.Loc.isValid());

970

S.

Diag

(owner.Loc, diag::note_arc_retain_cycle_owner)

971

<< owner.Indirect << owner.Range;

981

str = str.ltrim(

'_'

);

982 if

(str.starts_with(

"set"

))

984 else if

(str.starts_with(

"add"

)) {

986 if

(sel.

getNumArgs

() == 1 && str.starts_with(

"addOperationWithBlock"

))

997static

std::optional<int>

999 bool

IsMutableArray = S.NSAPIObj->isSubclassOfNSClass(

1001 if

(!IsMutableArray) {

1002 return

std::nullopt;

1005 Selector

Sel = Message->getSelector();

1007

std::optional<NSAPI::NSArrayMethodKind> MKOpt =

1008

S.NSAPIObj->getNSArrayMethodKind(Sel);

1010 return

std::nullopt;

1024 return

std::nullopt;

1027 return

std::nullopt;

1030static

std::optional<int>

1032 bool

IsMutableDictionary = S.NSAPIObj->isSubclassOfNSClass(

1034 if

(!IsMutableDictionary) {

1035 return

std::nullopt;

1038 Selector

Sel = Message->getSelector();

1040

std::optional<NSAPI::NSDictionaryMethodKind> MKOpt =

1041

S.NSAPIObj->getNSDictionaryMethodKind(Sel);

1043 return

std::nullopt;

1055 return

std::nullopt;

1058 return

std::nullopt;

1063 bool

IsMutableSet = S.NSAPIObj->isSubclassOfNSClass(

1066 bool

IsMutableOrderedSet = S.NSAPIObj->isSubclassOfNSClass(

1068 if

(!IsMutableSet && !IsMutableOrderedSet) {

1069 return

std::nullopt;

1072 Selector

Sel = Message->getSelector();

1074

std::optional<NSAPI::NSSetMethodKind> MKOpt =

1075

S.NSAPIObj->getNSSetMethodKind(Sel);

1077 return

std::nullopt;

1092 return

std::nullopt;

1096 if

(!Message->isInstanceMessage()) {

1100

std::optional<int> ArgOpt;

1108 int

ArgIndex = *ArgOpt;

1110 Expr

*Arg = Message->getArg(ArgIndex)->IgnoreImpCasts();

1116 if

(

DeclRefExpr

*ArgRE = dyn_cast<DeclRefExpr>(Arg)) {

1117 if

(ArgRE->isObjCSelfExpr()) {

1118 Diag

(Message->getSourceRange().getBegin(),

1119

diag::warn_objc_circular_container)

1120

<< ArgRE->getDecl() << StringRef(

"'super'"

);

1124 Expr

*Receiver = Message->getInstanceReceiver()->IgnoreImpCasts();

1130 if

(

DeclRefExpr

*ReceiverRE = dyn_cast<DeclRefExpr>(Receiver)) {

1131 if

(

DeclRefExpr

*ArgRE = dyn_cast<DeclRefExpr>(Arg)) {

1132 if

(ReceiverRE->getDecl() == ArgRE->getDecl()) {

1134 Diag

(Message->getSourceRange().getBegin(),

1135

diag::warn_objc_circular_container)

1137 if

(!ArgRE->isObjCSelfExpr()) {

1139

diag::note_objc_circular_container_declared_here)

1144

}

else if

(

ObjCIvarRefExpr

*IvarRE = dyn_cast<ObjCIvarRefExpr>(Receiver)) {

1146 if

(IvarRE->getDecl() == IvarArgRE->getDecl()) {

1148 Diag

(Message->getSourceRange().getBegin(),

1149

diag::warn_objc_circular_container)

1152

diag::note_objc_circular_container_declared_here)

1167

RetainCycleOwner owner;

1180 for

(

unsigned

i = 0, e = msg->

getNumArgs

(); i != e; ++i) {

1183 if

(MD && MD->

parameters

()[i]->hasAttr<NoEscapeAttr>())

1192

RetainCycleOwner owner;

1201

RetainCycleOwner Owner;

1222 if

(!Literal || !Literal->isOrdinary()) {

1223 Diag

(Arg->

getBeginLoc

(), diag::err_cfstring_literal_not_string_constant)

1228 if

(Literal->containsNonAsciiOrNull()) {

1229

StringRef String = Literal->getString();

1230 unsigned

NumBytes = String.size();

1232 const

llvm::UTF8 *FromPtr = (

const

llvm::UTF8 *)String.data();

1233

llvm::UTF16 *ToPtr = &ToBuf[0];

1235

llvm::ConversionResult

Result

=

1236

llvm::ConvertUTF8toUTF16(&FromPtr, FromPtr + NumBytes, &ToPtr,

1237

ToPtr + NumBytes, llvm::strictConversion);

1239 if

(

Result

!= llvm::conversionOK)

1264

DC = CatD->getClassInterface();

1273 return

Ident_NSError;

1279 "The next DeclContext should be lexically contained in the current one."

);

1306 return

cast_or_null<ObjCProtocolDecl>(

D

);

1322

Context.hasSameUnqualifiedType(FromType, ToType))

1363 bool

IncompatibleObjC;

1364 if

(Context.typesAreCompatible(FromPointee, ToPointee))

1365

FromPointee = ToPointee;

1372

FromPointee = Context.getQualifiedType(FromPointee, FromQuals);

1373

ConvertedType = Context.getPointerType(FromPointee);

1395 if

(isa<StringLiteral>(IndexExpr))

1399 Diag

(FromE->

getExprLoc

(), diag::err_objc_subscript_type_conversion) <<

T

;

1405

diag::err_objc_index_incomplete_class_type,

1411 int

NoIntegrals = 0, NoObjCIdPointers = 0;

1415

->getVisibleConversionFunctions()) {

1417

dyn_cast<CXXConversionDecl>(

D

->getUnderlyingDecl())) {

1418 QualType

CT = Conversion->getConversionType().getNonReferenceType();

1421

ConversionDecls.push_back(Conversion);

1424

ConversionDecls.push_back(Conversion);

1428 if

(NoIntegrals == 1 && NoObjCIdPointers == 0)

1430 if

(NoIntegrals == 0 && NoObjCIdPointers == 1)

1432 if

(NoIntegrals == 0 && NoObjCIdPointers == 0) {

1434 Diag

(FromE->

getExprLoc

(), diag::err_objc_subscript_type_conversion)

1438 Diag

(FromE->

getExprLoc

(), diag::err_objc_multiple_subscript_type_conversion)

1440 for

(

unsigned int

i = 0; i < ConversionDecls.size(); i++)

1441 Diag

(ConversionDecls[i]->getLocation(),

1442

diag::note_conv_function_declared_at);

1452 if

(!

Loc

.isValid())

1456 if

(

D

->hasAttr<CFAuditedTransferAttr>() ||

1457 D

->hasAttr<CFUnknownTransferAttr>())

1462 D

->addAttr(CFAuditedTransferAttr::CreateImplicit(Context, Info));

1476 if

(

auto

bridgeAttr = RD->

getAttr

<ObjCBridgeAttr>())

1477

bridgedType = bridgeAttr->getBridgedType();

1478 else if

(

auto

bridgeAttr = RD->

getAttr

<ObjCBridgeMutableAttr>())

1479

bridgedType = bridgeAttr->getBridgedType();

1501 if

(AllowNSAttributedString &&

1529 if

(

const auto

*VD = dyn_cast<ObjCIvarDecl>(

D

)) {

1531

S.

Diag

(AL.

getLoc

(), diag::warn_iboutlet_object_type)

1532

<< AL << VD->getType() << 0;

1535

}

else if

(

const auto

*PD = dyn_cast<ObjCPropertyDecl>(

D

)) {

1537

S.

Diag

(AL.

getLoc

(), diag::warn_iboutlet_object_type)

1538

<< AL << PD->getType() << 1;

1542

S.

Diag

(AL.

getLoc

(), diag::warn_attribute_iboutlet) << AL;

1561 Diag

(AL.

getLoc

(), diag::err_attribute_wrong_number_arguments) << AL << 1;

1574

Context.Idents.get(

"NSObject"

), AL.

getLoc

(),

1577 Diag

(AL.

getLoc

(), diag::err_iboutletcollection_type) <<

"NSObject"

;

1585

QTLoc = Context.getTrivialTypeSourceInfo(QT, AL.

getLoc

());

1593

? diag::err_iboutletcollection_builtintype

1594

: diag::err_iboutletcollection_type)

1599 D

->addAttr(::new (Context) IBOutletCollectionAttr(Context, AL, QTLoc));

1603 if

(!cast<ObjCProtocolDecl>(

D

)->isThisDeclarationADefinition()) {

1604 Diag

(AL.

getLoc

(), diag::err_objc_attr_protocol_requires_definition)

1615 if

(isa<ObjCProtocolDecl>(

D

->getDeclContext())) {

1616 Diag

(AL.

getLoc

(), diag::err_objc_direct_on_protocol) <<

false

;

1621

handleSimpleAttribute<ObjCDirectAttr>(*

this

,

D

, AL);

1623 Diag

(AL.

getLoc

(), diag::warn_objc_direct_ignored) << AL;

1629

handleSimpleAttribute<ObjCDirectMembersAttr>(*

this

,

D

, AL);

1631 Diag

(AL.

getLoc

(), diag::warn_objc_direct_ignored) << AL;

1636 const auto

*M = cast<ObjCMethodDecl>(

D

);

1638 Diag

(AL.

getLoc

(), diag::err_attribute_argument_n_type)

1644

ObjCMethodFamilyAttr::FamilyKind F;

1645 if

(!ObjCMethodFamilyAttr::ConvertStrToFamilyKind(IL->

Ident

->

getName

(), F)) {

1646 Diag

(IL->

Loc

, diag::warn_attribute_type_not_supported) << AL << IL->

Ident

;

1650 if

(F == ObjCMethodFamilyAttr::OMF_init &&

1651

!M->getReturnType()->isObjCObjectPointerType()) {

1652 Diag

(M->getLocation(), diag::err_init_method_bad_return_type)

1653

<< M->getReturnType();

1663 if

(

const auto

*TD = dyn_cast<TypedefNameDecl>(

D

)) {

1666 Diag

(TD->getLocation(), diag::err_nsobject_attribute);

1669

}

else if

(

const auto

*PD = dyn_cast<ObjCPropertyDecl>(

D

)) {

1672 Diag

(PD->getLocation(), diag::err_nsobject_attribute);

1682 Diag

(

D

->getLocation(), diag::warn_nsobject_attribute);

1688 if

(

const auto

*TD = dyn_cast<TypedefNameDecl>(

D

)) {

1691 Diag

(TD->getLocation(), diag::warn_ptr_independentclass_attribute);

1695 Diag

(

D

->getLocation(), diag::warn_independentclass_attribute);

1704 Diag

(AL.

getLoc

(), diag::err_attribute_argument_n_type)

1710

BlocksAttr::BlockType

type

;

1711 if

(!BlocksAttr::ConvertStrToBlockType(II->

getName

(),

type

)) {

1712 Diag

(AL.

getLoc

(), diag::warn_attribute_type_not_supported) << AL << II;

1742 bool

IsTemplateInstantiation) {

1746

handleSimpleAttributeOrDiagnose<OSConsumedAttr>(

1748

diag::warn_ns_attribute_wrong_parameter_type,

1749

CI.

getRange

(),

"os_consumed"

,

1);

1752

handleSimpleAttributeOrDiagnose<NSConsumedAttr>(

1759

((IsTemplateInstantiation &&

getLangOpts

().ObjCAutoRefCount)

1760

? diag::err_ns_attribute_wrong_parameter_type

1761

: diag::warn_ns_attribute_wrong_parameter_type),

1762

CI.

getRange

(),

"ns_consumed"

,

0);

1765

handleSimpleAttributeOrDiagnose<CFConsumedAttr>(

1767

diag::warn_ns_attribute_wrong_parameter_type,

1768

CI.

getRange

(),

"cf_consumed"

,

1);

1776 case

ParsedAttr::AT_CFConsumed:

1777 case

ParsedAttr::AT_CFReturnsRetained:

1778 case

ParsedAttr::AT_CFReturnsNotRetained:

1780 case

ParsedAttr::AT_OSConsumesThis:

1781 case

ParsedAttr::AT_OSConsumed:

1782 case

ParsedAttr::AT_OSReturnsRetained:

1783 case

ParsedAttr::AT_OSReturnsNotRetained:

1784 case

ParsedAttr::AT_OSReturnsRetainedOnZero:

1785 case

ParsedAttr::AT_OSReturnsRetainedOnNonZero:

1787 case

ParsedAttr::AT_NSConsumesSelf:

1788 case

ParsedAttr::AT_NSConsumed:

1789 case

ParsedAttr::AT_NSReturnsRetained:

1790 case

ParsedAttr::AT_NSReturnsNotRetained:

1791 case

ParsedAttr::AT_NSReturnsAutoreleased:

1794

llvm_unreachable(

"Wrong argument supplied"

);

1803 Diag

(

Loc

, diag::warn_ns_attribute_wrong_return_type)

1804

<<

"'ns_returns_retained'"

<< 0 << 0;

1810 const auto

*PVD = dyn_cast<ParmVarDecl>(

D

);

1822 if

(

const auto

*MD = dyn_cast<ObjCMethodDecl>(

D

)) {

1823

ReturnType = MD->getReturnType();

1825

(AL.

getKind

() == ParsedAttr::AT_NSReturnsRetained)) {

1827

}

else if

(

const auto

*PD = dyn_cast<ObjCPropertyDecl>(

D

)) {

1828

ReturnType = PD->getType();

1829

}

else if

(

const auto

*FD = dyn_cast<FunctionDecl>(

D

)) {

1830

ReturnType = FD->getReturnType();

1831

}

else if

(

const auto

*Param = dyn_cast<ParmVarDecl>(

D

)) {

1838 if

(ReturnType.

isNull

()) {

1839 Diag

(

D

->getBeginLoc(), diag::warn_ns_attribute_wrong_parameter_type)

1840

<< AL << DiagID << AL.

getRange

();

1849

llvm_unreachable(

"invalid ownership attribute"

);

1850 case

ParsedAttr::AT_NSReturnsRetained:

1851 case

ParsedAttr::AT_NSReturnsAutoreleased:

1852 case

ParsedAttr::AT_NSReturnsNotRetained:

1856 case

ParsedAttr::AT_OSReturnsRetained:

1857 case

ParsedAttr::AT_OSReturnsNotRetained:

1858 case

ParsedAttr::AT_CFReturnsRetained:

1859 case

ParsedAttr::AT_CFReturnsNotRetained:

1863 Diag

(

D

->getBeginLoc(), diag::warn_attribute_wrong_decl_type)

1865

<< ExpectedDeclKind;

1871 unsigned

ParmDiagID = 2;

1874

llvm_unreachable(

"invalid ownership attribute"

);

1875 case

ParsedAttr::AT_NSReturnsRetained:

1880 case

ParsedAttr::AT_NSReturnsAutoreleased:

1881 case

ParsedAttr::AT_NSReturnsNotRetained:

1886 case

ParsedAttr::AT_CFReturnsRetained:

1887 case

ParsedAttr::AT_CFReturnsNotRetained:

1892 case

ParsedAttr::AT_OSReturnsRetained:

1893 case

ParsedAttr::AT_OSReturnsNotRetained:

1904 if

(isa<ParmVarDecl>(

D

)) {

1905 Diag

(

D

->getBeginLoc(), diag::warn_ns_attribute_wrong_parameter_type)

1906

<< AL << ParmDiagID << AL.

getRange

();

1910 if

(isa<ObjCMethodDecl>(

D

))

1911

SubjectKind = Method;

1912 else if

(isa<ObjCPropertyDecl>(

D

))

1914 Diag

(

D

->getBeginLoc(), diag::warn_ns_attribute_wrong_return_type)

1915

<< AL << SubjectKind << Cf << AL.

getRange

();

1922

llvm_unreachable(

"invalid ownership attribute"

);

1923 case

ParsedAttr::AT_NSReturnsAutoreleased:

1924

handleSimpleAttribute<NSReturnsAutoreleasedAttr>(*

this

,

D

, AL);

1926 case

ParsedAttr::AT_CFReturnsNotRetained:

1927

handleSimpleAttribute<CFReturnsNotRetainedAttr>(*

this

,

D

, AL);

1929 case

ParsedAttr::AT_NSReturnsNotRetained:

1930

handleSimpleAttribute<NSReturnsNotRetainedAttr>(*

this

,

D

, AL);

1932 case

ParsedAttr::AT_CFReturnsRetained:

1933

handleSimpleAttribute<CFReturnsRetainedAttr>(*

this

,

D

, AL);

1935 case

ParsedAttr::AT_NSReturnsRetained:

1936

handleSimpleAttribute<NSReturnsRetainedAttr>(*

this

,

D

, AL);

1938 case

ParsedAttr::AT_OSReturnsRetained:

1939

handleSimpleAttribute<OSReturnsRetainedAttr>(*

this

,

D

, AL);

1941 case

ParsedAttr::AT_OSReturnsNotRetained:

1942

handleSimpleAttribute<OSReturnsNotRetainedAttr>(*

this

,

D

, AL);

1948 const int

EP_ObjCMethod = 1;

1949 const int

EP_ObjCProperty = 2;

1953 if

(isa<ObjCMethodDecl>(

D

))

1954

resultType = cast<ObjCMethodDecl>(

D

)->getReturnType();

1956

resultType = cast<ObjCPropertyDecl>(

D

)->getType();

1960 Diag

(

D

->getBeginLoc(), diag::warn_ns_attribute_wrong_return_type)

1962

<< (isa<ObjCMethodDecl>(

D

) ? EP_ObjCMethod : EP_ObjCProperty)

1974 const auto

*Method = cast<ObjCMethodDecl>(

D

);

1977 if

(

const auto

*PDecl = dyn_cast_if_present<ObjCProtocolDecl>(DC)) {

1978 Diag

(

D

->getBeginLoc(), diag::warn_objc_requires_super_protocol)

1980 Diag

(PDecl->getLocation(), diag::note_protocol_decl);

1984 Diag

(

D

->getBeginLoc(), diag::warn_objc_requires_super_protocol)

1994 if

(!isa<TagDecl>(

D

)) {

1995 Diag

(

D

->getBeginLoc(), diag::err_nserrordomain_invalid_decl) << 0;

2000 Attr

.isArgIdent(0) ?

Attr

.getArgAsIdent(0) :

nullptr

;

2001 if

(!IdentLoc || !IdentLoc->

Ident

) {

2004 if

(

Attr

.isArgExpr(0) &&

Attr

.getArgAsExpr(0))

2005 Loc

=

Attr

.getArgAsExpr(0)->getBeginLoc();

2007 Diag

(

Loc

, diag::err_nserrordomain_invalid_decl) << 0;

2017 Diag

(IdentLoc->

Loc

, diag::err_nserrordomain_invalid_decl)

2018

<< 1 << IdentLoc->

Ident

;

2030 Diag

(

D

->getBeginLoc(), diag::err_objc_attr_not_id) << AL << 0;

2035 if

(

const auto

*TD = dyn_cast<TypedefNameDecl>(

D

)) {

2037 Diag

(AL.

getLoc

(), diag::err_objc_attr_typedef_not_id) << AL;

2044 Diag

(AL.

getLoc

(), diag::err_objc_attr_typedef_not_void_pointer);

2057 Diag

(

D

->getBeginLoc(), diag::err_objc_attr_not_id) << AL << 0;

2068 if

(!RelatedClass) {

2069 Diag

(

D

->getBeginLoc(), diag::err_objc_attr_not_id) << AL << 0;

2077 getASTContext

(), AL, RelatedClass, ClassMethod, InstanceMethod));

2085 if

(!isa<ObjCInterfaceDecl>(Ctx) &&

2086

!(isa<ObjCCategoryDecl>(Ctx) &&

2087

cast<ObjCCategoryDecl>(Ctx)->IsClassExtension())) {

2088 Diag

(

D

->getLocation(), diag::err_designated_init_attr_non_init);

2093 if

(

auto

*CatDecl = dyn_cast<ObjCCategoryDecl>(Ctx))

2094

IFace = CatDecl->getClassInterface();

2096

IFace = cast<ObjCInterfaceDecl>(Ctx);

2107

StringRef MetaDataName;

2119 bool

notify =

false

;

2121 auto

*RD = dyn_cast<RecordDecl>(

D

);

2122 if

(RD && RD->getDefinition()) {

2123

RD = RD->getDefinition();

2128

ObjCBoxableAttr *BoxableAttr =

2130

RD->addAttr(BoxableAttr);

2135

L->AddedAttributeToRecord(BoxableAttr, RD);

2144 Diag

(

D

->getBeginLoc(), diag::err_attribute_wrong_decl_type)

2150 const auto

*VD = cast<ValueDecl>(

D

);

2154 Diag

(AL.

getLoc

(), diag::err_objc_precise_lifetime_bad_type) << QT;

2168 "didn't infer lifetime for non-dependent type?"

);

2177 Diag

(AL.

getLoc

(), diag::warn_objc_precise_lifetime_meaningless)

2187 bool

DiagnoseFailure) {

2190 if

(DiagnoseFailure) {

2191

S.

Diag

(VD->

getBeginLoc

(), diag::warn_ignored_objc_externally_retained)

2208 if

(DiagnoseFailure) {

2209

S.

Diag

(VD->

getBeginLoc

(), diag::warn_ignored_objc_externally_retained)

2224 if

(

auto

*VD = dyn_cast<VarDecl>(

D

)) {

2225

assert(!isa<ParmVarDecl>(VD) &&

"should be diagnosed automatically"

);

2226 if

(!VD->hasLocalStorage()) {

2227 Diag

(

D

->getBeginLoc(), diag::warn_ignored_objc_externally_retained) << 0;

2234

handleSimpleAttribute<ObjCExternallyRetainedAttr>(*

this

,

D

, AL);

2240 unsigned

NumParams =

2242 for

(

unsigned

I = 0; I != NumParams; ++I) {

2256

handleSimpleAttribute<ObjCExternallyRetainedAttr>(*

this

,

D

, AL);

2275 bool

Format =

false

;

2287 if

(!Format || NumArgs <= Idx)

2289 const Expr

*FormatExpr = Args[Idx];

2290 if

(

const CStyleCastExpr

*CSCE = dyn_cast<CStyleCastExpr>(FormatExpr))

2291

FormatExpr = CSCE->getSubExpr();

2301 Diag

(FormatExpr->

getExprLoc

(), diag::warn_objc_cdirective_format_string)

2316 if

(

const auto

*OVE = dyn_cast<OpaqueValueExpr>(Ignored))

2317

Ignored = OVE->getSourceExpr();

2318 bool

NeedsParens = isa<AbstractConditionalOperator>(Ignored) ||

2319

isa<BinaryOperator>(Ignored) ||

2320

isa<CXXOperatorCallExpr>(Ignored);

2331 Expr

*Element,

unsigned

ElementKind) {

2333 if

(

auto

ICE = dyn_cast<ImplicitCastExpr>(Element)) {

2334 if

(ICE->getCastKind() == CK_BitCast &&

2336

Element = ICE->getSubExpr();

2339 QualType

ElementType = Element->getType();

2344

S.

Diag

(Element->getBeginLoc(), diag::warn_objc_collection_literal_element)

2345

<< ElementType << ElementKind << TargetElementType

2346

<< Element->getSourceRange();

2349 if

(

auto

ArrayLiteral = dyn_cast<ObjCArrayLiteral>(Element))

2351 else if

(

auto

DictionaryLiteral = dyn_cast<ObjCDictionaryLiteral>(Element))

2366 if

(TargetObjCPtr->isUnspecialized() ||

2367

TargetObjCPtr->getInterfaceDecl()->getCanonicalDecl() !=

2372 if

(TypeArgs.size() != 1)

2375 QualType

TargetElementType = TypeArgs[0];

2376 for

(

unsigned

I = 0, N = ArrayLiteral->

getNumElements

(); I != N; ++I) {

2391 if

(TargetObjCPtr->isUnspecialized() ||

2392

TargetObjCPtr->getInterfaceDecl()->getCanonicalDecl() !=

2397 if

(TypeArgs.size() != 2)

2400 QualType

TargetKeyType = TypeArgs[0];

2401 QualType

TargetObjectType = TypeArgs[1];

2402 for

(

unsigned

I = 0, N = DictionaryLiteral->

getNumElements

(); I != N; ++I) {

Defines the clang::Preprocessor interface.

RedeclarationKind

Specifies whether (or how) name lookup is being performed for a redeclaration (vs.

This file declares semantic analysis for Objective-C.

Defines the Objective-C statement AST node classes.

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)

canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...

QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const

Legacy interface: cannot provide type arguments or __kindof.

An abstract interface that should be implemented by listeners that want to be notified when an AST en...

Attr - This represents one attribute.

SourceRange getRange() const

bool isRegularKeywordAttribute() const

SourceLocation getLoc() const

Type source information for an attributed type.

Stmt * getBody() const override

getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...

bool capturesVariable(const VarDecl *var) const

BlockExpr - Adaptor class for mixing a BlockDecl with expressions.

const BlockDecl * getBlockDecl() const

CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....

Represents a C++ conversion function within a class.

CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).

CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...

DeclContext - This is used only as base class of specific decl types that can act as declaration cont...

DeclContext * getLexicalParent()

getLexicalParent - Returns the containing lexical DeclContext.

A reference to a declared variable, function, enum, etc.

DeclStmt - Adaptor class for mixing declarations with statements and expressions.

Decl - This represents one declaration (or definition), e.g.

bool isInvalidDecl() const

llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const

SourceLocation getLocation() const

The name of a declaration.

SourceLocation getBeginLoc() const LLVM_READONLY

This represents one expression.

Expr * IgnoreParenCasts() LLVM_READONLY

Skip past any parentheses and casts which might surround this expression until reaching a fixed point...

bool isTypeDependent() const

Determines whether the type of this expression depends on.

Expr * IgnoreParenImpCasts() LLVM_READONLY

Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...

Expr * IgnoreImplicit() LLVM_READONLY

Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.

Expr * IgnoreParens() LLVM_READONLY

Skip past any parentheses which might surround this expression until reaching a fixed point.

bool isLValue() const

isLValue - True if this expression is an "l-value" according to the rules of the current language.

Expr * IgnoreImpCasts() LLVM_READONLY

Skip past any implicit casts which might surround this expression until reaching a fixed point.

SourceLocation getExprLoc() const LLVM_READONLY

getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...

static FixItHint CreateRemoval(CharSourceRange RemoveRange)

Create a code modification hint that removes the given source range.

static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)

Create a code modification hint that inserts the given code string at a specific location.

ForStmt - This represents a 'for (init;cond;inc)' stmt.

Represents a function declaration or definition.

One of these records is kept for each identifier that is lexed.

bool isStr(const char(&Str)[StrLen]) const

Return true if this is the identifier for the specified string.

StringRef getName() const

Return the actual identifier string.

IdentifierInfo & get(StringRef Name)

Return the identifier token info for the specified named identifier.

Represents the results of name lookup.

MemberExpr - [C99 6.5.2.3] Structure and Union Members.

@ ClassId_NSMutableOrderedSet

@ ClassId_NSMutableDictionary

NSSetMethodKind

Enumerates the NSMutableSet/NSOrderedSet methods used to apply some checks.

@ NSOrderedSet_setObjectAtIndex

@ NSOrderedSet_replaceObjectAtIndexWithObject

@ NSOrderedSet_setObjectAtIndexedSubscript

@ NSOrderedSet_insertObjectAtIndex

NSDictionaryMethodKind

Enumerates the NSDictionary/NSMutableDictionary methods used to generate literals and to apply some c...

@ NSMutableDict_setValueForKey

@ NSMutableDict_setObjectForKey

@ NSMutableDict_setObjectForKeyedSubscript

NSArrayMethodKind

Enumerates the NSArray/NSMutableArray methods used to generate literals and to apply some checks.

@ NSMutableArr_setObjectAtIndexedSubscript

@ NSMutableArr_insertObjectAtIndex

@ NSMutableArr_replaceObjectAtIndex

This represents a decl that may have a name.

IdentifierInfo * getIdentifier() const

Get the identifier that names this declaration, if there is one.

DeclarationName getDeclName() const

Get the actual, stored name of the declaration, which may be a special name.

ObjCStringFormatFamily getObjCFStringFormattingFamily() const

ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...

Expr * getElement(unsigned Index)

getElement - Return the Element at the specified index.

unsigned getNumElements() const

getNumElements - Return number of elements of objective-c array literal.

Represents Objective-C's @catch statement.

Represents Objective-C's @finally statement.

Represents Objective-C's @synchronized statement.

Represents Objective-C's @throw statement.

static ObjCAtTryStmt * Create(const ASTContext &Context, SourceLocation atTryLoc, Stmt *atTryStmt, Stmt **CatchStmts, unsigned NumCatchStmts, Stmt *atFinallyStmt)

Represents Objective-C's @autoreleasepool Statement.

ObjCCategoryDecl - Represents a category declaration.

ObjCContainerDecl - Represents a container for method declarations.

ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...

unsigned getNumElements() const

getNumElements - Return number of elements of objective-c dictionary literal.

ObjCDictionaryElement getKeyValueElement(unsigned Index) const

Represents Objective-C's collection statement.

Represents an ObjC class declaration.

ObjCTypeParamList * getTypeParamList() const

Retrieve the type parameters of this class.

ObjCMethodDecl * lookupInstanceMethod(Selector Sel) const

Lookup an instance method for a given selector.

ObjCMethodDecl * lookupPrivateMethod(const Selector &Sel, bool Instance=true) const

Lookup a method in the classes implementation hierarchy.

ObjCInterfaceDecl * getCanonicalDecl() override

Retrieves the canonical declaration of this Objective-C class.

void setHasDesignatedInitializers()

Indicate that this interface decl contains at least one initializer marked with the 'objc_designated_...

ObjCIvarDecl - Represents an ObjC instance variable.

ObjCIvarRefExpr - A reference to an ObjC instance variable.

An expression that sends a message to the given Objective-C object or class.

Expr * getArg(unsigned Arg)

getArg - Return the specified argument.

Expr * getInstanceReceiver()

Returns the object expression (receiver) for an instance message, or null for a message that is not a...

SourceLocation getSuperLoc() const

Retrieve the location of the 'super' keyword for a class or instance message to 'super',...

Selector getSelector() const

@ SuperInstance

The receiver is the instance of the superclass object.

@ Instance

The receiver is an object instance.

bool isInstanceMessage() const

Determine whether this is an instance message to either a computed object or to super.

const ObjCMethodDecl * getMethodDecl() const

ReceiverKind getReceiverKind() const

Determine the kind of receiver that this message is being sent to.

unsigned getNumArgs() const

Return the number of actual arguments in this message, not counting the receiver.

ObjCMethodDecl - Represents an instance or class method declaration.

ImplicitParamDecl * getSelfDecl() const

ArrayRef< ParmVarDecl * > parameters() const

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Wraps an ObjCPointerType with source location information.

void setStarLoc(SourceLocation Loc)

Represents a pointer to an Objective C object.

ArrayRef< QualType > getTypeArgs() const

Retrieve the type arguments for this type.

void setHasBaseTypeAsWritten(bool HasBaseType)

Represents a class type in Objective C.

ObjCInterfaceDecl * getInterface() const

Gets the interface declaration for this object type, if the base type really is an interface.

Represents one property declaration in an Objective-C interface.

ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.

ObjCPropertyDecl * getExplicitProperty() const

const Expr * getBase() const

bool isImplicitProperty() const

SourceLocation getLocation() const

bool isSuperReceiver() const

Represents an Objective-C protocol declaration.

The basic abstraction for the target Objective-C runtime.

bool allowsDirectDispatch() const

Does this runtime supports direct dispatch.

ObjCStringLiteral, used for Objective-C string literals i.e.

Represents the declaration of an Objective-C type parameter.

Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...

unsigned size() const

Determine the number of type parameters in this list.

ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...

OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.

Represents a pack expansion of types.

Represents a parameter to a function.

ParsedAttr - Represents a syntactic attribute.

IdentifierLoc * getArgAsIdent(unsigned Arg) const

bool hasParsedType() const

const ParsedType & getTypeArg() const

unsigned getNumArgs() const

getNumArgs - Return the number of actual arguments to this attribute.

bool isArgIdent(unsigned Arg) const

bool isUsedAsTypeAttr() const

AttributeCommonInfo::Kind getKind() const

PointerType - C99 6.7.5.1 - Pointer Declarators.

QualType getPointeeType() const

std::pair< IdentifierInfo *, SourceLocation > getPragmaARCCFCodeAuditedInfo() const

The location of the currently-active #pragma clang arc_cf_code_audited begin.

IdentifierInfo * getIdentifierInfo(StringRef Name) const

Return information about the specified preprocessor identifier token.

PseudoObjectExpr - An expression which accesses a pseudo-object l-value.

A (possibly-)qualified type.

QualType withConst() const

QualType getLocalUnqualifiedType() const

Return this type with all of the instance-specific qualifiers removed, but without removing any quali...

bool isNull() const

Return true if this QualType doesn't point to a type yet.

Qualifiers getQualifiers() const

Retrieve the set of qualifiers applied to this type.

Qualifiers::ObjCLifetime getObjCLifetime() const

Returns lifetime attribute of this type.

QualType getUnqualifiedType() const

Retrieve the unqualified variant of the given type, removing as little sugar as possible.

bool isConstQualified() const

Determine whether this type is const-qualified.

The collection of all-type qualifiers we support.

@ OCL_Strong

Assigning into this object requires the old value to be released and the new value to be retained.

@ OCL_ExplicitNone

This object can be modified without requiring retains or releases.

@ OCL_None

There is no lifetime qualification on this type.

@ OCL_Weak

Reading or writing from this object requires a barrier call.

@ OCL_Autoreleasing

Assigning into this object requires a lifetime extension.

bool compatiblyIncludes(Qualifiers other, const ASTContext &Ctx) const

Determines if these qualifiers compatibly include another set.

ObjCLifetime getObjCLifetime() const

Qualifiers withoutObjCLifetime() const

std::string getAsString() const

void setObjCLifetime(ObjCLifetime type)

Represents a struct/union/class.

A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...

RecordDecl * getDecl() const

Scope - A scope is a transient data structure that is used while parsing the program.

bool isAtCatchScope() const

isAtCatchScope - Return true if this scope is @catch.

const Scope * getParent() const

getParent - Return the scope that this is nested in.

Smart pointer class that efficiently represents Objective-C method names.

StringRef getNameForSlot(unsigned argIndex) const

Retrieve the name at a given position in the selector.

bool isUnarySelector() const

unsigned getNumArgs() const

A generic diagnostic builder for errors which may or may not be deferred.

SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)

Emit a diagnostic.

ASTContext & getASTContext() const

const LangOptions & getLangOpts() const

bool isCFError(RecordDecl *D)

void ActOnObjCReenterContainerContext(ObjCContainerDecl *ObjCCtx)

void ActOnObjCTemporaryExitContainerContext(ObjCContainerDecl *ObjCCtx)

Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...

void handleRuntimeName(Decl *D, const ParsedAttr &AL)

void handleNSObject(Decl *D, const ParsedAttr &AL)

bool isValidOSObjectOutParameter(const Decl *D)

StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)

StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)

FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.

void handleNSErrorDomain(Decl *D, const ParsedAttr &Attr)

void handleXReturnsXRetainedAttr(Decl *D, const ParsedAttr &AL)

QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)

Build an Objective-C type parameter type.

TypeResult actOnObjCTypeArgsAndProtocolQualifiers(Scope *S, SourceLocation Loc, ParsedType BaseType, SourceLocation TypeArgsLAngleLoc, ArrayRef< ParsedType > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< Decl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc)

Build a specialized and/or protocol-qualified Objective-C type.

void checkArrayLiteral(QualType TargetType, ObjCArrayLiteral *ArrayLiteral)

Check an Objective-C array literal being converted to the given target type.

void handleExternallyRetainedAttr(Decl *D, const ParsedAttr &AL)

ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE)

CheckSubscriptingKind - This routine decide what type of indexing represented by "FromE" is being don...

IdentifierInfo * getNSErrorIdent()

Retrieve the identifier "NSError".

StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)

ParsedType ActOnObjCInstanceType(SourceLocation Loc)

The parser has parsed the context-sensitive type 'instancetype' in an Objective-C message declaration...

void handleMethodFamilyAttr(Decl *D, const ParsedAttr &AL)

void handleIndependentClass(Decl *D, const ParsedAttr &AL)

ObjCInterfaceDecl * NSArrayDecl

The declaration of the Objective-C NSArray class.

RecordDecl * CFError

The struct behind the CFErrorRef pointer.

void handleIBOutlet(Decl *D, const ParsedAttr &AL)

void handleReturnsInnerPointerAttr(Decl *D, const ParsedAttr &Attrs)

bool isObjCWritebackConversion(QualType FromType, QualType ToType, QualType &ConvertedType)

Determine whether this is an Objective-C writeback conversion, used for parameter passing when perfor...

void CheckObjCCircularContainer(ObjCMessageExpr *Message)

Check whether receiver is mutable ObjC container which attempts to add itself into the container.

void handleSuppresProtocolAttr(Decl *D, const ParsedAttr &AL)

StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)

void handleOwnershipAttr(Decl *D, const ParsedAttr &AL)

bool isSignedCharBool(QualType Ty)

void handleBlocksAttr(Decl *D, const ParsedAttr &AL)

StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)

void ActOnObjCContainerFinishDefinition()

TypeResult actOnObjCProtocolQualifierType(SourceLocation lAngleLoc, ArrayRef< Decl * > protocols, ArrayRef< SourceLocation > protocolLocs, SourceLocation rAngleLoc)

Build a an Objective-C protocol-qualified 'id' type where no base type was specified.

StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)

void handleBridgeMutableAttr(Decl *D, const ParsedAttr &AL)

Sema::RetainOwnershipKind parsedAttrToRetainOwnershipKind(const ParsedAttr &AL)

void handleRequiresSuperAttr(Decl *D, const ParsedAttr &Attrs)

ObjCInterfaceDecl * NSDictionaryDecl

The declaration of the Objective-C NSDictionary class.

bool CheckObjCString(Expr *Arg)

CheckObjCString - Checks that the argument to the builtin CFString constructor is correct Note: It mi...

QualType 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)

Build an Objective-C object pointer type.

ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)

void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI, Sema::RetainOwnershipKind K, bool IsTemplateInstantiation)

void adornBoolConversionDiagWithTernaryFixit(Expr *SourceExpr, const Sema::SemaDiagnosticBuilder &Builder)

const DeclContext * getCurObjCLexicalContext() const

void handleDesignatedInitializer(Decl *D, const ParsedAttr &AL)

void handleBridgeRelatedAttr(Decl *D, const ParsedAttr &AL)

void handleIBOutletCollection(Decl *D, const ParsedAttr &AL)

ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)

Find the protocol with the given name, if any.

void DiagnoseCStringFormatDirectiveInCFAPI(const NamedDecl *FDecl, Expr **Args, unsigned NumArgs)

Diagnose use of s directive in an NSString which is being passed as formatting string to formatting m...

bool isCFStringType(QualType T)

void handleDirectAttr(Decl *D, const ParsedAttr &AL)

StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)

void checkRetainCycles(ObjCMessageExpr *msg)

checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle.

StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)

bool isNSStringType(QualType T, bool AllowNSAttributedString=false)

bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx)

ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection)

void AddCFAuditedAttribute(Decl *D)

AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and,...

void checkDictionaryLiteral(QualType TargetType, ObjCDictionaryLiteral *DictionaryLiteral)

Check an Objective-C dictionary literal being converted to the given target type.

void handleBoxable(Decl *D, const ParsedAttr &AL)

bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)

ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)

LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...

StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)

void handleDirectMembersAttr(Decl *D, const ParsedAttr &AL)

bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc, ArrayRef< const Expr * > Args)

void handleBridgeAttr(Decl *D, const ParsedAttr &AL)

void handlePreciseLifetimeAttr(Decl *D, const ParsedAttr &AL)

std::unique_ptr< NSAPI > NSAPIObj

Caches identifiers/selectors for NSFoundation APIs.

void ActOnObjCContainerStartDefinition(ObjCContainerDecl *IDecl)

Sema - This implements semantic analysis and AST building for C.

ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)

Package the given type and TSI into a ParsedType.

ExprResult PerformContextuallyConvertToObjCPointer(Expr *From)

PerformContextuallyConvertToObjCPointer - Perform a contextual conversion of the expression From to a...

@ LookupOrdinaryName

Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....

@ LookupObjCProtocolName

Look up the name of an Objective-C protocol.

bool FormatStringHasSArg(const StringLiteral *FExpr)

static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember, bool IsVariadic, FormatStringInfo *FSI)

Given a FunctionDecl's FormatAttr, attempts to populate the FomatStringInfo parameter with the Format...

Scope * getScopeForContext(DeclContext *Ctx)

Determines the active Scope associated with the given declaration context.

NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)

Look up a name, looking for a single declaration.

static FormatStringType GetFormatStringType(const FormatAttr *Format)

bool isObjCPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType, bool &IncompatibleObjC)

isObjCPointerConversion - Determines whether this is an Objective-C pointer conversion.

ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)

ObjCMethodDecl * getCurMethodDecl()

getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...

SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)

Calls Lexer::getLocForEndOfToken()

DeclContext * getCurLexicalContext() const

sema::FunctionScopeInfo * getCurFunction() const

AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)

Check assignment constraints for an assignment of RHS to LHSType.

ExprResult DefaultLvalueConversion(Expr *E)

void CheckTCBEnforcement(const SourceLocation CallExprLoc, const NamedDecl *Callee)

Enforce the bounds of a TCB CheckTCBEnforcement - Enforces that every function in a named TCB only di...

DeclContext * CurContext

CurContext - This is the current declaration context of parsing.

@ Compatible

Compatible - the types are compatible according to the standard.

DeclContext * OriginalLexicalContext

Generally null except when we temporarily switch decl contexts, like in.

bool inTemplateInstantiation() const

Determine whether we are currently performing template instantiation.

bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)

void setFunctionHasBranchProtectedScope()

ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, bool IsClassTemplateDeductionContext=true, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No, IdentifierInfo **CorrectedII=nullptr)

If the identifier refers to a type name within this scope, return the declaration of that type.

bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)

Ensure that the type T is a complete type.

Scope * TUScope

Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...

void DiagnoseAutoDeductionFailure(const VarDecl *VDecl, const Expr *Init)

TemplateDeductionResult DeduceAutoType(TypeLoc AutoTypeLoc, Expr *Initializer, QualType &Result, sema::TemplateDeductionInfo &Info, bool DependentDeduction=false, bool IgnoreConstraints=false, TemplateSpecCandidateSet *FailedTSC=nullptr)

Deduce the type for an auto type-specifier (C++11 [dcl.spec.auto]p6)

bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)

Perform unqualified name lookup starting from a given scope.

static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)

bool checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI, const Expr *E, StringRef &Str, SourceLocation *ArgLocation=nullptr)

Check if the argument E is a ASCII string literal.

ASTMutationListener * getASTMutationListener() const

ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})

Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...

ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)

void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto, const Expr *ThisArg, ArrayRef< const Expr * > Args, bool IsMemberFunction, SourceLocation Loc, SourceRange Range, VariadicCallType CallType)

Handles the checks for format strings, non-POD arguments to vararg functions, NULL arguments passed t...

Encodes a location in the source.

bool isValid() const

Return true if this is a valid SourceLocation object.

A trivial tuple used to represent a source range.

SourceLocation getBegin() const

Stmt - This represents one statement.

SourceLocation getEndLoc() const LLVM_READONLY

SourceRange getSourceRange() const LLVM_READONLY

SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...

SourceLocation getBeginLoc() const LLVM_READONLY

StringLiteral - This represents a string literal expression, e.g.

StringRef getString() const

TagKind getTagKind() const

Base wrapper for a particular "section" of type source info.

TypeLoc findExplicitQualifierLoc() const

Find a type with the location of an explicit type qualifier.

T getAs() const

Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...

T castAs() const

Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.

SourceRange getSourceRange() const LLVM_READONLY

Get the full source range.

SourceLocation getBeginLoc() const

Get the begin source location.

A container of type source information.

TypeLoc getTypeLoc() const

Return the TypeLoc wrapper for the type source info.

QualType getType() const

Return the type wrapped by this type source info.

CXXRecordDecl * getAsCXXRecordDecl() const

Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...

bool isBlockPointerType() const

bool isVoidPointerType() const

bool isPointerType() const

const T * castAs() const

Member-template castAs<specific type>.

bool isReferenceType() const

bool isObjCNSObjectType() const

QualType getPointeeType() const

If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.

bool isIntegralOrEnumerationType() const

Determine whether this type is an integral or enumeration type.

AutoType * getContainedAutoType() const

Get the AutoType whose type will be deduced for a variable with an initializer of this type.

bool isSpecificBuiltinType(unsigned K) const

Test for a particular builtin type.

bool isBuiltinType() const

Helper methods to distinguish type categories.

bool isDependentType() const

Whether this type is a dependent type, meaning that its definition somehow depends on a template para...

bool isCARCBridgableType() const

Determine whether the given type T is a "bridgeable" C type.

bool isObjCIdType() const

bool isObjCObjectType() const

bool isBlockCompatibleObjCPointerType(ASTContext &ctx) const

bool isObjCLifetimeType() const

Returns true if objects of this type have lifetime semantics under ARC.

Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const

Return the implicit lifetime for this type, which must not be dependent.

bool isIncompleteType(NamedDecl **Def=nullptr) const

Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...

bool isObjCObjectPointerType() const

const T * getAs() const

Member-template getAs<specific type>'.

bool isObjCRetainableType() const

QualType getUnderlyingType() const

Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...

void setType(QualType newType)

Represents a variable declaration or definition.

void setARCPseudoStrong(bool PS)

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Retains information about a function, method, or block that is currently being parsed.

void setHasObjCTry(SourceLocation TryLoc)

SourceLocation FirstSEHTryLoc

First SEH '__try' statement in the current function.

Provides information about an attempted template argument deduction, whose success or failure was des...

const AstTypeMatcher< PointerType > pointerType

Matches pointer types, but does not match Objective-C object pointer types.

const internal::VariadicAllOfMatcher< Attr > attr

Matches attributes.

const internal::VariadicAllOfMatcher< Type > type

Matches Types in the clang AST.

The JSON file list parser is used to communicate input to InstallAPI.

static void checkCollectionLiteralElement(Sema &S, QualType TargetElementType, Expr *Element, unsigned ElementKind)

Check a single element within a collection literal against the target element type.

AttributeDeclKind

These constants match the enumerated choices of warn_attribute_wrong_decl_type and err_attribute_wron...

@ ExpectedFunctionMethodOrParameter

@ ExpectedFunctionOrMethod

bool hasDeclarator(const Decl *D)

Return true if the given decl has a declarator that should have been processed by Sema::GetTypeForDec...

static bool isValidSubjectOfOSAttribute(QualType QT)

static void diagnoseRetainCycle(Sema &S, Expr *capturer, RetainCycleOwner &owner)

const ParmVarDecl * getFunctionOrMethodParam(const Decl *D, unsigned Idx)

static bool isSetterLikeSelector(Selector sel)

Check for a keyword selector that starts with the word 'add' or 'set'.

static Expr * findCapturingExpr(Sema &S, Expr *e, RetainCycleOwner &owner)

Check whether the given argument is a block which captures a variable.

static bool considerVariable(VarDecl *var, Expr *ref, RetainCycleOwner &owner)

Consider whether capturing the given variable can possibly lead to a retain cycle.

static std::optional< int > GetNSMutableDictionaryArgumentIndex(SemaObjC &S, ObjCMessageExpr *Message)

@ AANT_ArgumentIdentifier

@ Property

The type of a property.

@ Result

The result type of a method or function.

static bool checkIBOutletCommon(Sema &S, Decl *D, const ParsedAttr &AL)

LLVM_READONLY bool isLowercase(unsigned char c)

Return true if this character is a lowercase ASCII letter: [a-z].

@ Struct

The "struct" keyword.

static QualType applyObjCTypeArgs(Sema &S, SourceLocation loc, QualType type, ArrayRef< TypeSourceInfo * > typeArgs, SourceRange typeArgsRange, bool failOnError, bool rebuilding)

Apply Objective-C type arguments to the given type.

static bool isValidSubjectOfNSAttribute(QualType QT)

static bool isValidSubjectOfCFAttribute(QualType QT)

static std::optional< int > GetNSSetArgumentIndex(SemaObjC &S, ObjCMessageExpr *Message)

static bool tryMakeVariablePseudoStrong(Sema &S, VarDecl *VD, bool DiagnoseFailure)

@ VK_PRValue

A pr-value expression (in the C++11 taxonomy) produces a temporary value.

const FunctionProtoType * T

static bool isValidSubjectOfNSReturnsRetainedAttribute(QualType QT)

bool hasFunctionProto(const Decl *D)

hasFunctionProto - Return true if the given decl has a argument information.

static bool findRetainCycleOwner(Sema &S, Expr *e, RetainCycleOwner &owner)

unsigned getFunctionOrMethodNumParams(const Decl *D)

getFunctionOrMethodNumParams - Return number of function or method parameters.

TemplateDeductionResult

Describes the result of template argument deduction.

@ Success

Template argument deduction was successful.

@ AlreadyDiagnosed

Some error which was already diagnosed.

U cast(CodeGen::Address addr)

static std::optional< int > GetNSMutableArrayArgumentIndex(SemaObjC &S, ObjCMessageExpr *Message)

Wraps an identifier and optional source location for the identifier.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4