[clang] [Clang][analyzer] add documentation for optin performance padding (padding checker) #73675 (PR #86411)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 27 03:19:25 PDT 2024


steakhal wrote:

I figured, it might be easier to directly propose and apply some of my thoughts.
Let me know if you like it.

My goal was:
 - be specific what is the impact of not having the optimal layout: memory, cachemisses
 - have a single block of examples, demonstrating the bad, the good and an alternative good (bitpacking) case, while have no header dependencies
 - rework the example to work with the default configuration of the checker (this makes it more similar to the average user's diagnostics)
 - move all the advanced explanations to the end, as most users won't consider setting a custom threshold
 - make the definition of "when it warns" more accurate. I've checked [the code](https://github.com/llvm/llvm-project/blob/main/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp#L103-L109) and it seems that the difference counts compared to the optimal layout.
 - discourage the use of `pragma pack`
 - add guide for fixing the issue, along with a practical hint.
 
 Given that it looks now as I would like it, I'll invite @NagyDonat for a round of review.
 Let me know if you like it too, or have suggestions for making it better.
 
 Lastly, now the generated html would look like this:
 
![image](https://github.com/llvm/llvm-project/assets/6280485/9ea66343-5713-4b7d-b365-e81ae1ebb39e)


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


More information about the cfe-commits mailing list