[clang] [ClangRepl] Type Directed Code Completion (PR #67349)
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 6 10:58:17 PST 2023
================
@@ -159,29 +308,62 @@ void ExternalSource::completeVisibleDeclsMap(
for (auto *DeclCtxt = ParentTUDeclCtxt; DeclCtxt != nullptr;
DeclCtxt = DeclCtxt->getPreviousDecl()) {
for (auto &IDeclContext : DeclCtxt->decls()) {
- if (NamedDecl *Decl = llvm::dyn_cast<NamedDecl>(IDeclContext)) {
- if (auto DeclOrErr = Importer->Import(Decl)) {
- if (NamedDecl *importedNamedDecl =
- llvm::dyn_cast<NamedDecl>(*DeclOrErr)) {
- SetExternalVisibleDeclsForName(ChildDeclContext,
- importedNamedDecl->getDeclName(),
- importedNamedDecl);
- }
-
- } else {
- llvm::consumeError(DeclOrErr.takeError());
- }
+ if (!llvm::isa<NamedDecl>(IDeclContext))
+ continue;
+
+ NamedDecl *Decl = llvm::cast<NamedDecl>(IDeclContext);
+
+ auto DeclOrErr = Importer->Import(Decl);
+ if (!DeclOrErr) {
+ llvm::consumeError(DeclOrErr.takeError());
----------------
vgvassilev wrote:
Maybe add a comment here why error is fine.
https://github.com/llvm/llvm-project/pull/67349
More information about the cfe-commits
mailing list