Commit 4389220
authored
[Clang] Prevent potential null pointer dereferences (llvm#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.1 parent ecaf2c3 commit 4389220
File tree
3 files changed
+4
-4
lines changed- clang/lib
- AST
- Sema
3 files changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3558 | 3558 | | |
3559 | 3559 | | |
3560 | 3560 | | |
3561 | | - | |
| 3561 | + | |
3562 | 3562 | | |
3563 | 3563 | | |
3564 | 3564 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
627 | 627 | | |
628 | 628 | | |
629 | 629 | | |
630 | | - | |
| 630 | + | |
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1908 | 1908 | | |
1909 | 1909 | | |
1910 | 1910 | | |
1911 | | - | |
| 1911 | + | |
1912 | 1912 | | |
1913 | | - | |
| 1913 | + | |
1914 | 1914 | | |
1915 | 1915 | | |
1916 | 1916 | | |
| |||
0 commit comments