#include "IncludeFixer.h"
#include "clang/Format/Format.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Parse/ParseAST.h"
#include "clang/Sema/Sema.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#define DEBUG_TYPE …
usingnamespaceclang;
namespace clang {
namespace include_fixer {
namespace {
class Action : public clang::ASTFrontendAction { … };
}
IncludeFixerActionFactory::IncludeFixerActionFactory(
SymbolIndexManager &SymbolIndexMgr,
std::vector<IncludeFixerContext> &Contexts, StringRef StyleName,
bool MinimizeIncludePaths)
: … { … }
IncludeFixerActionFactory::~IncludeFixerActionFactory() = default;
bool IncludeFixerActionFactory::runInvocation(
std::shared_ptr<clang::CompilerInvocation> Invocation,
clang::FileManager *Files,
std::shared_ptr<clang::PCHContainerOperations> PCHContainerOps,
clang::DiagnosticConsumer *Diagnostics) { … }
static bool addDiagnosticsForContext(TypoCorrection &Correction,
const IncludeFixerContext &Context,
StringRef Code, SourceLocation StartOfFile,
ASTContext &Ctx) { … }
bool IncludeFixerSemaSource::MaybeDiagnoseMissingCompleteType(
clang::SourceLocation Loc, clang::QualType T) { … }
clang::TypoCorrection IncludeFixerSemaSource::CorrectTypo(
const DeclarationNameInfo &Typo, int LookupKind, Scope *S, CXXScopeSpec *SS,
CorrectionCandidateCallback &CCC, DeclContext *MemberContext,
bool EnteringContext, const ObjCObjectPointerType *OPT) { … }
std::string IncludeFixerSemaSource::minimizeInclude(
StringRef Include, const clang::SourceManager &SourceManager,
clang::HeaderSearch &HeaderSearch) const { … }
IncludeFixerContext IncludeFixerSemaSource::getIncludeFixerContext(
const clang::SourceManager &SourceManager,
clang::HeaderSearch &HeaderSearch,
ArrayRef<find_all_symbols::SymbolInfo> MatchedSymbols) const { … }
std::vector<find_all_symbols::SymbolInfo>
IncludeFixerSemaSource::query(StringRef Query, StringRef ScopedQualifiers,
tooling::Range Range) { … }
llvm::Expected<tooling::Replacements> createIncludeFixerReplacements(
StringRef Code, const IncludeFixerContext &Context,
const clang::format::FormatStyle &Style, bool AddQualifiers) { … }
}
}