[PATCH] D138318: [-Wunsafe-buffer-usage] Improve pointer match pattern

Ziqing Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 28 15:30:28 PST 2022


ziqingluo-90 added inline comments.


================
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:31-39
+    hasType(pointerType()),
+    hasType(autoType(
+            hasDeducedType(hasUnqualifiedDesugaredType(pointerType())))),
+    // DecayedType, e.g., array type in formal parameter decl
+    hasType(decayedType(hasDecayedType(pointerType()))),
+    // ElaboratedType, e.g., typedef
+    hasType(elaboratedType(hasUnqualifiedDesugaredType(pointerType()))),
----------------
xazax.hun wrote:
> Isn't it possible to reduce the number of cases by using `hasCanonicalType`?
aha, it simply works! 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138318/new/

https://reviews.llvm.org/D138318



More information about the cfe-commits mailing list