Fix invocation of clang-format in CMakeLists and apply clang-format.
Fix stack overflow in HandleNode by explicitly limiting the depth of recursion.