clang-tools 10.0.0

Classes | Public Member Functions | List of all members
clang::clangd::IncludeFixer Class Reference

Attempts to recover from error diagnostics by suggesting include insertion fixes. More...

`#include <IncludeFixer.h>`

## Classes
class | UnresolvedNameRecorder

## Public Member Functions
| IncludeFixer (llvm::StringRef File, std::shared_ptr< IncludeInserter > Inserter, const SymbolIndex &Index, unsigned IndexRequestLimit)
std::vector< Fix > | fix (DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic &Info) const
| Returns include insertions that can potentially recover the diagnostic. More...
llvm::IntrusiveRefCntPtr< ExternalSemaSource > | unresolvedNameRecorder ()
| Returns an ExternalSemaSource that records failed name lookups in Sema. More...

## Detailed Description

Attempts to recover from error diagnostics by suggesting include insertion fixes.

For example, member access into incomplete type can be fixes by include headers with the definition.

Definition at line 35 of file clangd/IncludeFixer.h.

## Constructor & Destructor Documentation

## ◆ IncludeFixer()

clang::clangd::IncludeFixer::IncludeFixer | ( | llvm::StringRef | File,
|  | std::shared_ptr< IncludeInserter > | Inserter,
|  | const SymbolIndex & | Index,
|  | unsigned | IndexRequestLimit
| ) |  |
| inline

Definition at line 37 of file clangd/IncludeFixer.h.

References fix(), clang::clangd::Info, Loc, Name, Type, and unresolvedNameRecorder().

## Member Function Documentation

## ◆ fix()

std::vector< Fix > clang::clangd::IncludeFixer::fix | ( | DiagnosticsEngine::Level | DiagLevel,
|  | const clang::Diagnostic & | Info
| ) |  | const

Returns include insertions that can potentially recover the diagnostic.

Definition at line 68 of file clangd/IncludeFixer.cpp.

References clang::clangd::Error, clang::clangd::printQualifiedName(), and Type.

Referenced by IncludeFixer().

## ◆ unresolvedNameRecorder()

llvm::IntrusiveRefCntPtr< ExternalSemaSource > clang::clangd::IncludeFixer::unresolvedNameRecorder | ( |  | ) |

Returns an ExternalSemaSource that records failed name lookups in Sema.

This allows IncludeFixer to suggest inserting headers that define those names.

Definition at line 380 of file clangd/IncludeFixer.cpp.

References clang::clangd::FuzzyFindRequest::AnyScope, E, clang::clangd::Symbol::IncludeHeaders, Index, clang::clangd::SymbolSlab::Builder::insert(), clang::tidy::cppcoreguidelines::join(), clang::clangd::FuzzyFindRequest::Limit, clang::clangd::Symbol::Name, clang::clangd::None, clang::clangd::FuzzyFindRequest::Query, clang::clangd::FuzzyFindRequest::RestrictForCodeCompletion, clang::clangd::FuzzyFindRequest::Scopes, clang::clangd::toJSON(), and clang::clangd::vlog().

Referenced by IncludeFixer().

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

- clangd/IncludeFixer.h
- clangd/IncludeFixer.cpp