[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 25 05:23:12 PDT 2017


lebedev.ri added a comment.

Nice!

  /home/eenitot/new_llvm/llvm/lib/Support/ConvertUTFWrapper.cpp:38:26: warning: do not cast pointers into more strictly aligned pointer types [cert-exp36-c]
      UTF16 *targetStart = reinterpret_cast<UTF16*>(ResultPtr);
                           ^

Hmm, the text is well-worded, but i wonder if a bit more context, much like the `-Wcast-align`, would be nicer, something like:

  warning: casting from type `T1` (alignment `a1`) to type `T2` (alignment `a2`) increases required alignment [cert-exp36-c]

It does mix the alignment of the type `T` and the alignment specified by `__attribute__((aligned()))` / `alignas()`, but i'm not sure it is possible to show that in the message..
Thoughts?


Repository:
  rL LLVM

https://reviews.llvm.org/D33826





More information about the cfe-commits mailing list