From 50a967d601749beceaaf901b5931fa0a96fb17df Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 28 Dec 2017 14:47:01 +0000 Subject: [clangd] Simplify code. No functionality change intended. llvm-svn: 321523 --- clang-tools-extra/clangd/index/SymbolCollector.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'clang-tools-extra/clangd/index/SymbolCollector.cpp') diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp index 1442f9364a6..3ffc1d1b3b2 100644 --- a/clang-tools-extra/clangd/index/SymbolCollector.cpp +++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp @@ -48,11 +48,10 @@ std::string makeAbsolutePath(const SourceManager &SM, StringRef Path) { llvm::sys::path::parent_path(AbsolutePath.str())); if (Dir) { StringRef DirName = SM.getFileManager().getCanonicalName(Dir); - SmallVector AbsoluteFilename; + SmallString<128> AbsoluteFilename; llvm::sys::path::append(AbsoluteFilename, DirName, llvm::sys::path::filename(AbsolutePath.str())); - return llvm::StringRef(AbsoluteFilename.data(), AbsoluteFilename.size()) - .str(); + return AbsoluteFilename.str(); } return AbsolutePath.str(); } @@ -85,11 +84,10 @@ bool SymbolCollector::handleDeclOccurence( if (!ND->hasExternalFormalLinkage() || ND->isInAnonymousNamespace()) return true; - llvm::SmallVector Buff; - if (index::generateUSRForDecl(ND, Buff)) + llvm::SmallString<128> USR; + if (index::generateUSRForDecl(ND, USR)) return true; - std::string USR(Buff.data(), Buff.size()); auto ID = SymbolID(USR); if (Symbols.find(ID) != nullptr) return true; -- cgit v1.2.3