Commit 7b61ff2
authored
[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.1 parent e8b5c00 commit 7b61ff2
File tree
4 files changed
+5
-5
lines changed- clang/lib
- CodeGen
- Sema
4 files changed
+5
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19052 | 19052 | | |
19053 | 19053 | | |
19054 | 19054 | | |
19055 | | - | |
19056 | | - | |
| 19055 | + | |
| 19056 | + | |
19057 | 19057 | | |
19058 | 19058 | | |
19059 | 19059 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4370 | 4370 | | |
4371 | 4371 | | |
4372 | 4372 | | |
4373 | | - | |
| 4373 | + | |
4374 | 4374 | | |
4375 | 4375 | | |
4376 | 4376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2257 | 2257 | | |
2258 | 2258 | | |
2259 | 2259 | | |
2260 | | - | |
| 2260 | + | |
2261 | 2261 | | |
2262 | 2262 | | |
2263 | 2263 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
| 380 | + | |
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| |||
0 commit comments