nanana37 / eacces-modifier

Make "Permission denied" detailed.
0 stars 0 forks source link

Use of llvm::InstVisit #4

Closed nanana37 closed 6 months ago

nanana37 commented 6 months ago

https://llvm.org/doxygen/classllvm_1_1InstVisitor.html

nanana37 commented 6 months ago

命令の型を確認してそれに合わせた処理を繰り返す getOrigin() 関数の実装をシンプルにできそう.

LLVM Programmer’s Manual

Note that the dyn_cast<> operator, like C++’s dynamic_cast<> or Java’s instanceof operator, can be abused. In particular, you should not use big chained if/then/else blocks to check for lots of different variants of classes. If you find yourself wanting to do this, it is much cleaner and more efficient to use the InstVisitor class to dispatch over the instruction type directly.

nanana37 commented 6 months ago

無事置き換えに成功.返り値を指定することで理想の使い方になりました.

https://github.com/nanana37/eacces-modifier/commit/c41cc6f8a39ceeed40062f6163637ef0bf0097ea