Skip to content

Commit fec28cf

Browse files
committed
make clang format happy
1 parent 3311cbd commit fec28cf

File tree

2 files changed

+38
-21
lines changed

2 files changed

+38
-21
lines changed
Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//===--- hlsl_compat_overloads.h - Additional HLSL overload definitions for intrinsics --===//
1+
//===--- hlsl_compat_overloads.h - Additional HLSL overload definitions for
2+
//intrinsics --===//
23
//
34
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45
// See https://llvm.org/LICENSE.txt for license information.
@@ -20,26 +21,40 @@ namespace hlsl {
2021
// clamp builtins overloads
2122
//===----------------------------------------------------------------------===//
2223

23-
template<typename T, typename R, typename U, uint N>
24-
constexpr __detail::enable_if_t<__detail::is_arithmetic<U>::Value, vector<T,N>> clamp(vector<T,N> p0, vector<R,N> p1, U p2) {
25-
return __builtin_hlsl_elementwise_clamp(p0, (vector<T,N>)p1, (vector<T,N>)p2);
24+
template <typename T, typename R, typename U, uint N>
25+
constexpr __detail::enable_if_t<__detail::is_arithmetic<U>::Value, vector<T, N>>
26+
clamp(vector<T, N> p0, vector<R, N> p1, U p2) {
27+
return __builtin_hlsl_elementwise_clamp(p0, (vector<T, N>)p1,
28+
(vector<T, N>)p2);
2629
}
27-
template<typename T, typename R, typename U, uint N>
28-
constexpr __detail::enable_if_t<__detail::is_arithmetic<U>::Value, vector<T,N>> clamp(vector<T,N> p0, U p1, vector<R,N> p2) {
29-
return __builtin_hlsl_elementwise_clamp(p0, (vector<T,N>)p1, (vector<T,N>)p2);
30+
template <typename T, typename R, typename U, uint N>
31+
constexpr __detail::enable_if_t<__detail::is_arithmetic<U>::Value, vector<T, N>>
32+
clamp(vector<T, N> p0, U p1, vector<R, N> p2) {
33+
return __builtin_hlsl_elementwise_clamp(p0, (vector<T, N>)p1,
34+
(vector<T, N>)p2);
3035
}
31-
template<typename T, typename U, typename V, uint N>
32-
constexpr __detail::enable_if_t<__detail::is_arithmetic<U>::Value && __detail::is_arithmetic<V>::Value, vector<T,N>> clamp(vector<T,N> p0, U p1, V p2) {
33-
return __builtin_hlsl_elementwise_clamp(p0, (vector<T,N>)p1, (vector<T,N>)p2);
36+
template <typename T, typename U, typename V, uint N>
37+
constexpr __detail::enable_if_t<__detail::is_arithmetic<U>::Value &&
38+
__detail::is_arithmetic<V>::Value,
39+
vector<T, N>>
40+
clamp(vector<T, N> p0, U p1, V p2) {
41+
return __builtin_hlsl_elementwise_clamp(p0, (vector<T, N>)p1,
42+
(vector<T, N>)p2);
3443
}
35-
template<typename T, typename R, typename S, uint N>
36-
constexpr vector<T,N> clamp(vector<T,N> p0, vector<R,N> p1, vector<S,N> p2) {
37-
return __builtin_hlsl_elementwise_clamp(p0, (vector<T,N>)p1, (vector<T,N>)p2);
44+
template <typename T, typename R, typename S, uint N>
45+
constexpr vector<T, N> clamp(vector<T, N> p0, vector<R, N> p1,
46+
vector<S, N> p2) {
47+
return __builtin_hlsl_elementwise_clamp(p0, (vector<T, N>)p1,
48+
(vector<T, N>)p2);
3849
}
39-
template<typename U, typename V, typename W>
40-
constexpr __detail::enable_if_t<__detail::is_arithmetic<U>::Value && __detail::is_arithmetic<V>::Value && __detail::is_arithmetic<W>::Value, U> clamp(U p0, V p1, W p2) {
41-
return __builtin_hlsl_elementwise_clamp(p0, (U) p1, (U) p2);
50+
template <typename U, typename V, typename W>
51+
constexpr __detail::enable_if_t<__detail::is_arithmetic<U>::Value &&
52+
__detail::is_arithmetic<V>::Value &&
53+
__detail::is_arithmetic<W>::Value,
54+
U>
55+
clamp(U p0, V p1, W p2) {
56+
return __builtin_hlsl_elementwise_clamp(p0, (U)p1, (U)p2);
4257
}
43-
58+
4459
} // namespace hlsl
4560
#endif // _HLSL_COMPAT_OVERLOADS_H_

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,10 +2045,12 @@ static bool CheckAllArgsHaveSameType(Sema *S, CallExpr *TheCall) {
20452045
QualType ArgTy0 = TheCall->getArg(0)->getType();
20462046

20472047
for (unsigned I = 1, N = TheCall->getNumArgs(); I < N; ++I) {
2048-
if (!S->getASTContext().hasSameUnqualifiedType(ArgTy0, TheCall->getArg(I)->getType())) {
2048+
if (!S->getASTContext().hasSameUnqualifiedType(
2049+
ArgTy0, TheCall->getArg(I)->getType())) {
20492050
S->Diag(TheCall->getBeginLoc(), diag::err_vec_builtin_incompatible_vector)
2050-
<< TheCall->getDirectCallee() << /*useAllTerminology*/ true
2051-
<< SourceRange(TheCall->getArg(0)->getBeginLoc(), TheCall->getArg(N-1)->getEndLoc());
2051+
<< TheCall->getDirectCallee() << /*useAllTerminology*/ true
2052+
<< SourceRange(TheCall->getArg(0)->getBeginLoc(),
2053+
TheCall->getArg(N - 1)->getEndLoc());
20522054
return true;
20532055
}
20542056
}
@@ -2407,7 +2409,7 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
24072409
if (SemaRef.checkArgCount(TheCall, 3))
24082410
return true;
24092411
if (CheckAnyScalarOrVector(&SemaRef, TheCall, 0) ||
2410-
CheckAllArgsHaveSameType(&SemaRef, TheCall))
2412+
CheckAllArgsHaveSameType(&SemaRef, TheCall))
24112413
return true;
24122414
if (SemaRef.BuiltinElementwiseTernaryMath(
24132415
TheCall, /*CheckForFloatArgs*/

0 commit comments

Comments
 (0)