Skip to content

Commit 1bcf418

Browse files
committed
Pass single quotes directly when reporting illegal vector component in CheckExtVector(), and offset the diagnostic arrow so it points to the offending component, rather than the '.' at the start of the component identifier.
1 parent 664ac70 commit 1bcf418

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clang/lib/Sema/SemaExprMember.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,10 @@ CheckExtVectorComponent(Sema &S, QualType baseType, ExprValueKind &VK,
434434
if (!HalvingSwizzle && *compStr) {
435435
// We didn't get to the end of the string. This means the component names
436436
// didn't come from the same set *or* we encountered an illegal name.
437-
S.Diag(OpLoc, diag::err_ext_vector_component_name_illegal)
438-
<< StringRef(compStr, 1) << SourceRange(CompLoc);
437+
size_t Offset = compStr - CompName->getNameStart() + 1;
438+
S.Diag(OpLoc.getLocWithOffset(Offset),
439+
diag::err_ext_vector_component_name_illegal)
440+
<< StringRef({'\'', *compStr, '\''}) << SourceRange(CompLoc);
439441
return QualType();
440442
}
441443

0 commit comments

Comments
 (0)