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

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Sun Mar 10 20:50:42 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3f6bc1adf805681293c2ef0b93b708ff52244c00
      https://github.com/llvm/llvm-project/commit/3f6bc1adf805681293c2ef0b93b708ff52244c00
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2024-03-11 (Mon, 11 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