[lldb][NFC] Simplify ClangASTContext::GetTranslationUnitDecl
authorRaphael Isemann <teemperor@gmail.com>
Mon, 23 Dec 2019 09:05:42 +0000 (10:05 +0100)
committerRaphael Isemann <teemperor@gmail.com>
Mon, 23 Dec 2019 10:02:21 +0000 (11:02 +0100)
commitfecb122cca254f565050559b349c8ff309194554
tree9dffc6eaa3bdca4cc187b2792554f3f8d3b1f170
parent5dca0596a959217a1c18858a62ed35245a4c42b4
[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.
lldb/include/lldb/Symbol/ClangASTContext.h
lldb/source/Symbol/ClangASTContext.cpp