[clang] [ClangRepl] Type Directed Code Completion (PR #67349)
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 1 07:37:18 PDT 2023
================
@@ -166,8 +300,37 @@ void ExternalSource::completeVisibleDeclsMap(
SetExternalVisibleDeclsForName(ChildDeclContext,
importedNamedDecl->getDeclName(),
importedNamedDecl);
- }
+ if (auto *Record =
+ llvm::dyn_cast<CXXRecordDecl>(importedNamedDecl)) {
+ if (auto Err = Importer->ImportDefinition(Decl))
+ consumeError(std::move(Err));
+ // LLVM_DEBUG(llvm::dbgs() << "\nHello :\n");
+ // Record->getTypeForDecl()->dump();
+ Record->setHasLoadedFieldsFromExternalStorage(true);
+ // auto ToOrErr = Importer->Import(->getTypeForDecl());
+ // if (!ToOrErr) {
+ // consumeError(std::move(ToOrErr.takeError()));
+ // }
+ LLVM_DEBUG(
+ llvm::dbgs()
+ << "\nCXXRecrod : " << Record->getName() << " size(methods): "
+ << std::distance(Record->method_begin(), Record->method_end())
+ << " has def?: " << Record->hasDefinition()
+ << " # (methods): "
+ << std::distance(Record->getDefinition()->method_begin(),
+ Record->getDefinition()->method_end())
+ << "\n");
+ for (auto *Meth : Record->methods()) {
+ SetExternalVisibleDeclsForName(ChildDeclContext,
+ Meth->getDeclName(), Meth);
+ // if (Meth->getDeclName().isIdentifier()) {
+ // LLVM_DEBUG(llvm::dbgs() << "CXXRecrod Method: " <<
+ // Meth->getName() << "\n");
----------------
vgvassilev wrote:
Can we clean up the comments and reduce the indentation levels as suggested in previous comments?
https://github.com/llvm/llvm-project/pull/67349
More information about the cfe-commits
mailing list