[clangd][NFC] Remove unnecessary vector.

As pointed out in D92788.

Reviewed By: kbobyrev

Differential Revision: https://reviews.llvm.org/D92986
This commit is contained in:
Nathan James 2020-12-10 14:59:16 +00:00
parent 34d2688a50
commit a0cf2b8f71
No known key found for this signature in database
GPG Key ID: CC007AFCDA90AA5F
1 changed files with 6 additions and 7 deletions

View File

@ -187,9 +187,6 @@ const Symbol &findSymbol(const SymbolSlab &Slab, llvm::StringRef QName) {
}
const NamedDecl &findDecl(ParsedAST &AST, llvm::StringRef QName) {
llvm::SmallVector<llvm::StringRef> Components;
QName.split(Components, "::");
auto &Ctx = AST.getASTContext();
auto LookupDecl = [&Ctx](const DeclContext &Scope,
llvm::StringRef Name) -> const NamedDecl & {
@ -200,11 +197,13 @@ const NamedDecl &findDecl(ParsedAST &AST, llvm::StringRef QName) {
};
const DeclContext *Scope = Ctx.getTranslationUnitDecl();
for (auto NameIt = Components.begin(), End = Components.end() - 1;
NameIt != End; ++NameIt) {
Scope = &cast<DeclContext>(LookupDecl(*Scope, *NameIt));
StringRef Cur, Rest;
for (std::tie(Cur, Rest) = QName.split("::"); !Rest.empty();
std::tie(Cur, Rest) = Rest.split("::")) {
Scope = &cast<DeclContext>(LookupDecl(*Scope, Cur));
}
return LookupDecl(*Scope, Components.back());
return LookupDecl(*Scope, Cur);
}
const NamedDecl &findDecl(ParsedAST &AST,