[clang] Fix double-quotes in diagnostic when attempting to access a ext_vector of bools (PR #118186)

William Tran-Viet via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 6 08:16:48 PST 2024


================
@@ -1655,8 +1655,10 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult &R,
     // We disallow element access for ext_vector_type bool.  There is no way to
     // materialize a reference to a vector element as a pointer (each element is
     // one bit in the vector).
+    assert(MemberName.isIdentifier() &&
+           "Ext vector component name not an identifier!");
     S.Diag(R.getNameLoc(), diag::err_ext_vector_component_name_illegal)
-        << MemberName
+        << MemberName.getAsIdentifierInfo()->getName()
----------------
smallp-o-p wrote:

The reason I did this instead of that was cause in `CheckExtVectorComponent`, a `StringRef` is passed to the diagnostics handler, which doesn't add quotes around the name, hence why the quotes are in the error message in the first place.   

Removing the quotes in `DiagnosticsSemaKind.td` causes the tests in `/Sema/ext_vector_components.c` to fail.

The real todo would be to implement modifications for `ak_std_string`. 

Let me know what you think, also thank you for taking the time to look at this. 

https://github.com/llvm/llvm-project/pull/118186


More information about the cfe-commits mailing list