================
@@ -202,10 +202,12 @@ class _LIBUNWIND_HIDDEN LocalAddressSpace {
 
   pint_t getEncodedP(pint_t &addr, pint_t end, uint8_t encoding,
                      pint_t datarelBase = 0, pint_t *resultAddr = nullptr);
-  bool findFunctionName(pint_t addr, char *buf, size_t bufLen,
+  template <typename T>
----------------
atrosinenko wrote:

I wonder if replacing `template <typename T>` with something like `template 
<typename ProtectedPtrT>` could further decrease the possibility that this hack 
would be accidentally ignored/removed by the future developers updating this 
code, as I assume it is easier to ignore a comment than to ignore a type name 
written in the very same line :) I definitely do NOT recommend using this 
approach *instead* of a comment. Maybe such `typename`s could even be used as a 
kind of "named hacks" to refer to in the comments. Furthermore, it would be 
great to reflect the fact that this signed pointer type is a pointee 
("referencee"?) itself and fit this description in 1-2 tens of letters :)

Well, this would still be hackish, but I agree that it is important to protect 
fixes for such hard-to-spot bugs from accidentally discarding. Ideally, such 
patterns should be caught by gadget scanner, I guess (or maybe even by the 
compiler itself - isn't #157779 somewhat relevant?).

By the way, is it possible to use a named `typedef` or something like this for 
reference-to-type? It would be great to simply refer to `bool 
findFunctionName(pint_arg_t addr, ...` and naturally attach the comment to the 
definition of `pint_arg_t`.

https://github.com/llvm/llvm-project/pull/173765
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to