class CodeCompletionResult

Declaration

class CodeCompletionResult { /* full declaration omitted */ };

Description

Captures a result of code completion.

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:752

Member Variables

public const clang::NamedDecl* Declaration = nullptr
When Kind == RK_Declaration or RK_Pattern, the declaration we are referring to. In the latter case, the declaration might be NULL.
public anonymous struct / union
public unsigned int Priority
The priority of this particular code-completion result.
public unsigned int StartParameter = 0
Specifies which parameter (of a function, Objective-C method, macro, etc.) we should start with when formatting the result.
public clang::CodeCompletionResult::ResultKind Kind
The kind of result stored here.
public CXCursorKind CursorKind
The cursor kind that describes this result.
public CXAvailabilityKind Availability = CXAvailability_Available
The availability of this result.
public std::vector<FixItHint> FixIts
std::unique_ptr <std ::vector <int >> vec_ptr; In 'vec_ptr.^', one of the completions is 'push_back', it requires replacing '.' with '->'. In 'vec_ptr->^', one of the completions is 'release', it requires replacing '->' with '.'.
public bool Hidden
Whether this result is hidden by another name.
public bool InBaseClass
Whether this is a class member from base class.
public bool QualifierIsInformative
Whether this result was found via lookup into a base class.
public bool StartsNestedNameSpecifier
Whether this declaration is the beginning of a nested-name-specifier and, therefore, should be followed by '::'.
public bool AllParametersAreInformative
Whether all parameters (of a function, Objective-C method, etc.) should be considered "informative".
public bool DeclaringEntity
Whether we're completing a declaration of the given entity, rather than a use of that entity.
public clang::NestedNameSpecifier* Qualifier = nullptr
If the result should have a nested-name-specifier, this is it. When \c QualifierIsInformative, the nested-name-specifier is informative rather than required.
public const clang::UsingShadowDecl* ShadowDecl = nullptr
If this Decl was unshadowed by using declaration, this can store a pointer to the UsingShadowDecl which was used in the unshadowing process. This information can be used to uprank CodeCompletionResults / which have corresponding `using decl::qualified::name;` nearby.
public const clang::MacroInfo* MacroDefInfo = nullptr
If the result is RK_Macro, this can store the information about the macro definition. This should be set in most cases but can be missing when the macro has been undefined.

Method Overview

  • public CodeCompletionResult(const clang::NamedDecl * Declaration, unsigned int Priority, clang::NestedNameSpecifier * Qualifier = nullptr, bool QualifierIsInformative = false, bool Accessible = true, std::vector<FixItHint> FixIts = std::vector<clang::FixItHint, std::allocator<clang::FixItHint>>())
  • public CodeCompletionResult(const char * Keyword, unsigned int Priority = CCP_Keyword)
  • public CodeCompletionResult(const clang::IdentifierInfo * Macro, const clang::MacroInfo * MI = nullptr, unsigned int Priority = CCP_Macro)
  • public CodeCompletionResult(clang::CodeCompletionString * Pattern, unsigned int Priority = CCP_CodePattern, CXCursorKind CursorKind = CXCursor_NotImplemented, CXAvailabilityKind Availability = CXAvailability_Available, const clang::NamedDecl * D = nullptr)
  • public CodeCompletionResult(clang::CodeCompletionString * Pattern, const clang::NamedDecl * D, unsigned int Priority)
  • public clang::CodeCompletionString * CreateCodeCompletionString(clang::Sema & S, const clang::CodeCompletionContext & CCContext, clang::CodeCompletionAllocator & Allocator, clang::CodeCompletionTUInfo & CCTUInfo, bool IncludeBriefComments)
  • public clang::CodeCompletionString * CreateCodeCompletionString(clang::ASTContext & Ctx, clang::Preprocessor & PP, const clang::CodeCompletionContext & CCContext, clang::CodeCompletionAllocator & Allocator, clang::CodeCompletionTUInfo & CCTUInfo, bool IncludeBriefComments)
  • public clang::CodeCompletionString * CreateCodeCompletionStringForMacro(clang::Preprocessor & PP, clang::CodeCompletionAllocator & Allocator, clang::CodeCompletionTUInfo & CCTUInfo)
  • private void computeCursorKindAndAvailability(bool Accessible = true)
  • public clang::CodeCompletionString * createCodeCompletionStringForDecl(clang::Preprocessor & PP, clang::ASTContext & Ctx, clang::CodeCompletionBuilder & Result, bool IncludeBriefComments, const clang::CodeCompletionContext & CCContext, clang::PrintingPolicy & Policy)
  • public clang::CodeCompletionString * createCodeCompletionStringForOverride(clang::Preprocessor & PP, clang::ASTContext & Ctx, clang::CodeCompletionBuilder & Result, bool IncludeBriefComments, const clang::CodeCompletionContext & CCContext, clang::PrintingPolicy & Policy)
  • public const clang::NamedDecl * getDeclaration() const
  • public const char * getKeyword() const
  • public llvm::StringRef getOrderedName(std::string & Saved) const

Methods

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

Description

Build a result that refers to a declaration.

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:870

Parameters

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

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

Description

Build a result that refers to a keyword or symbol.

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:885

Parameters

const char* Keyword
unsigned int Priority = CCP_Keyword

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

Description

Build a result that refers to a macro.

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:892

Parameters

const clang::IdentifierInfo* Macro
const clang::MacroInfo* MI = nullptr
unsigned int Priority = CCP_Macro

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

Description

Build a result that refers to a pattern.

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:902

Parameters

clang::CodeCompletionString* Pattern
unsigned int Priority = CCP_CodePattern
CXCursorKind CursorKind = CXCursor_NotImplemented
CXAvailabilityKind Availability = CXAvailability_Available
const clang::NamedDecl* D = nullptr

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

Description

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

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:915

Parameters

clang::CodeCompletionString* Pattern
const clang::NamedDecl* D
unsigned int Priority

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

Description

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

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:945

Parameters

clang::Sema& S
The semantic analysis that created the result.
const clang::CodeCompletionContext& CCContext
clang::CodeCompletionAllocator& Allocator
The allocator that will be used to allocate the string itself.
clang::CodeCompletionTUInfo& CCTUInfo
bool IncludeBriefComments

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

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:950

Parameters

clang::ASTContext& Ctx
clang::Preprocessor& PP
const clang::CodeCompletionContext& CCContext
clang::CodeCompletionAllocator& Allocator
clang::CodeCompletionTUInfo& CCTUInfo
bool IncludeBriefComments

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

Description

Creates a new code-completion string for the macro result. Similar to the above overloads, except this only requires preprocessor information. The result kind must be `RK_Macro`.

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:960

Parameters

clang::Preprocessor& PP
clang::CodeCompletionAllocator& Allocator
clang::CodeCompletionTUInfo& CCTUInfo

void computeCursorKindAndAvailability(
    bool Accessible = true)

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:981

Parameters

bool Accessible = true

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

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:964

Parameters

clang::Preprocessor& PP
clang::ASTContext& Ctx
clang::CodeCompletionBuilder& Result
bool IncludeBriefComments
const clang::CodeCompletionContext& CCContext
clang::PrintingPolicy& Policy

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

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:969

Parameters

clang::Preprocessor& PP
clang::ASTContext& Ctx
clang::CodeCompletionBuilder& Result
bool IncludeBriefComments
const clang::CodeCompletionContext& CCContext
clang::PrintingPolicy& Policy

const clang::NamedDecl* getDeclaration() const

Description

Retrieve the declaration stored in this result. This might be nullptr if Kind is RK_Pattern.

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:926

const char* getKeyword() const

Description

Retrieve the keyword stored in this result.

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:933

llvm::StringRef getOrderedName(
    std::string& Saved) const

Description

Retrieve the name that should be used to order a result. If the name needs to be constructed as a string, that string will be saved into Saved and the returned StringRef will refer to it.

Declared at: clang/include/clang/Sema/CodeCompleteConsumer.h:978

Parameters

std::string& Saved