[all-commits] [llvm/llvm-project] 42ec58: [lldb][NFC] Make CompilerDeclContext construction ...

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


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 42ec584a8b4e604360b7a4d45a65c570d58b1bf9
      https://github.com/llvm/llvm-project/commit/42ec584a8b4e604360b7a4d45a65c570d58b1bf9
  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/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    M lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
    M lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
    M lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
    M lldb/source/Symbol/ClangASTContext.cpp
    M lldb/unittests/Symbol/TestClangASTContext.cpp
    M lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp

  Log Message:
  -----------
  [lldb][NFC] Make CompilerDeclContext construction type safe

The CompilerDeclContext constructor takes a void* pointer which
means that all callers of this constructor need to first explicitly
convert all pointers to clang::DeclContext*. This causes that we
for example can't just pass a TranslationUnitDecl* to the constructor without
first casting it to its parent class (as it inherits from both
Decl and DeclContext so the void* pointer is actually a Decl*).

This patch introduces a utility function in the ClangASTContext
which gets rid of the requirement to cast all pointers to
clang::DeclContext. Also moves all constructor calls to use this
function instead which is NFC (beside the change in
DWARFASTParserClangTests.cpp).




More information about the All-commits mailing list