clang: include/clang/Sema/CodeCompleteConsumer.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H

14#define LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H

15

22#include "llvm/ADT/ArrayRef.h"

23#include "llvm/ADT/DenseMap.h"

24#include "llvm/ADT/SmallPtrSet.h"

25#include "llvm/ADT/SmallVector.h"

26#include "llvm/ADT/StringRef.h"

27#include "llvm/Support/Allocator.h"

28#include "llvm/Support/type_traits.h"

29#include

30#include

31#include

32#include

33#include

34

36

37class ASTContext;

39class DeclContext;

40class FunctionDecl;

41class FunctionTemplateDecl;

42class IdentifierInfo;

43class LangOptions;

44class NamedDecl;

45class NestedNameSpecifier;

46class Preprocessor;

47class RawComment;

48class Sema;

49class UsingShadowDecl;

50

51

52

53enum {

54

55

57

58

59

61

62

64

65

67

68

69

71

72

73

75

76

78

79

81

82

84

85

87

88

90

91

93

94

95

97

98

101

102

103

104enum {

105

107

108

109

111

112

113

114

116

117

118

120

121

122

124

125

127

128

129

132

133

134

135enum {

136

137

139

140

141

142

145

146

147

159

160

162

163

164

166

167

168

169

170

171

172

173

174

175

177 const LangOptions &LangOpts,

178 bool PreferredTypeIsPointer = false);

179

180

181

183

184

185

187public:

189

191

192

193

195

196

197

199

200

201

203

204

205

207

208

209

211

212

214

215

216

218

219

221

222

223

225

226

227

228

229

230

231

233

234

235

236

237

238

239

241

242

243

244

245

246

247

249

250

251

253

254

255

257

258

259

261

262

264

265

266

268

269

271

272

274

275

276

278

279

280

282

283

285

286

287

289

290

292

293

294

296

297

298

299

300

301

303

304

306

307

309

310

311

313

314

315

317

318

320

321

322

324

325

327

328

330

331

333

334

335

337

338

340

341

342

343

345 };

346

348

349private:

351

352

353

354

355 bool IsUsingDeclaration;

356

357

358

360

361

363

364

366

367

368

369 std::optional ScopeSpecifier;

370

371

372

374

375public:

376

378 : CCKind(CCKind), IsUsingDeclaration(false), SelIdents() {}

379

380

383 : CCKind(CCKind), IsUsingDeclaration(false), SelIdents(SelIdents) {

387 BaseType = T;

388 else

389 PreferredType = T;

390 }

391

394

395

397

398

399

400

403

404

405

407

408

410

411

412

414

415

416

417

419 this->ScopeSpecifier = std::move(SS);

420 }

421

422

424 VisitedContexts.insert(Ctx);

425 }

426

427

429 return VisitedContexts;

430 }

431

433 if (ScopeSpecifier)

434 return &*ScopeSpecifier;

435 return std::nullopt;

436 }

437};

438

439

441

442

443

444

445

446

447

448

450public:

451

452

454

455

456

458

459

460

462

463

464

465

467

468

469

471

472

473

475

476

478

479

480

481

483

484

486

487

489

490

492

493

495

496

498

499

501

502

504

505

507

508

510

511

513

514

516

517

519

520

522

523

524

527

528

530

531

533

534 union {

535

536

537

538

540

541

542

543

545 };

546

548

550

551

553

554

556

557

559

560

562

563

565

566

568 };

569

570private:

573

574

575 unsigned NumChunks : 16;

576

577

578 unsigned NumAnnotations : 16;

579

580

582

583

585 unsigned Availability : 2;

586

587

588 StringRef ParentName;

589

590

591

592 const char *BriefComment;

593

596 const char **Annotations, unsigned NumAnnotations,

597 StringRef ParentName,

598 const char *BriefComment);

600

601public:

604

606

609 bool empty() const { return NumChunks == 0; }

610 unsigned size() const { return NumChunks; }

611

613 assert(I < size() && "Chunk index out-of-range");

614 return begin()[I];

615 }

616

617

619

620

622

623

625

626

628

629

631

632

633 const char *getAnnotation(unsigned AnnotationNr) const;

634

635

637 return ParentName;

638 }

639

641 return BriefComment;

642 }

643

644

645

647};

648

649

651public:

652

653 const char *CopyString(const Twine &String);

654};

655

656

658

660 llvm::DenseMap<const DeclContext *, StringRef> ParentNames;

661 std::shared_ptr AllocatorRef;

662

663public:

665 std::shared_ptr Allocator)

666 : AllocatorRef(std::move(Allocator)) {}

667

668 std::shared_ptr getAllocatorRef() const {

669 return AllocatorRef;

670 }

671

673 assert(AllocatorRef);

674 return *AllocatorRef;

675 }

676

678};

679

680}

681

683

684

686public:

688

689private:

692 unsigned Priority = 0;

694 StringRef ParentName;

695 const char *BriefComment = nullptr;

696

697

699

701

702public:

705 : Allocator(Allocator), CCTUInfo(CCTUInfo) {}

706

710 : Allocator(Allocator), CCTUInfo(CCTUInfo), Priority(Priority),

711 Availability(Availability) {}

712

713

714

716

718

719

720

721

723

724

726

727

729

730

732

733

735

736

738

739

741

742

744

745

747

748 void AddAnnotation(const char *A) { Annotations.push_back(A); }

749

750

752

755

757};

758

759

761public:

762

764

766

767

769

770

772

773

776

777

778

780

781 union {

782

783

785

786

787

789

790

792 };

793

794

796

797

798

800

801

803

804

806

807

809

810

811

812

813

814

815

816

817

818

819

820

821

822

823

824

825

826

827

828

829

830

831

832

833

834

835

836

837

839

840

842

843

845

846

848

849

850

852

853

854

856

857

858

860

861

862

863

864

866

867

868

869

871

872

873

874

875

877

878

879

880

882

883

887 bool Accessible = true,

888 std::vector FixIts = std::vector())

894

895 computeCursorKindAndAvailability(Accessible);

896 }

897

898

905

906

915

916

927

928

929

936 computeCursorKindAndAvailability();

937 }

938

939

940

943 "Not a declaration or pattern result");

945 }

946

947

949 assert(Kind == RK_Keyword && "Not a keyword result");

951 }

952

953

954

955

956

957

958

959

964 bool IncludeBriefComments);

970 bool IncludeBriefComments);

971

972

973

978

983

988

989

990

991

992

994

995private:

996 void computeCursorKindAndAvailability(bool Accessible = true);

997};

998

999bool operator<(const CodeCompletionResult &X, const CodeCompletionResult &Y);

1000

1003 return Y < X;

1004}

1005

1008 return !(Y < X);

1009}

1010

1013 return !(X < Y);

1014}

1015

1016

1017

1019protected:

1021

1022public:

1024 public:

1025

1027

1029

1030

1032

1033

1034

1036

1037

1038

1040

1041

1043

1044

1046 };

1047

1048 private:

1049

1051

1052 union {

1053

1054

1056

1057

1058

1060

1061

1062

1064

1065

1066

1068

1069

1070

1072

1073

1074

1076 };

1077

1078 public:

1081 assert(Function != nullptr);

1082 }

1083

1087 }

1088

1091 assert(Type != nullptr);

1092 }

1093

1097 }

1098

1102 }

1103

1106

1107

1109

1110

1111

1113

1114

1118 }

1119

1120

1121

1123

1124

1125

1126

1128

1132 }

1133

1134

1138 }

1139

1140

1142

1143

1144

1146

1147

1148

1150

1151

1152

1157 bool IncludeBriefComments, bool Braced) const;

1158 };

1159

1162

1163

1166 }

1167

1168

1171 }

1172

1173

1175

1176

1177

1178

1181 }

1182

1183

1184

1187 }

1188

1189

1190

1192

1193

1194

1197 }

1198

1199

1201

1202

1203

1206 return false;

1207 }

1208

1209

1210

1211

1215 unsigned NumResults) {}

1216

1217

1218

1219

1220

1221

1222

1223

1224

1225

1226

1227

1230 unsigned NumCandidates,

1232 bool Braced) {}

1233

1234

1235

1236

1238

1240};

1241

1242

1243

1246

1247

1248

1251

1252

1253

1257 unsigned ArgIndex);

1258

1259

1260

1262

1263 raw_ostream &OS;

1264

1266

1267public:

1268

1269

1271 raw_ostream &OS)

1274

1275

1278 unsigned NumResults) override;

1279

1282 unsigned NumCandidates,

1284 bool Braced) override;

1285

1287

1290 }

1291

1293};

1294

1295}

1296

1297#endif

enum clang::sema::@1726::IndirectLocalPathEntry::EntryKind Kind

Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.

Defines the clang::MacroInfo and clang::MacroDirective classes.

C Language Family Type Representation.

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

Represents a C++ nested-name-specifier or a global scope specifier.

const FunctionType * Type

The function type that describes the entity being called, when Kind == CK_FunctionType.

const RecordDecl * AggregateType

The class being aggregate-initialized, when Kind == CK_Aggregate.

FunctionProtoTypeLoc ProtoTypeLoc

The location of the function prototype that describes the entity being called, when Kind == CK_Functi...

CodeCompletionString * CreateSignatureString(unsigned CurrentArg, Sema &S, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments, bool Braced) const

Create a new code-completion string that describes the function signature of this overload candidate.

QualType getParamType(unsigned N) const

Get the type of the Nth parameter.

const FunctionType * getFunctionType() const

Retrieve the function type of the entity, regardless of how the function is stored.

const TemplateDecl * getTemplate() const

CandidateKind getKind() const

Determine the kind of overload candidate.

const RecordDecl * getAggregate() const

Retrieve the aggregate type being initialized.

OverloadCandidate(FunctionTemplateDecl *FunctionTemplateDecl)

FunctionDecl * getFunction() const

Retrieve the function overload candidate or the templated function declaration for a function templat...

FunctionDecl * Function

The function overload candidate, available when Kind == CK_Function.

const FunctionProtoTypeLoc getFunctionProtoTypeLoc() const

Retrieve the function ProtoTypeLoc candidate.

CandidateKind

Describes the type of overload candidate.

@ CK_Aggregate

The candidate is aggregate initialization of a record type.

@ CK_FunctionType

The "candidate" is actually a variable, expression, or block for which we only have a function protot...

@ CK_Function

The candidate is a function declaration.

@ CK_FunctionProtoTypeLoc

The candidate is a variable or expression of function type for which we have the location of the prot...

@ CK_Template

The candidate is a template, template arguments are being completed.

@ CK_FunctionTemplate

The candidate is a function template, arguments are being completed.

OverloadCandidate(const FunctionType *Type)

OverloadCandidate(FunctionProtoTypeLoc Prototype)

FunctionTemplateDecl * FunctionTemplate

The function template overload candidate, available when Kind == CK_FunctionTemplate.

const NamedDecl * getParamDecl(unsigned N) const

Get the declaration of the Nth parameter.

unsigned getNumParams() const

Get the number of parameters in this signature.

const TemplateDecl * Template

The template overload candidate, available when Kind == CK_Template.

OverloadCandidate(const TemplateDecl *Template)

OverloadCandidate(FunctionDecl *Function)

OverloadCandidate(const RecordDecl *Aggregate)

FunctionTemplateDecl * getFunctionTemplate() const

Retrieve the function template overload candidate.

Abstract interface for a consumer of code-completion information.

CodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts)

bool includeNamespaceLevelDecls() const

Whether to include declarations in namespace contexts (including the global namespace).

bool includeMacros() const

Whether the code-completion consumer wants to see macros.

virtual ~CodeCompleteConsumer()

Deregisters and destroys this code-completion consumer.

bool includeFixIts() const

Whether to include completion items with small fix-its, e.g.

virtual CodeCompletionAllocator & getAllocator()=0

Retrieve the allocator that will be used to allocate code completion strings.

virtual bool isResultFilteredOut(StringRef Filter, CodeCompletionResult Results)

bool includeGlobals() const

Whether to include global (top-level) declaration results.

virtual void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, CodeCompletionResult *Results, unsigned NumResults)

Process the finalized code-completion results.

virtual CodeCompletionTUInfo & getCodeCompletionTUInfo()=0

bool includeCodePatterns() const

Whether the code-completion consumer wants to see code patterns.

bool loadExternal() const

Hint whether to load data from the external AST in order to provide full results.

const CodeCompleteOptions CodeCompleteOpts

bool includeBriefComments() const

Whether to include brief documentation comments within the set of code completions returned.

virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, OverloadCandidate *Candidates, unsigned NumCandidates, SourceLocation OpenParLoc, bool Braced)

Options controlling the behavior of code completion.

unsigned IncludeCodePatterns

Show code patterns in code completion results.

unsigned IncludeNamespaceLevelDecls

Show decls in namespace (including the global namespace) in code completion results.

unsigned IncludeFixIts

Include results after corrections (small fix-its), e.g.

unsigned LoadExternal

Hint whether to load data from the external AST to provide full results.

unsigned IncludeMacros

Show macros in code completion results.

unsigned IncludeBriefComments

Show brief documentation comments in code completion results.

unsigned IncludeGlobals

Show top-level decls in code completion results.

An allocator used specifically for the purpose of code completion.

const char * CopyString(const Twine &String)

Copy the given string into this allocator.

A builder class used to construct new code-completion strings.

CodeCompletionString * TakeString()

Take the resulting completion string.

CodeCompletionBuilder(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, unsigned Priority, CXAvailabilityKind Availability)

void AddPlaceholderChunk(const char *Placeholder)

Add a new placeholder chunk.

CodeCompletionBuilder(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo)

void AddTextChunk(const char *Text)

Add a new text chunk.

StringRef getParentName() const

void addParentContext(const DeclContext *DC)

Add the parent context information to this code completion.

const char * getBriefComment() const

void AddAnnotation(const char *A)

void addBriefComment(StringRef Comment)

void AddCurrentParameterChunk(const char *CurrentParameter)

Add a new current-parameter chunk.

CodeCompletionTUInfo & getCodeCompletionTUInfo() const

void AddResultTypeChunk(const char *ResultType)

Add a new result-type chunk.

void AddInformativeChunk(const char *Text)

Add a new informative chunk.

void AddOptionalChunk(CodeCompletionString *Optional)

Add a new optional chunk.

void AddTypedTextChunk(const char *Text)

Add a new typed-text chunk.

void AddChunk(CodeCompletionString::ChunkKind CK, const char *Text="")

Add a new chunk.

CodeCompletionAllocator & getAllocator() const

Retrieve the allocator into which the code completion strings should be allocated.

The context in which code completion occurred, so that the code-completion consumer can process the r...

std::optional< const CXXScopeSpec * > getCXXScopeSpecifier()

Kind getKind() const

Retrieve the kind of code-completion context.

void setCXXScopeSpecifier(CXXScopeSpec SS)

Sets the scope specifier that comes before the completion token.

@ CCC_TypeQualifiers

Code completion within a type-qualifier list.

@ CCC_ObjCMessageReceiver

Code completion occurred where an Objective-C message receiver is expected.

@ CCC_PreprocessorExpression

Code completion occurred within a preprocessor expression.

@ CCC_ObjCCategoryName

Code completion where an Objective-C category name is expected.

@ CCC_ObjCIvarList

Code completion occurred within the instance variable list of an Objective-C interface,...

@ CCC_Statement

Code completion occurred where a statement (or declaration) is expected in a function,...

@ CCC_Type

Code completion occurred where a type name is expected.

@ CCC_ArrowMemberAccess

Code completion occurred on the right-hand side of a member access expression using the arrow operato...

@ CCC_ClassStructUnion

Code completion occurred within a class, struct, or union.

@ CCC_ObjCInterface

Code completion occurred within an Objective-C interface, protocol, or category interface.

@ CCC_ObjCPropertyAccess

Code completion occurred on the right-hand side of an Objective-C property access expression.

@ CCC_Expression

Code completion occurred where an expression is expected.

@ CCC_SelectorName

Code completion for a selector, as in an @selector expression.

@ CCC_TopLevelOrExpression

Code completion at a top level, i.e.

@ CCC_EnumTag

Code completion occurred after the "enum" keyword, to indicate an enumeration name.

@ CCC_UnionTag

Code completion occurred after the "union" keyword, to indicate a union name.

@ CCC_ParenthesizedExpression

Code completion in a parenthesized expression, which means that we may also have types here in C and ...

@ CCC_TopLevel

Code completion occurred within a "top-level" completion context, e.g., at namespace or global scope.

@ CCC_ClassOrStructTag

Code completion occurred after the "struct" or "class" keyword, to indicate a struct or class name.

@ CCC_ObjCClassMessage

Code completion where an Objective-C class message is expected.

@ CCC_ObjCImplementation

Code completion occurred within an Objective-C implementation or category implementation.

@ CCC_IncludedFile

Code completion inside the filename part of a #include directive.

@ CCC_ObjCInstanceMessage

Code completion where an Objective-C instance message is expected.

@ CCC_SymbolOrNewName

Code completion occurred where both a new name and an existing symbol is permissible.

@ CCC_Recovery

An unknown context, in which we are recovering from a parsing error and don't know which completions ...

@ CCC_ObjCProtocolName

Code completion occurred where a protocol name is expected.

@ CCC_OtherWithMacros

An unspecified code-completion context where we should also add macro completions.

@ CCC_NewName

Code completion occurred where a new name is expected.

@ CCC_MacroNameUse

Code completion occurred where a macro name is expected (without any arguments, in the case of a func...

@ CCC_Symbol

Code completion occurred where an existing name(such as type, function or variable) is expected.

@ CCC_Attribute

Code completion of an attribute name.

@ CCC_Other

An unspecified code-completion context.

@ CCC_DotMemberAccess

Code completion occurred on the right-hand side of a member access expression using the dot operator.

@ CCC_MacroName

Code completion occurred where an macro is being defined.

@ CCC_Namespace

Code completion occurred where a namespace or namespace alias is expected.

@ CCC_PreprocessorDirective

Code completion occurred where a preprocessor directive is expected.

@ CCC_NaturalLanguage

Code completion occurred in a context where natural language is expected, e.g., a comment or string l...

@ CCC_ObjCInterfaceName

Code completion where the name of an Objective-C class is expected.

@ CCC_ObjCClassForwardDecl

bool isUsingDeclaration() const

QualType getBaseType() const

Retrieve the type of the base object in a member-access expression.

void setPreferredType(QualType T)

bool wantConstructorResults() const

Determines whether we want C++ constructors as results within this context.

void setIsUsingDeclaration(bool V)

QualType getPreferredType() const

Retrieve the type that this expression would prefer to have, e.g., if the expression is a variable in...

void addVisitedContext(DeclContext *Ctx)

Adds a visited context.

CodeCompletionContext(Kind CCKind, QualType T, ArrayRef< const IdentifierInfo * > SelIdents={})

Construct a new code-completion context of the given kind.

const VisitedContextSet & getVisitedContexts() const

Retrieves all visited contexts.

CodeCompletionContext(Kind CCKind)

Construct a new code-completion context of the given kind.

ArrayRef< const IdentifierInfo * > getSelIdents() const

Retrieve the Objective-C selector identifiers.

Captures a result of code completion.

bool DeclaringEntity

Whether we're completing a declaration of the given entity, rather than a use of that entity.

ResultKind Kind

The kind of result stored here.

const char * Keyword

When Kind == RK_Keyword, the string representing the keyword or symbol's spelling.

CXAvailabilityKind Availability

The availability of this result.

CodeCompletionResult(const char *Keyword, unsigned Priority=CCP_Keyword)

Build a result that refers to a keyword or symbol.

CodeCompletionResult(CodeCompletionString *Pattern, const NamedDecl *D, unsigned Priority)

Build a result that refers to a pattern with an associated declaration.

NestedNameSpecifier * Qualifier

If the result should have a nested-name-specifier, this is it.

CodeCompletionResult(const IdentifierInfo *Macro, const MacroInfo *MI=nullptr, unsigned Priority=CCP_Macro)

Build a result that refers to a macro.

const UsingShadowDecl * ShadowDecl

If this Decl was unshadowed by using declaration, this can store a pointer to the UsingShadowDecl whi...

CodeCompletionString * CreateCodeCompletionString(Sema &S, const CodeCompletionContext &CCContext, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments)

Create a new code-completion string that describes how to insert this result into a program.

bool QualifierIsInformative

Whether this result was found via lookup into a base class.

std::vector< FixItHint > FixIts

Fix-its that must be applied before inserting the text for the corresponding completion.

CodeCompletionResult(CodeCompletionString *Pattern, unsigned Priority=CCP_CodePattern, CXCursorKind CursorKind=CXCursor_NotImplemented, CXAvailabilityKind Availability=CXAvailability_Available, const NamedDecl *D=nullptr)

Build a result that refers to a pattern.

const NamedDecl * Declaration

When Kind == RK_Declaration or RK_Pattern, the declaration we are referring to.

CodeCompletionString * createCodeCompletionStringForDecl(Preprocessor &PP, ASTContext &Ctx, CodeCompletionBuilder &Result, bool IncludeBriefComments, const CodeCompletionContext &CCContext, PrintingPolicy &Policy)

CodeCompletionString * CreateCodeCompletionStringForMacro(Preprocessor &PP, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo)

Creates a new code-completion string for the macro result.

unsigned StartParameter

Specifies which parameter (of a function, Objective-C method, macro, etc.) we should start with when ...

bool InBaseClass

Whether this is a class member from base class.

StringRef getOrderedName(std::string &Saved) const

Retrieve the name that should be used to order a result.

unsigned Priority

The priority of this particular code-completion result.

bool StartsNestedNameSpecifier

Whether this declaration is the beginning of a nested-name-specifier and, therefore,...

bool Hidden

Whether this result is hidden by another name.

CodeCompletionString * Pattern

When Kind == RK_Pattern, the code-completion string that describes the completion text to insert.

bool FunctionCanBeCall

When completing a function, whether it can be a call.

bool AllParametersAreInformative

Whether all parameters (of a function, Objective-C method, etc.) should be considered "informative".

const char * getKeyword() const

Retrieve the keyword stored in this result.

const NamedDecl * getDeclaration() const

Retrieve the declaration stored in this result.

CodeCompletionString * createCodeCompletionStringForOverride(Preprocessor &PP, ASTContext &Ctx, CodeCompletionBuilder &Result, bool IncludeBriefComments, const CodeCompletionContext &CCContext, PrintingPolicy &Policy)

const MacroInfo * MacroDefInfo

If the result is RK_Macro, this can store the information about the macro definition.

CodeCompletionResult(const NamedDecl *Declaration, unsigned Priority, NestedNameSpecifier *Qualifier=nullptr, bool QualifierIsInformative=false, bool Accessible=true, std::vector< FixItHint > FixIts=std::vector< FixItHint >())

Build a result that refers to a declaration.

CXCursorKind CursorKind

The cursor kind that describes this result.

const IdentifierInfo * Macro

When Kind == RK_Macro, the identifier that refers to a macro.

ResultKind

Describes the kind of result generated.

@ RK_Pattern

Refers to a precomputed pattern.

@ RK_Declaration

Refers to a declaration.

@ RK_Macro

Refers to a macro.

@ RK_Keyword

Refers to a keyword or symbol.

A "string" used to describe how code completion can be performed for an entity.

unsigned getPriority() const

Retrieve the priority of this code completion result.

CodeCompletionString(const CodeCompletionString &)=delete

ChunkKind

The different kinds of "chunks" that can occur within a code completion string.

@ CK_Optional

A code completion string that is entirely optional.

@ CK_CurrentParameter

A piece of text that describes the parameter that corresponds to the code-completion location within ...

@ CK_Comma

A comma separator (',').

@ CK_Text

A piece of text that should be placed in the buffer, e.g., parentheses or a comma in a function call.

@ CK_Placeholder

A string that acts as a placeholder for, e.g., a function call argument.

@ CK_LeftParen

A left parenthesis ('(').

@ CK_HorizontalSpace

Horizontal whitespace (' ').

@ CK_RightAngle

A right angle bracket ('>').

@ CK_Informative

A piece of text that describes something about the result but should not be inserted into the buffer.

@ CK_LeftBracket

A left bracket ('[').

@ CK_RightParen

A right parenthesis (')').

@ CK_RightBrace

A right brace ('}').

@ CK_VerticalSpace

Vertical whitespace ('\n' or '\r\n', depending on the platform).

@ CK_SemiColon

A semicolon (';').

@ CK_TypedText

The piece of text that the user is expected to type to match the code-completion string,...

@ CK_ResultType

A piece of text that describes the type of an entity or, for functions and methods,...

@ CK_RightBracket

A right bracket (']').

@ CK_LeftBrace

A left brace ('{').

@ CK_LeftAngle

A left angle bracket ('<').

const Chunk & operator[](unsigned I) const

std::string getAsString() const

Retrieve a string representation of the code completion string, which is mainly useful for debugging.

StringRef getParentContextName() const

Retrieve the name of the parent context.

std::string getAllTypedText() const

Returns the combined text from all TypedText chunks.

const char * getTypedText() const

Returns the text in the first TypedText chunk.

CodeCompletionString & operator=(const CodeCompletionString &)=delete

unsigned getAvailability() const

Retrieve the availability of this code completion result.

const char * getBriefComment() const

unsigned getAnnotationCount() const

Retrieve the number of annotations for this code completion result.

const char * getAnnotation(unsigned AnnotationNr) const

Retrieve the annotation string specified by AnnotationNr.

std::shared_ptr< GlobalCodeCompletionAllocator > getAllocatorRef() const

StringRef getParentName(const DeclContext *DC)

CodeCompletionTUInfo(std::shared_ptr< GlobalCodeCompletionAllocator > Allocator)

CodeCompletionAllocator & getAllocator() const

DeclContext - This is used only as base class of specific decl types that can act as declaration cont...

Decl - This represents one declaration (or definition), e.g.

Represents a function declaration or definition.

Declaration of a template function.

FunctionType - C99 6.7.5.3 - Function Declarators.

Allocator for a cached set of global code completions.

One of these records is kept for each identifier that is lexed.

Encapsulates the data about a macro definition (e.g.

This represents a decl that may have a name.

Represents a C++ nested name specifier, such as "\::std::vector::".

Engages in a tight little dance with the lexer to efficiently preprocess tokens.

A simple code-completion consumer that prints the results it receives in a simple format.

void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, CodeCompletionResult *Results, unsigned NumResults) override

Prints the finalized code-completion results.

void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, OverloadCandidate *Candidates, unsigned NumCandidates, SourceLocation OpenParLoc, bool Braced) override

CodeCompletionTUInfo & getCodeCompletionTUInfo() override

CodeCompletionAllocator & getAllocator() override

Retrieve the allocator that will be used to allocate code completion strings.

bool isResultFilteredOut(StringRef Filter, CodeCompletionResult Results) override

PrintingCodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts, raw_ostream &OS)

Create a new printing code-completion consumer that prints its results to the given raw output stream...

A (possibly-)qualified type.

Represents a struct/union/class.

Sema - This implements semantic analysis and AST building for C.

Encodes a location in the source.

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

The base class of the type hierarchy.

Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...

CXCursorKind

Describes the kind of entity that a cursor refers to.

CXAvailabilityKind

Describes the availability of a particular entity, which indicates whether the use of this entity wil...

@ CXCursor_MacroDefinition

@ CXCursor_NotImplemented

@ CXAvailability_Available

The entity is available.

@ Decl

The l-value was an access to a declared entity or something equivalently strong, like the address of ...

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

QualType getDeclUsageType(ASTContext &C, const NamedDecl *ND)

Determine the type that this declaration will have if it is used as a type or in an expression.

CXCursorKind getCursorKindForDecl(const Decl *D)

Determine the libclang cursor kind associated with the given declaration.

const RawComment * getParameterComment(const ASTContext &Ctx, const CodeCompleteConsumer::OverloadCandidate &Result, unsigned ArgIndex)

Get the documentation comment used to produce CodeCompletionString::BriefComment for OverloadCandidat...

bool operator<(DeclarationName LHS, DeclarationName RHS)

Ordering on two declaration names.

CanQual< Type > CanQualType

Represents a canonical, potentially-qualified type.

@ Result

The result type of a method or function.

SimplifiedTypeClass

A simplified classification of types used when determining "similar" types for code completion.

const RawComment * getPatternCompletionComment(const ASTContext &Ctx, const NamedDecl *Decl)

Get the documentation comment used to produce CodeCompletionString::BriefComment for RK_Pattern.

@ CCF_ExactTypeMatch

Divide by this factor when a code-completion result's type exactly matches the type we expect.

@ CCF_SimilarTypeMatch

Divide by this factor when a code-completion result's type is similar to the type we expect (e....

const RawComment * getCompletionComment(const ASTContext &Ctx, const NamedDecl *Decl)

Get the documentation comment used to produce CodeCompletionString::BriefComment for RK_Declaration.

SimplifiedTypeClass getSimplifiedTypeClass(CanQualType T)

Determine the simplified type class of the given canonical type.

bool operator<=(DeclarationName LHS, DeclarationName RHS)

Ordering on two declaration names.

llvm::StringRef getCompletionKindString(CodeCompletionContext::Kind Kind)

Get string representation of Kind, useful for debugging.

bool operator>(DeclarationName LHS, DeclarationName RHS)

Ordering on two declaration names.

@ CCP_Type

Priority for a type.

@ CCP_ObjC_cmd

Priority for the Objective-C "_cmd" implicit parameter.

@ CCP_Keyword

Priority for a language keyword (that isn't any of the other categories).

@ CCP_Macro

Priority for a preprocessor macro.

@ CCP_LocalDeclaration

Priority for a declaration that is in the local scope.

@ CCP_Unlikely

Priority for a result that isn't likely to be what the user wants, but is included for completeness.

@ CCP_NestedNameSpecifier

Priority for a nested-name-specifier.

@ CCP_SuperCompletion

Priority for a send-to-super completion.

@ CCP_NextInitializer

Priority for the next initialization in a constructor initializer list.

@ CCP_Declaration

Priority for a non-type declaration.

@ CCP_Constant

Priority for a constant value (e.g., enumerator).

@ CCP_MemberDeclaration

Priority for a member declaration found from the current method or member function.

@ CCP_EnumInCase

Priority for an enumeration constant inside a switch whose condition is of the enumeration type.

@ CCP_CodePattern

Priority for a code pattern.

const FunctionProtoType * T

unsigned getMacroUsagePriority(StringRef MacroName, const LangOptions &LangOpts, bool PreferredTypeIsPointer=false)

Determine the priority to be given to a macro code completion result with the given name.

bool operator>=(DeclarationName LHS, DeclarationName RHS)

Ordering on two declaration names.

@ CCD_SelectorMatch

The selector of the given message exactly matches the selector of the current method,...

@ CCD_ObjectQualifierMatch

The result is a C++ non-static member function whose qualifiers exactly match the object type on whic...

@ CCD_bool_in_ObjC

Adjustment to the "bool" type in Objective-C, where the typedef "BOOL" is preferred.

@ CCD_InBaseClass

The result is in a base class.

@ CCD_ProbablyNotObjCCollection

Adjustment for KVC code pattern priorities when it doesn't look like the.

@ CCD_BlockPropertySetter

An Objective-C block property completed as a setter with a block placeholder.

@ CCD_MethodAsProperty

An Objective-C method being used as a property.

One piece of the code completion string.

static Chunk CreateOptional(CodeCompletionString *Optional)

Create a new optional chunk.

ChunkKind Kind

The kind of data stored in this piece of the code completion string.

static Chunk CreatePlaceholder(const char *Placeholder)

Create a new placeholder chunk.

static Chunk CreateCurrentParameter(const char *CurrentParameter)

Create a new current-parameter chunk.

static Chunk CreateInformative(const char *Informative)

Create a new informative chunk.

CodeCompletionString * Optional

The code completion string associated with a CK_Optional chunk.

static Chunk CreateResultType(const char *ResultType)

Create a new result type chunk.

const char * Text

The text string associated with a CK_Text, CK_Placeholder, CK_Informative, or CK_Comma chunk.

static Chunk CreateText(const char *Text)

Create a new text chunk.

OverloadCandidate - A single candidate in an overload set (C++ 13.3).

Describes how types, statements, expressions, and declarations should be printed.