various clang-tidy fixes, tree generator improvements, test fixes, tree KM for nonlinear tree patterns fixed