clang 20.0.0git
|
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Overload.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/SemaOpenMP.h"
Go to the source code of this file.
Typedefs | |
typedef llvm::SmallPtrSet< const CXXRecordDecl *, 4 > | BaseSet |
Functions | |
static bool | isProvablyNotDerivedFrom (Sema &SemaRef, CXXRecordDecl *Record, const BaseSet &Bases) |
Determines if the given class is provably not derived from all of the prospective base classes. | |
static IMAKind | ClassifyImplicitMemberAccess (Sema &SemaRef, const LookupResult &R) |
The given lookup names class member(s) and is not being used for an address-of-member expression. | |
static void | diagnoseInstanceReference (Sema &SemaRef, const CXXScopeSpec &SS, NamedDecl *Rep, const DeclarationNameInfo &nameInfo) |
Diagnose a reference to a field with no object available. | |
static bool | IsRGBA (char c) |
Determine whether input char is from rgba component set. | |
static bool | IsValidOpenCLComponentSwizzleLength (unsigned len) |
static QualType | CheckExtVectorComponent (Sema &S, QualType baseType, ExprValueKind &VK, SourceLocation OpLoc, const IdentifierInfo *CompName, SourceLocation CompLoc) |
Check an ext-vector component access expression. | |
static Decl * | FindGetterSetterNameDeclFromProtocolList (const ObjCProtocolDecl *PDecl, IdentifierInfo *Member, const Selector &Sel, ASTContext &Context) |
static Decl * | FindGetterSetterNameDecl (const ObjCObjectPointerType *QIdTy, IdentifierInfo *Member, const Selector &Sel, ASTContext &Context) |
static void | DiagnoseQualifiedMemberReference (Sema &SemaRef, Expr *BaseExpr, QualType BaseType, const CXXScopeSpec &SS, NamedDecl *rep, const DeclarationNameInfo &nameInfo) |
We know that the given qualified member reference points only to declarations which do not belong to the static type of the base expression. | |
static bool | LookupMemberExprInRecord (Sema &SemaRef, LookupResult &R, Expr *BaseExpr, QualType RTy, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, bool HasTemplateArgs, SourceLocation TemplateKWLoc, TypoExpr *&TE) |
static ExprResult | LookupMemberExpr (Sema &S, LookupResult &R, ExprResult &BaseExpr, bool &IsArrow, SourceLocation OpLoc, CXXScopeSpec &SS, Decl *ObjCImpDecl, bool HasTemplateArgs, SourceLocation TemplateKWLoc) |
Look up the given member of the given non-type-dependent expression. | |
static ExprResult | BuildMSPropertyRefExpr (Sema &S, Expr *BaseExpr, bool IsArrow, const CXXScopeSpec &SS, MSPropertyDecl *PD, const DeclarationNameInfo &NameInfo) |
static bool | IsInFnTryBlockHandler (const Scope *S) |
Determine if the given scope is within a function-try-block handler. | |
static bool | ShouldTryAgainWithRedefinitionType (Sema &S, ExprResult &base) |
Given that normal member access failed on the given expression, and given that the expression's type involves builtin-id or builtin-Class, decide whether substituting in the redefinition types would be profitable. | |
static bool | isRecordType (QualType T) |
static bool | isPointerToRecordType (QualType T) |
typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4> BaseSet |
Definition at line 28 of file SemaExprMember.cpp.
enum IMAKind |
Definition at line 40 of file SemaExprMember.cpp.
|
static |
Definition at line 918 of file SemaExprMember.cpp.
References clang::Sema::Context, clang::DeclarationNameInfo::getLoc(), clang::CXXScopeSpec::getWithLocInContext(), clang::ASTContext::PseudoObjectTy, and clang::VK_LValue.
Referenced by clang::Sema::BuildMemberReferenceExpr().
|
static |
Check an ext-vector component access expression.
VK should be set in advance to the value kind of the base expression.
Definition at line 372 of file SemaExprMember.cpp.
References clang::LazyVector< T, Source, Loader, LoadedStorage, LocalStorage >::begin(), clang::Type::castAs(), clang::Sema::Context, clang::SemaBase::Diag(), E, clang::LazyVector< T, Source, Loader, LoadedStorage, LocalStorage >::end(), clang::Sema::ExtVectorDecls, clang::VectorType::getElementType(), clang::Sema::getExternalSource(), clang::ASTContext::getExtVectorType(), clang::Sema::getLangOpts(), clang::IdentifierInfo::getLength(), clang::IdentifierInfo::getNameStart(), clang::VectorType::getNumElements(), clang::ExtVectorType::getNumericAccessorIdx(), clang::LangOptions::getOpenCLCompatibleVersion(), clang::ExtVectorType::getPointAccessorIdx(), clang::ASTContext::getTypedefType(), clang::ExtVectorType::isAccessorWithinNumElements(), IsRGBA(), IsValidOpenCLComponentSwizzleLength(), and clang::VK_PRValue.
Referenced by LookupMemberExpr().
|
static |
The given lookup names class member(s) and is not being used for an address-of-member expression.
Classify the type of access according to whether it's possible that this reference names an instance member. This is best-effort in dependent contexts; it is okay to conservatively answer "yes", in which case some errors will simply not be caught until template-instantiation.
Definition at line 92 of file SemaExprMember.cpp.
References clang::LookupResult::begin(), clang::Sema::CXXThisTypeOverride, D, clang::LookupResult::empty(), clang::Sema::ExprEvalContexts, clang::CXXRecordDecl::getCanonicalDecl(), clang::Decl::getDeclContext(), clang::Sema::getFunctionLevelDeclContext(), clang::Sema::getLangOpts(), clang::LookupResult::getNamingClass(), clang::DeclContext::getParent(), IMA_Abstract, IMA_Dependent, IMA_Error_StaticOrExplicitContext, IMA_Error_Unrelated, IMA_Field_Uneval_Context, IMA_Instance, IMA_Mixed, IMA_Mixed_StaticOrExplicitContext, IMA_Mixed_Unrelated, IMA_Static, IMA_Unresolved, IMA_Unresolved_StaticOrExplicitContext, clang::QualType::isNull(), isProvablyNotDerivedFrom(), and clang::LookupResult::isUnresolvableResult().
Referenced by clang::Sema::BuildPossibleImplicitMemberExpr().
|
static |
Diagnose a reference to a field with no object available.
Definition at line 221 of file SemaExprMember.cpp.
References clang::FixItHint::CreateInsertion(), Diag(), clang::SemaBase::Diag(), clang::DeclContext::Encloses(), clang::DeclContext::Equals(), clang::DeclarationName::getAsString(), clang::SourceRange::getBegin(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::Sema::getFunctionLevelDeclContext(), clang::DeclarationNameInfo::getLoc(), clang::DeclarationNameInfo::getName(), clang::FunctionDecl::getParamDecl(), clang::CXXMethodDecl::getParent(), clang::CXXScopeSpec::getRange(), clang::NamedDecl::getUnderlyingDecl(), clang::DeclarationName::isEmpty(), clang::CXXScopeSpec::isEmpty(), clang::CXXMethodDecl::isExplicitObjectMemberFunction(), clang::CXXScopeSpec::isSet(), clang::CXXMethodDecl::isStatic(), Loc, Range, and clang::SourceRange::setBegin().
Referenced by clang::Sema::BuildPossibleImplicitMemberExpr(), and DiagnoseQualifiedMemberReference().
|
static |
We know that the given qualified member reference points only to declarations which do not belong to the static type of the base expression.
Diagnose the problem.
Definition at line 599 of file SemaExprMember.cpp.
References clang::SemaBase::Diag(), diagnoseInstanceReference(), clang::DeclarationNameInfo::getLoc(), and clang::CXXScopeSpec::getRange().
Referenced by clang::Sema::CheckQualifiedMemberReference().
|
static |
Definition at line 523 of file SemaExprMember.cpp.
References FindGetterSetterNameDeclFromProtocolList(), clang::Member, clang::OBJC_PR_query_instance, and clang::ObjCObjectPointerType::quals().
Referenced by LookupMemberExpr().
|
static |
Definition at line 504 of file SemaExprMember.cpp.
References D, FindGetterSetterNameDeclFromProtocolList(), clang::ObjCContainerDecl::FindPropertyDeclaration(), clang::ObjCContainerDecl::getInstanceMethod(), clang::Member, clang::OBJC_PR_query_instance, and clang::ObjCProtocolDecl::protocols().
Referenced by FindGetterSetterNameDecl(), and FindGetterSetterNameDeclFromProtocolList().
Determine if the given scope is within a function-try-block handler.
Definition at line 960 of file SemaExprMember.cpp.
References clang::Scope::TryScope.
Referenced by clang::Sema::BuildMemberReferenceExpr().
Definition at line 1304 of file SemaExprMember.cpp.
References clang::Type::getAs(), and clang::T.
Referenced by LookupMemberExpr().
|
static |
Determines if the given class is provably not derived from all of the prospective base classes.
Definition at line 32 of file SemaExprMember.cpp.
Referenced by clang::Sema::CheckUsingDeclQualifier(), clang::Sema::CheckUsingShadowDecl(), and ClassifyImplicitMemberAccess().
Definition at line 1301 of file SemaExprMember.cpp.
References clang::Type::isRecordType(), and clang::T.
Referenced by clang::Sema::CreateOverloadedBinOp(), clang::QualType::getNonLValueExprType(), clang::Type::isCompoundType(), clang::Type::isOverloadableType(), clang::InitListExpr::isTransparent(), LookupMemberExpr(), clang::TemplateArgument::print(), and clang::ento::ExprEngine::Visit().
|
static |
Determine whether input char is from rgba component set.
Definition at line 347 of file SemaExprMember.cpp.
References c.
Referenced by CheckExtVectorComponent().
Definition at line 362 of file SemaExprMember.cpp.
Referenced by CheckExtVectorComponent().
|
static |
Look up the given member of the given non-type-dependent expression.
This can return in one of two ways:
The ObjCImpDecl bit is a gross hack that will need to be properly fixed for ObjC++.
Definition at line 1328 of file SemaExprMember.cpp.
References Category, CheckExtVectorComponent(), clang::CXXScopeSpec::clear(), clang::SelectorTable::constructSetterSelector(), clang::Sema::Context, clang::Sema::CorrectTypo(), clang::ImplicitCastExpr::Create(), clang::FixItHint::CreateRemoval(), clang::FixItHint::CreateReplacement(), clang::Sema::CTK_ErrorRecovery, clang::DeclarationName::CXXDestructorName, D, clang::declaresSameEntity(), clang::Sema::DefaultFunctionArrayConversion(), clang::Sema::DefaultLvalueConversion(), clang::ASTContext::DependentTy, clang::SemaBase::Diag(), clang::Sema::diagnoseTypo(), clang::Sema::DiagnoseUseOfDecl(), clang::Sema::DiagRuntimeBehavior(), clang::Sema::Diags, clang::ExprEmpty(), clang::ExprError(), FindGetterSetterNameDecl(), clang::ObjCContainerDecl::FindPropertyDeclaration(), clang::ActionResult< PtrTy, Compress >::get(), clang::ObjCIvarDecl::getAccessControl(), clang::Type::getAs(), clang::DeclarationName::getAsIdentifierInfo(), clang::Type::getAsRecordDecl(), clang::SourceRange::getBegin(), clang::ASTContext::getCanonicalType(), clang::ObjCMethodDecl::getClassInterface(), clang::Sema::getCurFunction(), clang::Sema::getCurFunctionDecl(), clang::Sema::getCurMethodDecl(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::ASTContext::getExtVectorType(), clang::Preprocessor::getIdentifierTable(), clang::Sema::getLangOpts(), clang::LookupResult::getLookupName(), clang::LookupResult::getLookupNameInfo(), clang::DeclarationName::getNameKind(), clang::LookupResult::getNameLoc(), clang::SelectorTable::getNullarySelector(), clang::ASTContext::getObjCClassType(), clang::QualType::getObjCLifetime(), clang::ASTContext::getObjCSelRedefinitionType(), clang::ObjCObjectPointerType::getObjectType(), clang::Type::getPointeeType(), clang::ASTContext::getPointerType(), clang::ASTContext::getQualifiedType(), clang::CanQual< T >::getQualifiers(), clang::CXXScopeSpec::getRange(), clang::CXXScopeSpec::getScopeRep(), clang::Preprocessor::getSelectorTable(), clang::Stmt::getSourceRange(), clang::ValueDecl::getType(), clang::Expr::getType(), clang::ObjCIvarDecl::getUsageType(), clang::Expr::getValueKind(), clang::SemaObjC::HandleExprPropertyRefExpr(), clang::ASTContext::hasSameUnqualifiedType(), clang::Expr::IgnoreParenCasts(), clang::Expr::IgnoreParenImpCasts(), clang::Sema::ImpCastExprToType(), int, clang::Interface, clang::Type::isDependentType(), clang::CXXScopeSpec::isEmpty(), clang::Type::isExtVectorBoolType(), clang::Type::isExtVectorType(), clang::Type::isFunctionType(), clang::DiagnosticsEngine::isIgnored(), clang::CXXScopeSpec::isInvalid(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Decl::isInvalidDecl(), clang::QualType::isNull(), clang::ObjCObjectType::isObjCClass(), clang::ObjCObjectType::isObjCId(), clang::CorrectionCandidateCallback::IsObjCIvarLookup, clang::Type::isObjCSelType(), isPointerToRecordType(), clang::Type::isRecordType(), isRecordType(), clang::Type::isScalarType(), clang::Sema::isSFINAEContext(), clang::Type::isSpecificBuiltinType(), clang::ObjCInterfaceDecl::isSuperClassOf(), clang::Sema::isUnevaluatedContext(), clang::SemaObjC::IvarBacksCurrentMethodAccessor(), clang::ObjCInterfaceDecl::lookupClassMethod(), clang::ObjCInterfaceDecl::lookupInstanceVariable(), LookupMemberExpr(), LookupMemberExprInRecord(), clang::Sema::LookupMemberName, clang::ObjCInterfaceDecl::lookupPrivateMethod(), clang::Member, clang::Sema::ObjC(), clang::OBJC_PR_query_instance, clang::Qualifiers::OCL_Weak, clang::OK_ObjCProperty, clang::OMF_dealloc, clang::OMF_finalize, clang::OMF_init, clang::ObjCIvarDecl::Package, clang::SemaBase::PDiag(), clang::Sema::PerformMemberExprBaseConversion(), clang::Sema::PP, clang::ObjCIvarDecl::Private, clang::ASTContext::PseudoObjectTy, clang::ObjCIvarDecl::Public, clang::sema::FunctionScopeInfo::recordUseOfWeak(), clang::Sema::RequireCompleteType(), clang::Result, clang::LookupResult::setNotFoundInCurrentInstantiation(), ShouldTryAgainWithRedefinitionType(), clang::Sema::tryToRecoverWithCall(), and clang::VK_LValue.
Referenced by clang::Sema::BuildMemberReferenceExpr(), and LookupMemberExpr().
|
static |
Definition at line 702 of file SemaExprMember.cpp.
References clang::Sema::computeDeclContext(), clang::Sema::CorrectTypoDelayed(), clang::LookupResult::empty(), clang::LookupResult::getLookupKind(), clang::LookupResult::getLookupName(), clang::LookupResult::getLookupNameInfo(), clang::LookupResult::getNameLoc(), clang::LookupResult::getSema(), clang::Stmt::getSourceRange(), clang::Type::isDependentType(), clang::CXXScopeSpec::isSet(), clang::Sema::isThisOutsideMemberFunctionBody(), clang::SourceLocation::isValid(), clang::Sema::LookupParsedName(), clang::Sema::LookupTemplateName(), clang::LookupResult::redeclarationKind(), clang::Sema::RequireCompleteType(), and clang::LookupResult::wasNotFoundInCurrentInstantiation().
Referenced by clang::Sema::BuildMemberReferenceExpr(), and LookupMemberExpr().
|
static |
Given that normal member access failed on the given expression, and given that the expression's type involves builtin-id or builtin-Class, decide whether substituting in the redefinition types would be profitable.
The redefinition type is whatever this translation unit tried to typedef to id/Class; we store it to the side and then re-use it in places like this.
Definition at line 1275 of file SemaExprMember.cpp.
References clang::Sema::Context, clang::ActionResult< PtrTy, Compress >::get(), clang::Type::getAs(), clang::ObjCObjectType::getInterface(), clang::ASTContext::getObjCClassRedefinitionType(), clang::ASTContext::getObjCIdRedefinitionType(), clang::ObjCObjectPointerType::getObjectType(), clang::Expr::getType(), clang::Sema::ImpCastExprToType(), clang::ObjCObjectType::isObjCClass(), and clang::ObjCObjectType::isObjCId().
Referenced by LookupMemberExpr().