[PATCH] D58769: Moved DenseMap support for SymbolID into SymbolID.h
Dmitri Gribenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 28 02:53:35 PST 2019
gribozavr created this revision.
gribozavr added a reviewer: ioeric.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D58769
Files:
clang-tools-extra/clangd/index/Index.h
clang-tools-extra/clangd/index/SymbolID.h
Index: clang-tools-extra/clangd/index/SymbolID.h
===================================================================
--- clang-tools-extra/clangd/index/SymbolID.h
+++ clang-tools-extra/clangd/index/SymbolID.h
@@ -9,6 +9,7 @@
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOLID_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOLID_H
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
@@ -61,4 +62,25 @@
} // namespace clangd
} // namespace clang
+namespace llvm {
+// Support SymbolIDs as DenseMap keys.
+template <> struct DenseMapInfo<clang::clangd::SymbolID> {
+ static inline clang::clangd::SymbolID getEmptyKey() {
+ static clang::clangd::SymbolID EmptyKey("EMPTYKEY");
+ return EmptyKey;
+ }
+ static inline clang::clangd::SymbolID getTombstoneKey() {
+ static clang::clangd::SymbolID TombstoneKey("TOMBSTONEKEY");
+ return TombstoneKey;
+ }
+ static unsigned getHashValue(const clang::clangd::SymbolID &Sym) {
+ return hash_value(Sym);
+ }
+ static bool isEqual(const clang::clangd::SymbolID &LHS,
+ const clang::clangd::SymbolID &RHS) {
+ return LHS == RHS;
+ }
+};
+} // namespace llvm
+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOLID_H
Index: clang-tools-extra/clangd/index/Index.h
===================================================================
--- clang-tools-extra/clangd/index/Index.h
+++ clang-tools-extra/clangd/index/Index.h
@@ -94,31 +94,6 @@
}
llvm::raw_ostream &operator<<(llvm::raw_ostream &, const SymbolLocation &);
-} // namespace clangd
-} // namespace clang
-namespace llvm {
-// Support SymbolIDs as DenseMap keys.
-template <> struct DenseMapInfo<clang::clangd::SymbolID> {
- static inline clang::clangd::SymbolID getEmptyKey() {
- static clang::clangd::SymbolID EmptyKey("EMPTYKEY");
- return EmptyKey;
- }
- static inline clang::clangd::SymbolID getTombstoneKey() {
- static clang::clangd::SymbolID TombstoneKey("TOMBSTONEKEY");
- return TombstoneKey;
- }
- static unsigned getHashValue(const clang::clangd::SymbolID &Sym) {
- return hash_value(Sym);
- }
- static bool isEqual(const clang::clangd::SymbolID &LHS,
- const clang::clangd::SymbolID &RHS) {
- return LHS == RHS;
- }
-};
-} // namespace llvm
-namespace clang {
-namespace clangd {
-
// Describes the source of information about a symbol.
// Mainly useful for debugging, e.g. understanding code completion reuslts.
// This is a bitfield as information can be combined from several sources.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58769.188696.patch
Type: text/x-patch
Size: 2582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190228/75877c23/attachment-0001.bin>
More information about the cfe-commits
mailing list