[PATCH] D51527: [NFC] Use LLVM naming conventions within FileDistance
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 31 00:50:25 PDT 2018
kbobyrev created this revision.
kbobyrev added reviewers: sammccall, ioeric.
kbobyrev added a project: clang-tools-extra.
Herald added subscribers: kadircet, arphaman, jkorous.
https://reviews.llvm.org/D51527
Files:
clang-tools-extra/clangd/FileDistance.cpp
clang-tools-extra/clangd/FileDistance.h
Index: clang-tools-extra/clangd/FileDistance.h
===================================================================
--- clang-tools-extra/clangd/FileDistance.h
+++ clang-tools-extra/clangd/FileDistance.h
@@ -66,7 +66,7 @@
// This object should be reused, it memoizes intermediate computations.
class FileDistance {
public:
- static constexpr unsigned kUnreachable = std::numeric_limits<unsigned>::max();
+ static constexpr unsigned Unreachable = std::numeric_limits<unsigned>::max();
FileDistance(llvm::StringMap<SourceParams> Sources,
const FileDistanceOptions &Opts = {});
Index: clang-tools-extra/clangd/FileDistance.cpp
===================================================================
--- clang-tools-extra/clangd/FileDistance.cpp
+++ clang-tools-extra/clangd/FileDistance.cpp
@@ -53,8 +53,6 @@
return Result;
}
-constexpr const unsigned FileDistance::kUnreachable;
-
FileDistance::FileDistance(StringMap<SourceParams> Sources,
const FileDistanceOptions &Opts)
: Opts(Opts) {
@@ -102,7 +100,7 @@
auto ParentCost = Cache.lookup(Next.front());
for (auto Child : DownEdges.lookup(Next.front())) {
auto &ChildCost =
- Cache.try_emplace(Child, kUnreachable).first->getSecond();
+ Cache.try_emplace(Child, Unreachable).first->getSecond();
if (ParentCost + Opts.DownCost < ChildCost)
ChildCost = ParentCost + Opts.DownCost;
Next.push(Child);
@@ -113,7 +111,7 @@
unsigned FileDistance::distance(StringRef Path) {
auto Canonical = canonicalize(Path);
- unsigned Cost = kUnreachable;
+ unsigned Cost = Unreachable;
SmallVector<hash_code, 16> Ancestors;
// Walk up ancestors until we find a path we know the distance for.
for (StringRef Rest = Canonical; !Rest.empty();
@@ -129,16 +127,16 @@
// Now we know the costs for (known node, queried node].
// Fill these in, walking down the directory tree.
for (hash_code Hash : reverse(Ancestors)) {
- if (Cost != kUnreachable)
+ if (Cost != Unreachable)
Cost += Opts.DownCost;
Cache.try_emplace(Hash, Cost);
}
dlog("distance({0} = {1})", Path, Cost);
return Cost;
}
unsigned URIDistance::distance(llvm::StringRef URI) {
- auto R = Cache.try_emplace(llvm::hash_value(URI), FileDistance::kUnreachable);
+ auto R = Cache.try_emplace(llvm::hash_value(URI), FileDistance::Unreachable);
if (!R.second)
return R.first->getSecond();
if (auto U = clangd::URI::parse(URI)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51527.163468.patch
Type: text/x-patch
Size: 2499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180831/f72f5eca/attachment-0001.bin>
More information about the cfe-commits
mailing list