[all-commits] [llvm/llvm-project] 864970: [clang-tidy] Use cast<>/castAs<> instead of dyn_ca...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Sun Jan 23 05:35:11 PST 2022


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

  Changed paths:
    M clang-tools-extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp
    M clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp

  Log Message:
  -----------
  [clang-tidy] Use cast<>/castAs<> instead of dyn_cast<>/getAs<> to avoid dereference of nullptr

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


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

  Changed paths:
    M clang-tools-extra/clangd/HeuristicResolver.cpp
    M clang-tools-extra/clangd/Hover.cpp

  Log Message:
  -----------
  [clangd] Use castAs<> instead of getAs<> 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/946f29028e06...df0fd1c301d6


More information about the All-commits mailing list