Skip to content

Commit e719ab9

Browse files
committed
[lldb][ClangASTImporter][NFCI] Factor setting external storage out of ASTImporterDelegate::Imported
1 parent 0755bd3 commit e719ab9

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,18 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
13551355
from, m_source_ctx, &to->getASTContext());
13561356
}
13571357

1358+
if (auto *to_namespace_decl = dyn_cast<NamespaceDecl>(to)) {
1359+
m_main.BuildNamespaceMap(to_namespace_decl);
1360+
to_namespace_decl->setHasExternalVisibleStorage();
1361+
}
1362+
1363+
MarkDeclImported(from, to);
1364+
}
1365+
1366+
void ClangASTImporter::ASTImporterDelegate::MarkDeclImported(Decl *from,
1367+
Decl *to) {
1368+
Log *log = GetLog(LLDBLog::Expressions);
1369+
13581370
if (auto *to_tag_decl = dyn_cast<TagDecl>(to)) {
13591371
to_tag_decl->setHasExternalLexicalStorage();
13601372
to_tag_decl->getPrimaryContext()->setMustBuildLookupTable();
@@ -1369,11 +1381,6 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
13691381
(to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"));
13701382
}
13711383

1372-
if (auto *to_namespace_decl = dyn_cast<NamespaceDecl>(to)) {
1373-
m_main.BuildNamespaceMap(to_namespace_decl);
1374-
to_namespace_decl->setHasExternalVisibleStorage();
1375-
}
1376-
13771384
if (auto *to_container_decl = dyn_cast<ObjCContainerDecl>(to)) {
13781385
to_container_decl->setHasExternalLexicalStorage();
13791386
to_container_decl->setHasExternalVisibleStorage();

lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ class ClangASTImporter {
346346
llvm::Expected<clang::Decl *> ImportImpl(clang::Decl *From) override;
347347

348348
private:
349+
void MarkDeclImported(clang::Decl *from, clang::Decl *to);
350+
349351
/// Decls we should ignore when mapping decls back to their original
350352
/// ASTContext. Used by the CxxModuleHandler to mark declarations that
351353
/// were created from the 'std' C++ module to prevent that the Importer

0 commit comments

Comments
 (0)