[PATCH] D96151: [OpenCL] Fix pipe type printing in arg info metadata

Stuart Brady via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 5 11:18:57 PST 2021


stuart added a comment.

This looks like a really good cleanup, in addition to fixing the metadata for pipes.

Minor nit: "matadata" -> "metadata" in the description, and there's a StringRef construction that could be sunk.



================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1496-1507
+      auto getTypeSpelling = [&](QualType Ty) {
+        auto typeName = Ty.getUnqualifiedType().getAsString(Policy);
+
+        StringRef typeNameRef = typeName;
+        // Turn "unsigned type" to "utype"
+        if (Ty.isCanonical()) {
+          if (typeNameRef.consume_front("unsigned "))
----------------
This seems far cleaner than the code it replaces!


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1499
+
+        StringRef typeNameRef = typeName;
+        // Turn "unsigned type" to "utype"
----------------
Would it be better to sink this into the `if (Ty.isCanonical())` block?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96151/new/

https://reviews.llvm.org/D96151



More information about the cfe-commits mailing list