[all-commits] [llvm/llvm-project] fecb12: [lldb][NFC] Simplify ClangASTContext::GetTranslati...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Mon Dec 23 02:03:00 PST 2019


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

  Changed paths:
    M lldb/include/lldb/Symbol/ClangASTContext.h
    M lldb/source/Symbol/ClangASTContext.cpp

  Log Message:
  -----------
  [lldb][NFC] Simplify ClangASTContext::GetTranslationUnitDecl

These two functions are just calling their equivalent function
in ASTContext and implicitly convert the result to a
DeclContext* (a parent class of TranslationUnitDecl). This leads
to the absurd situation that we had to cast the result of
GetTranslationUnitDecl to a TranslationUnitDecl*. The only reason
we did this implicit conversion to the parent class
was that the void* conversion for the CompilerDeclContext constructor
was sound (which otherwise would receive a Decl* pointer when
called with a TranslationUnitDecl*).

Now that the CompilerDeclContext constructor is type safe we can
properly implement these functions by actually returning the
right type. Also deletes the static inconvenience method that was
not used anywhere.




More information about the All-commits mailing list