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

32 if (const RecordType *RecordTy = dyn_cast(Ty)) {

34 if (Record->isDependentContext() ||

35 Record->isCurrentInstantiation(CurContext))

37

38 return nullptr;

39 } else if (isa(Ty))

40 return cast(Ty)->getDecl();

41 else

42 return nullptr;

43}

44

48 return Tag->getDecl();

49

50 return ::getCurrentInstantiationOf(T, CurContext);

51}

52

54 bool EnteringContext) {

56 return nullptr;

57

60

61

64

65 if (EnteringContext) {

67 if (!NNSType) {

68 return nullptr;

69 }

70

71

75

76

77

79 = dyn_cast_or_null(

80 SpecType->getTemplateName().getAsTemplateDecl())) {

83

84

85

86

87

88

92 if (!TemplateParamLists.empty()) {

93 unsigned Depth = ClassTemplate->getTemplateParameters()->getDepth();

94 auto L = find_if(TemplateParamLists,

96 return TPL->getDepth() == Depth;

97 });

98 if (L != TemplateParamLists.end()) {

99 void *Pos = nullptr;

100 PartialSpec = ClassTemplate->findPartialSpecialization(

101 SpecType->template_arguments(), *L, Pos);

102 }

103 } else {

105 }

106

107 if (PartialSpec) {

108

109

110

111 assert(isSFINAEContext() && "partial specialization scope "

112 "specifier in SFINAE context?");

117 true);

118 return PartialSpec;

119 }

120

121

122

123

125 ClassTemplate->getInjectedClassNameSpecialization();

128 }

130

131 return RecordT->getDecl();

132 }

133 }

134

135 return nullptr;

136 }

137

138 switch (NNS->getKind()) {

140 llvm_unreachable("Dependent nested-name-specifier has no DeclContext");

141

144

147

151 assert(Tag && "Non-tag type in nested-name-specifier");

152 return Tag->getDecl();

153 }

154

157

160 }

161

162 llvm_unreachable("Invalid NestedNameSpecifier::Kind!");

163}

164

167 return false;

168

170}

171

174 assert(NNS->isDependent() && "Only dependent nested-name-specifier allowed");

175

177 return nullptr;

178

180 return ::getCurrentInstantiationOf(T, CurContext);

181}

182

183

184

185

186

187

188

189

190

191

194 assert(DC && "given null context");

195

196 TagDecl *tag = dyn_cast(DC);

197

198

199

200

202 return false;

203

204

206 tag = type->getAsTagDecl();

207

208

209

211 return false;

212

215

216

220 return true;

221 }

222

223 if (auto *EnumD = dyn_cast(tag))

224

225

227

228 return false;

229}

230

231

232

233

237

238 NamedDecl *SuggestedDef = nullptr;

240 false)) {

241

242

245 TreatAsComplete);

246 return !TreatAsComplete;

247 }

248 return false;

249 }

250

251

252

259 if (SS)

261 return true;

262 }

263 return false;

264 }

265 }

266

267 if (SS) {

268 Diag(L, diag::err_incomplete_nested_name_spec)

271 } else {

274 }

275

276 return true;

277}

278

282 return false;

283}

284

289 Diag(SuperLoc, diag::err_super_in_lambda_unsupported);

290 return true;

291 }

292

295 if (S->isFunctionScope()) {

296 if (CXXMethodDecl *MD = dyn_cast(S->getEntity()))

298 break;

299 }

300 if (S->isClassScope()) {

301 RD = cast(S->getEntity());

302 break;

303 }

304 }

305

306 if (!RD) {

307 Diag(SuperLoc, diag::err_invalid_super_scope);

308 return true;

310 Diag(SuperLoc, diag::err_no_base_classes) << RD->getName();

311 return true;

312 }

313

315 return false;

316}

317

319 bool *IsExtension) {

320 if (!SD)

321 return false;

322

324

325

326 if (isa(SD))

327 return true;

328

329 if (!isa(SD))

330 return false;

331

332

333

336 return true;

337 if (const TypedefNameDecl *TD = dyn_cast(SD)) {

338 if (TD->getUnderlyingType()->isRecordType())

339 return true;

340 if (TD->getUnderlyingType()->isEnumeralType()) {

342 return true;

343 if (IsExtension)

344 *IsExtension = true;

345 }

346 } else if (isa(SD)) {

347 return true;

348 } else if (isa(SD)) {

350 return true;

351 if (IsExtension)

352 *IsExtension = true;

353 }

354

355 return false;

356}

357

359 if (!S || !NNS)

360 return nullptr;

361

364

366 return nullptr;

367

371 assert(Found.isAmbiguous() && "Cannot handle ambiguities here yet");

372

373 if (Found.isSingleResult())

374 return nullptr;

375

379

380 return nullptr;

381}

382

383namespace {

384

385

386

387class NestedNameSpecifierValidatorCCC final

389public:

390 explicit NestedNameSpecifierValidatorCCC(Sema &SRef)

391 : SRef(SRef) {}

392

393 bool ValidateCandidate(const TypoCorrection &candidate) override {

395 }

396

397 std::unique_ptr clone() override {

398 return std::make_unique(*this);

399 }

400

401 private:

403};

404

405}

406

410 bool ErrorRecoveryLookup,

411 bool *IsCorrectedToColon,

412 bool OnlyNamespace) {

414 return true;

419

420

422 bool isDependent = false;

423 if (IsCorrectedToColon)

424 *IsCorrectedToColon = false;

425 if (!ObjectType.isNull()) {

426

427

428 assert(!SS.isSet() && "ObjectType and scope specifier cannot coexist");

431 } else if (SS.isSet()) {

432

433

437 }

438

439 bool ObjectTypeSearchedInScope = false;

440 if (LookupCtx) {

441

442

443

444

445

446

449 return true;

450

452

453 if (!ObjectType.isNull() && Found.empty()) {

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474 if (S)

476 else if (ScopeLookupResult)

477 Found.addDecl(ScopeLookupResult);

478

479 ObjectTypeSearchedInScope = true;

480 }

481 } else if (!isDependent) {

482

484 }

485

486 if (Found.isAmbiguous())

487 return true;

488

489

490

491 if (Found.empty() && isDependent &&

492 !(LookupCtx && LookupCtx->isRecord() &&

493 (!cast(LookupCtx)->hasDefinition() ||

494 !cast(LookupCtx)->hasAnyDependentBases()))) {

495

496 if (ErrorRecoveryLookup)

497 return true;

498

499

500

501

502

504 return false;

505 }

506

507 if (Found.empty() && !ErrorRecoveryLookup) {

508

509

511 if (LookupCtx)

513 else if (S && !isDependent)

515 if (!R.empty()) {

516

518

519

520 if (IsCorrectedToColon) {

521 *IsCorrectedToColon = true;

522 Diag(IdInfo.CCLoc, diag::err_nested_name_spec_is_not_class)

526 Diag(ND->getLocation(), diag::note_declared_at);

527 return true;

528 }

529

531 ? unsigned(diag::err_expected_namespace_name)

532 : unsigned(diag::err_expected_class_or_namespace))

535 Diag(ND->getLocation(), diag::note_entity_declared_at)

537 return true;

538 }

539 }

540

541 if (Found.empty() && !ErrorRecoveryLookup && getLangOpts().MSVCCompat) {

542

543

546 NestedNameSpecifierValidatorCCC CCC(*this);

548 Found.getLookupNameInfo(), Found.getLookupKind(), S, &SS, CCC,

550 if (LookupCtx) {

551 bool DroppedSpecifier =

552 Corrected.WillReplaceSpecifier() &&

553 Name.getAsString() == Corrected.getAsString(getLangOpts());

554 if (DroppedSpecifier)

557 << Name << LookupCtx << DroppedSpecifier

559 } else

560 diagnoseTypo(Corrected, PDiag(diag::err_undeclared_var_use_suggest)

561 << Name);

562

563 if (Corrected.getCorrectionSpecifier())

566

567 if (NamedDecl *ND = Corrected.getFoundDecl())

568 Found.addDecl(ND);

569 Found.setLookupName(Corrected.getCorrection());

570 } else {

572 }

573 }

574

576 Found.isSingleResult() ? Found.getRepresentativeDecl() : nullptr;

577 bool IsExtension = false;

579 if (!AcceptSpec && IsExtension) {

580 AcceptSpec = true;

582 }

583 if (AcceptSpec) {

584 if (!ObjectType.isNull() && !ObjectTypeSearchedInScope &&

586

587

588

589

590

591

592

593

594

595

597 if (S) {

602 } else

603 OuterDecl = ScopeLookupResult;

604

607 (!isa(OuterDecl) || !isa(SD) ||

611 if (ErrorRecoveryLookup)

612 return true;

613

615 diag::err_nested_name_member_ref_lookup_ambiguous)

617 Diag(SD->getLocation(), diag::note_ambig_member_ref_object_type)

618 << ObjectType;

619 Diag(OuterDecl->getLocation(), diag::note_ambig_member_ref_scope);

620

621

622

623 }

624 }

625

626 if (auto *TD = dyn_cast_or_null(SD))

628

629

630

631 if (ErrorRecoveryLookup)

632 return false;

633

634

636

637 if (NamespaceDecl *Namespace = dyn_cast(SD)) {

639 return false;

640 }

641

644 return false;

645 }

646

649

651 Diag(IdInfo.IdentifierLoc, diag::warn_cxx98_compat_enum_nested_name_spec);

652

654 if (const auto *USD = dyn_cast(SD)) {

657 } else if (isa(T)) {

661 } else if (isa(T)) {

664 } else if (isa(T)) {

667 } else if (isa(T)) {

670 } else if (isa(T)) {

674 } else if (isa(T)) {

678 } else if (isa(T)) {

682 } else if (isa(T)) {

686 } else {

687 llvm_unreachable("Unhandled TypeDecl node in nested-name-specifier");

688 }

689

692 return false;

693 }

694

695

696

697 if (ErrorRecoveryLookup)

698 return true;

699

700

701

702

703 if (Found.empty()) {

706 }

707

708

709

710

711

712

713

714

715

716

717

718

719

720

721

722

723

724

731 diag::ext_undeclared_unqual_id_with_dependent_base)

732 << IdInfo.Identifier << ContainingClass;

733

734

740

743 return false;

744 }

745 }

746 }

747

748 if (Found.empty()) {

750 Diag(IdInfo.IdentifierLoc, diag::err_expected_class_or_namespace)

755 SuggestedType);

756 } else {

757 Diag(IdInfo.IdentifierLoc, diag::err_expected_class_or_namespace)

760 Diag(ND->getLocation(), diag::note_entity_declared_at)

762 }

763 } else if (SS.isSet())

765 << LookupCtx << SS.getRange();

766 else

769

770 return true;

771}

772

775 bool *IsCorrectedToColon,

776 bool OnlyNamespace) {

778 return true;

779

781 nullptr, false,

782 IsCorrectedToColon, OnlyNamespace);

783}

784

789 return true;

790

792

794 if (T.isNull())

795 return true;

796

800 return true;

801 }

802

808 ColonColonLoc);

809 return false;

810}

811

817 return true;

818

820

821 if (Type.isNull())

822 return true;

823

826 cast(Type.getTypePtr())->getPattern(),

831 ColonColonLoc);

832 return false;

833}

834

837 bool EnteringContext) {

839 return false;

840

842 nullptr, true);

843}

844

854 bool EnteringContext) {

856 return true;

857

859

860

863

866

867

872

873

883 for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)

884 SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());

885

887 CCLoc);

888 return false;

889 }

890

891

892

895 return true;

896

899 isa(TD) || isa(TD)) {

900 SourceRange R(TemplateNameLoc, RAngleLoc);

903

904 Diag(CCLoc, diag::err_non_type_template_in_nested_name_specifier)

905 << isa_and_nonnull(TD) << Template << R;

907 return true;

908 }

909

910

911

913 if (T.isNull())

914 return true;

915

916

917

919 Diag(TemplateNameLoc, diag::err_nested_name_spec_non_tag) << T;

921 return true;

922 }

923

924

932 for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)

933 SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());

934

935

937 CCLoc);

938 return false;

939}

940

941namespace {

942

943

944 struct NestedNameSpecifierAnnotation {

946 };

947}

948

951 return nullptr;

952

954 (sizeof(NestedNameSpecifierAnnotation) + SS.location_size()),

955 alignof(NestedNameSpecifierAnnotation));

956 NestedNameSpecifierAnnotation *Annotation

957 = new (Mem) NestedNameSpecifierAnnotation;

960 return Annotation;

961}

962

966 if (!AnnotationPtr) {

968 return;

969 }

970

971 NestedNameSpecifierAnnotation *Annotation

972 = static_cast<NestedNameSpecifierAnnotation *>(AnnotationPtr);

974}

975

977 assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");

978

979

980

982 return false;

983

985

986

987

988

989

990

991

992

993

994

995

996

997

998

999

1000 switch (Qualifier->getKind()) {

1004

1005

1007

1012

1013 return true;

1014 }

1015

1016 llvm_unreachable("Invalid NestedNameSpecifier::Kind!");

1017}

1018

1020 assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");

1021

1022 if (SS.isInvalid()) return true;

1023

1025 if (!DC) return true;

1026

1027

1028

1030 return true;

1031

1033

1034

1037

1038 return false;

1039}

1040

1042 assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");

1044 return;

1046 "exiting declarator scope we never really entered");

1048}

Defines the clang::ASTContext interface.

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.

enum clang::format::@1336::AnnotatingParser::Context::@353 ContextType

__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)

QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const

TranslationUnitDecl * getTranslationUnitDecl() const

QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgumentLoc > Args) const

CanQualType getCanonicalType(QualType T) const

Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...

bool hasSameType(QualType T1, QualType T2) const

Determine whether the given types T1 and T2 are equivalent.

QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const

Return the unique reference to the type for the specified type declaration.

const LangOptions & getLangOpts() const

void * Allocate(size_t Size, unsigned Align=8) 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.

char * location_data() const

Retrieve the data associated with the source-location information.

void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)

Make a new nested-name-specifier from incomplete source-location information.

SourceLocation getLastQualifierNameLoc() const

Retrieve the location of the name in the last qualifier in this nested name specifier.

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

NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const

Retrieve a nested-name-specifier with location information, copied into the given AST context.

NestedNameSpecifier * getScopeRep() const

Retrieve the representation of the nested-name-specifier.

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 MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)

Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.

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 isInvalid() const

An error occurred during parsing of the scope 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 isFileContext() const

bool isDependentContext() const

Determines whether this context is dependent on a template parameter.

DeclContext * getRedeclContext()

getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...

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.

void setRParenLoc(SourceLocation Loc)

void setDecltypeLoc(SourceLocation Loc)

Represents a dependent template name that cannot be resolved prior to template instantiation.

bool isIdentifier() const

Determine whether this template name refers to an identifier.

NestedNameSpecifier * getQualifier() const

Return the nested name specifier that qualifies this name.

const IdentifierInfo * getIdentifier() const

Returns the identifier to which this template name refers.

void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)

void setTemplateKeywordLoc(SourceLocation Loc)

void setElaboratedKeywordLoc(SourceLocation Loc)

void setRAngleLoc(SourceLocation Loc)

void setLAngleLoc(SourceLocation Loc)

void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)

void setTemplateNameLoc(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...

Wrapper for source info for enum types.

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.

Wrapper for source info for injected class names of class templates.

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.

NamespaceDecl * getNamespace()

Retrieve the namespace declaration aliased by this directive.

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 * getAsRecordDecl() const

Retrieve the record declaration stored in this nested name specifier.

bool isDependent() const

Whether this nested name specifier refers to a dependent type or not.

SpecifierKind getKind() const

Determine what kind of nested name specifier is stored.

NamespaceAliasDecl * getAsNamespaceAlias() const

Retrieve the namespace alias stored in this nested name specifier.

IdentifierInfo * getAsIdentifier() const

Retrieve the identifier stored in this nested name specifier.

NestedNameSpecifier * getPrefix() const

Return the prefix of this nested name specifier.

@ NamespaceAlias

A namespace alias, stored as a NamespaceAliasDecl*.

@ TypeSpec

A type, stored as a Type*.

@ TypeSpecWithTemplate

A type that was preceded by the 'template' keyword, stored as a Type*.

@ Super

Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.

@ Identifier

An identifier, stored as an IdentifierInfo*.

@ Global

The global specifier '::'. There is no stored value.

@ Namespace

A namespace, stored as a NamespaceDecl*.

NamespaceDecl * getAsNamespace() const

Retrieve the namespace stored in this nested name specifier.

const Type * getAsType() const

Retrieve the type stored in this nested name specifier.

void setEllipsisLoc(SourceLocation Loc)

A (possibly-)qualified type.

bool isNull() const

Return true if this QualType doesn't point to a type yet.

const Type * getTypePtr() const

Retrieves a pointer to the underlying (unqualified) type.

Wrapper for source info for record types.

A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...

Scope - A scope is a transient data structure that is used while parsing the program.

SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)

Emit a diagnostic.

PartialDiagnostic PDiag(unsigned DiagID=0)

Build a partial 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.

NamedDecl * FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS)

If the given nested-name-specifier begins with a bare identifier (e.g., Base::), perform name lookup ...

@ 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.

bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc)

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...

bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS)

bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS)

The parser has parsed a global nested-name-specifier '::'.

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::'.

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...

void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS)

ActOnCXXExitDeclaratorScope - Called when a declarator that previously invoked ActOnCXXEnterDeclarato...

sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)

Retrieve the current lambda scope info, if any.

bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS)

void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)

Perform marking for a reference to an arbitrary declaration.

bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc, SourceLocation ColonColonLoc, CXXScopeSpec &SS)

The parser has parsed a '__super' nested-name-specifier.

bool RequireCompleteEnumDecl(EnumDecl *D, SourceLocation L, CXXScopeSpec *SS=nullptr)

Require that the EnumDecl is completed with its enumerators defined or instantiated.

void ExitDeclaratorContext(Scope *S)

CXXRecordDecl * getCurrentInstantiationOf(NestedNameSpecifier *NNS)

If the given nested name specifier refers to the current instantiation, return the declaration that c...

std::optional< sema::TemplateDeductionInfo * > isSFINAEContext() const

Determines whether we are currently in a context where template argument substitution failures are no...

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.

void RestoreNestedNameSpecifierAnnotation(void *Annotation, SourceRange AnnotationRange, CXXScopeSpec &SS)

Given an annotation pointer for a nested-name-specifier, restore the nested-name-specifier structure.

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)

DeclContext * computeDeclContext(QualType T)

Compute the DeclContext that is associated with the given type.

QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)

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 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.

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...

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)

bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS)

ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global scope or nested-name-specifi...

bool resolveAssumedTemplateNameAsType(Scope *S, TemplateName &Name, SourceLocation NameLoc, bool Diagnose=true)

bool InstantiateEnum(SourceLocation PointOfInstantiation, EnumDecl *Instantiation, EnumDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)

Instantiate the definition of an enum from a given pattern.

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 ...

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.

void setBegin(SourceLocation b)

SourceLocation getEnd() const

SourceLocation getBegin() const

Wrapper for substituted template type parameters.

Wrapper for substituted template type parameters.

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.

A convenient class for passing around template argument information.

llvm::ArrayRef< TemplateArgumentLoc > arguments() const

The base class of all kinds of template declarations (e.g., class, function, etc.).

Represents a C++ template name within the type system.

TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const

Retrieve the underlying template declaration that this template name refers to, if known.

DependentTemplateName * getAsDependentTemplateName() const

Retrieve the underlying dependent template name structure, if any.

OverloadedTemplateStorage * getAsOverloadedTemplate() const

Retrieve the underlying, overloaded function template declarations that this template name refers to,...

AssumedTemplateStorage * getAsAssumedTemplateName() const

Retrieve information on a name that has been assumed to be a template-name in order to permit a call ...

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.

void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)

void setTemplateKeywordLoc(SourceLocation Loc)

void setTemplateNameLoc(SourceLocation Loc)

void setLAngleLoc(SourceLocation Loc)

void setRAngleLoc(SourceLocation Loc)

Represents a type template specialization; the template must be a class template, a type alias templa...

Wrapper for template type parameters.

Represents a declaration of a type.

const Type * getTypeForDecl() const

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.

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.

bool isEnumeralType() const

bool isDependentType() const

Whether this type is a dependent type, meaning that its definition somehow depends on a template para...

QualType getCanonicalTypeInternal() const

const T * getAs() const

Member-template getAs'.

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.

const internal::VariadicAllOfMatcher< Type > type

Matches Types in the clang AST.

The JSON file list parser is used to communicate input to InstallAPI.

@ Result

The result type of a method or function.

const FunctionProtoType * T

@ 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.

@ 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.