[all-commits] [llvm/llvm-project] 7b61ff: [Clang] Prevent null dereferences (#115502)

smanna12 via All-commits all-commits at lists.llvm.org
Thu Nov 21 07:15:25 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7b61ff2c263b7122c23783385662f6ff67764352
      https://github.com/llvm/llvm-project/commit/7b61ff2c263b7122c23783385662f6ff67764352
  Author: smanna12 <soumi.manna at intel.com>
  Date:   2024-11-21 (Thu, 21 Nov 2024)

  Changed paths:
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/Sema/AnalysisBasedWarnings.cpp
    M clang/lib/Sema/SemaExprMember.cpp

  Log Message:
  -----------
  [Clang] Prevent null dereferences (#115502)

This commit addresses several Static Analyzer issues related to
potential null dereference by replacing dyn_cast<> with cast<> and
getAs<> with castAs<> in various parts of the codes.

The cast function asserts that the cast is valid, ensuring that the
pointer is not null and preventing null dereference errors.

The changes are made in the following files:
CGBuiltin.cpp: Ensure vector types have exactly 3 elements.
CGExpr.cpp: Ensure member declarations are field declarations.
AnalysisBasedWarnings.cpp: Ensure operations are member expressions.
SemaExprMember.cpp: Ensure base types are extended vector types.

These changes ensure that the types are correctly cast and prevent
potential null dereference issues, improving the robustness and safety
of the code.



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