[-Wunsafe-buffer-usage] NFC: Introduce an abstraction for fixable code patterns.
This patch introduces a hierarchy of Gadget classes, which are going to be the core concept in the somewhat sophisticated machine behind the upcoming -Wunsafe-buffer-usage fix-it hints. A gadget is a rigid code pattern that constitutes an operation that the fixit machine "understands" well enough to work with. A gadget may be "unsafe" (i.e., constitute a raw buffer access) or "safe" (constitute a use of a pointer or array variable that isn't unsafe per se, but may need fixing if the participating variable changes type to a safe container/view). We'll be able to make decisions about how to fix the code depending on the set of gadgets that we've enumerated. Basically, in order to fix a type of a variable, each use of that variable has to participate in a gadget, and each such gadget has to consent to fixing itself according to the variable's new type. Differential Revision: https://reviews.llvm.org/D137348
Loading
Please sign in to comment