[PATCH] D152645: [clangd] Handle DependentNameType in HeuristicResolver::resolveTypeToRecordDecl()

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 11 00:05:01 PDT 2023


nridge added inline comments.


================
Comment at: clang-tools-extra/clangd/HeuristicResolver.cpp:38
+  if (const auto *TD = dyn_cast<TypeDecl>(Decls[0])) {
+    return Ctx.getTypeDeclType(TD).getTypePtr();
+  }
----------------
I wanted to call out the change on this line which is easy to overlook due to the code move:

We were previously calling [TypeDecl::getTypeForDecl()](https://searchfox.org/llvm/rev/5b657f50b8e8dc5836fb80e566ca7569fd04c26f/clang/include/clang/AST/Decl.h#3301), but that's actually a low-level accessor for a cached value. The function that also populates the value if needed is `ASTContext::getTypeDeclType()`, hence I switch to using that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152645/new/

https://reviews.llvm.org/D152645



More information about the cfe-commits mailing list