Skip to content

Commit 313a1af

Browse files
committed
[lldb][ClangASTImporter][NFC] Move ASTImproterDelegate constructor definition into source file
(cherry picked from commit a83739912e5490e48745d0505e29556649eb6b9f)
1 parent 0335368 commit 313a1af

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,3 +1181,22 @@ clang::Decl *
11811181
ClangASTImporter::ASTImporterDelegate::GetOriginalDecl(clang::Decl *To) {
11821182
return m_main.GetDeclOrigin(To).decl;
11831183
}
1184+
1185+
ClangASTImporter::ASTImporterDelegate::ASTImporterDelegate(
1186+
ClangASTImporter &main, clang::ASTContext *target_ctx,
1187+
clang::ASTContext *source_ctx)
1188+
: clang::ASTImporter(*target_ctx, main.m_file_manager, *source_ctx,
1189+
main.m_file_manager, true /*minimal*/),
1190+
m_main(main), m_source_ctx(source_ctx) {
1191+
// Target and source ASTContext shouldn't be identical. Importing AST
1192+
// nodes within the same AST doesn't make any sense as the whole idea
1193+
// is to import them to a different AST.
1194+
lldbassert(target_ctx != source_ctx && "Can't import into itself");
1195+
// This is always doing a minimal import of any declarations. This means
1196+
// that there has to be an ExternalASTSource in the target ASTContext
1197+
// (that should implement the callbacks that complete any declarations
1198+
// on demand). Without an ExternalASTSource, this ASTImporter will just
1199+
// do a minimal import and the imported declarations won't be completed.
1200+
assert(target_ctx->getExternalSource() && "Missing ExternalSource");
1201+
setODRHandling(clang::ASTImporter::ODRHandlingType::Liberal);
1202+
}

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -266,22 +266,7 @@ class ClangASTImporter {
266266
/// their counterpart from a C++ module.
267267
struct ASTImporterDelegate : public clang::ASTImporter {
268268
ASTImporterDelegate(ClangASTImporter &main, clang::ASTContext *target_ctx,
269-
clang::ASTContext *source_ctx)
270-
: clang::ASTImporter(*target_ctx, main.m_file_manager, *source_ctx,
271-
main.m_file_manager, true /*minimal*/),
272-
m_main(main), m_source_ctx(source_ctx) {
273-
// Target and source ASTContext shouldn't be identical. Importing AST
274-
// nodes within the same AST doesn't make any sense as the whole idea
275-
// is to import them to a different AST.
276-
lldbassert(target_ctx != source_ctx && "Can't import into itself");
277-
// This is always doing a minimal import of any declarations. This means
278-
// that there has to be an ExternalASTSource in the target ASTContext
279-
// (that should implement the callbacks that complete any declarations
280-
// on demand). Without an ExternalASTSource, this ASTImporter will just
281-
// do a minimal import and the imported declarations won't be completed.
282-
assert(target_ctx->getExternalSource() && "Missing ExternalSource");
283-
setODRHandling(clang::ASTImporter::ODRHandlingType::Liberal);
284-
}
269+
clang::ASTContext *source_ctx);
285270

286271
/// Scope guard that attaches a CxxModuleHandler to an ASTImporterDelegate
287272
/// and deattaches it at the end of the scope. Supports being used multiple

0 commit comments

Comments
 (0)