Depends on D91861.
This is close, just a few nits. Also, since this has the first uses of IsNegative, it'd be great to have a couple of tests for one of the flags it's used on.
Nit: clang/Basic/LLVM.h pulls Optional in namespace clang so you don't need the llvm:: qualifier.
Please drop parameter names for TableIndex and Diags.