clang 20.0.0git
|
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/SemaObjC.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallString.h"
Go to the source code of this file.
Functions | |
static Qualifiers::ObjCLifetime | getImpliedARCOwnership (ObjCPropertyAttribute::Kind attrs, QualType type) |
getImpliedARCOwnership - Given a set of property attributes and a type, infer an expected lifetime. | |
static void | checkPropertyDeclWithOwnership (Sema &S, ObjCPropertyDecl *property) |
Check the internal consistency of a property declaration with an explicit ownership qualifier. | |
static void | CheckPropertyAgainstProtocol (Sema &S, ObjCPropertyDecl *Prop, ObjCProtocolDecl *Proto, llvm::SmallPtrSetImpl< ObjCProtocolDecl * > &Known) |
Check this Objective-C property against a property declared in the given protocol. | |
static unsigned | deducePropertyOwnershipFromType (Sema &S, QualType T) |
static unsigned | getOwnershipRule (unsigned attr) |
static ObjCPropertyAttribute::Kind | makePropertyAttributesAsWritten (unsigned Attributes) |
static bool | LocPropertyAttribute (ASTContext &Context, const char *attrName, SourceLocation LParenLoc, SourceLocation &Loc) |
static void | checkAtomicPropertyMismatch (Sema &S, ObjCPropertyDecl *OldProperty, ObjCPropertyDecl *NewProperty, bool PropagateAtomicity) |
Check for a mismatch in the atomicity of the given properties. | |
static void | checkARCPropertyImpl (Sema &S, SourceLocation propertyImplLoc, ObjCPropertyDecl *property, ObjCIvarDecl *ivar) |
static void | setImpliedPropertyAttributeForReadOnlyProperty (ObjCPropertyDecl *property, ObjCIvarDecl *ivar) |
setImpliedPropertyAttributeForReadOnlyProperty - This routine evaludates life-time attributes for a 'readonly' property with no known lifetime of its own, using backing 'ivar's attribute, if any. | |
static bool | isIncompatiblePropertyAttribute (unsigned Attr1, unsigned Attr2, ObjCPropertyAttribute::Kind Kind) |
static bool | areIncompatiblePropertyAttributes (unsigned Attr1, unsigned Attr2, unsigned Kinds) |
static ObjCPropertyDecl * | SelectPropertyForSynthesisFromProtocols (Sema &S, SourceLocation AtLoc, ObjCInterfaceDecl *ClassDecl, ObjCPropertyDecl *Property) |
SelectPropertyForSynthesisFromProtocols - Finds the most appropriate property declaration that should be synthesised in all of the inherited protocols. | |
static bool | hasWrittenStorageAttribute (ObjCPropertyDecl *Prop, ObjCPropertyQueryKind QueryKind) |
Determine whether any storage attributes were written on the property. | |
static ObjCMethodDecl * | RedeclarePropertyAccessor (ASTContext &Context, ObjCImplementationDecl *Impl, ObjCMethodDecl *AccessorDecl, SourceLocation AtLoc, SourceLocation PropertyLoc) |
Create a synthesized property accessor stub inside the @implementation. | |
static void | CollectImmediateProperties (ObjCContainerDecl *CDecl, ObjCContainerDecl::PropertyMap &PropMap, ObjCContainerDecl::PropertyMap &SuperPropMap, bool CollectClassPropsOnly=false, bool IncludeProtocols=true) |
CollectImmediateProperties - This routine collects all properties in the class and its conforming protocols; but not those in its super class. | |
static void | CollectSuperClassPropertyImplementations (ObjCInterfaceDecl *CDecl, ObjCInterfaceDecl::PropertyMap &PropMap) |
CollectSuperClassPropertyImplementations - This routine collects list of properties to be implemented in super class(s) and also coming from their conforming protocols. | |
static bool | SuperClassImplementsProperty (ObjCInterfaceDecl *IDecl, ObjCPropertyDecl *Prop) |
static void | DiagnoseUnimplementedAccessor (Sema &S, ObjCInterfaceDecl *PrimaryClass, Selector Method, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, ObjCCategoryDecl *C, ObjCPropertyDecl *Prop, llvm::SmallPtrSet< const ObjCMethodDecl *, 8 > &SMap) |
static void | AddPropertyAttrs (Sema &S, ObjCMethodDecl *PropertyMethod, ObjCPropertyDecl *Property) |
AddPropertyAttrs - Propagates attributes from a property to the implicitly-declared getter or setter for that property. | |
Variables | |
static const unsigned | OwnershipMask |
|
static |
AddPropertyAttrs - Propagates attributes from a property to the implicitly-declared getter or setter for that property.
Definition at line 2341 of file SemaObjCProperty.cpp.
References clang::Decl::addAttr(), clang::Sema::Context, and clang::Property.
Referenced by clang::SemaObjC::ProcessPropertyDecl().
|
static |
Definition at line 812 of file SemaObjCProperty.cpp.
Referenced by SelectPropertyForSynthesisFromProtocols().
|
static |
Definition at line 706 of file SemaObjCProperty.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), clang::ObjCIvarDecl::getAccessControl(), clang::NamedDecl::getDeclName(), getImpliedARCOwnership(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::QualType::getObjCLifetime(), clang::ObjCPropertyDecl::getPropertyAttributes(), clang::ASTContext::getQualifiedType(), clang::ValueDecl::getType(), clang::ObjCPropertyDecl::getType(), clang::Qualifiers::hasObjCLifetime(), clang::Decl::isInvalidDecl(), clang::Type::isObjCARCImplicitlyUnretainedType(), clang::SourceLocation::isValid(), clang::ObjCPropertyAttribute::kind_assign, clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, clang::ObjCIvarDecl::Private, clang::SplitQualType::Quals, clang::Qualifiers::setObjCLifetime(), clang::ValueDecl::setType(), and clang::QualType::split().
Referenced by clang::SemaObjC::ActOnPropertyImplDecl().
|
static |
Check for a mismatch in the atomicity of the given properties.
Definition at line 336 of file SemaObjCProperty.cpp.
References Category, clang::SemaBase::Diag(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::Decl::getLocation(), clang::ObjCPropertyDecl::getPropertyAttributes(), clang::ObjCPropertyDecl::getPropertyAttributesAsWritten(), clang::ObjCPropertyAttribute::kind_atomic, clang::ObjCPropertyAttribute::kind_nonatomic, clang::ObjCPropertyAttribute::kind_readonly, clang::ObjCPropertyDecl::overwritePropertyAttributes(), and clang::Property.
Referenced by clang::SemaObjC::DiagnosePropertyMismatch(), and clang::SemaObjC::HandlePropertyInClassExtension().
|
static |
Check this Objective-C property against a property declared in the given protocol.
Definition at line 108 of file SemaObjCProperty.cpp.
References CheckPropertyAgainstProtocol(), clang::SemaObjC::DiagnosePropertyMismatch(), clang::NamedDecl::getIdentifier(), clang::ObjCContainerDecl::getProperty(), clang::ObjCPropertyDecl::isInstanceProperty(), clang::Sema::ObjC(), P, and clang::ObjCProtocolDecl::protocols().
Referenced by clang::SemaObjC::ActOnProperty(), and CheckPropertyAgainstProtocol().
|
static |
Check the internal consistency of a property declaration with an explicit ownership qualifier.
Definition at line 65 of file SemaObjCProperty.cpp.
References clang::ast_matchers::attr, clang::SemaBase::Diag(), getImpliedARCOwnership(), clang::Decl::getLocation(), clang::ObjCPropertyDecl::getType(), clang::Decl::isInvalidDecl(), clang::ObjCPropertyAttribute::kind_strong, clang::ObjCPropertyAttribute::kind_unsafe_unretained, clang::ObjCPropertyAttribute::kind_weak, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, and clang::Qualifiers::OCL_Weak.
Referenced by clang::SemaObjC::ActOnProperty().
|
static |
CollectImmediateProperties - This routine collects all properties in the class and its conforming protocols; but not those in its super class.
Definition at line 1734 of file SemaObjCProperty.cpp.
References CollectImmediateProperties(), and clang::NamedDecl::getIdentifier().
Referenced by CollectImmediateProperties(), and clang::SemaObjC::DiagnoseUnimplementedProperties().
|
static |
CollectSuperClassPropertyImplementations - This routine collects list of properties to be implemented in super class(s) and also coming from their conforming protocols.
Definition at line 1801 of file SemaObjCProperty.cpp.
References clang::ObjCInterfaceDecl::getSuperClass().
Referenced by clang::SemaObjC::DefaultSynthesizeProperties(), and clang::SemaObjC::DiagnoseUnimplementedProperties().
Definition at line 128 of file SemaObjCProperty.cpp.
References clang::Sema::getLangOpts(), clang::ObjCPropertyAttribute::kind_strong, clang::ObjCPropertyAttribute::kind_unsafe_unretained, clang::ObjCPropertyAttribute::kind_weak, clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, and clang::T.
Referenced by clang::SemaObjC::ActOnProperty().
|
static |
Definition at line 1974 of file SemaObjCProperty.cpp.
References clang::C, clang::SemaBase::Diag(), clang::NamedDecl::getDeclName(), clang::Decl::getLocation(), clang::ObjCMethodDecl::getSelector(), clang::ObjCMethodDecl::isClassMethod(), clang::ObjCPropertyDecl::isClassProperty(), clang::ObjCRuntime::isNonFragile(), clang::Sema::LangOpts, clang::ObjCInterfaceDecl::lookupPropertyAccessor(), and clang::LangOptions::ObjCRuntime.
Referenced by clang::SemaObjC::DiagnoseUnimplementedProperties().
|
static |
getImpliedARCOwnership - Given a set of property attributes and a type, infer an expected lifetime.
The type's ownership qualification is not considered.
Returns OCL_None if the attributes as stated do not imply an ownership. Never returns OCL_Autoreleasing.
Definition at line 40 of file SemaObjCProperty.cpp.
References clang::ObjCPropertyAttribute::kind_assign, clang::ObjCPropertyAttribute::kind_copy, clang::ObjCPropertyAttribute::kind_retain, clang::ObjCPropertyAttribute::kind_strong, clang::ObjCPropertyAttribute::kind_unsafe_unretained, clang::ObjCPropertyAttribute::kind_weak, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, and clang::ast_matchers::type.
Referenced by clang::SemaObjC::ActOnPropertyImplDecl(), checkARCPropertyImpl(), checkPropertyDeclWithOwnership(), and setImpliedPropertyAttributeForReadOnlyProperty().
Definition at line 160 of file SemaObjCProperty.cpp.
References clang::ast_matchers::attr, clang::ObjCPropertyAttribute::kind_assign, clang::ObjCPropertyAttribute::kind_unsafe_unretained, and OwnershipMask.
Referenced by clang::SemaObjC::ActOnProperty(), clang::SemaObjC::CheckObjCPropertyAttributes(), clang::SemaObjC::CreatePropertyDecl(), clang::SemaObjC::DiagnosePropertyMismatch(), and clang::SemaObjC::HandlePropertyInClassExtension().
|
static |
Determine whether any storage attributes were written on the property.
Definition at line 999 of file SemaObjCProperty.cpp.
References Category, clang::Found, clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::NamedDecl::getIdentifier(), clang::ObjCPropertyDecl::getPropertyAttributesAsWritten(), clang::ObjCPropertyDecl::isReadOnly(), and OwnershipMask.
Referenced by clang::SemaObjC::ActOnPropertyImplDecl().
|
static |
Definition at line 807 of file SemaObjCProperty.cpp.
Referenced by SelectPropertyForSynthesisFromProtocols().
|
static |
Definition at line 306 of file SemaObjCProperty.cpp.
References clang::ASTContext::getLangOpts(), clang::Token::getLocation(), clang::Token::getRawIdentifier(), clang::ASTContext::getSourceManager(), clang::Token::is(), clang::SourceLocation::isMacroID(), clang::Token::isNot(), clang::Lexer::LexFromRawLexer(), Loc, and SM.
Referenced by clang::SemaObjC::ActOnPropertyImplDecl().
|
static |
Definition at line 272 of file SemaObjCProperty.cpp.
References clang::ObjCPropertyAttribute::kind_assign, clang::ObjCPropertyAttribute::kind_atomic, clang::ObjCPropertyAttribute::kind_class, clang::ObjCPropertyAttribute::kind_copy, clang::ObjCPropertyAttribute::kind_direct, clang::ObjCPropertyAttribute::kind_getter, clang::ObjCPropertyAttribute::kind_nonatomic, clang::ObjCPropertyAttribute::kind_readonly, clang::ObjCPropertyAttribute::kind_readwrite, clang::ObjCPropertyAttribute::kind_retain, clang::ObjCPropertyAttribute::kind_setter, clang::ObjCPropertyAttribute::kind_strong, clang::ObjCPropertyAttribute::kind_unsafe_unretained, and clang::ObjCPropertyAttribute::kind_weak.
Referenced by clang::SemaObjC::CreatePropertyDecl().
|
static |
Create a synthesized property accessor stub inside the @implementation.
Definition at line 1033 of file SemaObjCProperty.cpp.
References clang::ObjCMethodDecl::Create(), clang::Decl::getAttrs(), clang::Decl::getBeginLoc(), clang::Decl::getEndLoc(), clang::ObjCMethodDecl::getMethodFamily(), clang::Decl::hasAttrs(), clang::Decl::isImplicit(), clang::SourceLocation::isValid(), clang::Decl::setAttrs(), clang::ObjCMethodDecl::setCmdDecl(), clang::ObjCMethodDecl::setDefined(), clang::Decl::setLexicalDeclContext(), clang::ObjCMethodDecl::setMethodParams(), and clang::ObjCMethodDecl::setSelfDecl().
Referenced by clang::SemaObjC::ActOnPropertyImplDecl().
|
static |
SelectPropertyForSynthesisFromProtocols - Finds the most appropriate property declaration that should be synthesised in all of the inherited protocols.
It also diagnoses properties declared in inherited protocols with mismatched types or attributes, since any of them can be candidate for synthesis.
Definition at line 823 of file SemaObjCProperty.cpp.
References clang::ObjCInterfaceDecl::all_referenced_protocols(), areIncompatiblePropertyAttributes(), clang::Sema::Context, Diag(), clang::SemaBase::Diag(), clang::ASTContext::getCanonicalType(), clang::ObjCProtocolDecl::getDefinition(), clang::ObjCInterfaceDecl::getSuperClass(), isIncompatiblePropertyAttribute(), clang::Sema::isObjCPointerConversion(), clang::SourceLocation::isValid(), Kind, clang::ObjCPropertyAttribute::kind_assign, clang::ObjCPropertyAttribute::kind_atomic, clang::ObjCPropertyAttribute::kind_copy, clang::ObjCPropertyAttribute::kind_retain, clang::ObjCPropertyAttribute::kind_strong, clang::ObjCPropertyAttribute::kind_unsafe_unretained, clang::ObjCPropertyAttribute::kind_weak, clang::Note, clang::Property, clang::ASTContext::propertyTypesAreCompatible(), and true.
Referenced by clang::SemaObjC::ActOnPropertyImplDecl().
|
static |
setImpliedPropertyAttributeForReadOnlyProperty - This routine evaludates life-time attributes for a 'readonly' property with no known lifetime of its own, using backing 'ivar's attribute, if any.
If no backing 'ivar', property's life-time is assumed 'strong'.
Definition at line 785 of file SemaObjCProperty.cpp.
References getImpliedARCOwnership(), clang::QualType::getObjCLifetime(), clang::ObjCPropertyDecl::getPropertyAttributes(), clang::ValueDecl::getType(), clang::ObjCPropertyDecl::getType(), clang::ObjCPropertyAttribute::kind_strong, clang::ObjCPropertyAttribute::kind_weak, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, and clang::Qualifiers::OCL_Weak.
Referenced by clang::SemaObjC::ActOnPropertyImplDecl().
|
static |
Definition at line 1843 of file SemaObjCProperty.cpp.
References clang::ObjCPropertyDecl::getGetterName(), clang::ObjCContainerDecl::getInstanceMethod(), clang::ObjCPropertyDecl::getPropertyAttributes(), clang::ObjCPropertyDecl::getSetterName(), clang::ObjCInterfaceDecl::getSuperClass(), and clang::ObjCPropertyAttribute::kind_readonly.
Referenced by clang::SemaObjC::DefaultSynthesizeProperties().
|
static |
Definition at line 154 of file SemaObjCProperty.cpp.
Referenced by getOwnershipRule(), and hasWrittenStorageAttribute().