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