[all-commits] [llvm/llvm-project] 5791bc: [AST] [Modules] Handle full cases of DefaultArgSto...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Tue Jul 12 09:14:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5791bcf9db0a3ec8bbce586dd99fce71fd773134
      https://github.com/llvm/llvm-project/commit/5791bcf9db0a3ec8bbce586dd99fce71fd773134
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2022-07-13 (Wed, 13 Jul 2022)

  Changed paths:
    M clang/include/clang/AST/DeclTemplate.h
    M clang/test/Modules/InheritDefaultArguments.cppm
    M clang/test/Modules/Inputs/PR31469/textual.h

  Log Message:
  -----------
  [AST] [Modules] Handle full cases of DefaultArgStorage::setInherited

There were two assertions in DefaultArgStorage::setInherited previously.
It requires the DefaultArgument is either empty or an argument value. It
would crash if it has a pointer refers to the previous declaration or
contains a chain to the previous declaration.

But there are edge cases could hit them actually. One is
InheritDefaultArguments.cppm that I found recently. Another one is pr31469.cpp,
which was created fives years ago.

This patch tries to fix the two failures by handling full cases in
DefaultArgStorage::setInherited.

This is guaranteed to not introduce any breaking change since it lives
in the path we wouldn't touch before. And the added assertions for
sameness should keep the correctness.

Reviewed By: v.g.vassilev

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




More information about the All-commits mailing list