This patch Improves the pointer-type matcher used by UnsafeBufferUsage checking by adding matchers for pointer types involving typedef, template instantiation, and decayed types. Corresponding tests are added.
Details
Diff Detail
Event Timeline
| clang/lib/Analysis/UnsafeBufferUsage.cpp | ||
|---|---|---|
| 31–39 | Isn't it possible to reduce the number of cases by using hasCanonicalType? | |
| clang/lib/Analysis/UnsafeBufferUsage.cpp | ||
|---|---|---|
| 31–39 | aha, it simply works! | |
| clang/lib/Analysis/UnsafeBufferUsage.cpp | ||
|---|---|---|
| 30–31 | ||
| 31 | My understanding is that a pointer-to-member type pointer cannot be used to do buffer access, i.e., one cannot do pointer addition on it. So we do not warn pointer-to-member themselves. In cases where the member type is a pointer, it has been covered. I have added a test involving pointer to member types. | |
| 35 | you are right! Thanks for pointing this out. | |
| clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp | ||
| 164 | ||
I shudder to ask this question, but ... pointer to member types?