[all-commits] [llvm/llvm-project] 4f8916: [C++20] [Modules] Exit early if export decl is not...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Thu Jan 13 18:22:26 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4f8916cfdd941db2a4c4cdad6e5bc549532277a2
      https://github.com/llvm/llvm-project/commit/4f8916cfdd941db2a4c4cdad6e5bc549532277a2
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2022-01-14 (Fri, 14 Jan 2022)

  Changed paths:
    M clang/lib/Sema/SemaModule.cpp
    A clang/test/Modules/export-in-non-modules.cpp

  Log Message:
  -----------
  [C++20] [Modules] Exit early if export decl is not valid

This patch fixes a crash due to following simple program:
> export struct Unit {
>    bool operator<(const Unit&);
> };

It would crash since the compiler would set the module ownership for
Unit. And the declaration with a module ownership is assumed to own a
module. But here isn't one. So here is the crash.

This patch fixes this by exiting early if it finds the export decl is
already invalid.

Reviewed By: aaron.ballman

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




More information about the All-commits mailing list