Warning, /include/clang/Analysis/Analyses/UnsafeBufferUsageGadgets.def is written in an unsupported language. File is not indexed.
0001 //=- UnsafeBufferUsageGadgets.def - List of ways to use a buffer --*- C++ -*-=//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008
0009 /// A gadget is an individual operation in the code that may be of interest to
0010 /// the UnsafeBufferUsage analysis.
0011 #ifndef GADGET
0012 #define GADGET(name)
0013 #endif
0014
0015 /// Unsafe gadgets correspond to unsafe code patterns that warrant
0016 /// an immediate warning.
0017 #ifndef WARNING_GADGET
0018 #define WARNING_GADGET(name) GADGET(name)
0019 #endif
0020
0021 /// A `WARNING_GADGET` subset, each of which may be enable/disable separately
0022 /// with different flags
0023 #ifndef WARNING_OPTIONAL_GADGET
0024 #define WARNING_OPTIONAL_GADGET(name) WARNING_GADGET(name)
0025 #endif
0026
0027 /// Safe gadgets correspond to code patterns that aren't unsafe but need to be
0028 /// properly recognized in order to emit correct warnings and fixes over unsafe
0029 /// gadgets.
0030 #ifndef FIXABLE_GADGET
0031 #define FIXABLE_GADGET(name) GADGET(name)
0032 #endif
0033
0034 WARNING_GADGET(Increment)
0035 WARNING_GADGET(Decrement)
0036 WARNING_GADGET(ArraySubscript)
0037 WARNING_GADGET(PointerArithmetic)
0038 WARNING_GADGET(UnsafeBufferUsageAttr)
0039 WARNING_GADGET(UnsafeBufferUsageCtorAttr)
0040 WARNING_GADGET(DataInvocation)
0041 WARNING_OPTIONAL_GADGET(UnsafeLibcFunctionCall)
0042 WARNING_OPTIONAL_GADGET(SpanTwoParamConstructor) // Uses of `std::span(arg0, arg1)`
0043 FIXABLE_GADGET(ULCArraySubscript) // `DRE[any]` in an Unspecified Lvalue Context
0044 FIXABLE_GADGET(DerefSimplePtrArithFixable)
0045 FIXABLE_GADGET(PointerDereference)
0046 FIXABLE_GADGET(UPCAddressofArraySubscript) // '&DRE[any]' in an Unspecified Pointer Context
0047 FIXABLE_GADGET(UPCStandalonePointer)
0048 FIXABLE_GADGET(UPCPreIncrement) // '++Ptr' in an Unspecified Pointer Context
0049 FIXABLE_GADGET(UUCAddAssign) // 'Ptr += n' in an Unspecified Untyped Context
0050 FIXABLE_GADGET(PtrToPtrAssignment)
0051 FIXABLE_GADGET(CArrayToPtrAssignment)
0052 FIXABLE_GADGET(PointerInit)
0053
0054 #undef FIXABLE_GADGET
0055 #undef WARNING_GADGET
0056 #undef WARNING_OPTIONAL_GADGET
0057 #undef GADGET