[all-commits] [llvm/llvm-project] c56a85: [llvm-profgen] Use cast<> instead of dyn_cast<> to...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Wed Feb 2 06:12:32 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c56a85fde0d6568cb12858bcf1db93c3e590f5e3
      https://github.com/llvm/llvm-project/commit/c56a85fde0d6568cb12858bcf1db93c3e590f5e3
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-02-02 (Wed, 02 Feb 2022)

  Changed paths:
    M llvm/tools/llvm-profgen/ProfiledBinary.cpp

  Log Message:
  -----------
  [llvm-profgen] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr


  Commit: 01d5254f3de0e8870e3550a792801fa1da59b931
      https://github.com/llvm/llvm-project/commit/01d5254f3de0e8870e3550a792801fa1da59b931
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-02-02 (Wed, 02 Feb 2022)

  Changed paths:
    M llvm/tools/llvm-profgen/ProfileGenerator.cpp

  Log Message:
  -----------
  [llvm-profgen] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr


Compare: https://github.com/llvm/llvm-project/compare/9fd9d56dc6bd...01d5254f3de0


More information about the All-commits mailing list