[PATCH] D50375: [clangd] Share getSymbolID implementation.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 7 01:48:28 PDT 2018


ioeric accepted this revision.
ioeric added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clangd/AST.cpp:59
+  llvm::SmallString<128> USR;
+  if (index::generateUSRForDecl(D, USR)) {
+    return None;
----------------
nit: no braces


================
Comment at: clangd/AST.h:38
+/// Gets the symbol ID for a declaration.
+/// Returns None if fails.
+llvm::Optional<SymbolID> getSymbolID(const Decl *D);
----------------
nit: this isn't necessary a failure. `D` might not have USR. Maybe `..., if possible.` like the original wording?


================
Comment at: clangd/CodeComplete.cpp:399
   case CodeCompletionResult::RK_Pattern: {
-    llvm::SmallString<128> USR;
-    if (/*Ignore=*/clang::index::generateUSRForDecl(R.Declaration, USR))
-      return None;
-    return SymbolID(USR);
+    return clang::clangd::getSymbolID(R.Declaration);
   }
----------------
No need for namespace qualifiers?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50375





More information about the cfe-commits mailing list