The provided test case was crashing because of confusion attempting to find types for ns::Foo under -gsimple-template-names. (This looks broken normally because it's attempting to find ns::Foo rather than ns::Foo<T>)
Looking up types can't give false positives, as opposed to looking up functions as mentioned in https://reviews.llvm.org/D137098.
You could consider using CompilerType::GetTypeInfo instead of introducing CompilerType::IsTemplateType. Though that function looks a bit chunky