Reported by Coverity:
In clang::ASTContext::hasUniqueObjectRepresentations(clang::QualType, bool): Return value of function which returns null is dereferenced without checking.
(Ty->isMemberPointerType()) {
//returned_null: getAs returns nullptr.
//var_assigned: Assigning: MPT = nullptr return value from getAs.
const auto *MPT = Ty->getAs<MemberPointerType>();
//dereference: Dereferencing a pointer that might be nullptr MPT when calling getMemberPointerInfo. (The virtual call resolves to
<unnamed>::ItaniumCXXABI::getMemberPointerInfo.)
return !ABI->getMemberPointerInfo(MPT).HasPadding;
}This patch uses castAs instead of getAs.
Remove the curley braces, otherwise LGTM.