[all-commits] [llvm/llvm-project] 438922: [Clang] Prevent potential null pointer dereference...

smanna12 via All-commits all-commits at lists.llvm.org
Fri Nov 22 06:41:42 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4389220549285fc9ef1e96f762eafa5f79a5d1ee
      https://github.com/llvm/llvm-project/commit/4389220549285fc9ef1e96f762eafa5f79a5d1ee
  Author: smanna12 <soumi.manna at intel.com>
  Date:   2024-11-22 (Fri, 22 Nov 2024)

  Changed paths:
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/Sema/SemaFunctionEffects.cpp
    M clang/lib/Sema/SemaHLSL.cpp

  Log Message:
  -----------
  [Clang] Prevent potential null pointer dereferences (#117176)

This commit addresses several null pointer issues identified by static
analysis by replacing dyn_cast<> with cast<> and getAs<> with castAs<>
in various parts of the Clang codebase. The cast and castAs method is
used to ensure that the type is correctly cast, which helps prevent
potential null pointer dereferences.

Changes:
1. ASTContext.cpp:
Replaced dyn_cast with cast to ensure that the type is correctly cast to
AttributedType.

2. SemaFunctionEffects.cpp:
Replaced getAs with castAs to ensure that the type is correctly cast to
FunctionProtoType.

3. SemaHLSL.cpp:
Replaced getAs with castAs to ensure that the type is correctly cast to
VectorType.



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