[PATCH] D77598: Integral template argument suffix printing

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 17 21:16:46 PDT 2020


rsmith added a comment.

Is is feasible to check whether the corresponding template parameter either has a deduced type or is a parameter of a function template? If not, we don't need to clarify the type of the template argument and could leave off the suffix to shorten the printed argument.



================
Comment at: clang/lib/AST/TemplateBase.cpp:83-84
+        Out << "U";
+      if (Val.getBitWidth() == 64)
+        Out << "LL";
+    }
----------------
We shouldn't assume that we have a `long long` if and only if we have a 64-bit value. We should determine how to print the value based on the type `T` instead.

There are cases where there is no matching suffix, too, such as a `short` template argument. If there is no matching suffix, presumably we should print a cast instead.


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

https://reviews.llvm.org/D77598





More information about the cfe-commits mailing list