Go to the documentation of this file.
23 #include "llvm/ADT/STLExtras.h"
24 using namespace clang;
33 if (
const RecordType *RecordTy = dyn_cast<RecordType>(Ty)) {
34 CXXRecordDecl *Record = cast<CXXRecordDecl>(RecordTy->getDecl());
40 }
else if (isa<InjectedClassNameType>(Ty))
41 return cast<InjectedClassNameType>(Ty)->getDecl();
56 return Tag->getDecl();
75 bool EnteringContext) {
86 if (EnteringContext) {
100 = dyn_cast_or_null<ClassTemplateDecl>(
101 SpecType->getTemplateName().getAsTemplateDecl())) {
109 = ClassTemplate->getInjectedClassNameSpecialization();
111 return ClassTemplate->getTemplatedDecl();
118 = ClassTemplate->findPartialSpecialization(
ContextType)) {
123 "partial specialization scope specifier in SFINAE context?");
133 return RecordT->getDecl();
142 llvm_unreachable(
"Dependent nested-name-specifier has no DeclContext");
153 assert(Tag &&
"Non-tag type in nested-name-specifier");
164 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
181 assert(NNS->
isDependent() &&
"Only dependent nested-name-specifier allowed");
201 assert(DC &&
"given null context");
203 TagDecl *tag = dyn_cast<TagDecl>(DC);
213 tag =
type->getAsTagDecl();
230 if (
auto *EnumD = dyn_cast<EnumDecl>(tag))
253 return !TreatAsComplete;
275 Diag(L, diag::err_incomplete_nested_name_spec)
297 if (S->isFunctionScope()) {
298 if (
CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(S->getEntity()))
302 if (S->isClassScope()) {
303 RD = cast<CXXRecordDecl>(S->getEntity());
309 Diag(SuperLoc, diag::err_invalid_super_scope);
312 Diag(SuperLoc, diag::err_super_in_lambda_unsupported);
315 Diag(SuperLoc, diag::err_no_base_classes) << RD->
getName();
336 if (isa<NamespaceDecl>(SD))
339 if (!isa<TypeDecl>(SD))
348 if (TD->getUnderlyingType()->isRecordType())
350 if (TD->getUnderlyingType()->isEnumeralType()) {
356 }
else if (isa<RecordDecl>(SD)) {
358 }
else if (isa<EnumDecl>(SD)) {
385 assert(!Found.
isAmbiguous() &&
"Cannot handle ambiguities here yet");
405 bool isDependent =
false;
406 if (!ObjectType.
isNull()) {
409 assert(!SS.
isSet() &&
"ObjectType and scope specifier cannot coexist");
412 }
else if (SS.
isSet()) {
432 }
else if (isDependent) {
446 class NestedNameSpecifierValidatorCCC final
449 explicit NestedNameSpecifierValidatorCCC(
Sema &SRef)
452 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
456 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
457 return std::make_unique<NestedNameSpecifierValidatorCCC>(*
this);
500 bool ErrorRecoveryLookup,
501 bool *IsCorrectedToColon,
502 bool OnlyNamespace) {
512 bool isDependent =
false;
513 if (IsCorrectedToColon)
514 *IsCorrectedToColon =
false;
515 if (!ObjectType.
isNull()) {
518 assert(!SS.
isSet() &&
"ObjectType and scope specifier cannot coexist");
521 }
else if (SS.
isSet()) {
529 bool ObjectTypeSearchedInScope =
false;
566 else if (ScopeLookupResult)
567 Found.
addDecl(ScopeLookupResult);
569 ObjectTypeSearchedInScope =
true;
571 }
else if (!isDependent) {
581 if (Found.
empty() && isDependent &&
582 !(LookupCtx && LookupCtx->
isRecord() &&
583 (!cast<CXXRecordDecl>(LookupCtx)->hasDefinition() ||
584 !cast<CXXRecordDecl>(LookupCtx)->hasAnyDependentBases()))) {
586 if (ErrorRecoveryLookup)
597 if (Found.
empty() && !ErrorRecoveryLookup) {
603 else if (S && !isDependent)
610 if (IsCorrectedToColon) {
611 *IsCorrectedToColon =
true;
612 Diag(IdInfo.
CCLoc, diag::err_nested_name_spec_is_not_class)
616 Diag(ND->getLocation(), diag::note_declared_at);
621 ?
unsigned(diag::err_expected_namespace_name)
622 :
unsigned(diag::err_expected_class_or_namespace))
625 Diag(ND->getLocation(), diag::note_entity_declared_at)
636 NestedNameSpecifierValidatorCCC CCC(*
this);
641 bool DroppedSpecifier =
642 Corrected.WillReplaceSpecifier() &&
643 Name.getAsString() == Corrected.getAsString(
getLangOpts());
644 if (DroppedSpecifier)
647 << Name << LookupCtx << DroppedSpecifier
653 if (Corrected.getCorrectionSpecifier())
657 if (
NamedDecl *ND = Corrected.getFoundDecl())
667 bool IsExtension =
false;
669 if (!AcceptSpec && IsExtension) {
674 if (!ObjectType.
isNull() && !ObjectTypeSearchedInScope &&
693 OuterDecl = ScopeLookupResult;
697 (!isa<TypeDecl>(OuterDecl) || !isa<TypeDecl>(SD) ||
701 if (ErrorRecoveryLookup)
705 diag::err_nested_name_member_ref_lookup_ambiguous)
716 if (
auto *TD = dyn_cast_or_null<TypedefNameDecl>(SD))
721 if (ErrorRecoveryLookup)
727 if (
NamespaceDecl *Namespace = dyn_cast<NamespaceDecl>(SD)) {
744 if (
const auto *USD = dyn_cast<UsingShadowDecl>(SD)) {
747 }
else if (isa<InjectedClassNameType>(T)) {
751 }
else if (isa<RecordType>(T)) {
754 }
else if (isa<TypedefType>(T)) {
757 }
else if (isa<EnumType>(T)) {
760 }
else if (isa<TemplateTypeParmType>(T)) {
764 }
else if (isa<UnresolvedUsingType>(T)) {
768 }
else if (isa<SubstTemplateTypeParmType>(T)) {
772 }
else if (isa<SubstTemplateTypeParmPackType>(T)) {
777 llvm_unreachable(
"Unhandled TypeDecl node in nested-name-specifier");
787 if (ErrorRecoveryLookup)
821 diag::ext_undeclared_unqual_id_with_dependent_base)
830 if (!Found.
empty()) {
838 Diag(ND->getLocation(), diag::note_entity_declared_at)
841 }
else if (SS.
isSet())
853 bool ErrorRecoveryLookup,
854 bool *IsCorrectedToColon,
855 bool OnlyNamespace) {
861 IsCorrectedToColon, OnlyNamespace);
899 bool EnteringContext) {
916 bool EnteringContext) {
946 for (
unsigned I = 0, N = TemplateArgs.
size(); I != N; ++I)
962 isa<FunctionTemplateDecl>(TD) || isa<VarTemplateDecl>(TD)) {
967 Diag(CCLoc, diag::err_non_type_template_in_nested_name_specifier)
968 << (TD && isa<VarTemplateDecl>(TD)) << Template << R;
982 Diag(TemplateNameLoc, diag::err_nested_name_spec_non_tag) << T;
995 for (
unsigned I = 0, N = TemplateArgs.
size(); I != N; ++I)
1007 struct NestedNameSpecifierAnnotation {
1017 (
sizeof(NestedNameSpecifierAnnotation) + SS.
location_size()),
1018 alignof(NestedNameSpecifierAnnotation));
1019 NestedNameSpecifierAnnotation *Annotation
1020 =
new (Mem) NestedNameSpecifierAnnotation;
1029 if (!AnnotationPtr) {
1034 NestedNameSpecifierAnnotation *Annotation
1035 =
static_cast<NestedNameSpecifierAnnotation *
>(AnnotationPtr);
1040 assert(SS.
isSet() &&
"Parser passed invalid CXXScopeSpec.");
1063 switch (Qualifier->getKind()) {
1079 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
1089 assert(SS.
isSet() &&
"Parser passed invalid CXXScopeSpec.");
1094 if (!DC)
return true;
1116 assert(SS.
isSet() &&
"Parser passed invalid CXXScopeSpec.");
1120 "exiting declarator scope we never really entered");
void setBegin(SourceLocation b)
void setTemplateKeywordLoc(SourceLocation Loc)
void setRParenLoc(SourceLocation Loc)
bool resolveAssumedTemplateNameAsType(Scope *S, TemplateName &Name, SourceLocation NameLoc, bool Diagnose=true)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
@ LookupNamespaceName
Look up a namespace name within a C++ using directive or namespace alias definition,...
@ Identifier
An identifier, stored as an IdentifierInfo*.
void NoteAllFoundTemplates(TemplateName Name)
bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS)
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation.
void setLookupName(DeclarationName Name)
Sets the name to look up.
Provides information a specialization of a member of a class template, which may be a member function...
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
A trivial tuple used to represent a source range.
void setTemplateKeywordLoc(SourceLocation Loc)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isSingleResult() const
Determines if this names a single result which is not an unresolved value using decl.
Simple class containing the result of Sema::CorrectTypo.
Represents a C++ namespace alias.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
Encodes a location in the source.
static const TST TST_error
This represents a decl that may have a name.
SourceLocation getBegin() const
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
Expr * getRepAsExpr() const
A (possibly-)qualified type.
const Type * getTypeForDecl() const
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Represents the results of name lookup.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
void setRAngleLoc(SourceLocation Loc)
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Represents a type template specialization; the template must be a class template, a type alias templa...
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template declarations that this template name refers to,...
Represents a C++ nested-name-specifier or a global scope specifier.
bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS)
The parser has parsed a global nested-name-specifier '::'.
QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const
The name of a declaration.
TranslationUnitDecl * getTranslationUnitDecl() const
SourceLocation getNameLoc() const
Gets the location of the identifier.
SourceLocation getTypeSpecTypeLoc() const
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
The base class of the type hierarchy.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool isSet() const
Deprecated.
const LangOptions & getLangOpts() const
void * Allocate(size_t Size, unsigned Align=8) const
void setLAngleLoc(SourceLocation Loc)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
SourceLocation IdentifierLoc
The location of the identifier.
@ Namespace
A namespace, stored as a NamespaceDecl*.
TypeSpecTypeLoc pushTypeSpec(QualType T)
Pushes space for a typespec TypeLoc.
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(const NamedDecl *D, const TemplateArgumentList *Innermost=nullptr, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
Wrapper for substituted template type parameters.
void * SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS)
Given a C++ nested-name-specifier, produce an annotation value that the parser can use later to recon...
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
A convenient class for passing around template argument information.
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
ActOnCXXExitDeclaratorScope - Called when a declarator that previously invoked ActOnCXXEnterDeclarato...
bool isCurrentInstantiation(const DeclContext *CurContext) const
Determine whether this dependent class is a current instantiation, when viewed from within the given ...
TST getTypeSpecType() const
Scope - A scope is a transient data structure that is used while parsing the program.
void SetInvalid(SourceRange R)
Indicate that this nested-name-specifier is invalid.
void EnterDeclaratorContext(Scope *S, DeclContext *DC)
EnterDeclaratorContext - Used when we must lookup names in the context of a declarator's nested name ...
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
SourceLocation getEnd() const
bool isIdentifier() const
Determine whether this template name refers to an identifier.
const T * getAs() const
Member-template getAs<specific type>'.
unsigned getNumBases() const
Retrieves the number of base classes of this class.
NamedDecl * FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS)
If the given nested-name-specifier begins with a bare identifier (e.g., Base::), perform name lookup ...
ParsedType ObjectType
The type of the object, if we're parsing nested-name-specifier in a member access expression.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization,...
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
AssumedTemplateStorage * getAsAssumedTemplateName() const
Retrieve information on a name that has been assumed to be a template-name in order to permit a call ...
Wrapper for source info for injected class names of class templates.
IdentifierInfo * Identifier
The identifier preceding the '::'.
static CXXRecordDecl * getCurrentInstantiationOf(QualType T, DeclContext *CurContext)
Find the current instantiation that associated with the given type.
Wrapper for source info for record types.
Represents the declaration of a struct/union/class/enum.
QualType getCanonicalTypeInternal() const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
Represents a declaration of a type.
@ Global
The global specifier '::'. There is no stored value.
A C++ nested-name-specifier augmented with source location information.
DeclarationName getLookupName() const
Gets the name to look up.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
void setTemplateNameLoc(SourceLocation Loc)
bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
bool isEnumeralType() const
void diagnoseMissingImport(SourceLocation Loc, NamedDecl *Decl, MissingImportKind MIK, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
void setLAngleLoc(SourceLocation Loc)
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
void setElaboratedKeywordLoc(SourceLocation Loc)
TagDecl * getDecl() const
@ ETK_None
No keyword precedes the qualified type name.
bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a visible definition.
bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo, bool EnteringContext)
IsInvalidUnlessNestedName - This method is used for error recovery purposes to determine whether the ...
void setContextRange(SourceRange SR)
Sets a 'context' source range.
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, 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...
Represents a dependent template name that cannot be resolved prior to template instantiation.
bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS)
ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global scope or nested-name-specifi...
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Represents a C++ struct/union/class.
void setTemplateNameLoc(SourceLocation Loc)
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
Wrapper for substituted template type parameters.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
CXXRecordDecl * getCurrentInstantiationOf(NestedNameSpecifier *NNS)
If the given nested name specifier refers to the current instantiation, return the declaration that c...
void suppressDiagnostics()
Suppress the diagnostics that would normally fire because of this lookup.
bool empty() const
Return true if no decls were found.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
bool isBeingDefined() const
Return true if this decl is currently being defined.
Declaration of a class template.
Wrapper for source info for unresolved typename using decls.
void setDecltypeLoc(SourceLocation Loc)
Represents a C++ template name within the type system.
char * location_data() const
Retrieve the data associated with the source-location information.
bool hasVisibleDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is visible.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Wrapper for source info for enum types.
enum clang::format::@1161::AnnotatingParser::Context::@327 ContextType
The base class of all kinds of template declarations (e.g., class, function, etc.).
bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
Sema - This implements semantic analysis and AST building for C.
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
static const TST TST_decltype
Wrapper for template type parameters.
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
bool isFileContext() const
bool isAcceptableNestedNameSpecifier(const NamedDecl *SD, bool *CanCorrect=nullptr)
Determines whether the given declaration is an valid acceptable result for name lookup of a nested-na...
QualType BuildDecltypeType(Expr *E, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
bool InstantiateEnum(SourceLocation PointOfInstantiation, EnumDecl *Instantiation, EnumDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiate the definition of an enum from a given pattern.
bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo)
Scope * getCurScope() const
Retrieve the parser's current scope.
bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc, SourceLocation ColonColonLoc, CXXScopeSpec &SS)
The parser has parsed a '__super' nested-name-specifier.
void setRAngleLoc(SourceLocation Loc)
@ LookupNestedNameSpecifierName
Look up of a name that precedes the '::' scope resolution operator in C++.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
SourceLocation CCLoc
The location of the '::'.
NamedDecl * getCorrectionDecl() const
Gets the pointer to the declaration of the typo correction.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
void RestoreNestedNameSpecifierAnnotation(void *Annotation, SourceRange AnnotationRange, CXXScopeSpec &SS)
Given an annotation pointer for a nested-name-specifier, restore the nested-name-specifier structure.
SourceRange getTypeofParensRange() const
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
void ExitDeclaratorContext(Scope *S)
Base class for declarations which introduce a typedef-name.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
DeclClass * getAsSingle() const
void setNameLoc(SourceLocation Loc)
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
bool RequireCompleteEnumDecl(EnumDecl *D, SourceLocation L, CXXScopeSpec *SS=nullptr)
Require that the EnumDecl is completed with its enumerators defined or instantiated.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
@ TypeSpec
A type, stored as a Type*.
bool isLambda() const
Determine whether this class describes a lambda function object.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
bool isEmpty() const
No scope specifier.
Keeps information about an identifier in a nested-name-spec.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
SourceRange getRange() const
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
bool isFunctionOrMethod() const
bool ActOnCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, bool ErrorRecoveryLookup=false, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
The parser has parsed a nested-name-specifier 'identifier::'.
SourceLocation getLocation() const
Represent a C++ namespace.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, const TemplateArgumentListInfo &Args) const
const DeclarationNameInfo & getLookupNameInfo() const
Gets the name info to look up.
bool isEditorPlaceholder() const
Return true if this identifier is an editor placeholder.
const LangOptions & getLangOpts() const
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
Captures information about "declaration specifiers".
Represents a static or instance method of a struct/union/class.
bool isInvalid() const
An error occurred during parsing of the scope specifier.
Wrapper for source info for typedefs.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.