[all-commits] [llvm/llvm-project] 2ab447: Fix dangling IPOAmendableCB function_ref. (#120698)

Haojian Wu via All-commits all-commits at lists.llvm.org
Tue Jan 7 12:53:21 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ab447ad6983fb9f22f2fea480f3857522750860
      https://github.com/llvm/llvm-project/commit/2ab447ad6983fb9f22f2fea480f3857522750860
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2025-01-07 (Tue, 07 Jan 2025)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/Attributor.h

  Log Message:
  -----------
  Fix dangling IPOAmendableCB function_ref. (#120698)

The `IPOAmendableCB`'s type is `llvm::function_ref`, it is error-prone
to write code (e.g.
https://github.com/llvm/llvm-project/blob/5656cbca52545e608f6fb8b7c9a778c7c9b4b468/llvm/lib/Transforms/IPO/OpenMPOpt.cpp#L5812)
that assign a temporary lambda to an `IPOAmendableCB` object, which is a
use-after-free issue.

This patch changes the `IPOAmendableCB` to `std::function`, to avoid the
dangling issue.



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