This is the initial commit for -Wunsafe-buffer-usage, a warning that helps codebases (especially modern C++ codebases) transition away from buffer accesses. It's a minimal commit that barely implements anything, mostly adds skeleton for future work; we have a long road ahead of us.
Backstory in https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734, more documentation for the proposed programming model in D136811.
I'm putting the actual implementation into libAnalysis as it's going to be a non-trivial analysis - mostly the fixit part where we try to figure out if we understand a variable's use pattern well enough to suggest a safe container/view replacement. Some parts of it may eventually prove useful for any similar fixit machine that tries to change types of variables. More on that in the next patch.
The interface for the analysis is currently very primitive, the analysis emits operations on raw buffers it thinks are unsafe. The plan is that it'll also emit fixit objects, but then the consuming class will figure out how to present them.
Warning text is currently somewhat lame, it going to improve a lot once we specialize it for different operations, and once we start emitting fixits we'll have to rethink it anyway because fixits can't be attached to a specific operation (but to an entire variable or even group of variables).
The warning is disabled by default.