clang  6.0.0svn
Public Types | Public Member Functions | Public Attributes | List of all members
clang::CodeCompletionResult Class Reference

Captures a result of code completion. More...

#include "clang/Sema/CodeCompleteConsumer.h"

Collaboration diagram for clang::CodeCompletionResult:
Collaboration graph
[legend]

Public Types

enum  ResultKind { RK_Declaration = 0, RK_Keyword, RK_Macro, RK_Pattern }
 Describes the kind of result generated. More...
 

Public Member Functions

 CodeCompletionResult (const NamedDecl *Declaration, unsigned Priority, NestedNameSpecifier *Qualifier=nullptr, bool QualifierIsInformative=false, bool Accessible=true)
 Build a result that refers to a declaration. More...
 
 CodeCompletionResult (const char *Keyword, unsigned Priority=CCP_Keyword)
 Build a result that refers to a keyword or symbol. More...
 
 CodeCompletionResult (const IdentifierInfo *Macro, unsigned Priority=CCP_Macro)
 Build a result that refers to a macro. More...
 
 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. More...
 
 CodeCompletionResult (CodeCompletionString *Pattern, const NamedDecl *D, unsigned Priority)
 Build a result that refers to a pattern with an associated declaration. More...
 
const NamedDeclgetDeclaration () const
 Retrieve the declaration stored in this result. More...
 
const char * getKeyword () const
 Retrieve the keyword stored in this result. More...
 
CodeCompletionStringCreateCodeCompletionString (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. More...
 
CodeCompletionStringCreateCodeCompletionString (ASTContext &Ctx, Preprocessor &PP, const CodeCompletionContext &CCContext, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments)
 If possible, create a new code completion string for the given result. More...
 

Public Attributes

const NamedDeclDeclaration
 When Kind == RK_Declaration or RK_Pattern, the declaration we are referring to. More...
 
union {
   const char *   Keyword
 When Kind == RK_Keyword, the string representing the keyword or symbol's spelling. More...
 
   CodeCompletionString *   Pattern
 When Kind == RK_Pattern, the code-completion string that describes the completion text to insert. More...
 
   const IdentifierInfo *   Macro
 When Kind == RK_Macro, the identifier that refers to a macro. More...
 
}; 
 
unsigned Priority
 The priority of this particular code-completion result. More...
 
unsigned StartParameter
 Specifies which parameter (of a function, Objective-C method, macro, etc.) we should start with when formatting the result. More...
 
ResultKind Kind
 The kind of result stored here. More...
 
CXCursorKind CursorKind
 The cursor kind that describes this result. More...
 
CXAvailabilityKind Availability
 The availability of this result. More...
 
bool Hidden: 1
 Whether this result is hidden by another name. More...
 
bool QualifierIsInformative: 1
 Whether this result was found via lookup into a base class. More...
 
bool StartsNestedNameSpecifier: 1
 Whether this declaration is the beginning of a nested-name-specifier and, therefore, should be followed by '::'. More...
 
bool AllParametersAreInformative: 1
 Whether all parameters (of a function, Objective-C method, etc.) should be considered "informative". More...
 
bool DeclaringEntity: 1
 Whether we're completing a declaration of the given entity, rather than a use of that entity. More...
 
NestedNameSpecifierQualifier
 If the result should have a nested-name-specifier, this is it. More...
 

Detailed Description

Captures a result of code completion.

Definition at line 623 of file CodeCompleteConsumer.h.

Member Enumeration Documentation

◆ ResultKind

Describes the kind of result generated.

Enumerator
RK_Declaration 

Refers to a declaration.

RK_Keyword 

Refers to a keyword or symbol.

RK_Macro 

Refers to a macro.

RK_Pattern 

Refers to a precomputed pattern.

Definition at line 626 of file CodeCompleteConsumer.h.

Constructor & Destructor Documentation

◆ CodeCompletionResult() [1/5]

clang::CodeCompletionResult::CodeCompletionResult ( const NamedDecl Declaration,
unsigned  Priority,
NestedNameSpecifier Qualifier = nullptr,
bool  QualifierIsInformative = false,
bool  Accessible = true 
)
inline

Build a result that refers to a declaration.

Definition at line 690 of file CodeCompleteConsumer.h.

◆ CodeCompletionResult() [2/5]

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

Build a result that refers to a keyword or symbol.

Definition at line 705 of file CodeCompleteConsumer.h.

◆ CodeCompletionResult() [3/5]

clang::CodeCompletionResult::CodeCompletionResult ( const IdentifierInfo Macro,
unsigned  Priority = CCP_Macro 
)
inline

Build a result that refers to a macro.

Definition at line 714 of file CodeCompleteConsumer.h.

◆ CodeCompletionResult() [4/5]

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

Build a result that refers to a pattern.

Definition at line 724 of file CodeCompleteConsumer.h.

◆ CodeCompletionResult() [5/5]

clang::CodeCompletionResult::CodeCompletionResult ( CodeCompletionString Pattern,
const NamedDecl D,
unsigned  Priority 
)
inline

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

Definition at line 739 of file CodeCompleteConsumer.h.

Member Function Documentation

◆ CreateCodeCompletionString() [1/2]

CodeCompletionString * CodeCompletionResult::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.

Parameters
SThe semantic analysis that created the result.
AllocatorThe allocator that will be used to allocate the string itself.

Definition at line 2709 of file SemaCodeComplete.cpp.

◆ CreateCodeCompletionString() [2/2]

CodeCompletionString * CodeCompletionResult::CreateCodeCompletionString ( ASTContext Ctx,
Preprocessor PP,
const CodeCompletionContext CCContext,
CodeCompletionAllocator Allocator,
CodeCompletionTUInfo CCTUInfo,
bool  IncludeBriefComments 
)

◆ getDeclaration()

const NamedDecl* clang::CodeCompletionResult::getDeclaration ( ) const
inline

Retrieve the declaration stored in this result.

Definition at line 750 of file CodeCompleteConsumer.h.

◆ getKeyword()

const char* clang::CodeCompletionResult::getKeyword ( ) const
inline

Retrieve the keyword stored in this result.

Definition at line 756 of file CodeCompleteConsumer.h.

Member Data Documentation

◆ @191

union { ... }

◆ AllParametersAreInformative

bool clang::CodeCompletionResult::AllParametersAreInformative

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

Definition at line 678 of file CodeCompleteConsumer.h.

◆ Availability

CXAvailabilityKind clang::CodeCompletionResult::Availability

The availability of this result.

Definition at line 664 of file CodeCompleteConsumer.h.

◆ CursorKind

CXCursorKind clang::CodeCompletionResult::CursorKind

The cursor kind that describes this result.

Definition at line 661 of file CodeCompleteConsumer.h.

◆ Declaration

const NamedDecl* clang::CodeCompletionResult::Declaration

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

In the latter case, the declaration might be NULL.

Definition at line 635 of file CodeCompleteConsumer.h.

Referenced by clang::PrintingCodeCompleteConsumer::isResultFilteredOut().

◆ DeclaringEntity

bool clang::CodeCompletionResult::DeclaringEntity

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

Definition at line 682 of file CodeCompleteConsumer.h.

◆ Hidden

bool clang::CodeCompletionResult::Hidden

Whether this result is hidden by another name.

Definition at line 667 of file CodeCompleteConsumer.h.

◆ Keyword

const char* clang::CodeCompletionResult::Keyword

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

Definition at line 640 of file CodeCompleteConsumer.h.

Referenced by getOrderedName(), and clang::PrintingCodeCompleteConsumer::isResultFilteredOut().

◆ Kind

ResultKind clang::CodeCompletionResult::Kind

The kind of result stored here.

Definition at line 658 of file CodeCompleteConsumer.h.

Referenced by getOrderedName(), and clang::PrintingCodeCompleteConsumer::isResultFilteredOut().

◆ Macro

const IdentifierInfo* clang::CodeCompletionResult::Macro

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

Definition at line 647 of file CodeCompleteConsumer.h.

Referenced by getOrderedName(), and clang::PrintingCodeCompleteConsumer::isResultFilteredOut().

◆ Pattern

CodeCompletionString* clang::CodeCompletionResult::Pattern

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

Definition at line 644 of file CodeCompleteConsumer.h.

Referenced by getOrderedName(), and clang::PrintingCodeCompleteConsumer::isResultFilteredOut().

◆ Priority

unsigned clang::CodeCompletionResult::Priority

The priority of this particular code-completion result.

Definition at line 651 of file CodeCompleteConsumer.h.

◆ Qualifier

NestedNameSpecifier* clang::CodeCompletionResult::Qualifier

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

When QualifierIsInformative, the nested-name-specifier is informative rather than required.

Definition at line 687 of file CodeCompleteConsumer.h.

◆ QualifierIsInformative

bool clang::CodeCompletionResult::QualifierIsInformative

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

Definition at line 670 of file CodeCompleteConsumer.h.

◆ StartParameter

unsigned clang::CodeCompletionResult::StartParameter

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

Definition at line 655 of file CodeCompleteConsumer.h.

◆ StartsNestedNameSpecifier

bool clang::CodeCompletionResult::StartsNestedNameSpecifier

Whether this declaration is the beginning of a nested-name-specifier and, therefore, should be followed by '::'.

Definition at line 674 of file CodeCompleteConsumer.h.


The documentation for this class was generated from the following files: