Now that it has it's own file, it makes little sense for isPointerOrReferenceUninit to be this large, so I moved dereferencing to a separate function.
Details
Details
- Reviewers
george.karpenkov NoQ xazax.hun rnkovacs - Commits
- rG646019655c2e: [analyzer][UninitializedObjectChecker] Refactoring p6.: Move dereferencing to a…
rC340265: [analyzer][UninitializedObjectChecker] Refactoring p6.: Move dereferencing to a…
rL340265: [analyzer][UninitializedObjectChecker] Refactoring p6.: Move dereferencing to a…
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/StaticAnalyzer/Checkers/UninitializedPointee.cpp | ||
---|---|---|
78 ↗ | (On Diff #159916) | In general, using return values is better than out-parameters. |
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp | ||
---|---|---|
223 ↗ | (On Diff #161209) | Hmm, i still have concerns about things like int *x = (int *)&x;. Why not just check the type to terminate the loop? Type hierarchy is guaranteed to be finite. |
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp | ||
---|---|---|
223 ↗ | (On Diff #161209) | There actually is a testcase for that -- it would create a nonloc::LocAsInteger, not a loc::MemRegionVal. I'll add a TODO to revisit this loop condition (again :) ). |
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp | ||
---|---|---|
223 ↗ | (On Diff #161209) | Ok, let's try with one more asterisk: 1 void test() { 2 int **x = (int **)&x; 3 int *y = *x; 4 int z = *y; 5 } Here's what i get in the Store: (x,0,direct) : &element{x,0 S64b,int *} (y,0,direct) : &element{x,0 S64b,int *} (z,0,direct) : &element{x,0 S64b,int *} |
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp | ||
---|---|---|
223 ↗ | (On Diff #161209) | Sounds fun, I'll see how the checker behaves to these when I'm in the office. |
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp | ||
---|---|---|
223 ↗ | (On Diff #161209) | Yup, you were correct, it ends up in an infinite loop. I'll add the testcase for it before commiting. |