clang-tools 10.0.0

Classes | Functions
clang::include_fixer Namespace Reference

## Classes
class | ClangIncludeFixerPluginAction
| The core include fixer plugin action. More...
class | FuzzySymbolIndex
class | IncludeFixerActionFactory
class | IncludeFixerContext
| A context for a file being processed. More...
class | IncludeFixerSemaSource
| Handles callbacks from sema, does the include lookup and turns it into an IncludeFixerContext. More...
class | InMemorySymbolIndex
| Xref database with fixed content. More...
class | SymbolIndex
| This class provides an interface for finding all `SymbolInfo`s corresponding to a symbol name from a symbol database. More...
class | SymbolIndexManager
| This class provides an interface for finding the header files corresponding to an identifier in the source code from multiple symbol databases. More...
class | YamlSymbolIndex
| Yaml format database. More...

## Functions
static bool | addDiagnosticsForContext (TypoCorrection &Correction, const IncludeFixerContext &Context, StringRef Code, SourceLocation StartOfFile, ASTContext &Ctx)
llvm::Expected< tooling::Replacements > | createIncludeFixerReplacements (StringRef Code, const IncludeFixerContext &Context, const clang::format::FormatStyle &Style, bool AddQualifiers)
llvm::Expected< tooling::Replacements > | createIncludeFixerReplacements (StringRef Code, const IncludeFixerContext &Context, const format::FormatStyle &Style=format::getLLVMStyle(), bool AddQualifiers=true)
| Create replacements, which are generated by clang-format, for the missing header and mising qualifiers insertions. More...
static double | similarityScore (llvm::StringRef FileName, llvm::StringRef Header)
static void | rank (std::vector< SymbolAndSignals > &Symbols, llvm::StringRef FileName)

## Function Documentation

## ◆ addDiagnosticsForContext()

static bool clang::include_fixer::addDiagnosticsForContext | ( | TypoCorrection & | Correction,
|  | const IncludeFixerContext & | Context,
|  | StringRef | Code,
|  | SourceLocation | StartOfFile,
|  | ASTContext & | Ctx
| ) |  |
| static

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

Referenced by clang::include_fixer::IncludeFixerSemaSource::MaybeDiagnoseMissingCompleteType().

## ◆ createIncludeFixerReplacements() [1/2]

llvm::Expected<tooling::Replacements> clang::include_fixer::createIncludeFixerReplacements | ( | StringRef | Code,
|  | const IncludeFixerContext & | Context,
|  | const format::FormatStyle & | Style = `format::getLLVMStyle()`,
|  | bool | AddQualifiers = `true`
| ) |  |

Create replacements, which are generated by clang-format, for the missing header and mising qualifiers insertions.

The function uses the first header for insertion.

Parameters

  Code | The source code.
  Context | The context which contains all information for creating clang-include-fixer replacements.
  Style | clang-format style being used.
  AddQualifiers | Whether we should add qualifiers to all instances of an unidentified symbol.

Returns
  Formatted replacements for inserting, sorting headers and adding qualifiers on success; otherwise, an llvm::Error carrying llvm::StringError is returned.

## ◆ createIncludeFixerReplacements() [2/2]

llvm::Expected<tooling::Replacements> clang::include_fixer::createIncludeFixerReplacements | ( | StringRef | Code,
|  | const IncludeFixerContext & | Context,
|  | const clang::format::FormatStyle & | Style,
|  | bool | AddQualifiers
| ) |  |

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

## ◆ rank()

static void clang::include_fixer::rank | ( | std::vector< SymbolAndSignals > & | Symbols,
|  | llvm::StringRef | FileName
| ) |  |
| static

Definition at line 48 of file SymbolIndexManager.cpp.

References clang::find_all_symbols::SymbolInfo::getFilePath(), Score, similarityScore(), and clang::find_all_symbols::SymbolAndSignals::Symbol.

Referenced by clang::include_fixer::SymbolIndexManager::search().

## ◆ similarityScore()

static double clang::include_fixer::similarityScore | ( | llvm::StringRef | FileName,
|  | llvm::StringRef | Header
| ) |  |
| static

Definition at line 26 of file SymbolIndexManager.cpp.

Referenced by rank().