Apparently TransformDecl in TreeTransform can be called with a nullptr for a Decl, so my casts were illegal. The fix here is to add an early exit to my TransformDecl.