clang API Documentation

Public Types | Public Member Functions | Public Attributes
clang::CodeCompletionResult Class Reference

Captures a result of code completion. More...

#include <CodeCompleteConsumer.h>

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

List of all members.

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.
 CodeCompletionResult (const char *Keyword, unsigned Priority=CCP_Keyword)
 Build a result that refers to a keyword or symbol.
 CodeCompletionResult (const IdentifierInfo *Macro, unsigned Priority=CCP_Macro)
 Build a result that refers to a macro.
 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.
 CodeCompletionResult (CodeCompletionString *Pattern, NamedDecl *D, unsigned Priority)
 Build a result that refers to a pattern with an associated declaration.
const NamedDeclgetDeclaration () const
 Retrieve the declaration stored in this result.
const char * getKeyword () const
 Retrieve the keyword stored in this result.
CodeCompletionStringCreateCodeCompletionString (Sema &S, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments)
 Create a new code-completion string that describes how to insert this result into a program.
CodeCompletionStringCreateCodeCompletionString (ASTContext &Ctx, Preprocessor &PP, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments)
 If possible, create a new code completion string for the given result.

Public Attributes

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

Detailed Description

Captures a result of code completion.

Definition at line 634 of file CodeCompleteConsumer.h.


Member Enumeration Documentation

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 637 of file CodeCompleteConsumer.h.


Constructor & Destructor Documentation

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 701 of file CodeCompleteConsumer.h.

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

Build a result that refers to a keyword or symbol.

Definition at line 716 of file CodeCompleteConsumer.h.

Build a result that refers to a macro.

Definition at line 725 of file CodeCompleteConsumer.h.

Build a result that refers to a pattern.

Definition at line 735 of file CodeCompleteConsumer.h.

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

Definition at line 750 of file CodeCompleteConsumer.h.


Member Function Documentation

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 2513 of file SemaCodeComplete.cpp.

References clang::Sema::Context, and clang::Sema::PP.

If possible, create a new code completion string for the given result.

Returns:
Either a new, heap-allocated code completion string describing how to use this result, or NULL to indicate that the string or name of the result is all that is needed.

Definition at line 2528 of file SemaCodeComplete.cpp.

References clang::CodeCompletionBuilder::AddAnnotation(), clang::CodeCompletionBuilder::addBriefComment(), clang::CodeCompletionBuilder::AddChunk(), AddFunctionParameterChunks(), AddFunctionTypeQualsToCompletionString(), clang::CodeCompletionBuilder::AddInformativeChunk(), clang::CodeCompletionBuilder::addParentContext(), clang::CodeCompletionBuilder::AddPlaceholderChunk(), AddQualifierToCompletionString(), AddResultTypeChunk(), AddTemplateParameterChunks(), clang::CodeCompletionBuilder::AddTextChunk(), clang::CodeCompletionBuilder::AddTypedTextChunk(), clang::MacroInfo::arg_begin(), clang::MacroInfo::arg_end(), clang::CodeCompletionString::CK_Comma, clang::CodeCompletionString::CK_HorizontalSpace, clang::CodeCompletionString::CK_LeftAngle, clang::CodeCompletionString::CK_LeftParen, clang::CodeCompletionString::CK_RightAngle, clang::CodeCompletionString::CK_RightParen, clang::CodeCompletionAllocator::CopyString(), clang::ObjCPropertyDecl::findPropertyDecl(), FormatFunctionParameter(), formatObjCParamQualifiers(), clang::CodeCompletionBuilder::getAllocator(), clang::CodeCompletionBuilder::getBriefComment(), getCompletionPrintingPolicy(), clang::Decl::getDeclContext(), clang::Selector::getIdentifierInfoForSlot(), clang::Preprocessor::getMacroDirectiveHistory(), clang::MacroDirective::getMacroInfo(), clang::NamedDecl::getNameAsString(), clang::Selector::getNameForSlot(), clang::CodeCompletionBuilder::getParentName(), clang::ASTContext::getRawCommentForAnyRedecl(), clang::MacroInfo::isC99Varargs(), clang::MacroDirective::isDefined(), clang::MacroInfo::isFunctionLike(), clang::Selector::isUnarySelector(), clang::MacroInfo::isVariadic(), clang::Sema::MarkDeducedTemplateParameters(), MaybeAddSentinel(), P, clang::Decl::specific_attrs(), and clang::CodeCompletionBuilder::TakeString().

Retrieve the declaration stored in this result.

Definition at line 761 of file CodeCompleteConsumer.h.

References Declaration, and RK_Declaration.

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

Retrieve the keyword stored in this result.

Definition at line 767 of file CodeCompleteConsumer.h.

References Keyword, and RK_Keyword.


Member Data Documentation

union { ... }

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

Definition at line 689 of file CodeCompleteConsumer.h.

The availability of this result.

Definition at line 675 of file CodeCompleteConsumer.h.

The cursor kind that describes this result.

Definition at line 672 of file CodeCompleteConsumer.h.

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 646 of file CodeCompleteConsumer.h.

Referenced by CalculateHiddenNames(), getDeclaration(), getOrderedName(), and clang::PrintingCodeCompleteConsumer::ProcessCodeCompleteResults().

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

Definition at line 693 of file CodeCompleteConsumer.h.

Whether this result is hidden by another name.

Definition at line 678 of file CodeCompleteConsumer.h.

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

Definition at line 651 of file CodeCompleteConsumer.h.

Referenced by getKeyword(), getOrderedName(), and clang::PrintingCodeCompleteConsumer::ProcessCodeCompleteResults().

The kind of result stored here.

Definition at line 669 of file CodeCompleteConsumer.h.

Referenced by getOrderedName().

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

Definition at line 658 of file CodeCompleteConsumer.h.

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

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

Definition at line 655 of file CodeCompleteConsumer.h.

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

The priority of this particular code-completion result.

Definition at line 662 of file CodeCompleteConsumer.h.

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 698 of file CodeCompleteConsumer.h.

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

Definition at line 681 of file CodeCompleteConsumer.h.

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

Definition at line 666 of file CodeCompleteConsumer.h.

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

Definition at line 685 of file CodeCompleteConsumer.h.


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