[all-commits] [llvm/llvm-project] 0877b9: [clang][ASTImporter] Fix a possible assertion fail...

Balázs Kéri via All-commits all-commits at lists.llvm.org
Thu Jan 7 02:25:59 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0877b963ef2d3c384b47f7a6161c9d9ab106a7f2
      https://github.com/llvm/llvm-project/commit/0877b963ef2d3c384b47f7a6161c9d9ab106a7f2
  Author: Balázs Kéri <1.int32 at gmail.com>
  Date:   2021-01-07 (Thu, 07 Jan 2021)

  Changed paths:
    M clang/lib/AST/ASTImporter.cpp
    M clang/unittests/AST/ASTImporterTest.cpp

  Log Message:
  -----------
  [clang][ASTImporter] Fix a possible assertion failure `NeedsInjectedClassNameType(Decl)'.

The assertion can happen if ASTImporter imports a CXXRecordDecl in a template
and then imports another redeclaration of this declaration, while the first import is in progress.
The process of first import did not set the "described template" yet
and the second import finds the first declaration at setting the injected types.
Setting the injected type requires in the assertion that the described template is set.
The exact assertion was:
clang/lib/AST/ASTContext.cpp:4411:
clang::QualType clang::ASTContext::getInjectedClassNameType(clang::CXXRecordDecl*, clang::QualType) const:
Assertion `NeedsInjectedClassNameType(Decl)' failed.

Reviewed By: shafik

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




More information about the All-commits mailing list