Go to the documentation of this file.
13 #ifndef LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H
14 #define LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H
22 #include "llvm/ADT/ArrayRef.h"
23 #include "llvm/ADT/DenseMap.h"
24 #include "llvm/ADT/None.h"
25 #include "llvm/ADT/Optional.h"
26 #include "llvm/ADT/SmallPtrSet.h"
27 #include "llvm/ADT/SmallVector.h"
28 #include "llvm/ADT/StringRef.h"
29 #include "llvm/Support/Allocator.h"
30 #include "llvm/Support/type_traits.h"
42 class FunctionTemplateDecl;
46 class NestedNameSpecifier;
50 class UsingShadowDecl;
178 const LangOptions &LangOpts,
179 bool PreferredTypeIsPointer =
false);
348 bool IsUsingDeclaration;
371 : CCKind(CCKind), IsUsingDeclaration(
false), SelIdents(None) {}
376 : CCKind(CCKind), IsUsingDeclaration(
false), SelIdents(SelIdents) {
412 this->ScopeSpecifier = std::move(SS);
417 VisitedContexts.insert(Ctx);
422 return VisitedContexts;
427 return ScopeSpecifier.getPointer();
568 unsigned NumChunks : 16;
571 unsigned NumAnnotations : 16;
577 unsigned Availability : 2;
580 StringRef ParentName;
584 const char *BriefComment;
588 const char **Annotations,
unsigned NumAnnotations,
589 StringRef ParentName,
590 const char *BriefComment);
601 bool empty()
const {
return NumChunks == 0; }
602 unsigned size()
const {
return NumChunks; }
605 assert(I <
size() &&
"Chunk index out-of-range");
652 llvm::DenseMap<const DeclContext *, StringRef> ParentNames;
653 std::shared_ptr<GlobalCodeCompletionAllocator> AllocatorRef;
657 std::shared_ptr<GlobalCodeCompletionAllocator> Allocator)
658 : AllocatorRef(
std::move(Allocator)) {}
665 assert(AllocatorRef);
666 return *AllocatorRef;
684 unsigned Priority = 0;
686 StringRef ParentName;
687 const char *BriefComment =
nullptr;
697 : Allocator(Allocator), CCTUInfo(CCTUInfo) {}
703 Availability(Availability) {}
873 bool Accessible =
true,
874 std::vector<FixItHint>
FixIts = std::vector<FixItHint>())
881 computeCursorKindAndAvailability(Accessible);
921 computeCursorKindAndAvailability();
928 "Not a declaration or pattern result");
949 bool IncludeBriefComments);
955 bool IncludeBriefComments);
981 void computeCursorKindAndAvailability(
bool Accessible =
true);
984 bool operator<(
const CodeCompletionResult &
X,
const CodeCompletionResult &Y);
1068 assert(
Type !=
nullptr);
1073 assert(Aggregate !=
nullptr);
1124 bool IncludeBriefComments,
bool Braced)
const;
1182 unsigned NumResults) {}
1197 unsigned NumCandidates,
1212 const NamedDecl *Decl);
1217 const NamedDecl *Decl);
1223 const CodeCompleteConsumer::OverloadCandidate &Result,
1245 unsigned NumResults)
override;
1249 unsigned NumCandidates,
1251 bool Braced)
override;
1264 #endif // LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H
OverloadCandidate(FunctionDecl *Function)
@ CCC_SymbolOrNewName
Code completion occurred where both a new name and an existing symbol is permissible.
@ CK_FunctionTemplate
The candidate is a function template, arguments are being completed.
unsigned IncludeMacros
Show macros in code completion results.
@ CCC_Other
An unspecified code-completion context.
@ CK_Function
The candidate is a function declaration.
bool includeCodePatterns() const
Whether the code-completion consumer wants to see code patterns.
void addParentContext(const DeclContext *DC)
Add the parent context information to this code completion.
const char * Keyword
When Kind == RK_Keyword, the string representing the keyword or symbol's spelling.
OverloadCandidate(const RecordDecl *Aggregate)
unsigned getAnnotationCount() const
Retrieve the number of annotations for this code completion result.
unsigned getPriority() const
Retrieve the priority of this code completion result.
@ CCD_InBaseClass
The result is in a base class.
bool loadExternal() const
Hint whether to load data from the external AST in order to provide full results.
CodeCompletionContext(Kind CCKind)
Construct a new code-completion context of the given kind.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool includeNamespaceLevelDecls() const
Whether to include declarations in namespace contexts (including the global namespace).
CodeCompletionString * TakeString()
Take the resulting completion string.
@ CCC_ObjCInstanceMessage
Code completion where an Objective-C instance message is expected.
@ CCC_Expression
Code completion occurred where an expression is expected.
CodeCompletionResult(const IdentifierInfo *Macro, const MacroInfo *MI=nullptr, unsigned Priority=CCP_Macro)
Build a result that refers to a macro.
void AddOptionalChunk(CodeCompletionString *Optional)
Add a new optional chunk.
const char * CopyString(const Twine &String)
Copy the given string into this allocator.
bool isResultFilteredOut(StringRef Filter, CodeCompletionResult Results) override
@ CCD_ObjectQualifierMatch
The result is a C++ non-static member function whose qualifiers exactly match the object type on whic...
A simple code-completion consumer that prints the results it receives in a simple format.
OverloadCandidate(FunctionTemplateDecl *FunctionTemplateDecl)
Encodes a location in the source.
bool includeGlobals() const
Whether to include global (top-level) declaration results.
unsigned IncludeBriefComments
Show brief documentation comments in code completion results.
@ CCC_Type
Code completion occurred where a type name is expected.
This represents a decl that may have a name.
unsigned IncludeFixIts
Include results after corrections (small fix-its), e.g.
@ CCC_ObjCImplementation
Code completion occurred within an Objective-C implementation or category implementation.
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.
A (possibly-)qualified type.
void AddChunk(CodeCompletionString::ChunkKind CK, const char *Text="")
Add a new chunk.
@ CK_Text
A piece of text that should be placed in the buffer, e.g., parentheses or a comma in a function call.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
CodeCompletionString * CreateCodeCompletionStringForMacro(Preprocessor &PP, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo)
Creates a new code-completion string for the macro result.
const FunctionType * getFunctionType() const
Retrieve the function type of the entity, regardless of how the function is stored.
const RecordDecl * getAggregate() const
Retrieve the aggregate type being initialized.
CodeCompletionTUInfo & getCodeCompletionTUInfo() const
CandidateKind getKind() const
Determine the kind of overload candidate.
const TemplateDecl * Template
The template overload candidate, available when Kind == CK_Template.
@ CCP_Keyword
Priority for a language keyword (that isn't any of the other categories).
@ CK_RightParen
A right parenthesis (')').
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
@ CCD_SelectorMatch
The selector of the given message exactly matches the selector of the current method,...
virtual CodeCompletionTUInfo & getCodeCompletionTUInfo()=0
const char * getBriefComment() const
@ CK_TypedText
The piece of text that the user is expected to type to match the code-completion string,...
const NamedDecl * getParamDecl(unsigned N) const
Get the declaration of the Nth parameter.
@ CCC_IncludedFile
Code completion inside the filename part of a include directive.
CodeCompletionString * Pattern
When Kind == RK_Pattern, the code-completion string that describes the completion text to insert.
Encapsulates the data about a macro definition (e.g.
@ RK_Keyword
Refers to a keyword or symbol.
unsigned Priority
The priority of this particular code-completion result.
@ CK_VerticalSpace
Vertical whitespace ('\n' or '\r\n', depending on the platform).
Represents a C++ nested-name-specifier or a global scope specifier.
CandidateKind
Describes the type of overload candidate.
Describes how types, statements, expressions, and declarations should be printed.
bool StartsNestedNameSpecifier
Whether this declaration is the beginning of a nested-name-specifier and, therefore,...
void AddTypedTextChunk(const char *Text)
Add a new typed-text chunk.
FunctionType - C99 6.7.5.3 - Function Declarators.
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.
@ CK_HorizontalSpace
Horizontal whitespace (' ').
QualType getBaseType() const
Retrieve the type of the base object in a member-access expression.
FunctionTemplateDecl * FunctionTemplate
The function template overload candidate, available when Kind == CK_FunctionTemplate.
const RawComment * getPatternCompletionComment(const ASTContext &Ctx, const NamedDecl *Decl)
Get the documentation comment used to produce CodeCompletionString::BriefComment for RK_Pattern.
@ CK_ResultType
A piece of text that describes the type of an entity or, for functions and methods,...
Captures a result of code completion.
@ CCP_NextInitializer
Priority for the next initialization in a constructor initializer list.
The base class of the type hierarchy.
@ CK_Aggregate
The candidate is aggregate initialization of a record type.
ChunkKind
The different kinds of "chunks" that can occur within a code completion string.
@ CCP_SuperCompletion
Priority for a send-to-super completion.
FunctionTemplateDecl * getFunctionTemplate() const
Retrieve the function template overload candidate.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
@ CCP_EnumInCase
Priority for an enumeration constant inside a switch whose condition is of the enumeration type.
@ CCC_ObjCCategoryName
Code completion where an Objective-C category name is expected.
CodeCompletionBuilder(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo)
@ CCC_TopLevel
Code completion occurred within a "top-level" completion context, e.g., at namespace or global scope.
Declaration of a template function.
@ CK_LeftAngle
A left angle bracket ('<').
const RecordDecl * AggregateType
The class being aggregate-initialized, when Kind == CK_Aggregate.
const UsingShadowDecl * ShadowDecl
If this Decl was unshadowed by using declaration, this can store a pointer to the UsingShadowDecl whi...
bool operator>(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
void AddCurrentParameterChunk(const char *CurrentParameter)
Add a new current-parameter chunk.
CXAvailabilityKind Availability
The availability of this result.
unsigned IncludeGlobals
Show top-level decls in code completion results.
@ CCC_Recovery
An unknown context, in which we are recovering from a parsing error and don't know which completions ...
@ CK_RightBracket
A right bracket (']').
@ CCC_ObjCProtocolName
Code completion occurred where a protocol name is expected.
@ CCC_EnumTag
Code completion occurred after the "enum" keyword, to indicate an enumeration name.
static Chunk CreateOptional(CodeCompletionString *Optional)
Create a new optional chunk.
unsigned IncludeCodePatterns
Show code patterns in code completion results.
A builder class used to construct new code-completion strings.
@ CXCursor_NotImplemented
@ CCP_CodePattern
Priority for a code pattern.
CodeCompletionResult(CodeCompletionString *Pattern, const NamedDecl *D, unsigned Priority)
Build a result that refers to a pattern with an associated declaration.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
@ CCC_ArrowMemberAccess
Code completion occurred on the right-hand side of a member access expression using the arrow operato...
@ CCC_Symbol
Code completion occurred where an existing name(such as type, function or variable) is expected.
void AddTextChunk(const char *Text)
Add a new text chunk.
static Chunk CreateResultType(const char *ResultType)
Create a new result type chunk.
StringRef getParentContextName() const
Retrieve the name of the parent context.
CodeCompletionTUInfo & getCodeCompletionTUInfo() override
virtual bool isResultFilteredOut(StringRef Filter, CodeCompletionResult Results)
FunctionDecl * Function
The function overload candidate, available when Kind == CK_Function.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
@ CCP_Constant
Priority for a constant value (e.g., enumerator).
@ CCP_ObjC_cmd
Priority for the Objective-C "_cmd" implicit parameter.
@ CCP_Type
Priority for a type.
@ CCC_ObjCInterfaceName
Code completion where the name of an Objective-C class is expected.
@ CK_Informative
A piece of text that describes something about the result but should not be inserted into the buffer.
@ CCC_Attribute
Code completion of an attribute name.
void setCXXScopeSpecifier(CXXScopeSpec SS)
Sets the scope specifier that comes before the completion token.
@ CK_LeftParen
A left parenthesis ('(').
@ CK_FunctionType
The "candidate" is actually a variable, expression, or block for which we only have a function protot...
CodeCompletionString * Optional
The code completion string associated with a CK_Optional chunk.
@ CCC_ObjCMessageReceiver
Code completion occurred where an Objective-C message receiver is expected.
const MacroInfo * MacroDefInfo
If the result is RK_Macro, this can store the information about the macro definition.
bool QualifierIsInformative
Whether this result was found via lookup into a base class.
void setPreferredType(QualType T)
CodeCompletionAllocator & getAllocator() const
Retrieve the allocator into which the code completion strings should be allocated.
CodeCompletionString & operator=(const CodeCompletionString &)=delete
const RawComment * getParameterComment(const ASTContext &Ctx, const CodeCompleteConsumer::OverloadCandidate &Result, unsigned ArgIndex)
Get the documentation comment used to produce CodeCompletionString::BriefComment for OverloadCandidat...
OverloadCandidate(const TemplateDecl *Template)
unsigned StartParameter
Specifies which parameter (of a function, Objective-C method, macro, etc.) we should start with when ...
@ CCP_MemberDeclaration
Priority for a member declaration found from the current method or member function.
std::string getAsString() const
Retrieve a string representation of the code completion string, which is mainly useful for debugging.
std::string getAllTypedText() const
Returns the combined text from all TypedText chunks.
A "string" used to describe how code completion can be performed for an entity.
static Chunk CreateCurrentParameter(const char *CurrentParameter)
Create a new current-parameter chunk.
bool includeMacros() const
Whether the code-completion consumer wants to see macros.
virtual void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, CodeCompletionResult *Results, unsigned NumResults)
Process the finalized code-completion results.
@ CCC_OtherWithMacros
An unspecified code-completion context where we should also add macro completions.
CodeCompletionString * createCodeCompletionStringForOverride(Preprocessor &PP, ASTContext &Ctx, CodeCompletionBuilder &Result, bool IncludeBriefComments, const CodeCompletionContext &CCContext, PrintingPolicy &Policy)
void AddResultTypeChunk(const char *ResultType)
Add a new result-type chunk.
@ CCC_Namespace
Code completion occurred where a namespace or namespace alias is expected.
@ RK_Macro
Refers to a macro.
unsigned IncludeNamespaceLevelDecls
Show decls in namespace (including the global namespace) in code completion results.
void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, OverloadCandidate *Candidates, unsigned NumCandidates, SourceLocation OpenParLoc, bool Braced) override
const Chunk & operator[](unsigned I) const
SimplifiedTypeClass getSimplifiedTypeClass(CanQualType T)
Determine the simplified type class of the given canonical type.
const NamedDecl * Declaration
When Kind == RK_Declaration or RK_Pattern, the declaration we are referring to.
PrintingCodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts, raw_ostream &OS)
Create a new printing code-completion consumer that prints its results to the given raw output stream...
@ CK_RightBrace
A right brace ('}').
std::shared_ptr< GlobalCodeCompletionAllocator > getAllocatorRef() const
@ CCP_Unlikely
Priority for a result that isn't likely to be what the user wants, but is included for completeness.
@ CCC_ObjCPropertyAccess
Code completion occurred on the right-hand side of an Objective-C property access expression.
ChunkKind Kind
The kind of data stored in this piece of the code completion string.
@ CK_SemiColon
A semicolon (';').
bool operator<=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
@ CCD_ProbablyNotObjCCollection
Adjustment for KVC code pattern priorities when it doesn't look like the.
llvm::Optional< const CXXScopeSpec * > getCXXScopeSpecifier()
@ CCC_PreprocessorExpression
Code completion occurred within a preprocessor expression.
void AddAnnotation(const char *A)
Kind getKind() const
Retrieve the kind of code-completion context.
@ CXCursor_MacroDefinition
@ CXAvailability_Available
The entity is available.
CXAvailabilityKind
Describes the availability of a particular entity, which indicates whether the use of this entity wil...
NestedNameSpecifier * Qualifier
If the result should have a nested-name-specifier, this is it.
The base class of all kinds of template declarations (e.g., class, function, etc.).
const char * getTypedText() const
Returns the text in the first TypedText chunk.
@ CCC_PreprocessorDirective
Code completion occurred where a preprocessor directive is expected.
bool includeFixIts() const
Whether to include completion items with small fix-its, e.g.
bool isUsingDeclaration() const
CXCursorKind
Describes the kind of entity that a cursor refers to.
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, CodeCompletionResult *Results, unsigned NumResults) override
Prints the finalized code-completion results.
Sema - This implements semantic analysis and AST building for C.
const char * getKeyword() const
Retrieve the keyword stored in this result.
@ CCC_ClassStructUnion
Code completion occurred within a class, struct, or union.
@ CCC_Statement
Code completion occurred where a statement (or declaration) is expected in a function,...
Abstract interface for a consumer of code-completion information.
@ CCC_DotMemberAccess
Code completion occurred on the right-hand side of a member access expression using the dot operator.
bool Hidden
Whether this result is hidden by another name.
unsigned getAvailability() const
Retrieve the availability of this code completion result.
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.
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.
CodeCompletionString * createCodeCompletionStringForDecl(Preprocessor &PP, ASTContext &Ctx, CodeCompletionBuilder &Result, bool IncludeBriefComments, const CodeCompletionContext &CCContext, PrintingPolicy &Policy)
const IdentifierInfo * Macro
When Kind == RK_Macro, the identifier that refers to a macro.
@ CK_CurrentParameter
A piece of text that describes the parameter that corresponds to the code-completion location within ...
const NamedDecl * getDeclaration() const
Retrieve the declaration stored in this result.
const char * getAnnotation(unsigned AnnotationNr) const
Retrieve the annotation string specified by AnnotationNr.
One of these records is kept for each identifier that is lexed.
SimplifiedTypeClass
A simplified classification of types used when determining "similar" types for code completion.
@ CCD_MethodAsProperty
An Objective-C method being used as a property.
const CodeCompleteOptions CodeCompleteOpts
@ CK_LeftBracket
A left bracket ('[').
CodeCompletionContext(Kind CCKind, QualType T, ArrayRef< IdentifierInfo * > SelIdents=None)
Construct a new code-completion context of the given kind.
@ CCD_BlockPropertySetter
An Objective-C block property completed as a setter with a block placeholder.
bool includeBriefComments() const
Whether to include brief documentation comments within the set of code completions returned.
const char * getBriefComment() const
@ RK_Pattern
Refers to a precomputed pattern.
@ CCP_Macro
Priority for a preprocessor macro.
ResultKind
Describes the kind of result generated.
CodeCompletionBuilder(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, unsigned Priority, CXAvailabilityKind Availability)
bool AllParametersAreInformative
Whether all parameters (of a function, Objective-C method, etc.) should be considered "informative".
static Chunk CreatePlaceholder(const char *Placeholder)
Create a new placeholder chunk.
@ CCC_NaturalLanguage
Code completion occurred in a context where natural language is expected, e.g., a comment or string l...
@ CK_Placeholder
A string that acts as a placeholder for, e.g., a function call argument.
const RawComment * getCompletionComment(const ASTContext &Ctx, const NamedDecl *Decl)
Get the documentation comment used to produce CodeCompletionString::BriefComment for RK_Declaration.
virtual CodeCompletionAllocator & getAllocator()=0
Retrieve the allocator that will be used to allocate code completion strings.
OverloadCandidate(const FunctionType *Type)
bool InBaseClass
Whether this is a class member from base class.
unsigned getNumParams() const
Get the number of parameters in this signature.
@ CCC_NewName
Code completion occurred where a new name is expected.
@ CCP_LocalDeclaration
Priority for a declaration that is in the local scope.
static Chunk CreateInformative(const char *Informative)
Create a new informative chunk.
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.
virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, OverloadCandidate *Candidates, unsigned NumCandidates, SourceLocation OpenParLoc, bool Braced)
StringRef getOrderedName(std::string &Saved) const
Retrieve the name that should be used to order a result.
bool operator<(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
void setIsUsingDeclaration(bool V)
void AddPlaceholderChunk(const char *Placeholder)
Add a new placeholder chunk.
@ CCP_NestedNameSpecifier
Priority for a nested-name-specifier.
void addBriefComment(StringRef Comment)
CodeCompletionTUInfo(std::shared_ptr< GlobalCodeCompletionAllocator > Allocator)
@ CCC_ObjCIvarList
Code completion occurred within the instance variable list of an Objective-C interface,...
@ CK_RightAngle
A right angle bracket ('>').
@ RK_Declaration
Refers to a declaration.
Options controlling the behavior of code completion.
An allocator used specifically for the purpose of code completion.
@ CCC_ParenthesizedExpression
Code completion in a parenthesized expression, which means that we may also have types here in C and ...
const FunctionType * Type
The function type that describes the entity being called, when Kind == CK_FunctionType.
@ CCF_ExactTypeMatch
Divide by this factor when a code-completion result's type exactly matches the type we expect.
bool DeclaringEntity
Whether we're completing a declaration of the given entity, rather than a use of that entity.
static Chunk CreateText(const char *Text)
Create a new text chunk.
bool wantConstructorResults() const
Determines whether we want C++ constructors as results within this context.
One piece of the code completion string.
@ CCC_SelectorName
Code completion for a selector, as in an @selector expression.
@ CCD_bool_in_ObjC
Adjustment to the "bool" type in Objective-C, where the typedef "BOOL" is preferred.
virtual ~CodeCompleteConsumer()
Deregisters and destroys this code-completion consumer.
ResultKind Kind
The kind of result stored here.
@ CK_Optional
A code completion string that is entirely optional.
Allocator for a cached set of global code completions.
CXCursorKind getCursorKindForDecl(const Decl *D)
Determine the libclang cursor kind associated with the given declaration.
The context in which code completion occurred, so that the code-completion consumer can process the r...
unsigned LoadExternal
Hint whether to load data from the external AST to provide full results.
llvm::StringRef getCompletionKindString(CodeCompletionContext::Kind Kind)
Get string representation of Kind, useful for for debugging.
void AddInformativeChunk(const char *Text)
Add a new informative chunk.
bool operator>=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
@ CK_LeftBrace
A left brace ('{').
std::vector< FixItHint > FixIts
Fix-its that must be applied before inserting the text for the corresponding completion.
StringRef getParentName(const DeclContext *DC)
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
@ CCP_Declaration
Priority for a non-type declaration.
CodeCompletionAllocator & getAllocator() const
CodeCompletionResult(const char *Keyword, unsigned Priority=CCP_Keyword)
Build a result that refers to a keyword or symbol.
CodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts)
StringRef getParentName() const
CXCursorKind CursorKind
The cursor kind that describes this result.
QualType getPreferredType() const
Retrieve the type that this expression would prefer to have, e.g., if the expression is a variable in...
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.
@ CK_Comma
A comma separator (',').
const char * Text
The text string associated with a CK_Text, CK_Placeholder, CK_Informative, or CK_Comma chunk.
Represents a function declaration or definition.
@ CK_Template
The candidate is a template, template arguments are being completed.
Represents a struct/union/class.
@ CCC_UnionTag
Code completion occurred after the "union" keyword, to indicate a union name.
FunctionDecl * getFunction() const
Retrieve the function overload candidate or the templated function declaration for a function templat...
const TemplateDecl * getTemplate() const
QualType getParamType(unsigned N) const
Get the type of the Nth parameter.
CodeCompletionAllocator & getAllocator() override
Retrieve the allocator that will be used to allocate code completion strings.
@ CCC_MacroName
Code completion occurred where an macro is being defined.
void addVisitedContext(DeclContext *Ctx)
Adds a visited context.
const VisitedContextSet & getVisitedContexts() const
Retrieves all visited contexts.
@ CCC_ObjCClassMessage
Code completion where an Objective-C class message is expected.
@ CCC_ObjCInterface
Code completion occurred within an Objective-C interface, protocol, or category interface.
@ CCF_SimilarTypeMatch
Divide by this factor when a code-completion result's type is similar to the type we expect (e....
@ CCC_ClassOrStructTag
Code completion occurred after the "struct" or "class" keyword, to indicate a struct or class name.
@ CCC_TypeQualifiers
Code completion within a type-qualifier list.
@ CCC_MacroNameUse
Code completion occurred where a macro name is expected (without any arguments, in the case of a func...
ArrayRef< IdentifierInfo * > getSelIdents() const
Retrieve the Objective-C selector identifiers.