[Matrix] Move C++ matrix cast checks to TryStaticCast.
authorFlorian Hahn <flo@fhahn.com>
Fri, 28 May 2021 11:12:50 +0000 (12:12 +0100)
committerFlorian Hahn <flo@fhahn.com>
Fri, 28 May 2021 12:00:28 +0000 (13:00 +0100)
commit5bccdde070d29fb83aec69c498285b4c8914f8d1
tree062f650fcd59917394830244de7735c4d07541ae
parent49b2f8328f363b8c989f8139c2ab2063f26363ea
[Matrix] Move C++ matrix cast checks to TryStaticCast.

At the moment, the matrix support in CheckCXXCStyleCast (added in
D101696) breaks function-style constructor calls that take a
single matrix value, because it is treated as matrix cast.

Instead, unify the C++ matrix cast handling by moving the logic to
TryStaticCast and only handle the case where both types are matrix
types. Otherwise, fall back to the generic mis-match detection.

Suggested by @rjmccall

Reviewed By: SaurabhJha

Differential Revision: https://reviews.llvm.org/D103163
clang/lib/Sema/SemaCast.cpp
clang/test/CodeGenCXX/matrix-casts.cpp
clang/test/SemaCXX/matrix-casts.cpp