Skip to content

Commit 7ac4da8

Browse files
committed
[NFC] Fixed Diagnostics that assumed only two arguments
1 parent 0068078 commit 7ac4da8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,8 +1688,9 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) {
16881688
auto *VecTyA = ArgTyA->getAs<VectorType>();
16891689
SourceLocation BuiltinLoc = TheCall->getBeginLoc();
16901690

1691+
ExprResult B;
16911692
for (unsigned i = 1; i < TheCall->getNumArgs(); ++i) {
1692-
ExprResult B = TheCall->getArg(i);
1693+
B = TheCall->getArg(i);
16931694
QualType ArgTyB = B.get()->getType();
16941695
auto *VecTyB = ArgTyB->getAs<VectorType>();
16951696
if (VecTyA == nullptr && VecTyB == nullptr)
@@ -1712,8 +1713,7 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) {
17121713
// HLSLVectorTruncation.
17131714
S->Diag(BuiltinLoc, diag::err_vec_builtin_incompatible_vector)
17141715
<< TheCall->getDirectCallee() << /*useAllTerminology*/ true
1715-
<< SourceRange(TheCall->getArg(0)->getBeginLoc(),
1716-
TheCall->getArg(1)->getEndLoc());
1716+
<< SourceRange(A.get()->getBeginLoc(), B.get()->getEndLoc());
17171717
retValue = true;
17181718
}
17191719
return retValue;
@@ -1724,8 +1724,7 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) {
17241724
// requires a VectorSplat on Arg0 or Arg1
17251725
S->Diag(BuiltinLoc, diag::err_vec_builtin_non_vector)
17261726
<< TheCall->getDirectCallee() << /*useAllTerminology*/ true
1727-
<< SourceRange(TheCall->getArg(0)->getBeginLoc(),
1728-
TheCall->getArg(1)->getEndLoc());
1727+
<< SourceRange(A.get()->getBeginLoc(), B.get()->getEndLoc());
17291728
return true;
17301729
}
17311730

0 commit comments

Comments
 (0)