This patch enables throwing exceptions for invalid backreferences in the constructor when using the basic, extended, grep, or egrep grammar. This fixes bug 34297. Differential Revision: https://reviews.llvm.org/D62453