[clang] Warning for unsafe invocation of span::data (PR #75650)

Ziqing Luo via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 15 14:32:25 PST 2023


================
@@ -721,6 +721,33 @@ class UnsafeBufferUsageAttrGadget : public WarningGadget {
   DeclUseList getClaimedVarUseSites() const override { return {}; }
 };
 
+// Warning gadget for unsafe invocation of span::data method.
+// Triggers when the pointer returned by the invocation is immediately
+// cast to a larger type.
+
+class DataInvocationGadget : public WarningGadget {
+  constexpr static const char *const OpTag = "data_invocation_expr";
----------------
ziqingluo-90 wrote:

a nitpick:  I noticed most tag strings use camel cases.   We better be consistent on this?

https://github.com/llvm/llvm-project/pull/75650


More information about the cfe-commits mailing list