[PATCH] D92986: [clangd][NFC] Remove unnecessary vector.
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 10 06:59:28 PST 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa0cf2b8f712e: [clangd][NFC] Remove unnecessary vector. (authored by njames93).
Changed prior to commit:
https://reviews.llvm.org/D92986?vs=310729&id=310879#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92986/new/
https://reviews.llvm.org/D92986
Files:
clang-tools-extra/clangd/unittests/TestTU.cpp
Index: clang-tools-extra/clangd/unittests/TestTU.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/TestTU.cpp
+++ clang-tools-extra/clangd/unittests/TestTU.cpp
@@ -187,9 +187,6 @@
}
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 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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92986.310879.patch
Type: text/x-patch
Size: 1155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201210/a50948cc/attachment.bin>
More information about the cfe-commits
mailing list