getUBSanFunctionTypeHash does not handle the attributed function case correctly. For a function with an attribute, the QualType passed to the function is a FunctionNoProtoType wrapped in an AttributedType. As a result, the code goes down the !isa<FunctionNoProtoType> branch which is incorrect behavior. This results in an assertion failure inside the call to getFunctionTypeWithExceptionSpec.
The added test is a sanity check that the compiler no longer crashes during compilation.
rdar://113144087