Lines Matching +full:msi +full:- +full:specifier
1 //===--- SemaCXXScopeSpec.cpp - Semantic Analysis for C++ scope specifiers-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
32 const Type *Ty = T->getCanonicalTypeInternal().getTypePtr(); in getCurrentInstantiationOf()
34 CXXRecordDecl *Record = cast<CXXRecordDecl>(RecordTy->getDecl()); in getCurrentInstantiationOf()
35 if (!Record->isDependentContext() || in getCurrentInstantiationOf()
36 Record->isCurrentInstantiation(CurContext)) in getCurrentInstantiationOf()
41 return cast<InjectedClassNameType>(Ty)->getDecl(); in getCurrentInstantiationOf()
47 if (!T->isDependentType()) in computeDeclContext()
48 if (const TagType *Tag = T->getAs<TagType>()) in computeDeclContext()
49 return Tag->getDecl(); in computeDeclContext()
60 if (NNS->isDependent()) { in computeDeclContext()
61 // If this nested-name-specifier refers to the current in computeDeclContext()
67 const Type *NNSType = NNS->getAsType(); in computeDeclContext()
75 = NNSType->getAs<TemplateSpecializationType>()) { in computeDeclContext()
76 // We are entering the context of the nested name specifier, so try to in computeDeclContext()
77 // match the nested name specifier to either a primary class template in computeDeclContext()
81 SpecType->getTemplateName().getAsTemplateDecl())) { in computeDeclContext()
94 unsigned Depth = ClassTemplate->getTemplateParameters()->getDepth(); in computeDeclContext()
97 return TPL->getDepth() == Depth; in computeDeclContext()
101 PartialSpec = ClassTemplate->findPartialSpecialization( in computeDeclContext()
102 SpecType->template_arguments(), *L, Pos); in computeDeclContext()
105 PartialSpec = ClassTemplate->findPartialSpecialization(ContextType); in computeDeclContext()
113 "specifier in SFINAE context?"); in computeDeclContext()
114 if (PartialSpec->hasDefinition() && in computeDeclContext()
122 // If the type of the nested name specifier is the same as the in computeDeclContext()
126 ClassTemplate->getInjectedClassNameSpecialization(); in computeDeclContext()
128 return ClassTemplate->getTemplatedDecl(); in computeDeclContext()
130 } else if (const RecordType *RecordT = NNSType->getAs<RecordType>()) { in computeDeclContext()
131 // The nested name specifier refers to a member of a class template. in computeDeclContext()
132 return RecordT->getDecl(); in computeDeclContext()
139 switch (NNS->getKind()) { in computeDeclContext()
141 llvm_unreachable("Dependent nested-name-specifier has no DeclContext"); in computeDeclContext()
144 return NNS->getAsNamespace(); in computeDeclContext()
147 return NNS->getAsNamespaceAlias()->getNamespace(); in computeDeclContext()
151 const TagType *Tag = NNS->getAsType()->getAs<TagType>(); in computeDeclContext()
152 assert(Tag && "Non-tag type in nested-name-specifier"); in computeDeclContext()
153 return Tag->getDecl(); in computeDeclContext()
160 return NNS->getAsRecordDecl(); in computeDeclContext()
170 return SS.getScopeRep()->isDependent(); in isDependentScopeSpecifier()
175 assert(NNS->isDependent() && "Only dependent nested-name-specifier allowed"); in getCurrentInstantiationOf()
177 if (!NNS->getAsType()) in getCurrentInstantiationOf()
180 QualType T = QualType(NNS->getAsType(), 0); in getCurrentInstantiationOf()
202 if (!tag || tag->isDependentContext()) in RequireCompleteDeclContext()
207 tag = type->getAsTagDecl(); in RequireCompleteDeclContext()
211 if (tag->isBeingDefined()) in RequireCompleteDeclContext()
237 if (EnumD->isCompleteDefinition()) { in RequireCompleteEnumDecl()
254 if (EnumDecl *Pattern = EnumD->getInstantiatedFromMemberEnum()) { in RequireCompleteEnumDecl()
255 MemberSpecializationInfo *MSI = EnumD->getMemberSpecializationInfo(); in RequireCompleteEnumDecl() local
256 if (MSI->getTemplateSpecializationKind() != TSK_ExplicitSpecialization) { in RequireCompleteEnumDecl()
261 SS->SetInvalid(SS->getRange()); in RequireCompleteEnumDecl()
270 << QualType(EnumD->getTypeForDecl(), 0) << SS->getRange(); in RequireCompleteEnumDecl()
271 SS->SetInvalid(SS->getRange()); in RequireCompleteEnumDecl()
273 Diag(L, diag::err_incomplete_enum) << QualType(EnumD->getTypeForDecl(), 0); in RequireCompleteEnumDecl()
274 Diag(EnumD->getLocation(), diag::note_declared_at); in RequireCompleteEnumDecl()
295 for (Scope *S = getCurScope(); S; S = S->getParent()) { in ActOnSuperScopeSpecifier()
296 if (S->isFunctionScope()) { in ActOnSuperScopeSpecifier()
297 if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(S->getEntity())) in ActOnSuperScopeSpecifier()
298 RD = MD->getParent(); in ActOnSuperScopeSpecifier()
301 if (S->isClassScope()) { in ActOnSuperScopeSpecifier()
302 RD = cast<CXXRecordDecl>(S->getEntity()); in ActOnSuperScopeSpecifier()
310 } else if (RD->getNumBases() == 0) { in ActOnSuperScopeSpecifier()
311 Diag(SuperLoc, diag::err_no_base_classes) << RD->getName(); in ActOnSuperScopeSpecifier()
324 SD = SD->getUnderlyingDecl(); in isAcceptableNestedNameSpecifier()
334 // a typedef thereof. If so, build the nested-name-specifier. in isAcceptableNestedNameSpecifier()
336 if (T->isDependentType()) in isAcceptableNestedNameSpecifier()
339 if (TD->getUnderlyingType()->isRecordType()) in isAcceptableNestedNameSpecifier()
341 if (TD->getUnderlyingType()->isEnumeralType()) { in isAcceptableNestedNameSpecifier()
363 while (NNS->getPrefix()) in FindFirstQualifierInScope()
364 NNS = NNS->getPrefix(); in FindFirstQualifierInScope()
366 if (NNS->getKind() != NestedNameSpecifier::Identifier) in FindFirstQualifierInScope()
369 LookupResult Found(*this, NNS->getAsIdentifier(), SourceLocation(), in FindFirstQualifierInScope()
387 // initializer: either a non-static field member or a base class.
414 if (IdInfo.Identifier->isEditorPlaceholder()) in BuildCXXNestedNameSpecifier()
427 // This nested-name-specifier occurs in a member access expression, e.g., in BuildCXXNestedNameSpecifier()
428 // x->B::f, and we are looking into the type of the object. in BuildCXXNestedNameSpecifier()
429 assert(!SS.isSet() && "ObjectType and scope specifier cannot coexist"); in BuildCXXNestedNameSpecifier()
431 isDependent = ObjectType->isDependentType(); in BuildCXXNestedNameSpecifier()
433 // This nested-name-specifier occurs after another nested-name-specifier, in BuildCXXNestedNameSpecifier()
434 // so look into the context associated with the prior nested-name-specifier. in BuildCXXNestedNameSpecifier()
445 // nested-name-specifier. in BuildCXXNestedNameSpecifier()
448 if (!LookupCtx->isDependentContext() && in BuildCXXNestedNameSpecifier()
456 // If the id-expression in a class member access is a qualified-id of in BuildCXXNestedNameSpecifier()
459 // class-name-or-namespace-name::... in BuildCXXNestedNameSpecifier()
461 // the class-name-or-namespace-name following the . or -> operator is in BuildCXXNestedNameSpecifier()
462 // looked up both in the context of the entire postfix-expression and in in BuildCXXNestedNameSpecifier()
465 // shall refer to a class-name. If the name is found only in the in BuildCXXNestedNameSpecifier()
466 // context of the entire postfix-expression, the name shall refer to a in BuildCXXNestedNameSpecifier()
467 // class-name or namespace-name. [...] in BuildCXXNestedNameSpecifier()
469 // Qualified name lookup into a class will not find a namespace-name, in BuildCXXNestedNameSpecifier()
491 // that's fine: just build a dependent nested-name-specifier. in BuildCXXNestedNameSpecifier()
493 !(LookupCtx && LookupCtx->isRecord() && in BuildCXXNestedNameSpecifier()
494 (!cast<CXXRecordDecl>(LookupCtx)->hasDefinition() || in BuildCXXNestedNameSpecifier()
495 !cast<CXXRecordDecl>(LookupCtx)->hasAnyDependentBases()))) { in BuildCXXNestedNameSpecifier()
501 // base object type or prior nested-name-specifier, so this in BuildCXXNestedNameSpecifier()
502 // nested-name-specifier refers to an unknown specialization. Just build in BuildCXXNestedNameSpecifier()
503 // a dependent nested-name-specifier. in BuildCXXNestedNameSpecifier()
509 // If identifier is not found as class-name-or-namespace-name, but is found in BuildCXXNestedNameSpecifier()
527 Diag(ND->getLocation(), diag::note_declared_at); in BuildCXXNestedNameSpecifier()
530 // Replacement '::' -> ':' is not allowed, just issue respective error. in BuildCXXNestedNameSpecifier()
536 Diag(ND->getLocation(), diag::note_entity_declared_at) in BuildCXXNestedNameSpecifier()
589 // class-name-or-namespace-name shall refer to the same entity. in BuildCXXNestedNameSpecifier()
592 // into the current scope (the scope of the postfix-expression) to in BuildCXXNestedNameSpecifier()
607 OuterDecl->getCanonicalDecl() != SD->getCanonicalDecl() && in BuildCXXNestedNameSpecifier()
618 Diag(SD->getLocation(), diag::note_ambig_member_ref_object_type) in BuildCXXNestedNameSpecifier()
620 Diag(OuterDecl->getLocation(), diag::note_ambig_member_ref_scope); in BuildCXXNestedNameSpecifier()
628 MarkAnyDeclReferenced(TD->getLocation(), TD, /*OdrUse=*/false); in BuildCXXNestedNameSpecifier()
630 // If we're just performing this lookup for error-recovery purposes, in BuildCXXNestedNameSpecifier()
631 // don't extend the nested-name-specifier. Just return now. in BuildCXXNestedNameSpecifier()
635 // The use of a nested name specifier may trigger deprecation warnings. in BuildCXXNestedNameSpecifier()
649 Context.getTypeDeclType(cast<TypeDecl>(SD->getUnderlyingDecl())); in BuildCXXNestedNameSpecifier()
651 if (T->isEnumeralType()) in BuildCXXNestedNameSpecifier()
688 llvm_unreachable("Unhandled TypeDecl node in nested-name-specifier"); in BuildCXXNestedNameSpecifier()
713 // nested-name-specifier is located inside a dependent base class. in BuildCXXNestedNameSpecifier()
728 if (DC->isDependentContext() && DC->isFunctionOrMethod()) { in BuildCXXNestedNameSpecifier()
729 CXXRecordDecl *ContainingClass = dyn_cast<CXXRecordDecl>(DC->getParent()); in BuildCXXNestedNameSpecifier()
730 if (ContainingClass && ContainingClass->hasAnyDependentBases()) { in BuildCXXNestedNameSpecifier()
734 // Fake up a nested-name-specifier that starts with the in BuildCXXNestedNameSpecifier()
735 // injected-class-name of the enclosing class. in BuildCXXNestedNameSpecifier()
761 Diag(ND->getLocation(), diag::note_entity_declared_at) in BuildCXXNestedNameSpecifier()
798 if (!T->isDependentType() && !T->getAs<TagType>()) { in ActOnCXXNestedNameSpecifierDecltype()
827 cast<PackIndexingType>(Type.getTypePtr())->getPattern(), in ActOnCXXNestedNameSpecifierIndexedPack()
866 if (DTN && DTN->isIdentifier()) { in ActOnCXXNestedNameSpecifier()
869 assert(DTN->getQualifier() == SS.getScopeRep()); in ActOnCXXNestedNameSpecifier()
871 ElaboratedTypeKeyword::None, DTN->getQualifier(), DTN->getIdentifier(), in ActOnCXXNestedNameSpecifier()
874 // Create source-location information for this type. in ActOnCXXNestedNameSpecifier()
893 // typo-correct it now. in ActOnCXXNestedNameSpecifier()
912 // Build an appropriate nested-name-specifier. in ActOnCXXNestedNameSpecifier()
919 if (!T->isDependentType() && !T->getAs<TagType>()) { in ActOnCXXNestedNameSpecifier()
925 // Provide source-location information for the template specialization type. in ActOnCXXNestedNameSpecifier()
943 /// A structure that stores a nested-name-specifier annotation,
944 /// including both the nested-name-specifier
959 Annotation->NNS = SS.getScopeRep(); in SaveNestedNameSpecifierAnnotation()
974 SS.Adopt(NestedNameSpecifierLoc(Annotation->NNS, Annotation + 1)); in RestoreNestedNameSpecifierAnnotation()
980 // Don't enter a declarator context when the current context is an Objective-C in ShouldEnterDeclaratorScope()
987 // There are only two places a well-formed program may qualify a in ShouldEnterDeclaratorScope()
989 // out-of-line, and second, when naming an explicitly-qualified in ShouldEnterDeclaratorScope()
993 // in the function declarator and not part of a template-argument in ShouldEnterDeclaratorScope()
994 // in a template-id is first looked up in the scope of the member in ShouldEnterDeclaratorScope()
996 // a template-argument in a template-id, the look up is as in ShouldEnterDeclaratorScope()
1001 switch (Qualifier->getKind()) { in ShouldEnterDeclaratorScope()
1007 return CurContext->getRedeclContext()->isFileContext(); in ShouldEnterDeclaratorScope()
1030 if (!DC->isDependentContext() && RequireCompleteDeclContext(SS, DC)) in ActOnCXXEnterDeclaratorScope()
1035 // Rebuild the nested name specifier for the new scope. in ActOnCXXEnterDeclaratorScope()
1036 if (DC->isDependentContext()) in ActOnCXXEnterDeclaratorScope()