[all-commits] [llvm/llvm-project] 73951a: [lldb] Add sanity check to CreateDeclContext and f...

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


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

  Changed paths:
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
    M lldb/source/Symbol/ClangASTContext.cpp
    M lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp

  Log Message:
  -----------
  [lldb] Add sanity check to CreateDeclContext and fixed illformed CompilerContext in ClangExpressionDeclMap.

This adds a check that the ClangASTContext actually fits to the
DeclContext that we want to create a CompilerDeclContext for. If
the ClangASTContext (and its associated ASTContext) does not fit
to the DeclContext (that is, the DeclContext wasn't created by the
ASTContext), all computations using this malformed CompilerDeclContext
will yield unpredictable results.

Also fixes the only place that actually hits this assert which is the
construction of a CompilerDeclContext in ClangExpressionDeclMap
where we pass an unrelated ASTContext instead of the ASTContext
of the current expression.

I had to revert my previous change to DWARFASTParserClangTests.cpp
back to using the unsafe direct construction of CompilerDeclContext
as this assert won't work if the DeclContext we pass isn't a valid
DeclContext in the first place.




More information about the All-commits mailing list