1//=- UnsafeBufferUsageGadgets.def - List of ways to use a buffer --*- C++ -*-=//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9/// A gadget is an individual operation in the code that may be of interest to
10/// the UnsafeBufferUsage analysis.
11#ifndef GADGET
12#define GADGET(name)
13#endif
14
15/// Unsafe gadgets correspond to unsafe code patterns that warrant
16/// an immediate warning.
17#ifndef WARNING_GADGET
18#define WARNING_GADGET(name) GADGET(name)
19#endif
20
21/// Safe gadgets correspond to code patterns that aren't unsafe but need to be
22/// properly recognized in order to emit correct warnings and fixes over unsafe
23/// gadgets.
24#ifndef FIXABLE_GADGET
25#define FIXABLE_GADGET(name) GADGET(name)
26#endif
27
28WARNING_GADGET(Increment)
29WARNING_GADGET(Decrement)
30WARNING_GADGET(ArraySubscript)
31WARNING_GADGET(PointerArithmetic)
32WARNING_GADGET(UnsafeBufferUsageAttr)
33FIXABLE_GADGET(ULCArraySubscript)          // `DRE[any]` in an Unspecified Lvalue Context
34FIXABLE_GADGET(DerefSimplePtrArithFixable)
35FIXABLE_GADGET(PointerDereference)
36FIXABLE_GADGET(UPCAddressofArraySubscript) // '&DRE[any]' in an Unspecified Pointer Context
37FIXABLE_GADGET(UPCStandalonePointer)
38FIXABLE_GADGET(UPCPreIncrement)            // '++Ptr' in an Unspecified Pointer Context
39FIXABLE_GADGET(PointerAssignment)
40FIXABLE_GADGET(PointerInit)
41
42#undef FIXABLE_GADGET
43#undef WARNING_GADGET
44#undef GADGET
45