[all-commits] [llvm/llvm-project] 7b00ee: [lldb] Fix another crash in covariant type handling

Pavel Labath via All-commits all-commits at lists.llvm.org
Mon Mar 30 07:00:31 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7b00eeb53de06c7979fd2a88436c3387d0492ee8
      https://github.com/llvm/llvm-project/commit/7b00eeb53de06c7979fd2a88436c3387d0492ee8
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2020-03-30 (Mon, 30 Mar 2020)

  Changed paths:
    M lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
    M lldb/test/API/lang/cpp/covariant-return-types/TestCovariantReturnTypes.py
    M lldb/test/API/lang/cpp/covariant-return-types/main.cpp

  Log Message:
  -----------
  [lldb] Fix another crash in covariant type handling

Summary:
D73024 seems to have fixed one set crash, but it introduced another.
Namely, if a class contains a covariant method returning itself, the
logic in MaybeCompleteReturnType could cause us to attempt a recursive
import, which would result in an assertion failure in
clang::DeclContext::removeDecl.

For some reason, this only manifested itself if the class contained at
least two member variables, and the class itself was imported as a
result of a recursive covariant import.

This patch fixes the crash by not attempting to import classes which are
already completed in MaybeCompleteReturnType. However, it's not clear to
me if this is the right fix, or if this should be handled automatically
by functions lower in the stack.

Reviewers: teemperor, shafik

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D76840




More information about the All-commits mailing list