mirror of
https://github.com/skylot/jadx.git
synced 2024-11-23 04:39:46 +00:00
feat: give ability to plugins to edit blocks before locking (PR #2336)
Plugins can use `.before('BlockFinisher')` to edit blocks before they are locked.
This commit is contained in:
parent
57238de6ff
commit
4c74e8e300
@ -47,6 +47,7 @@ import jadx.core.dex.visitors.ReplaceNewArray;
|
||||
import jadx.core.dex.visitors.ShadowFieldVisitor;
|
||||
import jadx.core.dex.visitors.SignatureProcessor;
|
||||
import jadx.core.dex.visitors.SimplifyVisitor;
|
||||
import jadx.core.dex.visitors.blocks.BlockFinisher;
|
||||
import jadx.core.dex.visitors.blocks.BlockProcessor;
|
||||
import jadx.core.dex.visitors.blocks.BlockSplitter;
|
||||
import jadx.core.dex.visitors.debuginfo.DebugInfoApplyVisitor;
|
||||
@ -131,6 +132,7 @@ public class Jadx {
|
||||
// blocks IR
|
||||
passes.add(new BlockSplitter());
|
||||
passes.add(new BlockProcessor());
|
||||
passes.add(new BlockFinisher());
|
||||
if (args.isRawCFGOutput()) {
|
||||
passes.add(DotGraphVisitor.dumpRaw());
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package jadx.core.dex.visitors.blocks;
|
||||
|
||||
import jadx.core.dex.attributes.AFlag;
|
||||
import jadx.core.dex.nodes.MethodNode;
|
||||
import jadx.core.dex.visitors.AbstractVisitor;
|
||||
|
||||
public class BlockFinisher extends AbstractVisitor {
|
||||
@Override
|
||||
public void visit(MethodNode mth) {
|
||||
if (mth.isNoCode() || mth.getBasicBlocks().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (!mth.contains(AFlag.DISABLE_BLOCKS_LOCK)) {
|
||||
mth.finishBasicBlocks();
|
||||
}
|
||||
}
|
||||
}
|
@ -92,9 +92,6 @@ public class BlockProcessor extends AbstractVisitor {
|
||||
PostDominatorTree.compute(mth);
|
||||
|
||||
updateCleanSuccessors(mth);
|
||||
if (!mth.contains(AFlag.DISABLE_BLOCKS_LOCK)) {
|
||||
mth.finishBasicBlocks();
|
||||
}
|
||||
}
|
||||
|
||||
static void updateCleanSuccessors(MethodNode mth) {
|
||||
|
Loading…
Reference in New Issue
Block a user