[all-commits] [llvm/llvm-project] 0bf7ff: [C++20] [Moduls] Avoid computing odr hash for func...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Tue Mar 19 14:05:29 PDT 2024


  Branch: refs/heads/release/18.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 0bf7ff1028fb7cc81324e9c38c585e6533b754e4
      https://github.com/llvm/llvm-project/commit/0bf7ff1028fb7cc81324e9c38c585e6533b754e4
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2024-03-19 (Tue, 19 Mar 2024)

  Changed paths:
    M clang/include/clang/AST/DeclBase.h
    M clang/include/clang/Serialization/ASTReader.h
    M clang/lib/AST/Decl.cpp
    M clang/lib/AST/DeclBase.cpp
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTReaderDecl.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/Serialization/ASTWriterDecl.cpp
    A clang/test/Modules/hashing-decls-in-exprs-from-gmf.cppm

  Log Message:
  -----------
  [C++20] [Moduls] Avoid computing odr hash for functions from comparing constraint expression

Previously we disabled to compute ODR hash for declarations from the
global module fragment. However, we missed the case that the functions
lives in the concept requiments (see the attached the test files for
example). And the mismatch causes the potential crashment.

Due to we will set the function body as lazy after we deserialize it and
we will only take its body when needed. However, we don't allow to take
the body during deserializing. So it is actually potentially problematic
if we set the body as lazy first and computing the hash value of the
function, which requires to deserialize its body. So we will meet a
crash here.

This patch tries to solve the issue by not taking the body of the
function from GMF. Note that we can't skip comparing the constraint
expression from the GMF directly since it is an key part of the
function selecting and it may be the reason why we can't return 0
directly for `FunctionDecl::getODRHash()` from the GMF.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list