Skip to content

Commit 049e044

Browse files
committed
[lldb][ClangASTImporter][NFC] Move ASTImproterDelegate constructor definition into source file
1 parent e719ab9 commit 049e044

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
@@ -1413,3 +1413,22 @@ clang::Decl *
14131413
ClangASTImporter::ASTImporterDelegate::GetOriginalDecl(clang::Decl *To) {
14141414
return m_main.GetDeclOrigin(To).decl;
14151415
}
1416+
1417+
ClangASTImporter::ASTImporterDelegate::ASTImporterDelegate(
1418+
ClangASTImporter &main, clang::ASTContext *target_ctx,
1419+
clang::ASTContext *source_ctx)
1420+
: clang::ASTImporter(*target_ctx, main.m_file_manager, *source_ctx,
1421+
main.m_file_manager, true /*minimal*/),
1422+
m_main(main), m_source_ctx(source_ctx) {
1423+
// Target and source ASTContext shouldn't be identical. Importing AST
1424+
// nodes within the same AST doesn't make any sense as the whole idea
1425+
// is to import them to a different AST.
1426+
lldbassert(target_ctx != source_ctx && "Can't import into itself");
1427+
// This is always doing a minimal import of any declarations. This means
1428+
// that there has to be an ExternalASTSource in the target ASTContext
1429+
// (that should implement the callbacks that complete any declarations
1430+
// on demand). Without an ExternalASTSource, this ASTImporter will just
1431+
// do a minimal import and the imported declarations won't be completed.
1432+
assert(target_ctx->getExternalSource() && "Missing ExternalSource");
1433+
setODRHandling(clang::ASTImporter::ODRHandlingType::Liberal);
1434+
}

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -282,22 +282,7 @@ class ClangASTImporter {
282282
/// their counterpart from a C++ module.
283283
struct ASTImporterDelegate : public clang::ASTImporter {
284284
ASTImporterDelegate(ClangASTImporter &main, clang::ASTContext *target_ctx,
285-
clang::ASTContext *source_ctx)
286-
: clang::ASTImporter(*target_ctx, main.m_file_manager, *source_ctx,
287-
main.m_file_manager, true /*minimal*/),
288-
m_main(main), m_source_ctx(source_ctx) {
289-
// Target and source ASTContext shouldn't be identical. Importing AST
290-
// nodes within the same AST doesn't make any sense as the whole idea
291-
// is to import them to a different AST.
292-
lldbassert(target_ctx != source_ctx && "Can't import into itself");
293-
// This is always doing a minimal import of any declarations. This means
294-
// that there has to be an ExternalASTSource in the target ASTContext
295-
// (that should implement the callbacks that complete any declarations
296-
// on demand). Without an ExternalASTSource, this ASTImporter will just
297-
// do a minimal import and the imported declarations won't be completed.
298-
assert(target_ctx->getExternalSource() && "Missing ExternalSource");
299-
setODRHandling(clang::ASTImporter::ODRHandlingType::Liberal);
300-
}
285+
clang::ASTContext *source_ctx);
301286

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

0 commit comments

Comments
 (0)