clang-tools 20.0.0git
Public Member Functions | List of all members
clang::include_fixer::IncludeFixerSemaSource Class Reference

Handles callbacks from sema, does the include lookup and turns it into an IncludeFixerContext. More...

#include <IncludeFixer.h>

Inheritance diagram for clang::include_fixer::IncludeFixerSemaSource:
Inheritance graph
[legend]

Public Member Functions

 IncludeFixerSemaSource (SymbolIndexManager &SymbolIndexMgr, bool MinimizeIncludePaths, bool GenerateDiagnostics)
 
void setCompilerInstance (CompilerInstance *CI)
 
void setFilePath (StringRef FilePath)
 
bool MaybeDiagnoseMissingCompleteType (clang::SourceLocation Loc, clang::QualType T) override
 Callback for incomplete types.
 
clang::TypoCorrection CorrectTypo (const DeclarationNameInfo &Typo, int LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, DeclContext *MemberContext, bool EnteringContext, const ObjCObjectPointerType *OPT) override
 Callback for unknown identifiers.
 
std::string minimizeInclude (StringRef Include, const clang::SourceManager &SourceManager, clang::HeaderSearch &HeaderSearch) const
 Get the minimal include for a given path.
 
IncludeFixerContext getIncludeFixerContext (const clang::SourceManager &SourceManager, clang::HeaderSearch &HeaderSearch, ArrayRef< find_all_symbols::SymbolInfo > MatchedSymbols) const
 Get the include fixer context for the queried symbol.
 
ArrayRef< find_all_symbols::SymbolInfogetMatchedSymbols () const
 Get the global matched symbols.
 

Detailed Description

Handles callbacks from sema, does the include lookup and turns it into an IncludeFixerContext.

Definition at line 85 of file clang-include-fixer/IncludeFixer.h.

Constructor & Destructor Documentation

◆ IncludeFixerSemaSource()

clang::include_fixer::IncludeFixerSemaSource::IncludeFixerSemaSource ( SymbolIndexManager SymbolIndexMgr,
bool  MinimizeIncludePaths,
bool  GenerateDiagnostics 
)
inlineexplicit

Definition at line 87 of file clang-include-fixer/IncludeFixer.h.

Member Function Documentation

◆ CorrectTypo()

clang::TypoCorrection clang::include_fixer::IncludeFixerSemaSource::CorrectTypo ( const DeclarationNameInfo &  Typo,
int  LookupKind,
Scope *  S,
CXXScopeSpec *  SS,
CorrectionCandidateCallback &  CCC,
DeclContext *  MemberContext,
bool  EnteringContext,
const ObjCObjectPointerType *  OPT 
)
override

Callback for unknown identifiers.

Try to piece together as much qualification as we can get and do a query.

If we have a scope specification, use that to get more precise results.

Definition at line 185 of file clang-include-fixer/IncludeFixer.cpp.

References clang::include_fixer::addDiagnosticsForContext(), Code, getIncludeFixerContext(), and Range.

◆ getIncludeFixerContext()

IncludeFixerContext clang::include_fixer::IncludeFixerSemaSource::getIncludeFixerContext ( const clang::SourceManager &  SourceManager,
clang::HeaderSearch &  HeaderSearch,
ArrayRef< find_all_symbols::SymbolInfo MatchedSymbols 
) const

Get the include fixer context for the queried symbol.

Definition at line 326 of file clang-include-fixer/IncludeFixer.cpp.

References minimizeInclude().

Referenced by CorrectTypo(), and MaybeDiagnoseMissingCompleteType().

◆ getMatchedSymbols()

ArrayRef< find_all_symbols::SymbolInfo > clang::include_fixer::IncludeFixerSemaSource::getMatchedSymbols ( ) const
inline

Get the global matched symbols.

Definition at line 125 of file clang-include-fixer/IncludeFixer.h.

◆ MaybeDiagnoseMissingCompleteType()

bool clang::include_fixer::IncludeFixerSemaSource::MaybeDiagnoseMissingCompleteType ( clang::SourceLocation  Loc,
clang::QualType  T 
)
override

Callback for incomplete types.

If we encounter a forward declaration we have the fully qualified name ready. Just query that.

Definition at line 150 of file clang-include-fixer/IncludeFixer.cpp.

References clang::include_fixer::addDiagnosticsForContext(), Code, getIncludeFixerContext(), and Loc.

◆ minimizeInclude()

std::string clang::include_fixer::IncludeFixerSemaSource::minimizeInclude ( StringRef  Include,
const clang::SourceManager &  SourceManager,
clang::HeaderSearch &  HeaderSearch 
) const

Get the minimal include for a given path.

Definition at line 302 of file clang-include-fixer/IncludeFixer.cpp.

References IsAngled.

Referenced by getIncludeFixerContext().

◆ setCompilerInstance()

void clang::include_fixer::IncludeFixerSemaSource::setCompilerInstance ( CompilerInstance *  CI)
inline

Definition at line 94 of file clang-include-fixer/IncludeFixer.h.

References CI.

◆ setFilePath()

void clang::include_fixer::IncludeFixerSemaSource::setFilePath ( StringRef  FilePath)
inline

Definition at line 95 of file clang-include-fixer/IncludeFixer.h.


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