This adds a checker, llvm-problematic-statics, that detects functions in header files that return the address of a local static variable. These cause problems if the resulting pointer is expected to be unique because it may have different values across shared library boundaries.
I agree with @Eugene.Zelenko that this check should rather live in bugprone- as the issue its diagnosing is not LLVM specific. It is ok to add an alias into the llvm module.
Nit: you can inline this variable, having it does not improve readability (IMHO) nor does it reduce duplication.
I think the matching on include should not be done. Maybe it's ok to filter for header files, but we should not assume they live in include/... (as i think this check is generally useful and not too LLVM specific).
More filters for false positives could be checking if the function itself is static or in an anonymous namespace.
Please assert on VD and Return
I think the testing should include more cases. At least normal functions, and a false case as well.
because the matcher might evolve over time. Right now this can not be triggered, that is correct. Asking for it was inappropriate but having it doesn't hurt.