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

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Sun Jan 23 04:51:06 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ff05b93a02d18c3b388658de2186f570d725ec71
      https://github.com/llvm/llvm-project/commit/ff05b93a02d18c3b388658de2186f570d725ec71
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-01-23 (Sun, 23 Jan 2022)

  Changed paths:
    M llvm/tools/llvm-objdump/MachODump.cpp

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

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


  Commit: 20d46fbd4a51a0b80731268f8d72b62e87ead915
      https://github.com/llvm/llvm-project/commit/20d46fbd4a51a0b80731268f8d72b62e87ead915
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-01-23 (Sun, 23 Jan 2022)

  Changed paths:
    M llvm/lib/CodeGen/CodeGenPrepare.cpp

  Log Message:
  -----------
  [CodeGenPrepare] Use dyn_cast result to check for null pointers

Simplifies logic and helps the static analyzer correctly check for nullptr dereferences


  Commit: 946f29028e063c768dc9b8c6e87c2eb584993df6
      https://github.com/llvm/llvm-project/commit/946f29028e063c768dc9b8c6e87c2eb584993df6
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-01-23 (Sun, 23 Jan 2022)

  Changed paths:
    M llvm/tools/llvm-objdump/WasmDump.cpp

  Log Message:
  -----------
  [llvm-objdump] 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/a4f202549208...946f29028e06


More information about the All-commits mailing list