[all-commits] [llvm/llvm-project] c61299: [SemaOverload] Use castAs<> instead of getAs<> to ...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Tue Jan 11 02:31:47 PST 2022


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

  Changed paths:
    M clang/lib/Sema/SemaOverload.cpp

  Log Message:
  -----------
  [SemaOverload] Use castAs<> instead of getAs<> to avoid dereference of nullptr

The pointer is always dereferenced inside BuildSimilarlyQualifiedPointerType, so assert the cast is correct instead of returning nullptr


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

  Changed paths:
    M clang/lib/Sema/SemaOverload.cpp

  Log Message:
  -----------
  [SemaOverload] compareConversionFunctions - use castAs<> instead of getAs<> to avoid dereference of nullptr

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


Compare: https://github.com/llvm/llvm-project/compare/18b2385f2b09...2e52f76a722a


More information about the All-commits mailing list