clang
3.9.0
|
#include "clang/Sema/Overload.h"
#include "clang/AST/ASTLambda.h"
#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/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaInternal.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. More... | |
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. More... | |
static void | diagnoseInstanceReference (Sema &SemaRef, const CXXScopeSpec &SS, NamedDecl *Rep, const DeclarationNameInfo &nameInfo) |
Diagnose a reference to a field with no object available. More... | |
static QualType | CheckExtVectorComponent (Sema &S, QualType baseType, ExprValueKind &VK, SourceLocation OpLoc, const IdentifierInfo *CompName, SourceLocation CompLoc) |
Check an ext-vector component access expression. More... | |
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. More... | |
static bool | LookupMemberExprInRecord (Sema &SemaRef, LookupResult &R, Expr *BaseExpr, const RecordType *RTy, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, bool HasTemplateArgs, TypoExpr *&TE) |
static ExprResult | LookupMemberExpr (Sema &S, LookupResult &R, ExprResult &BaseExpr, bool &IsArrow, SourceLocation OpLoc, CXXScopeSpec &SS, Decl *ObjCImpDecl, bool HasTemplateArgs) |
Look up the given member of the given non-type-dependent expression. More... | |
static ExprResult | BuildFieldReferenceExpr (Sema &S, Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo) |
static ExprResult | BuildMSPropertyRefExpr (Sema &S, Expr *BaseExpr, bool IsArrow, const CXXScopeSpec &SS, MSPropertyDecl *PD, const DeclarationNameInfo &NameInfo) |
static MemberExpr * | BuildMemberExpr (Sema &SemaRef, ASTContext &C, Expr *Base, bool isArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, ValueDecl *Member, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo, QualType Ty, ExprValueKind VK, ExprObjectKind OK, const TemplateArgumentListInfo *TemplateArgs=nullptr) |
Build a MemberExpr AST node. More... | |
static bool | IsInFnTryBlockHandler (const Scope *S) |
Determine if the given scope is within a function-try-block handler. More... | |
static VarDecl * | getVarTemplateSpecialization (Sema &S, VarTemplateDecl *VarTempl, const TemplateArgumentListInfo *TemplateArgs, const DeclarationNameInfo &MemberNameInfo, SourceLocation TemplateKWLoc) |
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. More... | |
static bool | isRecordType (QualType T) |
static bool | isPointerToRecordType (QualType T) |
typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4> BaseSet |
Definition at line 29 of file SemaExprMember.cpp.
enum IMAKind |
Definition at line 41 of file SemaExprMember.cpp.
|
static |
Definition at line 1733 of file SemaExprMember.cpp.
References BuildMemberExpr(), clang::Sema::Context, clang::Sema::CurContext, clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::Sema::getLangOpts(), clang::Expr::getObjectKind(), clang::Sema::getOpenMPCapturedExpr(), clang::Type::getPointeeType(), clang::ASTContext::getQualifiedType(), clang::CanQual< T >::getQualifiers(), clang::QualType::getQualifiers(), clang::CXXScopeSpec::getScopeRep(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::Expr::getValueKind(), clang::Qualifiers::hasAddressSpace(), clang::Expr::IgnoreParenImpCasts(), clang::FieldDecl::isBitField(), clang::DeclContext::isDependentContext(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::FieldDecl::isMutable(), clang::Sema::IsOpenMPCapturedDecl(), clang::OK_BitField, clang::OK_Ordinary, clang::Sema::PerformObjectMemberConversion(), clang::Qualifiers::removeConst(), clang::Qualifiers::removeObjCGCAttr(), clang::Sema::UnusedPrivateFields, clang::VK_LValue, and clang::VK_RValue.
Referenced by clang::Sema::BuildAnonymousStructUnionMemberReference(), and clang::Sema::BuildMemberReferenceExpr().
|
static |
Build a MemberExpr AST node.
Definition at line 880 of file SemaExprMember.cpp.
References clang::MemberExpr::Create(), E, clang::CXXScopeSpec::getWithLocInContext(), clang::Expr::isRValue(), and clang::Sema::MarkMemberReferenced().
Referenced by BuildFieldReferenceExpr(), and clang::Sema::BuildMemberReferenceExpr().
|
static |
Definition at line 867 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 277 of file SemaExprMember.cpp.
References clang::LazyVector< T, Source, Loader, LoadedStorage, LocalStorage >::begin(), clang::Sema::Context, clang::Sema::Diag(), E, clang::LazyVector< T, Source, Loader, LoadedStorage, LocalStorage >::end(), clang::Sema::ExtVectorDecls, clang::Type::getAs(), clang::VectorType::getElementType(), clang::Sema::getExternalSource(), clang::ASTContext::getExtVectorType(), clang::IdentifierInfo::getLength(), clang::IdentifierInfo::getNameStart(), clang::VectorType::getNumElements(), clang::ExtVectorType::getNumericAccessorIdx(), clang::ExtVectorType::getPointAccessorIdx(), clang::ASTContext::getTypedefType(), I, clang::ExtVectorType::isAccessorWithinNumElements(), and clang::VK_RValue.
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 89 of file SemaExprMember.cpp.
References clang::LookupResult::begin(), clang::Sema::ConstantEvaluated, clang::Sema::CXXThisTypeOverride, clang::Sema::DiscardedStatement, clang::LookupResult::empty(), clang::Sema::ExprEvalContexts, clang::CXXRecordDecl::getCanonicalDecl(), clang::Sema::getFunctionLevelDeclContext(), clang::Sema::getLangOpts(), clang::DeclContext::getParent(), IMA_Abstract, IMA_Error_StaticContext, IMA_Error_Unrelated, IMA_Field_Uneval_Context, IMA_Instance, IMA_Mixed, IMA_Mixed_StaticContext, IMA_Mixed_Unrelated, IMA_Static, IMA_Unresolved, IMA_Unresolved_StaticContext, clang::QualType::isNull(), isProvablyNotDerivedFrom(), clang::LookupResult::isUnresolvableResult(), clang::Sema::PotentiallyEvaluated, clang::Sema::PotentiallyEvaluatedIfUsed, clang::Sema::Unevaluated, and clang::Sema::UnevaluatedAbstract.
Referenced by clang::Sema::BuildPossibleImplicitMemberExpr().
|
static |
Diagnose a reference to a field with no object available.
Definition at line 196 of file SemaExprMember.cpp.
References clang::Sema::Diag(), clang::DeclContext::Encloses(), clang::DeclContext::Equals(), clang::SourceRange::getBegin(), clang::Sema::getFunctionLevelDeclContext(), clang::DeclarationNameInfo::getLoc(), clang::DeclarationNameInfo::getName(), clang::CXXMethodDecl::getParent(), clang::CXXScopeSpec::getRange(), clang::NamedDecl::getUnderlyingDecl(), clang::CXXScopeSpec::isEmpty(), clang::CXXScopeSpec::isSet(), clang::CXXMethodDecl::isStatic(), 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 471 of file SemaExprMember.cpp.
References clang::Sema::Diag(), diagnoseInstanceReference(), clang::DeclarationNameInfo::getLoc(), and clang::CXXScopeSpec::getRange().
Referenced by clang::Sema::CheckQualifiedMemberReference().
|
static |
Definition at line 398 of file SemaExprMember.cpp.
References FindGetterSetterNameDeclFromProtocolList(), I, clang::OBJC_PR_query_instance, and clang::ObjCObjectPointerType::quals().
Referenced by LookupMemberExpr().
|
static |
Definition at line 379 of file SemaExprMember.cpp.
References clang::ObjCContainerDecl::FindPropertyDeclaration(), clang::ObjCContainerDecl::getInstanceMethod(), I, clang::OBJC_PR_query_instance, and clang::ObjCProtocolDecl::protocols().
Referenced by FindGetterSetterNameDecl().
|
static |
Definition at line 907 of file SemaExprMember.cpp.
References clang::Sema::CheckVarTemplateId(), clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::DeclarationNameInfo::getBeginLoc(), clang::DeclarationNameInfo::getLoc(), clang::DeclarationNameInfo::getName(), clang::DeclarationNameInfo::getSourceRange(), clang::VarDecl::getTemplateSpecializationKind(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::VarDecl::setTemplateSpecializationKind(), and clang::TSK_ImplicitInstantiation.
Referenced by clang::Sema::BuildMemberReferenceExpr().
Determine if the given scope is within a function-try-block handler.
Definition at line 895 of file SemaExprMember.cpp.
References clang::Scope::FnTryCatchScope, clang::Scope::getFlags(), clang::Scope::getFnParent(), clang::Scope::getParent(), and clang::Scope::TryScope.
Referenced by clang::Sema::BuildMemberReferenceExpr().
Definition at line 1230 of file SemaExprMember.cpp.
References clang::Type::getAs().
Referenced by LookupMemberExpr().
|
static |
Determines if the given class is provably not derived from all of the prospective base classes.
Definition at line 33 of file SemaExprMember.cpp.
References clang::CXXRecordDecl::forallBases().
Referenced by ClassifyImplicitMemberAccess().
Definition at line 1227 of file SemaExprMember.cpp.
References clang::Type::isRecordType().
Referenced by clang::Sema::CreateOverloadedBinOp(), clang::Expr::EvaluateAsInitializer(), and LookupMemberExpr().
|
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 1255 of file SemaExprMember.cpp.
References CheckExtVectorComponent(), clang::CXXScopeSpec::clear(), clang::SelectorTable::constructSetterSelector(), clang::Sema::Context, clang::Sema::CorrectTypo(), clang::FixItHint::CreateRemoval(), clang::FixItHint::CreateReplacement(), clang::Sema::CTK_ErrorRecovery, clang::DeclarationName::CXXDestructorName, clang::declaresSameEntity(), clang::Sema::DefaultFunctionArrayConversion(), clang::Sema::DefaultLvalueConversion(), clang::Sema::Diag(), clang::Sema::diagnoseTypo(), clang::Sema::DiagnoseUseOfDecl(), clang::Sema::Diags, clang::ExprError(), FindGetterSetterNameDecl(), clang::ObjCContainerDecl::FindPropertyDeclaration(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ObjCIvarDecl::getAccessControl(), clang::Type::getAs(), clang::SourceRange::getBegin(), clang::ObjCMethodDecl::getClassInterface(), clang::Sema::getCurFunctionDecl(), clang::Sema::getCurMethodDecl(), clang::NamedDecl::getDeclName(), clang::Preprocessor::getIdentifierTable(), clang::Sema::getLangOpts(), clang::LookupResult::getLookupName(), clang::LookupResult::getLookupNameInfo(), clang::LookupResult::getNameLoc(), clang::SelectorTable::getNullarySelector(), clang::ASTContext::getObjCClassType(), clang::QualType::getObjCLifetime(), clang::ASTContext::getObjCSelRedefinitionType(), clang::ObjCObjectPointerType::getObjectType(), clang::Type::getPointeeType(), clang::CXXScopeSpec::getRange(), clang::CXXScopeSpec::getScopeRep(), clang::Preprocessor::getSelectorTable(), clang::ValueDecl::getType(), clang::ObjCIvarDecl::getUsageType(), clang::Sema::HandleExprPropertyRefExpr(), clang::ASTContext::hasSameUnqualifiedType(), clang::Expr::IgnoreParenCasts(), clang::Expr::IgnoreParenImpCasts(), clang::Sema::ImpCastExprToType(), clang::Type::isDependentType(), clang::CXXScopeSpec::isEmpty(), clang::Type::isExtVectorType(), clang::Type::isFunctionType(), clang::DiagnosticsEngine::isIgnored(), clang::CXXScopeSpec::isInvalid(), clang::QualType::isNull(), clang::ObjCObjectType::isObjCClass(), clang::ObjCObjectType::isObjCId(), clang::Type::isObjCSelType(), isPointerToRecordType(), isRecordType(), clang::Type::isRecordType(), clang::Type::isSpecificBuiltinType(), clang::IdentifierInfo::isStr(), clang::ObjCInterfaceDecl::isSuperClassOf(), clang::Sema::IvarBacksCurrentMethodAccessor(), clang::ObjCInterfaceDecl::lookupClassMethod(), clang::ObjCInterfaceDecl::lookupInstanceVariable(), LookupMemberExprInRecord(), clang::Sema::LookupMemberName, clang::ObjCInterfaceDecl::lookupPrivateMethod(), 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::Sema::PDiag(), clang::Sema::PerformMemberExprBaseConversion(), clang::Sema::PP, clang::ObjCIvarDecl::Private, clang::ASTContext::PseudoObjectTy, clang::ObjCIvarDecl::Public, clang::Sema::recordUseOfEvaluatedWeak(), clang::Sema::RequireCompleteType(), clang::Result, ShouldTryAgainWithRedefinitionType(), clang::Sema::tryToRecoverWithCall(), and clang::VK_LValue.
Referenced by clang::Sema::BuildMemberReferenceExpr().
|
static |
Definition at line 586 of file SemaExprMember.cpp.
References clang::LookupResult::addDecl(), clang::Sema::BuildMemberReferenceExpr(), clang::LookupResult::clear(), clang::Sema::computeDeclContext(), clang::Sema::CorrectTypoDelayed(), clang::Sema::CTK_ErrorRecovery, clang::Sema::Diag(), clang::Sema::diagnoseTypo(), clang::LookupResult::empty(), clang::Sema::ForRedeclaration, clang::TypoCorrection::getAsString(), clang::DeclarationName::getAsString(), clang::TypoCorrection::getCorrection(), clang::RecordType::getDecl(), clang::SourceRange::getEnd(), clang::Sema::getLangOpts(), clang::LookupResult::getLookupKind(), clang::LookupResult::getLookupName(), clang::LookupResult::getLookupNameInfo(), clang::LookupResult::getNameLoc(), clang::CXXScopeSpec::getRange(), clang::LookupResult::getSema(), clang::Expr::getType(), clang::LookupResult::isForRedeclaration(), clang::TypoCorrection::isKeyword(), clang::CXXScopeSpec::isSet(), clang::Sema::isThisOutsideMemberFunctionBody(), clang::Sema::LookupQualifiedName(), clang::Sema::LookupTemplateName(), clang::Sema::NotForRedeclaration, clang::Sema::PDiag(), clang::Sema::RequireCompleteDeclContext(), clang::Sema::RequireCompleteType(), clang::LookupResult::resolveKind(), clang::LookupResult::setLookupName(), clang::LookupResult::suppressDiagnostics(), Typo, and clang::TypoCorrection::WillReplaceSpecifier().
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 1201 of file SemaExprMember.cpp.
References clang::Sema::Context, clang::ActionResult< PtrTy, CompressInvalid >::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().