Replace getAs with castAs and add assert if needed.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM with the think-o fixed.
clang/lib/Frontend/FrontendActions.cpp | ||
---|---|---|
461 | This doesn't build. ;-) |
clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp | ||
---|---|---|
294–295 |
Fix the assert causing build failure and address another review comment.
clang/lib/Frontend/FrontendActions.cpp | ||
---|---|---|
461 | Thanks for the catch. Something was wrong with my workspace build setup, and didn't diagnose this at all! I changed this in the new patch. |
clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp | ||
---|---|---|
294–295 | Wouldn't it be better to do an with a comment, like below? assert(lstate && "lstate should not be null"); |
Looks good. Thanks!
clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp | ||
---|---|---|
294–295 | As a Static Analyzer dev I don't think its necessary. StateRefs are ubiquitous and here we probably know it cannot be null. And if it turns out to be null we would get a segfault. So that sense I don't think its necessary. And speaking of a comment like "it should not be null" I think the segfault would sort of imply that. |
clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp | ||
---|---|---|
294–295 | That makes sense! Thanks! |
This doesn't build. ;-)