================
@@ -434,8 +434,11 @@ CheckExtVectorComponent(Sema &S, QualType baseType, 
ExprValueKind &VK,
   if (!HalvingSwizzle && *compStr) {
     // We didn't get to the end of the string. This means the component names
     // didn't come from the same set *or* we encountered an illegal name.
-    S.Diag(OpLoc, diag::err_ext_vector_component_name_illegal)
-      << StringRef(compStr, 1) << SourceRange(CompLoc);
+    size_t Offset = compStr - CompName->getNameStart() + 1;
+    char Fmt[3] = {'\'', *compStr, '\''};
+    S.Diag(OpLoc.getLocWithOffset(Offset),
+           diag::err_ext_vector_component_name_illegal)
+        << StringRef(Fmt, 3) << SourceRange(CompLoc);
----------------
erichkeane wrote:

A quick debug shows the below test changes are a little confusing, as the 
'bool' vectors dont' actually allow anything, so this just ends up diagnosing 
elsewhere.  So this change _IS_ just diagnosing a single letter.

For some reason that I don't quite understand, the access is allowed to be any 
combo of `x`,`y`, `z`, `w`, `r`, `g`,` b`, and `a`, with some attempt to be 
able to 'set' them.  So it seems we're trying to diagnose the first one that 
isn't one of those above letters, so the single letter thing seems fine, just 
confusing for obvious reasons :) 

https://github.com/llvm/llvm-project/pull/118186
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to