[all-commits] [llvm/llvm-project] ca0980: [LLVM][Coverage][Unittest] Fix dangling reference ...

Tomohiro Kashiwada via All-commits all-commits at lists.llvm.org
Thu Sep 11 13:13:15 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ca09801bd03579f28edac60077a164fab0474eb4
      https://github.com/llvm/llvm-project/commit/ca09801bd03579f28edac60077a164fab0474eb4
  Author: Tomohiro Kashiwada <kikairoya at gmail.com>
  Date:   2025-09-11 (Thu, 11 Sep 2025)

  Changed paths:
    M llvm/unittests/ProfileData/CoverageMappingTest.cpp

  Log Message:
  -----------
  [LLVM][Coverage][Unittest] Fix dangling reference in unittest (#147118)

In loop of `writeAndReadCoverageRegions`, `OutputFunctions[I].Filenames`
references to contents of `Filenames` after returning from
`readCoverageRegions` but `Filenames` will be cleared in next call of
`readCoverageRegions`, causes dangling reference.
The lifetime of the contents of `Filenames` must be equal or longer than
`OutputFunctions[I]`, thus it has been moved into `OutputFunctions[I]`
(typed `OutputFunctionCoverageData`).



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