A RetroSearch Logo

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

Search Query:

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

clang: lib/Sema/SemaSwift.cpp Source File

28 if

(

const auto

*PrevSNA =

D

->getAttr<SwiftNameAttr>()) {

29 if

(PrevSNA->getName() != Name && !PrevSNA->isImplicit()) {

30 Diag

(PrevSNA->getLocation(), diag::err_attributes_are_not_compatible)

32

<< (PrevSNA->isRegularKeywordAttribute() ||

33

SNA.isRegularKeywordAttribute());

34 Diag

(SNA.getLoc(), diag::note_conflicting_attribute);

37 D

->dropAttr<SwiftNameAttr>();

99 if

(

const auto

*

Other

=

D

->getAttr<SwiftBridgeAttr>()) {

100 if

(

Other

->getSwiftType() != BT)

101 Diag

(AL.

getLoc

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

117 if

(

const auto

*

ID

= OPT->getInterfaceDecl())

123 if

(

const auto

*RT = PT->getPointeeType()->getAs<

RecordType

>())

137

S.Diag(AL.

getLoc

(), diag::err_attr_swift_error_no_error_parameter)

138

<< AL << isa<ObjCMethodDecl>(

D

);

150

S.Diag(AL.

getLoc

(), diag::err_attr_swift_error_return_type)

161

S.Diag(AL.

getLoc

(), diag::err_attr_swift_error_return_type)

167 if

(

D

->isInvalidDecl())

171

SwiftErrorAttr::ConventionKind Convention;

172 if

(!SwiftErrorAttr::ConvertStrToConventionKind(

Loc

->Ident->getName(),

174 Diag

(AL.

getLoc

(), diag::warn_attribute_type_not_supported)

175

<< AL <<

Loc

->Ident;

179 switch

(Convention) {

180 case

SwiftErrorAttr::None:

184 case

SwiftErrorAttr::NonNullError:

185 if

(!hasErrorParameter(

SemaRef

,

D

, AL))

189 case

SwiftErrorAttr::NullResult:

190 if

(!hasErrorParameter(

SemaRef

,

D

, AL) || !hasPointerResult(

SemaRef

,

D

, AL))

194 case

SwiftErrorAttr::NonZeroResult:

195 case

SwiftErrorAttr::ZeroResult:

196 if

(!hasErrorParameter(

SemaRef

,

D

, AL) || !hasIntegerResult(

SemaRef

,

D

, AL))

206 const

SwiftAsyncErrorAttr *ErrorAttr,

207 const

SwiftAsyncAttr *AsyncAttr) {

208 if

(AsyncAttr->getKind() == SwiftAsyncAttr::None) {

209 if

(ErrorAttr->getConvention() != SwiftAsyncErrorAttr::None) {

210

S.

Diag

(AsyncAttr->getLocation(),

211

diag::err_swift_async_error_without_swift_async)

212

<< AsyncAttr << isa<ObjCMethodDecl>(

D

);

218 D

, AsyncAttr->getCompletionHandlerIndex().getASTIndex());

221 const auto

*FuncTy = HandlerParam->

getType

()

227

BlockParams = FuncTy->getParamTypes();

229 switch

(ErrorAttr->getConvention()) {

230 case

SwiftAsyncErrorAttr::ZeroArgument:

231 case

SwiftAsyncErrorAttr::NonZeroArgument: {

232

uint32_t

ParamIdx

= ErrorAttr->getHandlerParamIdx();

234

S.

Diag

(ErrorAttr->getLocation(),

235

diag::err_attribute_argument_out_of_bounds)

242

ErrorAttr->getConvention() == SwiftAsyncErrorAttr::ZeroArgument

244

:

"nonzero_argument"

;

245

S.

Diag

(ErrorAttr->getLocation(), diag::err_swift_async_error_non_integral)

246

<< ErrorAttr << ConvStr <<

ParamIdx

<< ErrorParam;

251 case

SwiftAsyncErrorAttr::NonNullError: {

252 bool

AnyErrorParams =

false

;

253 for

(

QualType

Param : BlockParams) {

256 if

(

const auto

*

ID

= ObjCPtrTy->getInterfaceDecl()) {

258

AnyErrorParams =

true

;

264 if

(

const auto

*PtrTy = Param->getAs<

PointerType

>()) {

265 if

(

const auto

*RT = PtrTy->getPointeeType()->getAs<

RecordType

>()) {

267

AnyErrorParams =

true

;

274 if

(!AnyErrorParams) {

275

S.

Diag

(ErrorAttr->getLocation(),

276

diag::err_swift_async_error_no_error_parameter)

277

<< ErrorAttr << isa<ObjCMethodDecl>(

D

);

282 case

SwiftAsyncErrorAttr::None:

289

SwiftAsyncErrorAttr::ConventionKind ConvKind;

290 if

(!SwiftAsyncErrorAttr::ConvertStrToConventionKind(IDLoc->

Ident

->

getName

(),

292 Diag

(AL.

getLoc

(), diag::warn_attribute_type_not_supported)

293

<< AL << IDLoc->

Ident

;

299 case

SwiftAsyncErrorAttr::ZeroArgument:

300 case

SwiftAsyncErrorAttr::NonZeroArgument: {

309 case

SwiftAsyncErrorAttr::NonNullError:

310 case

SwiftAsyncErrorAttr::None: {

319 D

->addAttr(ErrorAttr);

321 if

(

auto

*AsyncAttr =

D

->getAttr<SwiftAsyncAttr>())

335 unsigned

&SwiftParamCount,

336 bool

&IsSingleParamInit) {

338

IsSingleParamInit =

false

;

341 bool

IsGetter =

false

, IsSetter =

false

;

342 if

(Name.consume_front(

"getter:"

))

344 else if

(Name.consume_front(

"setter:"

))

347 if

(Name.back() !=

')'

) {

348

S.

Diag

(

Loc

, diag::warn_attr_swift_name_function) << AL;

352 bool

IsMember =

false

;

353

StringRef ContextName, BaseName, Parameters;

355

std::tie(BaseName, Parameters) = Name.split(

'('

);

359

std::tie(ContextName, BaseName) = BaseName.split(

'.'

);

360 if

(BaseName.empty()) {

361

BaseName = ContextName;

362

ContextName = StringRef();

364

S.

Diag

(

Loc

, diag::warn_attr_swift_name_invalid_identifier)

372

S.

Diag

(

Loc

, diag::warn_attr_swift_name_invalid_identifier)

377 bool

IsSubscript = BaseName ==

"subscript"

;

379 if

(IsSubscript && !IsGetter && !IsSetter) {

380

S.

Diag

(

Loc

, diag::warn_attr_swift_name_subscript_invalid_parameter)

385 if

(Parameters.empty()) {

386

S.

Diag

(

Loc

, diag::warn_attr_swift_name_missing_parameters) << AL;

390

assert(Parameters.back() ==

')'

&&

"expected ')'"

);

391

Parameters = Parameters.drop_back();

393 if

(Parameters.empty()) {

396

S.

Diag

(

Loc

, diag::warn_attr_swift_name_subscript_invalid_parameter)

402

S.

Diag

(

Loc

, diag::warn_attr_swift_name_setter_parameters) << AL;

409 if

(Parameters.back() !=

':'

) {

410

S.

Diag

(

Loc

, diag::warn_attr_swift_name_function) << AL;

414

StringRef CurrentParam;

415

std::optional<unsigned> SelfLocation;

416 unsigned

NewValueCount = 0;

417

std::optional<unsigned> NewValueLocation;

419

std::tie(CurrentParam, Parameters) = Parameters.split(

':'

);

422

S.

Diag

(

Loc

, diag::warn_attr_swift_name_invalid_identifier)

427 if

(IsMember && CurrentParam ==

"self"

) {

432

S.

Diag

(

Loc

, diag::warn_attr_swift_name_multiple_selfs) << AL;

437

SelfLocation = SwiftParamCount;

438

}

else if

(CurrentParam ==

"newValue"

) {

445

NewValueLocation = SwiftParamCount;

449

}

while

(!Parameters.empty());

452 if

(IsSubscript && !SelfLocation) {

453

S.

Diag

(

Loc

, diag::warn_attr_swift_name_subscript_invalid_parameter)

459

SwiftParamCount == 1 && BaseName ==

"init"

&& CurrentParam !=

"_"

;

462 if

(IsGetter || IsSetter) {

464 unsigned

NumExpectedParams = IsGetter ? 0 : 1;

465 unsigned

ParamDiag = IsGetter

466

? diag::warn_attr_swift_name_getter_parameters

467

: diag::warn_attr_swift_name_setter_parameters;

476 if

(SwiftParamCount < NumExpectedParams) {

477

S.

Diag

(

Loc

, ParamDiag) << AL;

484 if

(!NewValueLocation) {

485

S.

Diag

(

Loc

, diag::warn_attr_swift_name_subscript_setter_no_newValue)

489 if

(NewValueCount > 1) {

491

diag::warn_attr_swift_name_subscript_setter_multiple_newValues)

497 if

(NewValueLocation) {

498

S.

Diag

(

Loc

, diag::warn_attr_swift_name_subscript_getter_newValue)

505 if

(SwiftParamCount != NumExpectedParams) {

506

S.

Diag

(

Loc

, ParamDiag) << AL;

517 if

(isa<ObjCMethodDecl>(

D

) || isa<FunctionDecl>(

D

)) {

521 if

(

const auto

*Method = dyn_cast<ObjCMethodDecl>(

D

)) {

522

ParamCount = Method->getSelector().getNumArgs();

523

Params = Method->parameters().slice(0, ParamCount);

525 const auto

*F = cast<FunctionDecl>(

D

);

527

ParamCount = F->getNumParams();

528

Params = F->parameters();

530 if

(!F->hasWrittenPrototype()) {

531 Diag

(

Loc

, diag::warn_attribute_wrong_decl_type)

540 if

(ParamCount == 0) {

541 Diag

(

Loc

, diag::warn_attr_swift_name_decl_missing_params)

542

<< AL << isa<ObjCMethodDecl>(

D

);

548 unsigned

SwiftParamCount;

549 bool

IsSingleParamInit;

554 bool

ParamCountValid;

555 if

(SwiftParamCount == ParamCount) {

556

ParamCountValid =

true

;

557

}

else if

(SwiftParamCount > ParamCount) {

558

ParamCountValid = IsSingleParamInit && ParamCount == 0;

563 unsigned

MaybeOutParamCount =

564

llvm::count_if(Params, [](

const ParmVarDecl

*Param) ->

bool

{

571

ParamCountValid = SwiftParamCount + MaybeOutParamCount >= ParamCount;

574 if

(!ParamCountValid) {

575 Diag

(

Loc

, diag::warn_attr_swift_name_num_params)

576

<< (SwiftParamCount > ParamCount) << AL << ParamCount

580

}

else if

((isa<EnumConstantDecl>(

D

) || isa<ObjCProtocolDecl>(

D

) ||

581

isa<ObjCInterfaceDecl>(

D

) || isa<ObjCPropertyDecl>(

D

) ||

582

isa<VarDecl>(

D

) || isa<TypedefNameDecl>(

D

) || isa<TagDecl>(

D

) ||

583

isa<IndirectFieldDecl>(

D

) || isa<FieldDecl>(

D

)) &&

585

StringRef ContextName, BaseName;

587

std::tie(ContextName, BaseName) = Name.split(

'.'

);

588 if

(BaseName.empty()) {

589

BaseName = ContextName;

590

ContextName = StringRef();

592 Diag

(

Loc

, diag::warn_attr_swift_name_invalid_identifier)

598 Diag

(

Loc

, diag::warn_attr_swift_name_invalid_identifier)

603 Diag

(

Loc

, diag::warn_attr_swift_name_decl_kind) << AL;

640 Diag

(AL.

getLoc

(), diag::err_attribute_argument_type)

645

SwiftNewTypeAttr::NewtypeKind

Kind

;

647 if

(!SwiftNewTypeAttr::ConvertStrToNewtypeKind(II->

getName

(),

Kind

)) {

648 Diag

(AL.

getLoc

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

652 if

(!isa<TypedefNameDecl>(

D

)) {

653 Diag

(AL.

getLoc

(), diag::warn_attribute_wrong_decl_type)

664 Diag

(AL.

getLoc

(), diag::err_attribute_argument_n_type)

669

SwiftAsyncAttr::Kind

Kind

;

671 if

(!SwiftAsyncAttr::ConvertStrToKind(II->

getName

(),

Kind

)) {

672 Diag

(AL.

getLoc

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

677 if

(

Kind

== SwiftAsyncAttr::None) {

694 Diag

(CompletionBlock->

getLocation

(), diag::err_swift_async_bad_block_type)

695

<< CompletionBlock->

getType

();

701 Diag

(CompletionBlock->

getLocation

(), diag::err_swift_async_bad_block_type)

702

<< CompletionBlock->

getType

();

709 D

->addAttr(AsyncAttr);

711 if

(

auto

*ErrorAttr =

D

->getAttr<SwiftAsyncErrorAttr>())

721 if

(existingAttr->getABI() != abi) {

722 Diag

(CI.

getLoc

(), diag::err_attributes_are_not_compatible)

725

existingAttr->isRegularKeywordAttribute());

726 Diag

(existingAttr->getLocation(), diag::note_conflicting_attribute);

734

llvm_unreachable(

"explicit attribute for non-swift parameter ABI?"

);

736

llvm_unreachable(

"explicit attribute for ordinary parameter ABI?"

);

740 Diag

(CI.

getLoc

(), diag::err_swift_abi_parameter_wrong_type)

743 D

->addAttr(::new (Context) SwiftContextAttr(Context, CI));

748 Diag

(CI.

getLoc

(), diag::err_swift_abi_parameter_wrong_type)

751 D

->addAttr(::new (Context) SwiftAsyncContextAttr(Context, CI));

756 Diag

(CI.

getLoc

(), diag::err_swift_abi_parameter_wrong_type)

759 D

->addAttr(::new (Context) SwiftErrorResultAttr(Context, CI));

764 Diag

(CI.

getLoc

(), diag::err_swift_abi_parameter_wrong_type)

767 D

->addAttr(::new (Context) SwiftIndirectResultAttr(Context, CI));

770

llvm_unreachable(

"bad parameter ABI attribute"

);

enum clang::sema::@1704::IndirectLocalPathEntry::EntryKind Kind

This file declares semantic analysis for Objective-C.

This file declares semantic analysis functions specific to Swift.

Defines various enumerations that describe declaration and type specifiers.

static QualType getPointeeType(const MemRegion *R)

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

bool isRegularKeywordAttribute() const

SourceLocation getLoc() const

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

SourceLocation getLocation() const

This represents one expression.

Represents a prototype with parameter type info, e.g.

FunctionType - C99 6.7.5.3 - Function Declarators.

QualType getReturnType() const

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

StringRef getName() const

Return the actual identifier string.

Represents a pointer to an Objective C object.

A single parameter index whose accessors require each use to make explicit the parameter index encodi...

unsigned getASTIndex() const

Get the parameter index as it would normally be encoded at the AST level of representation: zero-orig...

A parameter attribute which changes the argument-passing ABI rule for the parameter.

Represents a parameter to a function.

ParsedAttr - Represents a syntactic attribute.

bool checkExactlyNumArgs(class Sema &S, unsigned Num) const

Check if the attribute has exactly as many args as Num.

IdentifierLoc * getArgAsIdent(unsigned Arg) const

void setInvalid(bool b=true) const

bool isArgIdent(unsigned Arg) const

Expr * getArgAsExpr(unsigned Arg) const

bool isUsedAsTypeAttr() const

PointerType - C99 6.7.5.1 - Pointer Declarators.

A (possibly-)qualified type.

LangAS getAddressSpace() const

Return the address space of this type.

Qualifiers getQualifiers() const

Retrieve the set of qualifiers applied to this type.

bool isConstQualified() const

Determine whether this type is const-qualified.

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

Base for LValueReferenceType and RValueReferenceType.

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

Emit a diagnostic.

ASTContext & getASTContext() const

bool isCFError(RecordDecl *D)

IdentifierInfo * getNSErrorIdent()

Retrieve the identifier "NSError".

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

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

bool DiagnoseName(Decl *D, StringRef Name, SourceLocation Loc, const ParsedAttr &AL, bool IsAsync)

Do a check to make sure Name looks like a legal argument for the swift_name attribute applied to decl...

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

SwiftNameAttr * mergeNameAttr(Decl *D, const SwiftNameAttr &SNA, StringRef Name)

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

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

void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI, ParameterABI abi)

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

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

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

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

bool checkUInt32Argument(const AttrInfo &AI, const Expr *Expr, uint32_t &Val, unsigned Idx=UINT_MAX, bool StrictlyUnsigned=false)

If Expr is a valid integer constant, get the value of the integer expression and return success or fa...

bool checkFunctionOrMethodParameterIndex(const Decl *D, const AttrInfo &AI, unsigned AttrArgNum, const Expr *IdxExpr, ParamIdx &Idx, bool CanIndexImplicitThis=false)

Check if IdxExpr is a valid parameter index for a function or instance method D.

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

Check if the argument E is a ASCII string literal.

Encodes a location in the source.

bool isBlockPointerType() const

bool isPointerType() const

const T * castAs() const

Member-template castAs<specific type>.

bool isReferenceType() const

bool isIntegralType(const ASTContext &Ctx) const

Determine whether this type is an integral type.

QualType getPointeeType() const

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

bool isDependentType() const

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

const T * getAs() const

Member-template getAs<specific type>'.

bool hasPointerRepresentation() const

Whether this type is represented natively as a pointer.

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 checkSwiftAsyncErrorBlock(Sema &S, Decl *D, const SwiftAsyncErrorAttr *ErrorAttr, const SwiftAsyncAttr *AsyncAttr)

@ ExpectedFunctionWithProtoType

static bool isValidSwiftErrorResultType(QualType Ty)

Pointers and references to pointers in the default address space.

llvm::StringRef getParameterABISpelling(ParameterABI kind)

QualType getFunctionOrMethodResultType(const Decl *D)

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

static bool isErrorParameter(Sema &S, QualType QT)

LLVM_READONLY bool isValidAsciiIdentifier(StringRef S, bool AllowDollar=false)

Return true if this is a valid ASCII identifier.

static bool isValidSwiftIndirectResultType(QualType Ty)

Pointers and references in the default address space.

QualType getFunctionOrMethodParamType(const Decl *D, unsigned Idx)

@ AANT_ArgumentIdentifier

ParameterABI

Kinds of parameter ABI.

@ SwiftAsyncContext

This parameter (which must have pointer type) uses the special Swift asynchronous context-pointer ABI...

@ SwiftErrorResult

This parameter (which must have pointer-to-pointer type) uses the special Swift error-result ABI trea...

@ Ordinary

This parameter uses ordinary ABI rules for its type.

@ SwiftIndirectResult

This parameter (which must have pointer type) is a Swift indirect result parameter.

@ SwiftContext

This parameter (which must have pointer type) uses the special Swift context-pointer ABI treatment.

static bool isValidSwiftContextType(QualType Ty)

Pointer-like types in the default address space.

static bool validateSwiftFunctionName(Sema &S, const ParsedAttr &AL, SourceLocation Loc, StringRef Name, unsigned &SwiftParamCount, bool &IsSingleParamInit)

unsigned getFunctionOrMethodNumParams(const Decl *D)

getFunctionOrMethodNumParams - Return number of function or method parameters.

@ Other

Other implicit parameter.

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