[all-commits] [llvm/llvm-project] 0c926e: [ASTImporter] Make the Import() return value consi...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Tue Nov 24 14:46:53 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0c926e6d245bec176bf2554a9f0bd48ef2276678
      https://github.com/llvm/llvm-project/commit/0c926e6d245bec176bf2554a9f0bd48ef2276678
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-11-24 (Tue, 24 Nov 2020)

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

  Log Message:
  -----------
  [ASTImporter] Make the Import() return value consistent with the map of imported decls when merging ClassTemplateSpecializationDecls

When importing a `ClassTemplateSpecializationDecl` definition into a TU with a matching
`ClassTemplateSpecializationDecl` definition and a more recent forward decl, the ASTImporter
currently will call `MapImported()` for the definitions, but will return the forward declaration
from the `ASTImporter::Import()` call.

This is triggering some assertions in LLDB when we try to fully import some DeclContexts
before we delete the 'From' AST. The returned 'To' Decl before this patch is just the most recent
forward decl but that's not the Decl with the definition to which the ASTImporter will import
the child declarations.

This patch just changes that the ASTImporter returns the definition that the imported Decl was
merged with instead of the found forward declaration.

Reviewed By: martong

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




More information about the All-commits mailing list