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
- Repository
- rG LLVM Github Monorepo
Event Timeline
| clang/lib/Analysis/UnsafeBufferUsage.cpp | ||
|---|---|---|
| 32–40 | Isn't it possible to reduce the number of cases by using hasCanonicalType? | |
| clang/lib/Analysis/UnsafeBufferUsage.cpp | ||
|---|---|---|
| 32–40 | aha, it simply works! | |
| clang/lib/Analysis/UnsafeBufferUsage.cpp | ||
|---|---|---|
| 31–32 | ||
| 32 | 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. | |
| 36 | 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?