Author: Raphael Isemann
Date: 2021-02-25T11:42:14+01:00
New Revision: 7cfa6e1cc64bc41e644cfc4a43bc122790896569

URL: 
https://github.com/llvm/llvm-project/commit/7cfa6e1cc64bc41e644cfc4a43bc122790896569
DIFF: 
https://github.com/llvm/llvm-project/commit/7cfa6e1cc64bc41e644cfc4a43bc122790896569.diff

LOG: [lldb] Let ClangASTImporter assert that the target AST has an external 
source

This prevents people from accidentially using this code outside the
intended setup.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h
index f4ea3af8d9b9..79465316dbc2 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h
@@ -198,6 +198,12 @@ class ClangASTImporter {
       // nodes within the same AST doesn't make any sense as the whole idea
       // is to import them to a 
diff erent AST.
       lldbassert(target_ctx != source_ctx && "Can't import into itself");
+      // This is always doing a minimal import of any declarations. This means
+      // that there has to be an ExternalASTSource in the target ASTContext
+      // (that should implement the callbacks that complete any declarations
+      // on demand). Without an ExternalASTSource, this ASTImporter will just
+      // do a minimal import and the imported declarations won't be completed.
+      assert(target_ctx->getExternalSource() && "Missing ExternalSource");
       setODRHandling(clang::ASTImporter::ODRHandlingType::Liberal);
     }
 


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to