clang: lib/Sema/SemaCXXScopeSpec.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
22#include "llvm/ADT/STLExtras.h"
23using namespace clang;
24
25
28 if (T.isNull())
29 return nullptr;
30
31 const TagType *TagTy = dyn_cast(T->getCanonicalTypeInternal());
32 if (!isa_and_present<RecordType, InjectedClassNameType>(TagTy))
33 return nullptr;
36 RD->isCurrentInstantiation(CurContext))
37 return RD;
38 return nullptr;
39}
40
42 if (->isDependentType())
43 if (auto *D = T->getAsTagDecl())
44 return D;
45 return ::getCurrentInstantiationOf(T, CurContext);
46}
47
49 bool EnteringContext) {
51 return nullptr;
52
55
56
59
60 if (EnteringContext) {
62 return nullptr;
64
65
66 NNSType = Context.getCanonicalType(NNSType);
67 if (const auto *SpecType =
68 dyn_cast(NNSType)) {
69
70
71
73 dyn_cast_or_null(
74 SpecType->getTemplateName().getAsTemplateDecl())) {
75
76
77
78
79
83 if (!TemplateParamLists.empty()) {
84 unsigned Depth = ClassTemplate->getTemplateParameters()->getDepth();
85 auto L = find_if(TemplateParamLists,
87 return TPL->getDepth() == Depth;
88 });
89 if (L != TemplateParamLists.end()) {
90 void *Pos = nullptr;
91 PartialSpec = ClassTemplate->findPartialSpecialization(
92 SpecType->template_arguments(), *L, Pos);
93 }
94 } else {
95 PartialSpec =
97 }
98
99 if (PartialSpec) {
100
101
102
103 assert(() && "partial specialization scope "
104 "specifier in SFINAE context?");
109 true);
110 return PartialSpec;
111 }
112
113
114
115
118 if (Context.hasSameType(Injected, QualType(SpecType, 0)))
120 }
121 } else if (const auto *RecordT = dyn_cast(NNSType)) {
122
123 return RecordT->getDecl()->getDefinitionOrSelf();
124 }
125 }
126
127 return nullptr;
128 }
129
134
137
139 return Context.getTranslationUnitDecl();
140
143
145 llvm_unreachable("unexpected null nested name specifier");
146 }
147
148 llvm_unreachable("Invalid NestedNameSpecifier::Kind!");
149}
150
153 return false;
154
156}
157
160 assert(NNS.isDependent() && "Only dependent nested-name-specifier allowed");
161
163 return nullptr;
164
166 return ::getCurrentInstantiationOf(T, CurContext);
167}
168
169
170
171
172
173
174
175
176
177
180 assert(DC && "given null context");
181
182 TagDecl *tag = dyn_cast(DC);
183
184
185
186
188 return false;
189
190
192
193
194
196 return false;
197
200
201
203 diag::err_incomplete_nested_name_spec,
206 return true;
207 }
208
209 if (auto *EnumD = dyn_cast(tag))
210
211
213
214 return false;
215}
216
217
218
219
224
225 NamedDecl *SuggestedDef = nullptr;
227 false)) {
228
229
232 TreatAsComplete);
233 return !TreatAsComplete;
234 }
235 return false;
236 }
237
238
239
246 if (SS)
248 return true;
249 }
250 return false;
251 }
252 }
253
254 if (SS) {
255 Diag(L, diag::err_incomplete_nested_name_spec)
258 } else {
259 Diag(L, diag::err_incomplete_enum) << Context.getCanonicalTagType(EnumD);
261 }
262
263 return true;
264}
265
271
276 Diag(SuperLoc, diag::err_super_in_lambda_unsupported);
277 return true;
278 }
279
282 if (S->isFunctionScope()) {
283 if (CXXMethodDecl *MD = dyn_cast(S->getEntity()))
285 break;
286 }
287 if (S->isClassScope()) {
289 break;
290 }
291 }
292
293 if (!RD) {
294 Diag(SuperLoc, diag::err_invalid_super_scope);
295 return true;
297 Diag(SuperLoc, diag::err_no_base_classes) << RD->getName();
298 return true;
299 }
300
302 return false;
303}
304
306 bool *IsExtension) {
307 if (!SD)
308 return false;
309
311
312
314 return true;
315
317 return false;
318
319
320
321 if (const TypedefNameDecl *TD = dyn_cast(SD)) {
322 if (TD->getUnderlyingType()->isRecordType())
323 return true;
324 if (TD->getUnderlyingType()->isEnumeralType()) {
325 if (Context.getLangOpts().CPlusPlus11)
326 return true;
327 if (IsExtension)
328 *IsExtension = true;
329 }
331 return true;
333 if (Context.getLangOpts().CPlusPlus11)
334 return true;
335 if (IsExtension)
336 *IsExtension = true;
337 }
338 if (auto *TD = dyn_cast(SD)) {
339 if (TD->isDependentType())
340 return true;
342 ->isDependentType()) {
343 return true;
344 }
345
346 return false;
347}
348
350 if (!S)
351 return nullptr;
352
355 if ((NNS = T->getPrefix()))
356 continue;
357
358 const auto *DNT = dyn_cast(T);
359 if (!DNT)
360 break;
361
365 assert(.isAmbiguous() && "Cannot handle ambiguities here yet");
366
367 if (.isSingleResult())
368 return nullptr;
369
373 }
374 return nullptr;
375}
376
377namespace {
378
379
380
381class NestedNameSpecifierValidatorCCC final
383public:
384 explicit NestedNameSpecifierValidatorCCC(Sema &SRef)
385 : SRef(SRef) {}
386
387 bool ValidateCandidate(const TypoCorrection &candidate) override {
389 }
390
391 std::unique_ptr clone() override {
392 return std::make_unique(*this);
393 }
394
395 private:
396 Sema &SRef;
397};
398
399}
400
407 if (const auto *USD = dyn_cast(ND)) {
409 USD);
412 } else if (const auto *TD = dyn_cast(ND)) {
414 TD);
415 switch (T->getTypeClass()) {
416 case Type::Record:
417 case Type::InjectedClassName:
418 case Type::Enum: {
422 TTL.setNameLoc(NameLoc);
423 break;
424 }
425 case Type::Typedef:
428 NameLoc);
429 break;
430 case Type::UnresolvedUsing:
434 break;
435 default:
439 break;
440 }
441 } else {
442 return false;
443 }
446 return true;
447}
448
452 bool ErrorRecoveryLookup,
453 bool *IsCorrectedToColon,
454 bool OnlyNamespace) {
456 return true;
461
462
464 bool isDependent = false;
465 if (IsCorrectedToColon)
466 *IsCorrectedToColon = false;
467 if (!ObjectType.isNull()) {
468
469
470 assert(!SS.isSet() && "ObjectType and scope specifier cannot coexist");
473 } else if (SS.isSet()) {
474
475
479 }
480
481 bool ObjectTypeSearchedInScope = false;
482 if (LookupCtx) {
483
484
485
486
487
488
491 return true;
492
494
495 if (!ObjectType.isNull() && Found.empty()) {
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516 if (S)
518 else if (ScopeLookupResult)
519 Found.addDecl(ScopeLookupResult);
520
521 ObjectTypeSearchedInScope = true;
522 }
523 } else if (!isDependent) {
524
526 }
527
528 if (Found.isAmbiguous())
529 return true;
530
531
532
533 if (Found.empty() && isDependent &&
534 !(LookupCtx && LookupCtx->isRecord() &&
537
538 if (ErrorRecoveryLookup)
539 return true;
540
541
542
543
544
545
547
554
557 return false;
558 }
559
560 if (Found.empty() && !ErrorRecoveryLookup) {
561
562
564 if (LookupCtx)
566 else if (S && !isDependent)
568 if (!R.empty()) {
569
571
572
573 if (IsCorrectedToColon) {
574 *IsCorrectedToColon = true;
575 Diag(IdInfo.CCLoc, diag::err_nested_name_spec_is_not_class)
579 Diag(ND->getLocation(), diag::note_declared_at);
580 return true;
581 }
582
584 ? unsigned(diag::err_expected_namespace_name)
585 : unsigned(diag::err_expected_class_or_namespace))
588 Diag(ND->getLocation(), diag::note_entity_declared_at)
590 return true;
591 }
592 }
593
594 if (Found.empty() && !ErrorRecoveryLookup && ().MSVCCompat) {
595
596
599 NestedNameSpecifierValidatorCCC CCC(*this);
601 Found.getLookupNameInfo(), Found.getLookupKind(), S, &SS, CCC,
603 if (LookupCtx) {
604 bool DroppedSpecifier =
605 Corrected.WillReplaceSpecifier() &&
607 if (DroppedSpecifier)
610 << Name << LookupCtx << DroppedSpecifier
612 } else
613 diagnoseTypo(Corrected, PDiag(diag::err_undeclared_var_use_suggest)
614 << Name);
615
616 if (Corrected.getCorrectionSpecifier())
619
620 if (NamedDecl *ND = Corrected.getFoundDecl())
621 Found.addDecl(ND);
622 Found.setLookupName(Corrected.getCorrection());
623 } else {
625 }
626 }
627
629 Found.isSingleResult() ? Found.getRepresentativeDecl() : nullptr;
630 bool IsExtension = false;
632 if (!AcceptSpec && IsExtension) {
633 AcceptSpec = true;
635 }
636 if (AcceptSpec) {
637 if (!ObjectType.isNull() && !ObjectTypeSearchedInScope &&
639
640
641
642
643
644
645
646
647
648
650 if (S) {
655 } else
656 OuterDecl = ScopeLookupResult;
657
664 if (ErrorRecoveryLookup)
665 return true;
666
668 diag::err_nested_name_member_ref_lookup_ambiguous)
670 Diag(SD->getLocation(), diag::note_ambig_member_ref_object_type)
671 << ObjectType;
672 Diag(OuterDecl->getLocation(), diag::note_ambig_member_ref_scope);
673
674
675
676 }
677 }
678
679 if (auto *TD = dyn_cast_or_null(SD))
681
682
683
684 if (ErrorRecoveryLookup)
685 return false;
686
687
689
690 if (NamespaceDecl *Namespace = dyn_cast(SD)) {
692 return false;
693 }
694
697 return false;
698 }
699
702 Diag(IdInfo.IdentifierLoc, diag::warn_cxx98_compat_enum_nested_name_spec);
703
706 assert(IsType && "unhandled declaration kind");
707 return false;
708 }
709
710
711
712 if (ErrorRecoveryLookup)
713 return true;
714
715
716
717
718 if (Found.empty()) {
721 }
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
746 diag::ext_undeclared_unqual_id_with_dependent_base)
747 << IdInfo.Identifier << ContainingClass;
748
750
751
752
753
754
757 ContainingClass, false);
764
766
767
776 return false;
777 }
778 }
779 }
780
781 if (.empty()) {
783 if (!ND) {
784 Diag(IdInfo.IdentifierLoc, diag::err_expected_class_or_namespace)
786 return true;
787 }
791 Diag(IdInfo.IdentifierLoc, diag::err_expected_class_or_namespace)
793
794 return ->getAsCanonical();
795 }
799 SuggestedType);
800 } else {
801 Diag(IdInfo.IdentifierLoc, diag::err_expected_class_or_namespace)
804 Diag(ND->getLocation(), diag::note_entity_declared_at)
806 }
807 } else if (SS.isSet())
809 << LookupCtx << SS.getRange();
810 else
813
814 return true;
815}
816
819 bool *IsCorrectedToColon,
820 bool OnlyNamespace) {
822 return true;
823
825 nullptr, false,
826 IsCorrectedToColon, OnlyNamespace);
827}
828
833 return true;
834
836
838 if (T.isNull())
839 return true;
840
841 if (->isDependentType() &&
(T.getCanonicalType())) {
844 return true;
845 }
846
848
854 return false;
855}
856
862 return true;
863
865
866 if (Type.isNull())
867 return true;
868
870
878 return false;
879}
880
883 bool EnteringContext) {
885 return false;
886
888 nullptr, true);
889}
890
900 bool EnteringContext) {
902 return true;
903
904
907
908
909
912 TemplateArgs, S, true);
913 if (T.isNull())
914 return true;
915
916
917
918 if (->isDependentType() &&
(T.getCanonicalType())) {
919 Diag(TemplateNameLoc, diag::err_nested_name_spec_non_tag) << T;
921 return true;
922 }
923
924
929 TemplateArgs);
930
933 return false;
934}
935
936namespace {
937
938
939 struct NestedNameSpecifierAnnotation {
941 };
942}
943
946 return nullptr;
947
948 void *Mem = Context.Allocate(
949 (sizeof(NestedNameSpecifierAnnotation) + SS.location_size()),
950 alignof(NestedNameSpecifierAnnotation));
951 NestedNameSpecifierAnnotation *Annotation
952 = new (Mem) NestedNameSpecifierAnnotation;
955 return Annotation;
956}
957
961 if (!AnnotationPtr) {
963 return;
964 }
965
966 NestedNameSpecifierAnnotation *Annotation
967 = static_cast<NestedNameSpecifierAnnotation *>(AnnotationPtr);
969}
970
972 assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
973
974
975
977 return false;
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
996
997
998 return CurContext->getRedeclContext()->isFileContext();
999
1002
1003 return true;
1004
1006 llvm_unreachable("unexpected null nested name specifier");
1007 }
1008
1009 llvm_unreachable("Invalid NestedNameSpecifier::Kind!");
1010}
1011
1013 assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
1014
1015 if (SS.isInvalid()) return true;
1016
1018 if (!DC) return true;
1019
1020
1021
1023 return true;
1024
1026
1027
1030
1031 return false;
1032}
1033
1035 assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
1037 return;
1039 "exiting declarator scope we never really entered");
1041}
Defines the clang::ASTContext interface.
This file defines the classes used to store parsed information about declaration-specifiers and decla...
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
llvm::MachO::Record Record
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
static CXXRecordDecl * getCurrentInstantiationOf(QualType T, DeclContext *CurContext)
Find the current instantiation that associated with the given type.
Definition SemaCXXScopeSpec.cpp:26
static bool ExtendNestedNameSpecifier(Sema &S, CXXScopeSpec &SS, const NamedDecl *ND, SourceLocation NameLoc, SourceLocation CCLoc)
Definition SemaCXXScopeSpec.cpp:401
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
QualType getUsingType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const UsingShadowDecl *D, QualType UnderlyingType=QualType()) const
QualType getTypeDeclType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypeDecl *Decl) const
Represents a static or instance method of a struct/union/class.
Represents a C++ struct/union/class.
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation.
unsigned getNumBases() const
Retrieves the number of base classes of this class.
bool hasDefinition() const
Represents a C++ nested-name-specifier or a global scope specifier.
void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc)
Make a nested-name-specifier of the form 'type::'.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
bool isSet() const
Deprecated.
ArrayRef< TemplateParameterList * > getTemplateParamLists() const
NestedNameSpecifier getScopeRep() const
Retrieve the representation of the nested-name-specifier.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
void SetInvalid(SourceRange R)
Indicate that this nested-name-specifier is invalid.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void Extend(ASTContext &Context, NamespaceBaseDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'name...
bool isInvalid() const
An error occurred during parsing of the scope specifier.
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isEmpty() const
No scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Declaration of a class template.
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
bool isFunctionOrMethod() const
Captures information about "declaration specifiers".
TST getTypeSpecType() const
SourceLocation getBeginLoc() const LLVM_READONLY
static const TST TST_typename_pack_indexing
SourceLocation getEllipsisLoc() const
Expr * getRepAsExpr() const
static const TST TST_decltype
SourceLocation getTypeSpecTypeLoc() const
static const TST TST_error
SourceRange getTypeofParensRange() const
SourceLocation getLocation() const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
std::string getAsString() const
Retrieve the human-readable string for this name.
void setRParenLoc(SourceLocation Loc)
void setDecltypeLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization,...
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
EnumDecl * getDefinition() const
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
bool isEditorPlaceholder() const
Return true if this identifier is an editor placeholder.
Represents the results of name lookup.
DeclClass * getAsSingle() const
bool empty() const
Return true if no decls were found.
SourceLocation getNameLoc() const
Gets the location of the identifier.
void suppressDiagnostics()
Suppress the diagnostics that would normally fire because of this lookup.
Provides information a specialization of a member of a class template, which may be a member function...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Represents a C++ namespace alias.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector::".
CXXRecordDecl * getAsMicrosoftSuper() const
NamespaceAndPrefix getAsNamespaceAndPrefix() const
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
const Type * getAsType() const
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
void setEllipsisLoc(SourceLocation Loc)
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Scope - A scope is a transient data structure that is used while parsing the program.
const Scope * getParent() const
getParent - Return the scope that this is nested in.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Sema - This implements semantic analysis and AST building for C.
bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a reachable definition.
Scope * getCurScope() const
Retrieve the parser's current scope.
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupNestedNameSpecifierName
Look up of a name that precedes the '::' scope resolution operator in C++.
@ LookupNamespaceName
Look up a namespace name within a C++ using directive or namespace alias definition,...
void NoteAllFoundTemplates(TemplateName Name)
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
Definition SemaCXXScopeSpec.cpp:178
bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc)
Definition SemaCXXScopeSpec.cpp:829
ASTContext & getASTContext() const
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
void * SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS)
Given a C++ nested-name-specifier, produce an annotation value that the parser can use later to recon...
Definition SemaCXXScopeSpec.cpp:944
bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS)
bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS)
The parser has parsed a global nested-name-specifier '::'.
Definition SemaCXXScopeSpec.cpp:266
bool ActOnCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
The parser has parsed a nested-name-specifier 'identifier::'.
Definition SemaCXXScopeSpec.cpp:817
const LangOptions & getLangOpts() const
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...
NamedDecl * FindFirstQualifierInScope(Scope *S, NestedNameSpecifier NNS)
If the given nested-name-specifier begins with a bare identifier (e.g., Base::), perform name lookup ...
Definition SemaCXXScopeSpec.cpp:349
void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
ActOnCXXExitDeclaratorScope - Called when a declarator that previously invoked ActOnCXXEnterDeclarato...
Definition SemaCXXScopeSpec.cpp:1034
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
Definition SemaCXXScopeSpec.cpp:971
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
CXXRecordDecl * getCurrentInstantiationOf(NestedNameSpecifier NNS)
If the given nested name specifier refers to the current instantiation, return the declaration that c...
Definition SemaCXXScopeSpec.cpp:158
bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc, SourceLocation ColonColonLoc, CXXScopeSpec &SS)
The parser has parsed a '__super' nested-name-specifier.
Definition SemaCXXScopeSpec.cpp:272
bool RequireCompleteEnumDecl(EnumDecl *D, SourceLocation L, CXXScopeSpec *SS=nullptr)
Require that the EnumDecl is completed with its enumerators defined or instantiated.
Definition SemaCXXScopeSpec.cpp:220
void ExitDeclaratorContext(Scope *S)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(const NamedDecl *D, const DeclContext *DC=nullptr, bool Final=false, std::optional< ArrayRef< TemplateArgument > > Innermost=std::nullopt, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr, bool ForConstraintInstantiation=false, bool SkipForSpecialization=false, bool ForDefaultArgumentSubstitution=false)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
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.
Definition SemaCXXScopeSpec.cpp:449
void RestoreNestedNameSpecifierAnnotation(void *Annotation, SourceRange AnnotationRange, CXXScopeSpec &SS)
Given an annotation pointer for a nested-name-specifier, restore the nested-name-specifier structure.
Definition SemaCXXScopeSpec.cpp:958
void EnterDeclaratorContext(Scope *S, DeclContext *DC)
EnterDeclaratorContext - Used when we must lookup names in the context of a declarator's nested name ...
bool ActOnCXXNestedNameSpecifierIndexedPack(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc, QualType Type)
Definition SemaCXXScopeSpec.cpp:857
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
Definition SemaCXXScopeSpec.cpp:41
void diagnoseMissingImport(SourceLocation Loc, const 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...
bool isSFINAEContext() const
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
QualType CheckTemplateIdType(ElaboratedTypeKeyword Keyword, TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, Scope *Scope, bool ForNestedNameSpecifier)
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...
Definition SemaCXXScopeSpec.cpp:305
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...
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
Definition SemaCXXScopeSpec.cpp:151
bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS)
ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global scope or nested-name-specifi...
Definition SemaCXXScopeSpec.cpp:1012
bool InstantiateEnum(SourceLocation PointOfInstantiation, EnumDecl *Instantiation, EnumDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiate the definition of an enum from a given pattern.
OpaquePtr< TemplateName > TemplateTy
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo, bool EnteringContext)
IsInvalidUnlessNestedName - This method is used for error recovery purposes to determine whether the ...
Definition SemaCXXScopeSpec.cpp:881
void DiagnoseUnknownTypeName(IdentifierInfo *&II, SourceLocation IILoc, Scope *S, CXXScopeSpec *SS, ParsedType &SuggestedType, bool IsTemplateName=false)
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Represents the declaration of a struct/union/class/enum.
bool isBeingDefined() const
Return true if this decl is currently being defined.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
TagDecl * getDefinitionOrSelf() const
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void clear()
Resets this builder to the newly-initialized state.
TypeSpecTypeLoc pushTypeSpec(QualType T)
Pushes space for a typespec TypeLoc.
void pushTrivial(ASTContext &Context, QualType T, SourceLocation Loc)
Pushes 'T' with all locations pointing to 'Loc'.
void setNameLoc(SourceLocation Loc)
The base class of the type hierarchy.
TagDecl * castAsTagDecl() const
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
Simple class containing the result of Sema::CorrectTypo.
NamedDecl * getCorrectionDecl() const
Gets the pointer to the declaration of the typo correction.
Wrapper for source info for unresolved typename using decls.
Wrapper for source info for types used via transparent aliases.
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
bool isa(CodeGen::Address addr)
@ Result
The result type of a method or function.
const FunctionProtoType * T
MutableArrayRef< ParsedTemplateArgument > ASTTemplateArgsPtr
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
U cast(CodeGen::Address addr)
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
@ None
No keyword precedes the qualified type name.
Keeps information about an identifier in a nested-name-spec.
IdentifierInfo * Identifier
The identifier preceding the '::'.
SourceLocation IdentifierLoc
The location of the identifier.
SourceLocation CCLoc
The location of the '::'.
ParsedType ObjectType
The type of the object, if we're parsing nested-name-specifier in a member access expression.