26 using namespace clang;
29 typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4>
BaseSet;
31 const BaseSet &Bases = *
reinterpret_cast<const BaseSet*
>(BasesPtr);
39 void *BasesPtr =
const_cast<void*
>(
reinterpret_cast<const void*
>(&Bases));
94 assert(!R.
empty() && (*R.
begin())->isCXXClassMember());
99 (!isa<CXXMethodDecl>(DC) || cast<CXXMethodDecl>(DC)->isStatic());
105 bool hasNonInstance =
false;
106 bool isField =
false;
112 isField |= isa<FieldDecl>(D) || isa<MSPropertyDecl>(D) ||
113 isa<IndirectFieldDecl>(D);
116 Classes.insert(R->getCanonicalDecl());
119 hasNonInstance =
true;
137 assert(!AbstractInstanceResult);
156 if (isStaticContext) {
160 return AbstractInstanceResult ? AbstractInstanceResult
166 contextClass = MD->
getParent()->getCanonicalDecl();
168 contextClass = cast<CXXRecordDecl>(DC);
191 AbstractInstanceResult ? AbstractInstanceResult :
214 bool InStaticMethod = Method && Method->
isStatic();
215 bool IsField = isa<FieldDecl>(Rep) || isa<IndirectFieldDecl>(Rep);
217 if (IsField && InStaticMethod)
219 SemaRef.
Diag(Loc, diag::err_invalid_member_use_in_static_method)
220 << Range << nameInfo.
getName();
221 else if (ContextClass && RepClass && SS.
isEmpty() && !InStaticMethod &&
222 !RepClass->
Equals(ContextClass) && RepClass->
Encloses(ContextClass))
225 SemaRef.
Diag(Loc, diag::err_nested_non_static_member_use)
226 << IsField << RepClass << nameInfo.
getName() << ContextClass << Range;
228 SemaRef.
Diag(Loc, diag::err_invalid_non_static_member_use)
229 << nameInfo.
getName() << Range;
231 SemaRef.
Diag(Loc, diag::err_member_call_without_object)
243 return BuildImplicitMemberExpr(SS, TemplateKWLoc, R, TemplateArgs,
true);
248 return BuildImplicitMemberExpr(SS, TemplateKWLoc, R, TemplateArgs,
false);
251 Diag(R.
getNameLoc(), diag::warn_cxx98_compat_non_static_member_use)
258 if (TemplateArgs || TemplateKWLoc.
isValid())
259 return BuildTemplateIdExpr(SS, TemplateKWLoc, R,
false, TemplateArgs);
260 return BuildDeclarationNameExpr(SS, R,
false);
269 llvm_unreachable(
"unexpected instance member access kind");
293 bool HalvingSwizzle =
false;
297 bool HexSwizzle = (*compStr ==
's' || *compStr ==
'S') && compStr[1];
299 bool HasRepeated =
false;
300 bool HasIndex[16] = {};
306 if (!strcmp(compStr,
"hi") || !strcmp(compStr,
"lo") ||
307 !strcmp(compStr,
"even") || !strcmp(compStr,
"odd")) {
308 HalvingSwizzle =
true;
309 }
else if (!HexSwizzle &&
312 if (HasIndex[Idx]) HasRepeated =
true;
313 HasIndex[Idx] =
true;
317 if (HexSwizzle) compStr++;
319 if (HasIndex[Idx]) HasRepeated =
true;
320 HasIndex[Idx] =
true;
325 if (!HalvingSwizzle && *compStr) {
328 S.
Diag(OpLoc, diag::err_ext_vector_component_name_illegal)
335 if (!HalvingSwizzle) {
343 S.
Diag(OpLoc, diag::err_ext_vector_component_exceeds_length)
355 unsigned CompSize = HalvingSwizzle ? (vecType->
getNumElements() + 1) / 2
368 for (Sema::ExtVectorDeclsType::iterator
372 if ((*I)->getUnderlyingType() == VT)
389 for (
const auto *I : PDecl->
protocols()) {
402 Decl *GDecl =
nullptr;
403 for (
const auto *I : QIdTy->
quals()) {
416 for (
const auto *I : QIdTy->
quals()) {
445 if (PT && (!getLangOpts().ObjC1 ||
447 assert(BaseExpr &&
"cannot happen with implicit member accesses");
448 Diag(OpLoc, diag::err_typecheck_member_reference_struct_union)
449 << BaseType << BaseExpr->getSourceRange() << NameInfo.
getSourceRange();
456 isDependentScopeSpecifier(SS));
461 Context, BaseExpr, BaseType, IsArrow, OpLoc,
463 NameInfo, TemplateArgs);
480 SemaRef.
Diag(nameInfo.
getLoc(), diag::err_qualified_member_of_unrelated)
481 << SS.
getRange() << rep << BaseType;
501 cast_or_null<CXXRecordDecl>(computeDeclContext(BaseType));
512 if (!BaseExpr && !(*I)->isCXXInstanceMember())
523 CXXRecordDecl *MemberRecord = cast<CXXRecordDecl>(DC)->getCanonicalDecl();
542 explicit RecordMemberExprValidatorCCC(
const RecordType *RTy)
543 : Record(RTy->getDecl()) {
546 WantTypeSpecifiers =
false;
547 WantExpressionKeywords =
false;
548 WantCXXNamedCasts =
false;
549 WantFunctionLikeCasts =
false;
550 WantRemainingKeywords =
false;
553 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
557 if (!ND || !(isa<ValueDecl>(ND) || isa<FunctionTemplateDecl>(ND)))
561 if (Record->containsDecl(ND))
564 if (
const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Record)) {
566 for (
const auto &BS : RD->bases()) {
568 dyn_cast_or_null<RecordType>(BS.getType().getTypePtrOrNull())) {
569 if (BSTy->getDecl()->containsDecl(ND))
594 diag::err_typecheck_incomplete_tag,
598 if (HasTemplateArgs) {
619 assert(DC &&
"Cannot handle non-computable dependent contexts in lookup");
621 if (!isa<TypeDecl>(DC)) {
638 llvm::make_unique<RecordMemberExprValidatorCCC>(RTy),
642 "Got a keyword as a correction for a member!");
643 bool DroppedSpecifier =
647 << Typo << DC << DroppedSpecifier
650 SemaRef.
Diag(TypoLoc, diag::err_no_member) << Typo << DC << BaseRange;
662 nullptr, R,
nullptr);
672 Decl *ObjCImpDecl,
bool HasTemplateArgs);
684 (SS.
isSet() && isDependentScopeSpecifier(SS)))
685 return ActOnDependentMemberExpr(Base, BaseType,
687 SS, TemplateKWLoc, FirstQualifierInScope,
688 NameInfo, TemplateArgs);
699 SS, TemplateArgs !=
nullptr, TE))
708 *
this, R, BaseResult, IsArrow, OpLoc, SS,
710 TemplateArgs !=
nullptr);
714 Base = BaseResult.
get();
726 return BuildMemberReferenceExpr(Base, BaseType,
727 OpLoc, IsArrow, SS, TemplateKWLoc,
728 FirstQualifierInScope, R, TemplateArgs,
743 Expr *baseObjectExpr,
747 bool baseObjectIsPointer =
false;
761 assert(!baseObjectExpr &&
"anonymous struct/union is static data member?");
766 = BuildDeclarationNameExpr(EmptySS, baseNameInfo, baseVariable);
769 baseObjectExpr = result.
get();
770 baseObjectIsPointer =
false;
775 }
else if (baseObjectExpr) {
782 baseObjectIsPointer =
true;
785 baseObjectIsPointer =
false;
795 QualType ThisTy = getCurrentThisType();
797 Diag(loc, diag::err_invalid_member_use_in_static_method)
803 CheckCXXThisCapture(loc);
806 baseObjectIsPointer =
true;
812 Expr *result = baseObjectExpr;
825 foundDecl, memberNameInfo).
get();
836 FieldDecl *field = cast<FieldDecl>(*FI++);
846 field, fakeFoundDecl, memberNameInfo).
get();
872 assert((!isArrow || Base->
isRValue()) &&
"-> base must be a pointer rvalue");
875 FoundDecl, MemberNameInfo, TemplateArgs, Ty, VK, OK);
888 bool SuppressQualifierCheck,
923 if (!BaseExpr && CurLSI) {
934 if (!CheckCXXThisCapture(Loc,
false,
false))
935 CheckCXXThisCapture(Loc);
936 }
else if (CurContext->isDependentContext()) {
954 ? computeDeclContext(SS,
false)
959 if (!IsArrow && BaseExpr) {
962 bool MayBePseudoDestructor =
false;
963 RetryExpr = ActOnStartCXXMemberReference(getCurScope(), BaseExpr,
964 OpLoc, tok::arrow, ObjectType,
965 MayBePseudoDestructor);
968 RetryExpr = ActOnMemberAccessExpr(
969 ExtraArgs->
S, RetryExpr.
get(), OpLoc, tok::arrow, TempSS,
976 Diag(OpLoc, diag::err_no_member_overloaded_arrow)
984 << (BaseExpr ? BaseExpr->getSourceRange() :
SourceRange());
995 if ((SS.
isSet() || !BaseExpr ||
996 (isa<CXXThisExpr>(BaseExpr) &&
997 cast<CXXThisExpr>(BaseExpr)->isImplicit())) &&
998 !SuppressQualifierCheck &&
999 CheckQualifiedMemberReference(BaseExpr, BaseType, SS, R))
1011 BaseExpr, BaseExprType,
1014 TemplateKWLoc, MemberNameInfo,
1041 CheckCXXThisCapture(Loc);
1045 bool ShouldCheckUse =
true;
1046 if (
CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(MemberDecl)) {
1049 if (MD->isVirtual() && !SS.
isSet())
1050 ShouldCheckUse =
false;
1054 if (ShouldCheckUse && DiagnoseUseOfDecl(MemberDecl, MemberLoc))
1057 if (
FieldDecl *FD = dyn_cast<FieldDecl>(MemberDecl))
1059 FoundDecl, MemberNameInfo);
1068 return BuildAnonymousStructUnionMemberReference(SS, MemberLoc, FD,
1069 FoundDecl, BaseExpr,
1072 if (
VarDecl *Var = dyn_cast<VarDecl>(MemberDecl)) {
1074 TemplateKWLoc, Var, FoundDecl, MemberNameInfo,
1075 Var->getType().getNonReferenceType(),
VK_LValue,
1079 if (
CXXMethodDecl *MemberFn = dyn_cast<CXXMethodDecl>(MemberDecl)) {
1082 if (MemberFn->isInstance()) {
1087 type = MemberFn->getType();
1091 TemplateKWLoc, MemberFn, FoundDecl, MemberNameInfo,
1094 assert(!isa<FunctionDecl>(MemberDecl) &&
"member function not C++ method?");
1098 TemplateKWLoc, Enum, FoundDecl, MemberNameInfo,
1103 if (isa<TypeDecl>(MemberDecl))
1104 Diag(MemberLoc, diag::err_typecheck_member_reference_type)
1105 << MemberName << BaseType << int(IsArrow);
1107 Diag(MemberLoc, diag::err_typecheck_member_reference_unknown)
1108 << MemberName << BaseType << int(IsArrow);
1125 if (!opty)
return false;
1153 return PT->getPointeeType()->isRecordType();
1161 return DefaultFunctionArrayLvalueConversion(Base);
1163 return CheckPlaceholderExpr(Base);
1179 Decl *ObjCImpDecl,
bool HasTemplateArgs) {
1180 assert(BaseExpr.
get() &&
"no base expression");
1184 if (BaseExpr.isInvalid())
1187 QualType BaseType = BaseExpr.get()->getType();
1212 S.
Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
1213 << BaseType << int(IsArrow) << BaseExpr.get()->getSourceRange()
1220 S.
Diag(MemberLoc, diag::err_typecheck_member_reference_arrow)
1221 << BaseType << BaseExpr.get()->getSourceRange();
1230 OpLoc, IsArrow, SS, HasTemplateArgs, TE))
1258 (OTy->isObjCId() || OTy->isObjCClass()))
1263 if (OTy->isObjCId() && Member->
isStr(
"isa"))
1268 ObjCImpDecl, HasTemplateArgs);
1273 diag::err_typecheck_incomplete_tag,
1282 auto Validator = llvm::make_unique<DeclFilterCCC<ObjCIvarDecl>>();
1283 Validator->IsObjCIvarLookup = IsArrow;
1290 S.
PDiag(diag::err_typecheck_member_reference_ivar_suggest)
1294 assert(!ClassDeclared);
1297 D = CAT->getClassInterface();
1298 ClassDeclared = cast<ObjCInterfaceDecl>(D);
1301 S.
Diag(MemberLoc, diag::err_property_found_suggest)
1302 << Member << BaseExpr.get()->getType()
1307 S.
Diag(MemberLoc, diag::err_typecheck_member_reference_ivar)
1309 << BaseExpr.get()->getSourceRange();
1314 assert(ClassDeclared);
1329 ClassOfMethodDecl = MD->getClassInterface();
1338 dyn_cast<ObjCImplementationDecl>(ObjCImpDecl))
1339 ClassOfMethodDecl = IMPD->getClassInterface();
1341 dyn_cast<ObjCCategoryImplDecl>(ObjCImpDecl))
1342 ClassOfMethodDecl = CatImplClass->getClassInterface();
1348 S.
Diag(MemberLoc, diag::error_private_ivar_access)
1352 S.
Diag(MemberLoc, diag::error_protected_ivar_access)
1363 if (
DeclRefExpr *DE = dyn_cast<DeclRefExpr>(BaseExp))
1365 S.
Diag(DE->getLocation(), diag::error_arc_weak_ivar_access);
1377 S.
Diag(MemberLoc, diag::warn_direct_ivar_access) << IV->
getDeclName();
1381 IV, IV->
getUsageType(BaseType), MemberLoc, OpLoc, BaseExpr.get(),
1386 if (!S.
Diags.
isIgnored(diag::warn_arc_repeated_use_of_weak, MemberLoc))
1405 if (BaseExpr.isInvalid())
1409 BaseExpr.get()->getType()));
1443 SMD = dyn_cast<ObjCMethodDecl>(SDecl);
1454 ObjCImpDecl, HasTemplateArgs);
1456 return ExprError(S.
Diag(MemberLoc, diag::err_property_not_found)
1457 << MemberName << BaseType);
1467 ObjCImpDecl, HasTemplateArgs);
1498 if (Getter || Setter) {
1506 ObjCImpDecl, HasTemplateArgs);
1508 return ExprError(S.
Diag(MemberLoc, diag::err_property_not_found)
1509 << MemberName << BaseType);
1527 VK = POE->getSyntacticForm()->getValueKind();
1529 VK = BaseExpr.get()->getValueKind();
1547 ObjCImpDecl, HasTemplateArgs);
1561 if (!IsArrow && Ptr->getPointeeType()->isRecordType() &&
1563 S.
Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
1564 << BaseType << int(IsArrow) << BaseExpr.get()->getSourceRange()
1570 ObjCImpDecl, HasTemplateArgs);
1577 BaseExpr, S.
PDiag(diag::err_member_reference_needs_call),
1580 if (BaseExpr.isInvalid())
1584 ObjCImpDecl, HasTemplateArgs);
1587 S.
Diag(OpLoc, diag::err_typecheck_member_reference_struct_union)
1588 << BaseType << BaseExpr.get()->getSourceRange() << MemberLoc;
1609 Decl *ObjCImpDecl) {
1614 if (getLangOpts().MicrosoftExt &&
1617 diag::ext_ms_explicit_constructor_call);
1624 DecomposeUnqualifiedId(Id, TemplateArgsBuffer,
1625 NameInfo, TemplateArgs);
1628 bool IsArrow = (OpKind == tok::arrow);
1631 = (!SS.
isSet() ?
nullptr : FindFirstQualifierInScope(S, SS.
getScopeRep()));
1636 Base = Result.
get();
1639 isDependentScopeSpecifier(SS)) {
1640 return ActOnDependentMemberExpr(Base, Base->
getType(), IsArrow, OpLoc, SS,
1641 TemplateKWLoc, FirstQualifierInScope,
1642 NameInfo, TemplateArgs);
1646 return BuildMemberReferenceExpr(Base, Base->
getType(), OpLoc, IsArrow, SS,
1647 TemplateKWLoc, FirstQualifierInScope,
1648 NameInfo, TemplateArgs, &ExtraArgs);
1695 Qualifiers Combined = BaseQuals + MemberQuals;
1696 if (Combined != MemberQuals)
1709 MemberNameInfo, MemberType, VK, OK);
1721 bool IsKnownInstance) {
1729 QualType ThisTy = getCurrentThisType();
1730 assert(!ThisTy.
isNull() &&
"didn't correctly pre-flight capture of 'this'");
1732 Expr *baseExpr =
nullptr;
1733 if (IsKnownInstance) {
1737 CheckCXXThisCapture(Loc);
1741 return BuildMemberReferenceExpr(baseExpr, ThisTy,
bool isObjCSelType() const
bool isDependentName() const
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself ...
unsigned getNumElements() const
SourceLocation getEnd() const
IdKind getKind() const
Determine what kind of name we have.
ExprObjectKind getObjectKind() const
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
ExtVectorDeclsType ExtVectorDecls
bool isTransparentContext() const
protocol_range protocols() const
The current expression occurs within an unevaluated operand that unconditionally permits abstract ref...
Smart pointer class that efficiently represents Objective-C method names.
SelectorTable & getSelectorTable()
Simple class containing the result of Sema::CorrectTypo.
bool isSpecificBuiltinType(unsigned K) const
isSpecificBuiltinType - Test for a particular builtin type.
ObjCInterfaceDecl * getClassInterface()
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
bool isBitField() const
Determines whether this field is a bitfield.
SourceRange getSourceRange() const LLVM_READONLY
Return the source range that covers this unqualified-id.
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.
DeclContext * getFunctionLevelDeclContext()
static void diagnoseInstanceReference(Sema &SemaRef, const CXXScopeSpec &SS, NamedDecl *Rep, const DeclarationNameInfo &nameInfo)
Diagnose a reference to a field with no object available.
static CXXDependentScopeMemberExpr * Create(const ASTContext &C, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs)
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
const LangOptions & getLangOpts() const
void setLookupName(DeclarationName Name)
Sets the name to look up.
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
ActionResult< Expr * > ExprResult
The current expression is potentially evaluated at run time, which means that code may be generated t...
bool isRecordType() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Defines the C++ template declaration subclasses.
The reference is definitely an implicit instance member access.
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
unsigned getLength() const
Efficiently return the length of this identifier info.
QualType getObjCClassRedefinitionType() const
Retrieve the type that Class has been defined to, which may be different from the built-in Class if C...
const ObjCObjectType * getObjectType() const
This file provides some common utility functions for processing Lambda related AST Constructs...
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
DiagnosticsEngine & Diags
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
AccessSpecifier getAccess() const
QualType getUsageType(QualType objectType) const
bool isUnresolvableResult() const
QualType getObjCClassType() const
Represents the Objective-C Class type.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
void setBegin(SourceLocation b)
Defines the clang::Expr interface and subclasses for C++ expressions.
bool isEmpty() const
No scope specifier.
iterator begin(Source *source, bool LocalOnly=false)
DeclarationName getName() const
getName - Returns the embedded declaration name.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType, const CXXScopeSpec &SS, const LookupResult &R)
ObjCMethodFamily
A family of Objective-C methods.
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
static bool ShouldTryAgainWithRedefinitionType(Sema &S, ExprResult &base)
static bool LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R, Expr *BaseExpr, const RecordType *RTy, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, bool HasTemplateArgs, TypoExpr *&TE)
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
static int getPointAccessorIdx(char c)
bool forallBases(ForallBasesCallback *BaseMatches, void *UserData, bool AllowShortCircuit=true) const
Determines if the given callback holds for all the direct or indirect base classes of this type...
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
static bool BaseIsNotInSet(const CXXRecordDecl *Base, void *BasesPtr)
static Selector constructSetterSelector(IdentifierTable &Idents, SelectorTable &SelTable, const IdentifierInfo *Name)
Return the default setter selector for the given identifier.
Represents a C++ unqualified-id that has been parsed.
Selector getNullarySelector(IdentifierInfo *ID)
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
Represents the results of name lookup.
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics...
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
ObjCMethodDecl * getCurMethodDecl()
static IMAKind ClassifyImplicitMemberAccess(Sema &SemaRef, const LookupResult &R)
const CXXRecordDecl * getParent() const
VarDecl * getVarDecl() const
ExprResult BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS, SourceLocation nameLoc, IndirectFieldDecl *indirectField, DeclAccessPair FoundDecl=DeclAccessPair::make(nullptr, AS_none), Expr *baseObjectExpr=nullptr, SourceLocation opLoc=SourceLocation())
static bool isRecordType(QualType T)
The reference is a contextually-permitted abstract member reference.
CanQualType PseudoObjectTy
RecordDecl * getDecl() const
ObjCInterfaceDecl * getInterface() const
Expr * IgnoreParenCasts() LLVM_READONLY
chain_iterator chain_begin() const
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
ExprResult ActOnDependentMemberExpr(Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
Represents a C++ nested-name-specifier or a global scope specifier.
Represents an Objective-C protocol declaration.
std::string getAsString() const
getNameAsString - Retrieve the human-readable string for this name.
The reference may be an implicit instance member access.
An ordinary object is located at an address in memory.
Represents an ObjC class declaration.
bool isExtVectorType() const
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access. Does not test the acceptance criteria...
NamedDecl *const * chain_iterator
ObjCMethodDecl * lookupPrivateMethod(const Selector &Sel, bool Instance=true) const
Lookup a method in the classes implementation hierarchy.
Represents the this expression in C++.
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
llvm::SmallPtrSet< const CXXRecordDecl *, 4 > BaseSet
ImplicitCaptureStyle ImpCaptureStyle
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
Sema - This implements semantic analysis and AST building for C.
const DeclarationNameInfo & getLookupNameInfo() const
Gets the name info to look up.
Qualifiers::ObjCLifetime getObjCLifetime() const
getObjCLifetime - Returns lifetime attribute of this type.
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
QualType getPointeeType() const
DeclarationName getLookupName() const
Gets the name to look up.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
CXXRecordDecl * getNamingClass() const
Returns the 'naming class' for this lookup, i.e. the class which was looked into to find these result...
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs)
Builds an expression which might be an implicit member expression.
Qualifiers getQualifiers() const
Retrieve all qualifiers.
SourceLocation getNameLoc() const
bool Encloses(const DeclContext *DC) const
Determine whether this declaration context encloses the declaration context DC.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup. Asserts that one was found.
Defines the clang::Preprocessor interface.
ObjCMethodDecl * lookupClassMethod(Selector Sel) const
Lookup a class method for a given selector.
DeclContext * getDeclContext()
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
const SourceRange & getRange() const
bool isDependentType() const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
static void DiagnoseQualifiedMemberReference(Sema &SemaRef, Expr *BaseExpr, QualType BaseType, const CXXScopeSpec &SS, NamedDecl *rep, const DeclarationNameInfo &nameInfo)
A member reference to an MSPropertyDecl.
DeclarationName getDeclName() const
QualType getElementType() const
The result type of a method or function.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
static bool isPointerToRecordType(QualType T)
static ExprResult BuildMSPropertyRefExpr(Sema &S, Expr *BaseExpr, bool IsArrow, const CXXScopeSpec &SS, MSPropertyDecl *PD, const DeclarationNameInfo &NameInfo)
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
bool isValid() const
Return true if this is a valid SourceLocation object.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
IdentifierTable & getIdentifierTable()
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Represents a static or instance method of a struct/union/class.
ExprResult DefaultLvalueConversion(Expr *E)
The reference may be to an unresolved using declaration.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
bool isInvalid() const
An error occurred during parsing of the scope specifier.
QualType getObjCSelRedefinitionType() const
Retrieve the type that 'SEL' has been defined to, which may be different from the built-in 'SEL' if '...
ExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, bool IsDefiniteInstance)
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Represents one property declaration in an Objective-C interface.
SourceLocation getBegin() const
static Decl * FindGetterSetterNameDecl(const ObjCObjectPointerType *QIdTy, IdentifierInfo *Member, const Selector &Sel, ASTContext &Context)
void addPotentialThisCapture(SourceLocation Loc)
bool isThisOutsideMemberFunctionBody(QualType BaseType)
Determine whether the given type is the type of *this that is used outside of the body of a member fu...
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
bool isAccessorWithinNumElements(char c) const
static MemberExpr * Create(const ASTContext &C, Expr *base, bool isarrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *memberdecl, DeclAccessPair founddecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *targs, QualType ty, ExprValueKind VK, ExprObjectKind OK)
QualType getPointeeType() const
const DeclAccessPair & getPair() const
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
void recordUseOfEvaluatedWeak(const ExprT *E, bool IsRead=true)
static ExprResult LookupMemberExpr(Sema &S, LookupResult &R, ExprResult &BaseExpr, bool &IsArrow, SourceLocation OpLoc, CXXScopeSpec &SS, Decl *ObjCImpDecl, bool HasTemplateArgs)
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_RValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
bool isInvalidDecl() const
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
chain_iterator chain_end() const
bool tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD, bool ForceComplain=false, bool(*IsPlausibleResult)(QualType)=nullptr)
Try to recover by turning the given expression into a call. Returns true if recovery was attempted or...
bool isSingleResult() const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
ExprResult ActOnMemberAccessExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Member, Decl *ObjCImpDecl)
ExprResult DefaultFunctionArrayConversion(Expr *E)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
DeclarationName getCorrection() const
Gets the DeclarationName of the typo correction.
Expr * IgnoreParenImpCasts() LLVM_READONLY
bool empty() const
Return true if no decls were found.
NamedDecl * getCorrectionDecl() const
Gets the pointer to the declaration of the typo correction.
ExternalSemaSource * getExternalSource() const
SourceRange getSourceRange() const LLVM_READONLY
getSourceRange - The range of the declaration name.
FunctionDecl * getCurFunctionDecl()
ExprResult HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, Expr *BaseExpr, SourceLocation OpLoc, DeclarationName MemberName, SourceLocation MemberLoc, SourceLocation SuperLoc, QualType SuperType, bool Super)
bool isFunctionType() const
ObjCPropertyDecl * FindPropertyDeclaration(const IdentifierInfo *PropertyId) const
CanQualType BoundMemberTy
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
std::string getAsString(const LangOptions &LO) const
QualType getObjCIdRedefinitionType() const
Retrieve the type that id has been defined to, which may be different from the built-in id if id has ...
A bitfield object is a bitfield on a C or C++ record.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
static ExprResult BuildFieldReferenceExpr(Sema &S, Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
AccessControl getAccessControl() const
Reading or writing from this object requires a barrier call.
static UnresolvedMemberExpr * Create(const ASTContext &C, bool HasUnresolvedUsing, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Canon=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
bool hasAddressSpace() const
Represents a C++ struct/union/class.
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
TypoExpr * CorrectTypoDelayed(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, std::unique_ptr< CorrectionCandidateCallback > CCC, TypoDiagnosticGenerator TDG, TypoRecoveryCallback TRC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string...
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
void LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, bool &MemberOfUnknownSpecialization)
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7)...
bool isProvablyNotDerivedFrom(const CXXRecordDecl *Base) const
Determine whether this class is provably not derived from the type Base.
void setBaseObjectType(QualType T)
Sets the base object type for this lookup.
The reference is definitely not an instance member access.
void suppressDiagnostics()
An l-value expression is a reference to an object with independent storage.
static Decl * FindGetterSetterNameDeclFromProtocolList(const ObjCProtocolDecl *PDecl, IdentifierInfo *Member, const Selector &Sel, ASTContext &Context)
static int getNumericAccessorIdx(char c)
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, std::unique_ptr< CorrectionCandidateCallback > CCC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr, bool RecordFailure=true)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
bool isNull() const
isNull - Return true if this QualType doesn't point to a type yet.
static QualType CheckExtVectorComponent(Sema &S, QualType baseType, ExprValueKind &VK, SourceLocation OpLoc, const IdentifierInfo *CompName, SourceLocation CompLoc)
void WillReplaceSpecifier(bool ForceReplacement)
void clear()
Clears out any current state.
bool isOverloadedResult() const
Determines if the results are overloaded.
NamedDeclSetType UnusedPrivateFields
Set containing all declared private fields that are not used.
static bool isProvablyNotDerivedFrom(Sema &SemaRef, CXXRecordDecl *Record, const BaseSet &Bases)
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
bool isPointerType() const