[all-commits] [llvm/llvm-project] a688b5: [clang][ASTImporter] Remove use of ParentMapContext.

Balázs Kéri via All-commits all-commits at lists.llvm.org
Wed Oct 26 07:26:50 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a688b5f92a17dccbad411b41e254addfbd4d2852
      https://github.com/llvm/llvm-project/commit/a688b5f92a17dccbad411b41e254addfbd4d2852
  Author: Balázs Kéri <1.int32 at gmail.com>
  Date:   2022-10-26 (Wed, 26 Oct 2022)

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

  Log Message:
  -----------
  [clang][ASTImporter] Remove use of ParentMapContext.

Function 'isAncestorDeclContextOf' was using 'ParentMapContext' for
looking up parent of statement nodes. There may be cases (bugs?) with
ParentMapContext when parents of specific statements are not found.
This leads to 'ASTImporter' infinite import loops when function
'hasAutoReturnTypeDeclaredInside' returns false incorrectly.
A real case was found but could not be reproduced with test code.
Use of 'ParentMapContext' is now removed and changed to a more safe
(currently) method by searching for declarations in statements
and find parent of these declarations. The new code was tested on
a number of projects and no related crash was found.

Reviewed By: martong

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




More information about the All-commits mailing list