================
@@ -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:

Can someone explain how this works?  It looks like (both before and after) that 
we're treating the name length as being only 1 (and in this case, 3 after we're 
adding the single quote on both sides).  

BUT it seems in test 91 below that the 'wyx' works, but is 3 characters long.  
Why can't we just print the entirety of the `IdentifierInfo` above?

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