[all-commits] [llvm/llvm-project] 4657a3: [lldb][NFC] Remove ClangExternalASTSourceCommon

Raphael Isemann via All-commits all-commits at lists.llvm.org
Tue Dec 24 04:21:49 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4657a397c22a27775823b8f731abdc6477badfea
      https://github.com/llvm/llvm-project/commit/4657a397c22a27775823b8f731abdc6477badfea
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2019-12-24 (Tue, 24 Dec 2019)

  Changed paths:
    M lldb/include/lldb/Symbol/ClangASTContext.h
    M lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
    R lldb/include/lldb/Symbol/ClangExternalASTSourceCommon.h
    M lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
    M lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
    M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
    M lldb/source/Symbol/CMakeLists.txt
    M lldb/source/Symbol/ClangASTContext.cpp
    R lldb/source/Symbol/ClangExternalASTSourceCommon.cpp

  Log Message:
  -----------
  [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.




More information about the All-commits mailing list