@Test public void strip() throws Exception { String programBefore = "void foo();\n" + "void bar() {\n" + "}\n" + "void buzz() {\n" + "}\n" + "void baz() {\n" + " buzz();\n" + "}\n" + "int garb(int z) {\n" + "}\n" + "int glib() {\n" + " return 2;\n" + "}\n" + "void main() {\n" + " int z = garb(glib());\n" + " baz();" + "}\n"; String programAfter = "void buzz() {\n" + "}\n" + "void baz() {\n" + " buzz();\n" + "}\n" + "int garb(int z) {\n" + "}\n" + "int glib() {\n" + " return 2;\n" + "}\n" + "void main() {\n" + " int z = garb(glib());\n" + " baz();" + "}\n"; TranslationUnit tuBefore = ParseHelper.parse(programBefore); TranslationUnit tuAfter = ParseHelper.parse(programAfter); StripUnusedFunctions.strip(tuBefore); assertEquals( PrettyPrinterVisitor.prettyPrintAsString(tuAfter), PrettyPrinterVisitor.prettyPrintAsString(tuBefore) ); }
public static void strip(TranslationUnit tu) { new StripUnusedFunctions().applyStrip(tu); }
StripUnusedFunctions extends StandardVisitor { public static void strip(TranslationUnit tu) { new StripUnusedFunctions().applyStrip(tu); } }
StripUnusedFunctions extends StandardVisitor { public static void strip(TranslationUnit tu) { new StripUnusedFunctions().applyStrip(tu); } private  StripUnusedFunctions(); }
StripUnusedFunctions extends StandardVisitor { public static void strip(TranslationUnit tu) { new StripUnusedFunctions().applyStrip(tu); } private  StripUnusedFunctions(); static void strip(TranslationUnit tu); void applyStrip(TranslationUnit tu); @Override void visitFunctionDefinition(FunctionDefinition functionDefinition); @Override void visitFunctionCallExpr(FunctionCallExpr functionCallExpr); }
StripUnusedFunctions extends StandardVisitor { public static void strip(TranslationUnit tu) { new StripUnusedFunctions().applyStrip(tu); } private  StripUnusedFunctions(); static void strip(TranslationUnit tu); void applyStrip(TranslationUnit tu); @Override void visitFunctionDefinition(FunctionDefinition functionDefinition); @Override void visitFunctionCallExpr(FunctionCallExpr functionCallExpr);  }