[PATCH] D120263: [BOLT] Fix X86MCPlusBuilder::replaceRegWithImm

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 21 10:19:02 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 (clean and proper way, but with some code churn),
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/D120263/new/

https://reviews.llvm.org/D120263



More information about the llvm-commits mailing list