[clang-tools-extra] 01e5290 - [clangd] Simplify the code, NFC.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 5 06:32:30 PST 2019
Author: Haojian Wu
Date: 2019-12-05T15:32:14+01:00
New Revision: 01e5290b49bd2a8753c685bb5f02596989a31754
URL: https://github.com/llvm/llvm-project/commit/01e5290b49bd2a8753c685bb5f02596989a31754
DIFF: https://github.com/llvm/llvm-project/commit/01e5290b49bd2a8753c685bb5f02596989a31754.diff
LOG: [clangd] Simplify the code, NFC.
AST.getASTContext().getSourceManager() => AST.getSourceManager().
Added:
Modified:
clang-tools-extra/clangd/Hover.cpp
clang-tools-extra/clangd/XRefs.cpp
clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp
index 9053bc08b4ec..6a7d994ce7e3 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools-extra/clangd/Hover.cpp
@@ -434,7 +434,7 @@ llvm::Optional<HoverInfo> getHover(ParsedAST &AST, Position Pos,
tooling::applyAllReplacements(HI->Definition, Replacements))
HI->Definition = *Formatted;
- HI->SymRange = getTokenRange(AST.getASTContext().getSourceManager(),
+ HI->SymRange = getTokenRange(AST.getSourceManager(),
AST.getLangOpts(), SourceLocationBeg);
return HI;
}
diff --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp
index 8bcc268d1b18..157faf37ea1e 100644
--- a/clang-tools-extra/clangd/XRefs.cpp
+++ b/clang-tools-extra/clangd/XRefs.cpp
@@ -373,7 +373,7 @@ std::vector<DocumentHighlight> findDocumentHighlights(ParsedAST &AST,
//
diff erent kinds, deduplicate them.
std::vector<DocumentHighlight> Result;
for (const auto &Ref : References) {
- if (auto Range = getTokenRange(AST.getASTContext().getSourceManager(),
+ if (auto Range = getTokenRange(AST.getSourceManager(),
AST.getLangOpts(), Ref.Loc)) {
DocumentHighlight DH;
DH.range = *Range;
diff --git a/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp b/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
index ed3725bf7ea1..879f4d23c24b 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
@@ -61,7 +61,7 @@ REGISTER_TWEAK(DumpAST)
llvm::Expected<Tweak::Effect> DumpAST::apply(const Selection &Inputs) {
std::string Str;
llvm::raw_string_ostream OS(Str);
- Node->dump(OS, Inputs.AST.getASTContext().getSourceManager());
+ Node->dump(OS, Inputs.AST.getSourceManager());
return Effect::showMessage(std::move(OS.str()));
}
diff --git a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
index 31e79d27d06f..a17324d07dbb 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
@@ -71,7 +71,7 @@ bool ExpandAutoType::prepare(const Selection& Inputs) {
}
Expected<Tweak::Effect> ExpandAutoType::apply(const Selection& Inputs) {
- auto& SrcMgr = Inputs.AST.getASTContext().getSourceManager();
+ auto& SrcMgr = Inputs.AST.getSourceManager();
llvm::Optional<clang::QualType> DeducedType =
getDeducedType(Inputs.AST.getASTContext(), CachedLocation->getBeginLoc());
@@ -107,7 +107,7 @@ Expected<Tweak::Effect> ExpandAutoType::apply(const Selection& Inputs) {
llvm::Error ExpandAutoType::createErrorMessage(const std::string& Message,
const Selection& Inputs) {
- auto& SrcMgr = Inputs.AST.getASTContext().getSourceManager();
+ auto& SrcMgr = Inputs.AST.getSourceManager();
std::string ErrorMessage =
Message + ": " +
SrcMgr.getFilename(Inputs.Cursor).str() + " Line " +
More information about the cfe-commits
mailing list