[lldb][NFC] Remove ClangExternalASTSourceCommon
authorRaphael Isemann <teemperor@gmail.com>
Mon, 23 Dec 2019 19:42:25 +0000 (20:42 +0100)
committerRaphael Isemann <teemperor@gmail.com>
Tue, 24 Dec 2019 12:17:27 +0000 (13:17 +0100)
commit4657a397c22a27775823b8f731abdc6477badfea
tree824de1197bc46ce022a3edd850654f8d7a93fbaf
parent8131c04836829e7f37f2feaa1d85b4ef62ad092f
[lldb][NFC] Remove ClangExternalASTSourceCommon

ClangExternalASTSourceCommon's purpose is to store a map from
Decl*/Type* to ClangASTMetadata. Usually this data is accessed
via the ClangASTContext interface which then grabs the
current ExternalASTSource of its ASTContext, tries to cast it
to ClangExternalASTSourceCommon and then accesses the metadata
map. If the casting fails the setter does nothing and the getter
returns a nullptr as if there was no known metadata for a type/decl.

This system breaks as soon as any non-LLDB ExternalASTSource is added via
a multiplexer to our existing ExternalASTSource (in which case we suddenly
loose all out metadata as the casting always fails with an ExternalASTSource
that is not inheriting from ClangExternalASTSourceCommon).

This patch moves the metadata map to the ClangASTContext. This gets
rid of all the fragile casting, the requirement that every ExternalASTSource in
LLDB has to inherit from ClangExternalASTSourceCommon and simplifies
the metadata implementation to a simple map lookup. As ClangExternalASTSourceCommon
had no other purpose than storing metadata, this patch deletes this class
and replaces all uses with clang::ExternalASTSource.

No other code changes in this commit beside the AppleObjCDeclVendor which
was the only code that did not use the ClangASTContext interface but directly
accessed the ClangExternalASTSourceCommon.
lldb/include/lldb/Symbol/ClangASTContext.h
lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
lldb/include/lldb/Symbol/ClangExternalASTSourceCommon.h [deleted file]
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
lldb/source/Symbol/CMakeLists.txt
lldb/source/Symbol/ClangASTContext.cpp
lldb/source/Symbol/ClangExternalASTSourceCommon.cpp [deleted file]