Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 14 | pmbaty | 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 | |||
| 28 | WARNING_GADGET(Increment) | ||
| 29 | WARNING_GADGET(Decrement) | ||
| 30 | WARNING_GADGET(ArraySubscript) | ||
| 31 | WARNING_GADGET(PointerArithmetic) | ||
| 32 | |||
| 33 | #undef FIXABLE_GADGET | ||
| 34 | #undef WARNING_GADGET | ||
| 35 | #undef GADGET |