Author: spyffe
Date: Thu Sep 28 13:20:25 2017
New Revision: 314458
URL: http://llvm.org/viewvc/llvm-project?rev=314458=rev
Log:
[Expression parser] Setting to enable use of ExternalASTMerger
This setting can be enabled like this at the target level:
(lldb) settings set target.experimental.use-modern-type-lookup true
This causes several new behaviors in the Clang expression parser:
- It completely disables use of ClangASTImporter. None are created
at all, and all users of it are now conditionalized on its
presence.
- It instead constructs a per-expression ExternalASTMerger, which
exists inside Clang and contains much of the type completion
logic that hitherto lived in ExternalASTSource,
ClangExpressionDeclMap, and ClangASTImporter.
- The expression parser uses this Merger as a backend for copying
and completing types.
- It also constructs a persistent ExternalASTMerger which is
connected to the Target's persistent AST context.
This is a major chunk of LLDB functionality moved into Clang. It
can be tested in two ways:
1. For an individual debug session, enable the setting before
running a target.
2. For the testsuite, change the option to be default-true. This
is done in Target.cpp's g_experimental_properties. The
testsuite is not yet clean with this, so I have not committed
that switch.
I have filed a Bugzilla for extending the testsuite to allow
custom settings for all tests:
https://bugs.llvm.org/show_bug.cgi?id=34771
I have also filed a Bugzilla for fixing the remaining testsuite
failures with this setting enabled:
https://bugs.llvm.org/show_bug.cgi?id=34772
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/DeclVendor.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=314458=314457=314458=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Sep 28 13:20:25 2017
@@ -25,6 +25,7 @@
// Other libraries and framework includes
#include "clang/AST/ASTContext.h"
+#include "clang/AST/ExternalASTMerger.h"
#include "clang/AST/TemplateBase.h"
#include "llvm/ADT/SmallVector.h"
@@ -964,7 +965,10 @@ public:
clang::DeclarationName
GetDeclarationName(const char *name, const CompilerType
_clang_type);
-
+
+ virtual const clang::ExternalASTMerger::OriginMap () {
+return m_origins;
+ }
protected:
//--
// Classes that inherit from ClangASTContext can see and modify these
@@ -990,6 +994,7 @@ protected:
CompleteTagDeclCallback m_callback_tag_decl;
CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
void * m_callback_baton;
+clang::ExternalASTMerger::OriginMap m_origins;
uint32_tm_pointer_byte_size;
boolm_ast_owned;
boolm_can_evaluate_expressions;
@@ -1023,7 +1028,12 @@ public:
const char *name) override;
PersistentExpressionState *GetPersistentExpressionState() override;
-
+
+ clang::ExternalASTMerger ();
+
+ const clang::ExternalASTMerger::OriginMap () override {
+return GetMergerUnchecked().GetOrigins();
+ }
private:
lldb::TargetWP m_target_wp;
lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the
Modified: lldb/trunk/include/lldb/Symbol/DeclVendor.h
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DeclVendor.h?rev=314458=314457=314458=diff
==
--- lldb/trunk/include/lldb/Symbol/DeclVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/DeclVendor.h Thu Sep 28 13:20:25 2017
@@ -13,6 +13,8 @@
#include "lldb/Core/ClangForward.h"
#include "lldb/lldb-defines.h"
+#include