clang API Documentation

Classes | Public Member Functions
clang::TypoCorrectionConsumer Class Reference

#include <SemaInternal.h>

Inheritance diagram for clang::TypoCorrectionConsumer:
Inheritance graph
[legend]
Collaboration diagram for clang::TypoCorrectionConsumer:
Collaboration graph
[legend]

List of all members.

Classes

class  NamespaceSpecifierSet

Public Member Functions

 TypoCorrectionConsumer (Sema &SemaRef, const DeclarationNameInfo &TypoName, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, std::unique_ptr< CorrectionCandidateCallback > CCC, DeclContext *MemberContext, bool EnteringContext)
bool includeHiddenDecls () const override
 Determine whether hidden declarations (from unimported modules) should be given to this consumer. By default, they are not included.
void FoundDecl (NamedDecl *ND, NamedDecl *Hiding, DeclContext *Ctx, bool InBaseClass) override
 Invoked each time Sema::LookupVisibleDecls() finds a declaration visible from the current scope or context.
void FoundName (StringRef Name)
void addKeywordResult (StringRef Keyword)
void addCorrection (TypoCorrection Correction)
bool empty () const
TypoResultList & operator[] (StringRef Name)
 Return the list of TypoCorrections for the given identifier from the set of corrections that have the closest edit distance, if any.
unsigned getBestEditDistance (bool Normalized)
 Return the edit distance of the corrections that have the closest/best edit distance from the original typop.
void addNamespaces (const llvm::MapVector< NamespaceDecl *, bool > &KnownNamespaces)
 Set-up method to add to the consumer the set of namespaces to use in performing corrections to nested name specifiers. This method also implicitly adds all of the known classes in the current AST context to the to the consumer for correcting nested name specifiers.
const TypoCorrectiongetNextCorrection ()
 Return the next typo correction that passes all internal filters and is deemed valid by the consumer's CorrectionCandidateCallback, starting with the corrections that have the closest edit distance. An empty TypoCorrection is returned once no more viable corrections remain in the consumer.
const TypoCorrectiongetCurrentCorrection ()
 Get the last correction returned by getNextCorrection().
void resetCorrectionStream ()
 Reset the consumer's position in the stream of viable corrections (i.e. getNextCorrection() will return each of the previously returned corrections in order before returning any new corrections).
bool finished ()
 Return whether the end of the stream of corrections has been reached.
ASTContextgetContext () const
const LookupResultgetLookupResult () const

Detailed Description

Definition at line 90 of file SemaInternal.h.


Constructor & Destructor Documentation

clang::TypoCorrectionConsumer::TypoCorrectionConsumer ( Sema SemaRef,
const DeclarationNameInfo TypoName,
Sema::LookupNameKind  LookupKind,
Scope S,
CXXScopeSpec SS,
std::unique_ptr< CorrectionCandidateCallback CCC,
DeclContext MemberContext,
bool  EnteringContext 
) [inline]

Definition at line 96 of file SemaInternal.h.

References clang::LookupResult::suppressDiagnostics().


Member Function Documentation

void TypoCorrectionConsumer::addKeywordResult ( StringRef  Keyword)

Definition at line 3394 of file SemaLookup.cpp.

Referenced by AddKeywordsToConsumer().

void TypoCorrectionConsumer::addNamespaces ( const llvm::MapVector< NamespaceDecl *, bool > &  KnownNamespaces)

Set-up method to add to the consumer the set of namespaces to use in performing corrections to nested name specifiers. This method also implicitly adds all of the known classes in the current AST context to the to the consumer for correcting nested name specifiers.

Definition at line 3467 of file SemaLookup.cpp.

References clang::Sema::getASTContext(), and clang::ASTContext::types().

Definition at line 124 of file SemaInternal.h.

Return whether the end of the stream of corrections has been reached.

Definition at line 174 of file SemaInternal.h.

void TypoCorrectionConsumer::FoundDecl ( NamedDecl ND,
NamedDecl Hiding,
DeclContext Ctx,
bool  InBaseClass 
) [override, virtual]

Invoked each time Sema::LookupVisibleDecls() finds a declaration visible from the current scope or context.

Parameters:
NDthe declaration found.
Hidinga declaration that hides the declaration ND, or NULL if no such declaration exists.
Ctxthe original context from which the lookup started.
InBaseClasswhether this declaration was found in base class of the context we searched.

Implements clang::VisibleDeclConsumer.

Definition at line 3366 of file SemaLookup.cpp.

References findAcceptableDecl(), clang::NamedDecl::getIdentifier(), clang::IdentifierInfo::getName(), clang::LookupResult::isVisible(), and Typo.

void TypoCorrectionConsumer::FoundName ( StringRef  Name)

Definition at line 3388 of file SemaLookup.cpp.

Return the edit distance of the corrections that have the closest/best edit distance from the original typop.

Definition at line 136 of file SemaInternal.h.

References clang::TypoCorrection::NormalizeEditDistance().

Definition at line 179 of file SemaInternal.h.

References clang::Sema::Context.

Get the last correction returned by getNextCorrection().

Definition at line 159 of file SemaInternal.h.

Definition at line 180 of file SemaInternal.h.

Return the next typo correction that passes all internal filters and is deemed valid by the consumer's CorrectionCandidateCallback, starting with the corrections that have the closest edit distance. An empty TypoCorrection is returned once no more viable corrections remain in the consumer.

Definition at line 3492 of file SemaLookup.cpp.

References clang::TypoCorrection::begin(), clang::TypoCorrection::isResolved(), and clang::TypoCorrection::requiresImport().

bool clang::TypoCorrectionConsumer::includeHiddenDecls ( ) const [inline, override, virtual]

Determine whether hidden declarations (from unimported modules) should be given to this consumer. By default, they are not included.

Reimplemented from clang::VisibleDeclConsumer.

Definition at line 115 of file SemaInternal.h.

TypoResultList& clang::TypoCorrectionConsumer::operator[] ( StringRef  Name) [inline]

Return the list of TypoCorrections for the given identifier from the set of corrections that have the closest edit distance, if any.

Definition at line 130 of file SemaInternal.h.

Reset the consumer's position in the stream of viable corrections (i.e. getNextCorrection() will return each of the previously returned corrections in order before returning any new corrections).

Definition at line 168 of file SemaInternal.h.


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