[PATCH] D120260: [BOLT][NFC] Fix undefined behavior in encodeAnnotationImm

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 22 13:26:09 PST 2022


Amir added a comment.

I wanted to test MCPlusBuilder’s private methods (encodeAnnotationImm and friends) that are not directly exposed through public methods. The options were:

1. add test class as a friend of MCPlusBuilder (less invasive, future unit tests may follow)
2. move these methods into another file (eg MCPlusAnnotation.h) and include it into MCPlusBuilder.h and test source, the downside is code churn and pollution of the global namespace with these new functions,
3. test using hackish indirect way (through GnuArgsSize annotation) that doesn’t require any changes to MCPlusBuilder source, does the job but test code would be ugly.

This diff goes with option 2, but I'm open to the feedback.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120260



More information about the llvm-commits mailing list