[PATCH] D83371: [clangd] Factor out some helper functions related to heuristic resolution in TargetFinder
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 8 07:56:59 PDT 2020
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.
thanks, looks good.
================
Comment at: clang-tools-extra/clangd/FindTarget.cpp:64
+// resolves it to a CXXRecordDecl in which we can try name lookup.
+CXXRecordDecl *resolveTypeToRecordDecl(const Type *T) {
+ if (auto *ICNT = T->getAs<InjectedClassNameType>()) {
----------------
nit: add assert(T), or even use `const Type&` as the parameter type.
================
Comment at: clang-tools-extra/clangd/FindTarget.cpp:158
+// or more declarations that it likely references.
+std::vector<const NamedDecl *> resolveDependentExprToDecls(const Expr *E) {
+ switch (E->getStmtClass()) {
----------------
nit: add `assert(E->isTypeDepndent())`;
================
Comment at: clang-tools-extra/clangd/FindTarget.cpp:159
+std::vector<const NamedDecl *> resolveDependentExprToDecls(const Expr *E) {
+ switch (E->getStmtClass()) {
+ case Stmt::CXXDependentScopeMemberExprClass: {
----------------
nit: looks like the code will be a bit simpler if we just use if branch like
```
if (const auto * a = dyn_cast<XX>(xxxx));
```
but up to you.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83371/new/
https://reviews.llvm.org/D83371
More information about the cfe-commits
mailing list