[all-commits] [llvm/llvm-project] eed0af: [clang] Exclude invalid destructors from lookups.

Adam Czachorowski via All-commits all-commits at lists.llvm.org
Wed Aug 26 10:37:09 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: eed0af6179ca4fe9e60121e0829ed8d3849b1ce5
      https://github.com/llvm/llvm-project/commit/eed0af6179ca4fe9e60121e0829ed8d3849b1ce5
  Author: Adam Czachorowski <adamcz at google.com>
  Date:   2020-08-26 (Wed, 26 Aug 2020)

  Changed paths:
    M clang/lib/AST/DeclBase.cpp
    A clang/test/PCH/cxx-invalid-destructor.cpp
    A clang/test/PCH/cxx-invalid-destructor.h

  Log Message:
  -----------
  [clang] Exclude invalid destructors from lookups.

This fixes a crash when declaring a destructor with a wrong name, then
writing result to pch file and loading it again. The PCH storage uses
DeclarationNameKey as key and it is the same key for both the invalid
destructor and the implicit one that was created because the other one
was invalid. When querying for the Foo::~Foo we end up getting
Foo::~Bar, which is then rejected and we end up with nullptr in
CXXRecordDecl::GetDestructor().

Fixes https://bugs.llvm.org/show_bug.cgi?id=47270

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




More information about the All-commits mailing list