From 88ac6424fee0d9dd5ba52674df44821fb949270c Mon Sep 17 00:00:00 2001 From: Jimmy Cleary Date: Fri, 14 Apr 2023 14:38:28 -0700 Subject: [PATCH] Add requires/preserves/establishes for HasSourceBlocks checker Summary: InsertSourceBlocksPass establishes it. Passes which may use profile info require it. InstrumentPass destroys/does not preserve it. Reviewed By: agampe Differential Revision: D44941800 fbshipit-source-id: 076c65324b627857f883b56ca825884f3e6627cd --- .../IPReflectionAnalysis.h | 7 ++++ analysis/max-depth/MaxDepthAnalysis.h | 7 ++++ opt/access-marking/AccessMarking.h | 6 ++++ opt/analyze-pure-method/PureMethods.h | 6 ++++ opt/annokill/AnnoKill.h | 7 ++++ opt/app_module_usage/AppModuleUsage.h | 6 ++++ opt/basic-block/BasicBlockProfile.h | 6 ++++ .../BranchPrefixHoisting.h | 5 ++- opt/builder_pattern/RemoveBuilderPattern.h | 7 ++++ opt/check-recursion/CheckRecursion.h | 6 ++++ opt/check_breadcrumbs/CheckBreadcrumbs.h | 5 ++- opt/class-merging/AnonymousClassMergingPass.h | 6 ++++ opt/class-merging/ClassMergingPass.h | 7 ++++ opt/class-merging/IntraDexClassMergingPass.h | 6 ++++ opt/class-splitting/ClassSplittingPass.h | 6 ++++ .../ConstantPropagationPass.h | 6 ++++ .../IPConstantPropagation.h | 6 ++++ opt/copy-propagation/CopyPropagationPass.h | 5 ++- opt/cse/CommonSubexpressionEliminationPass.h | 6 ++++ opt/dedup-strings/DedupStrings.h | 6 ++++ opt/dedup_blocks/DedupBlocksPass.h | 5 ++- opt/dedup_resources/DedupResources.h | 6 ++++ opt/delinit/DelInit.h | 6 ++++ opt/delsuper/DelSuper.h | 6 ++++ opt/evaluate_type_checks/EvaluateTypeChecks.h | 6 ++++ opt/final_inline/FinalInline.h | 6 ++++ opt/final_inline/FinalInlineV2.h | 6 ++++ opt/init-classes/InitClassLoweringPass.h | 5 ++- opt/insert-source-blocks/InsertSourceBlocks.h | 6 ++++ opt/instrument/Instrument.h | 6 ++++ opt/interdex/InterDexPass.h | 7 ++++ opt/interdex/InterDexReshufflePass.h | 6 ++++ opt/interdex/SortRemainingClassesPass.h | 6 ++++ opt/kotlin-lambda/KotlinObjectInliner.h | 7 ++++ .../RewriteKotlinSingletonInstance.h | 7 ++++ .../LayoutReachabilityPass.h | 6 ++++ opt/local-dce/LocalDcePass.h | 5 ++- opt/make-public/MakePublicPass.h | 1 + opt/merge_interface/MergeInterface.h | 7 ++++ opt/methodinline/BridgeSynthInlinePass.h | 6 ++++ opt/methodinline/IntraDexInlinePass.h | 6 ++++ opt/methodinline/LocalMethodInlinePass.h | 6 ++++ opt/methodinline/MethodInlinePass.h | 6 ++++ opt/methodinline/PerfMethodInlinePass.h | 7 ++++ .../IntrinsifyNullChecksPass.h | 7 ++++ .../MaterializeNullChecksPass.h | 7 ++++ opt/obfuscate/Obfuscate.h | 6 ++++ .../ObfuscateResourcesPass.h | 5 ++- .../ObjectEscapeAnalysis.h | 6 ++++ .../ObjectSensitiveDcePass.h | 6 ++++ opt/optimize_enums/OptimizeEnums.h | 6 ++++ opt/optimize_resources/OptimizeResources.h | 7 ++++ opt/original_name/OriginalNamePass.h | 6 ++++ opt/outliner/InstructionSequenceOutliner.h | 6 ++++ opt/partial-application/PartialApplication.h | 6 ++++ opt/peephole/Peephole.h | 6 ++++ opt/print-kotlin-stats/PrintKotlinStats.h | 7 ++++ opt/print-members/PrintMembers.h | 6 ++++ opt/reachable-natives/ReachableNatives.h | 6 ++++ .../ReduceArrayLiterals.h | 6 ++++ .../ReduceBooleanBranchesPass.h | 7 ++++ opt/reduce-gotos/ReduceGotos.h | 5 ++- opt/regalloc-fast/FastRegAlloc.h | 6 ++++ opt/regalloc/RegAlloc.h | 5 ++- .../RemoveApiLevelChecks.h | 6 ++++ opt/remove-builders/RemoveBuilders.h | 6 ++++ opt/remove-interfaces/RemoveInterfacePass.h | 6 ++++ .../RemoveNullcheckStringArg.h | 7 ++++ .../RemoveRecursiveLocks.h | 6 ++++ .../RemoveUninstantiablesPass.h | 6 ++++ opt/remove-unreachable/RemoveUnreachable.h | 6 ++++ opt/remove-unused-args/RemoveUnusedArgs.h | 6 ++++ opt/remove-unused-fields/RemoveUnusedFields.h | 6 ++++ opt/remove_empty_classes/RemoveEmptyClasses.h | 6 ++++ .../RemoveRedundantCheckCasts.h | 6 ++++ opt/renameclasses/RenameClassesV2.h | 6 ++++ .../ReorderInterfacesDecl.h | 6 ++++ .../ResolveProguardAssumeValues.h | 7 ++++ opt/resolve-refs/ExternalRefsManglingPass.h | 6 ++++ opt/result-propagation/ResultPropagation.h | 6 ++++ opt/shorten-srcstrings/Shorten.h | 6 ++++ opt/shrinker/ShrinkerPass.h | 6 ++++ opt/singleimpl/SingleImpl.h | 6 ++++ opt/split_huge_switches/SplitHugeSwitchPass.h | 6 ++++ .../SplitResourceTables.h | 6 ++++ opt/staticrelo/StaticReloV2.h | 7 ++++ opt/string_concatenator/StringConcatenator.h | 6 ++++ .../StringBuilderOutliner.h | 6 ++++ opt/strip-debug-info/StripDebugInfo.h | 6 ++++ opt/test_cfg/TestCFG.h | 6 ++++ opt/throw-propagation/ThrowPropagationPass.h | 6 ++++ opt/track_resources/TrackResources.h | 6 ++++ opt/type-analysis/GlobalTypeAnalysisPass.h | 6 ++++ .../TypeAnalysisCallGraphGenerationPass.h | 6 ++++ .../UnreferencedInterfaces.h | 6 ++++ opt/up-code-motion/UpCodeMotion.h | 6 ++++ opt/uses-names/UsesNames.h | 6 ++++ opt/verifier/Verifier.h | 6 ++++ opt/vertical_merging/VerticalMerging.h | 7 ++++ opt/virtual_merging/VirtualMerging.h | 6 ++++ .../MethodDevirtualizationPass.h | 6 ++++ test/integ/MaxDepthAnalysisTest.cpp | 7 ++++ test/unit/AnalysisUsageTest.cpp | 36 +++++++++++++++++++ 103 files changed, 645 insertions(+), 9 deletions(-) diff --git a/analysis/ip-reflection-analysis/IPReflectionAnalysis.h b/analysis/ip-reflection-analysis/IPReflectionAnalysis.h index 215997049f..f03b0b229c 100644 --- a/analysis/ip-reflection-analysis/IPReflectionAnalysis.h +++ b/analysis/ip-reflection-analysis/IPReflectionAnalysis.h @@ -15,6 +15,13 @@ class IPReflectionAnalysisPass : public Pass { public: IPReflectionAnalysisPass() : Pass("IPReflectionAnalysisPass", Pass::ANALYSIS) {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("max_iteration", 20U, m_max_iteration); bind("export_results", false, m_export_results, diff --git a/analysis/max-depth/MaxDepthAnalysis.h b/analysis/max-depth/MaxDepthAnalysis.h index 13daeea70a..32eb2415d4 100644 --- a/analysis/max-depth/MaxDepthAnalysis.h +++ b/analysis/max-depth/MaxDepthAnalysis.h @@ -15,6 +15,13 @@ class MaxDepthAnalysisPass : public Pass { public: MaxDepthAnalysisPass() : Pass("MaxDepthAnalysisPass", Pass::ANALYSIS) {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("max_iteration", 20U, m_max_iteration); } void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/access-marking/AccessMarking.h b/opt/access-marking/AccessMarking.h index 36c90772c3..f458a3934c 100644 --- a/opt/access-marking/AccessMarking.h +++ b/opt/access-marking/AccessMarking.h @@ -13,6 +13,12 @@ class AccessMarkingPass : public Pass { public: AccessMarkingPass() : Pass("AccessMarkingPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + std::string get_config_doc() override { return "This pass will mark class, methods, and fields final, when able to " "do so. This is generally advantageous for performance. It will " diff --git a/opt/analyze-pure-method/PureMethods.h b/opt/analyze-pure-method/PureMethods.h index 48dc342dad..e2f28f881b 100644 --- a/opt/analyze-pure-method/PureMethods.h +++ b/opt/analyze-pure-method/PureMethods.h @@ -30,6 +30,12 @@ class AnalyzePureMethodsPass : public Pass { AnalyzePureMethodsPass() : Pass("AnalyzePureMethodsPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; bool is_editable_cfg_friendly() override { return true; } diff --git a/opt/annokill/AnnoKill.h b/opt/annokill/AnnoKill.h index 633dc885f1..eb1b9e545f 100644 --- a/opt/annokill/AnnoKill.h +++ b/opt/annokill/AnnoKill.h @@ -115,6 +115,13 @@ class AnnoKill { class AnnoKillPass : public Pass { public: AnnoKillPass() : Pass("AnnoKillPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + explicit AnnoKillPass(const std::string& name) : Pass(name) {} void bind_config() override { diff --git a/opt/app_module_usage/AppModuleUsage.h b/opt/app_module_usage/AppModuleUsage.h index 86eb7eea71..98660fb91d 100644 --- a/opt/app_module_usage/AppModuleUsage.h +++ b/opt/app_module_usage/AppModuleUsage.h @@ -45,6 +45,12 @@ class AppModuleUsagePass : public Pass { public: AppModuleUsagePass() : Pass("AppModuleUsagePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("uses_app_module_annotation_descriptor", DexType::get_type("Lcom/facebook/redex/annotations/UsesAppModule;"), diff --git a/opt/basic-block/BasicBlockProfile.h b/opt/basic-block/BasicBlockProfile.h index f547cab95a..3fd8162e8f 100644 --- a/opt/basic-block/BasicBlockProfile.h +++ b/opt/basic-block/BasicBlockProfile.h @@ -13,5 +13,11 @@ class BasicBlockProfilePass : public Pass { public: BasicBlockProfilePass() : Pass("BasicBlockProfilePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/branch-prefix-hoisting/BranchPrefixHoisting.h b/opt/branch-prefix-hoisting/BranchPrefixHoisting.h index 9a219aa502..b888623c1f 100644 --- a/opt/branch-prefix-hoisting/BranchPrefixHoisting.h +++ b/opt/branch-prefix-hoisting/BranchPrefixHoisting.h @@ -30,7 +30,10 @@ class BranchPrefixHoistingPass : public Pass { redex_properties::PropertyInteractions get_property_interactions() const override { using namespace redex_properties::names; - return {{NoInitClassInstructions, {.preserves = true}}}; + return { + {NoInitClassInstructions, {.preserves = true}}, + {HasSourceBlocks, {.preserves = true}}, + }; } void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/builder_pattern/RemoveBuilderPattern.h b/opt/builder_pattern/RemoveBuilderPattern.h index c00d3b5c0c..90edc50fcd 100644 --- a/opt/builder_pattern/RemoveBuilderPattern.h +++ b/opt/builder_pattern/RemoveBuilderPattern.h @@ -16,6 +16,13 @@ namespace builder_pattern { class RemoveBuilderPatternPass : public Pass { public: RemoveBuilderPatternPass() : Pass("RemoveBuilderPatternPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + explicit RemoveBuilderPatternPass(const std::string& name) : Pass(name) {} void bind_config() override; diff --git a/opt/check-recursion/CheckRecursion.h b/opt/check-recursion/CheckRecursion.h index 741d0f0dc8..d6269b73e0 100644 --- a/opt/check-recursion/CheckRecursion.h +++ b/opt/check-recursion/CheckRecursion.h @@ -13,6 +13,12 @@ class CheckRecursionPass : public Pass { public: CheckRecursionPass() : Pass("CheckRecursionPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + int bad_recursion_count{4}; void bind_config() override { diff --git a/opt/check_breadcrumbs/CheckBreadcrumbs.h b/opt/check_breadcrumbs/CheckBreadcrumbs.h index fa5f94a170..235d8a52b7 100644 --- a/opt/check_breadcrumbs/CheckBreadcrumbs.h +++ b/opt/check_breadcrumbs/CheckBreadcrumbs.h @@ -30,7 +30,10 @@ class CheckBreadcrumbsPass : public Pass { redex_properties::PropertyInteractions get_property_interactions() const override { using namespace redex_properties::names; - return {{NoInitClassInstructions, {.preserves = true}}}; + return { + {NoInitClassInstructions, {.preserves = true}}, + {HasSourceBlocks, {.preserves = true}}, + }; } void bind_config() override { diff --git a/opt/class-merging/AnonymousClassMergingPass.h b/opt/class-merging/AnonymousClassMergingPass.h index 2787a9ead5..0b821a54e2 100644 --- a/opt/class-merging/AnonymousClassMergingPass.h +++ b/opt/class-merging/AnonymousClassMergingPass.h @@ -17,6 +17,12 @@ class AnonymousClassMergingPass : public Pass { public: AnonymousClassMergingPass() : Pass("AnonymousClassMergingPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/class-merging/ClassMergingPass.h b/opt/class-merging/ClassMergingPass.h index 188cfb15a1..c2a810f217 100644 --- a/opt/class-merging/ClassMergingPass.h +++ b/opt/class-merging/ClassMergingPass.h @@ -21,6 +21,13 @@ class ModelMerger; class ClassMergingPass : public Pass { public: ClassMergingPass() : Pass("ClassMergingPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + explicit ClassMergingPass(const char* name) : Pass(name) {} void bind_config() override; diff --git a/opt/class-merging/IntraDexClassMergingPass.h b/opt/class-merging/IntraDexClassMergingPass.h index 36964c7cb2..bd40205fd1 100644 --- a/opt/class-merging/IntraDexClassMergingPass.h +++ b/opt/class-merging/IntraDexClassMergingPass.h @@ -24,6 +24,12 @@ class IntraDexClassMergingPass : public Pass { public: IntraDexClassMergingPass() : Pass("IntraDexClassMergingPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/class-splitting/ClassSplittingPass.h b/opt/class-splitting/ClassSplittingPass.h index 43dc5385d5..262fed166e 100644 --- a/opt/class-splitting/ClassSplittingPass.h +++ b/opt/class-splitting/ClassSplittingPass.h @@ -16,6 +16,12 @@ class ClassSplittingPass : public Pass { public: ClassSplittingPass() : Pass("ClassSplittingPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.requires_ = true, .preserves = true}}}; + } + void bind_config() override { bind("enabled", m_config.enabled, m_config.enabled); bind("combine_target_classes_by_api_level", diff --git a/opt/constant-propagation/ConstantPropagationPass.h b/opt/constant-propagation/ConstantPropagationPass.h index 83805b2ff5..2e37d362bf 100644 --- a/opt/constant-propagation/ConstantPropagationPass.h +++ b/opt/constant-propagation/ConstantPropagationPass.h @@ -16,6 +16,12 @@ class ConstantPropagationPass : public Pass { public: ConstantPropagationPass() : Pass("ConstantPropagationPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("replace_moves_with_consts", true, diff --git a/opt/constant-propagation/IPConstantPropagation.h b/opt/constant-propagation/IPConstantPropagation.h index 279d34fc03..98c467d84d 100644 --- a/opt/constant-propagation/IPConstantPropagation.h +++ b/opt/constant-propagation/IPConstantPropagation.h @@ -41,6 +41,12 @@ class PassImpl : public Pass { : Pass("InterproceduralConstantPropagationPass"), m_config(std::move(config)) {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + PassImpl() : PassImpl(Config()) {} void bind_config() override { diff --git a/opt/copy-propagation/CopyPropagationPass.h b/opt/copy-propagation/CopyPropagationPass.h index 9eaa3e435f..1506b5bee7 100644 --- a/opt/copy-propagation/CopyPropagationPass.h +++ b/opt/copy-propagation/CopyPropagationPass.h @@ -17,7 +17,10 @@ class CopyPropagationPass : public Pass { redex_properties::PropertyInteractions get_property_interactions() const override { using namespace redex_properties::names; - return {{NoInitClassInstructions, {.preserves = true}}}; + return { + {NoInitClassInstructions, {.preserves = true}}, + {HasSourceBlocks, {.preserves = true}}, + }; } void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/cse/CommonSubexpressionEliminationPass.h b/opt/cse/CommonSubexpressionEliminationPass.h index ce2617d255..5bbd0f1a1a 100644 --- a/opt/cse/CommonSubexpressionEliminationPass.h +++ b/opt/cse/CommonSubexpressionEliminationPass.h @@ -15,6 +15,12 @@ class CommonSubexpressionEliminationPass : public Pass { CommonSubexpressionEliminationPass() : Pass("CommonSubexpressionEliminationPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/dedup-strings/DedupStrings.h b/opt/dedup-strings/DedupStrings.h index 1aaf648f04..e7b4532654 100644 --- a/opt/dedup-strings/DedupStrings.h +++ b/opt/dedup-strings/DedupStrings.h @@ -172,6 +172,12 @@ class DedupStringsPass : public Pass { public: DedupStringsPass() : Pass("DedupStringsPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.requires_ = true, .preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; bool is_editable_cfg_friendly() override { return true; } diff --git a/opt/dedup_blocks/DedupBlocksPass.h b/opt/dedup_blocks/DedupBlocksPass.h index 5ca530f494..0fc5e520d6 100644 --- a/opt/dedup_blocks/DedupBlocksPass.h +++ b/opt/dedup_blocks/DedupBlocksPass.h @@ -17,7 +17,10 @@ class DedupBlocksPass : public Pass { redex_properties::PropertyInteractions get_property_interactions() const override { using namespace redex_properties::names; - return {{NoInitClassInstructions, {.preserves = true}}}; + return { + {NoInitClassInstructions, {.preserves = true}}, + {HasSourceBlocks, {.preserves = true}}, + }; } void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/dedup_resources/DedupResources.h b/opt/dedup_resources/DedupResources.h index bc8026942f..69af577220 100644 --- a/opt/dedup_resources/DedupResources.h +++ b/opt/dedup_resources/DedupResources.h @@ -51,6 +51,12 @@ class DedupResourcesPass : public Pass { public: DedupResourcesPass() : Pass("DedupResourcesPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("disallowed_types", {}, m_disallowed_types); bind("disallowed_resources", {}, m_disallowed_resources); diff --git a/opt/delinit/DelInit.h b/opt/delinit/DelInit.h index 095431b4a0..cea1599ef2 100644 --- a/opt/delinit/DelInit.h +++ b/opt/delinit/DelInit.h @@ -13,6 +13,12 @@ class DelInitPass : public Pass { public: DelInitPass() : Pass("DelInitPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("package_allowlist", {}, m_package_filter); } diff --git a/opt/delsuper/DelSuper.h b/opt/delsuper/DelSuper.h index 81225708a3..3f2777d32d 100644 --- a/opt/delsuper/DelSuper.h +++ b/opt/delsuper/DelSuper.h @@ -14,5 +14,11 @@ class DelSuperPass : public Pass { public: DelSuperPass() : Pass("DelSuperPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/evaluate_type_checks/EvaluateTypeChecks.h b/opt/evaluate_type_checks/EvaluateTypeChecks.h index 9ab89f35ef..6d67002f50 100644 --- a/opt/evaluate_type_checks/EvaluateTypeChecks.h +++ b/opt/evaluate_type_checks/EvaluateTypeChecks.h @@ -22,6 +22,12 @@ class EvaluateTypeChecksPass : public Pass { public: EvaluateTypeChecksPass() : Pass("EvaluateTypeChecksPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; // Exposed for testing. diff --git a/opt/final_inline/FinalInline.h b/opt/final_inline/FinalInline.h index 5bbfe7f203..38d4b6dbc9 100644 --- a/opt/final_inline/FinalInline.h +++ b/opt/final_inline/FinalInline.h @@ -27,6 +27,12 @@ class FinalInlinePass : public Pass { public: FinalInlinePass() : Pass("FinalInlinePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("blocklist_annos", {}, diff --git a/opt/final_inline/FinalInlineV2.h b/opt/final_inline/FinalInlineV2.h index 56aa0083cd..6fad9847d2 100644 --- a/opt/final_inline/FinalInlineV2.h +++ b/opt/final_inline/FinalInlineV2.h @@ -27,6 +27,12 @@ class FinalInlinePassV2 : public Pass { FinalInlinePassV2() : Pass("FinalInlinePassV2") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("inline_instance_field", true, m_config.inline_instance_field); bind("blocklist_types", diff --git a/opt/init-classes/InitClassLoweringPass.h b/opt/init-classes/InitClassLoweringPass.h index 1a472f72a7..dae5405dd9 100644 --- a/opt/init-classes/InitClassLoweringPass.h +++ b/opt/init-classes/InitClassLoweringPass.h @@ -17,7 +17,10 @@ class InitClassLoweringPass : public Pass { redex_properties::PropertyInteractions get_property_interactions() const override { using namespace redex_properties::names; - return {{NoInitClassInstructions, {.establishes = true}}}; + return { + {NoInitClassInstructions, {.establishes = true}}, + {HasSourceBlocks, {.preserves = true}}, + }; } void bind_config() override; diff --git a/opt/insert-source-blocks/InsertSourceBlocks.h b/opt/insert-source-blocks/InsertSourceBlocks.h index fcabc5d30c..229316c5be 100644 --- a/opt/insert-source-blocks/InsertSourceBlocks.h +++ b/opt/insert-source-blocks/InsertSourceBlocks.h @@ -22,6 +22,12 @@ class InsertSourceBlocksPass : public Pass { public: InsertSourceBlocksPass() : Pass("InsertSourceBlocksPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.establishes = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/instrument/Instrument.h b/opt/instrument/Instrument.h index 42dd5941cc..58cba2cefb 100644 --- a/opt/instrument/Instrument.h +++ b/opt/instrument/Instrument.h @@ -31,6 +31,12 @@ class InstrumentPass : public Pass { public: InstrumentPass() : Pass("InstrumentPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.requires_ = true, .preserves = false}}}; + } + void bind_config() override; void eval_pass(DexStoresVector& stores, ConfigFiles& conf, diff --git a/opt/interdex/InterDexPass.h b/opt/interdex/InterDexPass.h index 1ef631518b..08f1560973 100644 --- a/opt/interdex/InterDexPass.h +++ b/opt/interdex/InterDexPass.h @@ -55,6 +55,7 @@ class InterDexPass : public Pass { public: explicit InterDexPass(bool register_plugins = true) : Pass(INTERDEX_PASS_NAME) { + if (register_plugins) { std::unique_ptr plugin = std::make_unique(); @@ -63,6 +64,12 @@ class InterDexPass : public Pass { } } + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void eval_pass(DexStoresVector& stores, diff --git a/opt/interdex/InterDexReshufflePass.h b/opt/interdex/InterDexReshufflePass.h index 1ebbca9d14..8c85600377 100644 --- a/opt/interdex/InterDexReshufflePass.h +++ b/opt/interdex/InterDexReshufflePass.h @@ -57,6 +57,12 @@ class InterDexReshufflePass : public Pass { }; explicit InterDexReshufflePass() : Pass("InterDexReshufflePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; void bind_config() override { diff --git a/opt/interdex/SortRemainingClassesPass.h b/opt/interdex/SortRemainingClassesPass.h index 46872fda2e..a6c28e04a7 100644 --- a/opt/interdex/SortRemainingClassesPass.h +++ b/opt/interdex/SortRemainingClassesPass.h @@ -13,6 +13,12 @@ class SortRemainingClassesPass : public Pass { public: explicit SortRemainingClassesPass() : Pass("SortRemainingClassesPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("enable_pass", false, m_enable_pass, "Whether to enable SortRemainingClassesPass."); diff --git a/opt/kotlin-lambda/KotlinObjectInliner.h b/opt/kotlin-lambda/KotlinObjectInliner.h index 97729c3316..1f58d71016 100644 --- a/opt/kotlin-lambda/KotlinObjectInliner.h +++ b/opt/kotlin-lambda/KotlinObjectInliner.h @@ -35,6 +35,13 @@ class KotlinObjectInliner : public Pass { "Do not inline these companion objects"); } KotlinObjectInliner() : Pass("KotlinObjectInlinerPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; bool is_editable_cfg_friendly() override { return true; } diff --git a/opt/kotlin-lambda/RewriteKotlinSingletonInstance.h b/opt/kotlin-lambda/RewriteKotlinSingletonInstance.h index 00168bef70..db443e1a62 100644 --- a/opt/kotlin-lambda/RewriteKotlinSingletonInstance.h +++ b/opt/kotlin-lambda/RewriteKotlinSingletonInstance.h @@ -38,5 +38,12 @@ class RewriteKotlinSingletonInstance : public Pass { public: RewriteKotlinSingletonInstance() : Pass("RewriteKotlinSingletonInstancePass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/layout-reachability/LayoutReachabilityPass.h b/opt/layout-reachability/LayoutReachabilityPass.h index 1d164279bd..2c2c1d6557 100644 --- a/opt/layout-reachability/LayoutReachabilityPass.h +++ b/opt/layout-reachability/LayoutReachabilityPass.h @@ -19,5 +19,11 @@ class LayoutReachabilityPass : Pass { public: LayoutReachabilityPass() : Pass("LayoutReachabilityPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/local-dce/LocalDcePass.h b/opt/local-dce/LocalDcePass.h index cff06696cf..23a8eecc69 100644 --- a/opt/local-dce/LocalDcePass.h +++ b/opt/local-dce/LocalDcePass.h @@ -17,7 +17,10 @@ class LocalDcePass : public Pass { redex_properties::PropertyInteractions get_property_interactions() const override { using namespace redex_properties::names; - return {{NoInitClassInstructions, {.preserves = true}}}; + return { + {NoInitClassInstructions, {.preserves = true}}, + {HasSourceBlocks, {.preserves = true}}, + }; } void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/make-public/MakePublicPass.h b/opt/make-public/MakePublicPass.h index 77414407f8..acb3359b4a 100644 --- a/opt/make-public/MakePublicPass.h +++ b/opt/make-public/MakePublicPass.h @@ -24,6 +24,7 @@ class MakePublicPass : public Pass { return { {NoInitClassInstructions, {.preserves = true}}, {NeedsEverythingPublic, {.preserves = false}}, + {HasSourceBlocks, {.preserves = true}}, }; } diff --git a/opt/merge_interface/MergeInterface.h b/opt/merge_interface/MergeInterface.h index c94e34411a..9cc8094037 100644 --- a/opt/merge_interface/MergeInterface.h +++ b/opt/merge_interface/MergeInterface.h @@ -22,6 +22,13 @@ class MergeInterfacePass : public Pass { public: MergeInterfacePass() : Pass("MergeInterfacePass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; struct Metric { diff --git a/opt/methodinline/BridgeSynthInlinePass.h b/opt/methodinline/BridgeSynthInlinePass.h index 36b8a440e5..da01020f0f 100644 --- a/opt/methodinline/BridgeSynthInlinePass.h +++ b/opt/methodinline/BridgeSynthInlinePass.h @@ -14,5 +14,11 @@ class BridgeSynthInlinePass : public Pass { public: BridgeSynthInlinePass() : Pass("BridgeSynthInlinePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/methodinline/IntraDexInlinePass.h b/opt/methodinline/IntraDexInlinePass.h index 91c8cea913..48e7cfcef3 100644 --- a/opt/methodinline/IntraDexInlinePass.h +++ b/opt/methodinline/IntraDexInlinePass.h @@ -14,5 +14,11 @@ class IntraDexInlinePass : public Pass { public: IntraDexInlinePass() : Pass("IntraDexInlinePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/methodinline/LocalMethodInlinePass.h b/opt/methodinline/LocalMethodInlinePass.h index a60eaa5ee5..e6c6d2eb8a 100644 --- a/opt/methodinline/LocalMethodInlinePass.h +++ b/opt/methodinline/LocalMethodInlinePass.h @@ -14,5 +14,11 @@ class LocalMethodInlinePass : public Pass { public: LocalMethodInlinePass() : Pass("LocalMethodInlinePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/methodinline/MethodInlinePass.h b/opt/methodinline/MethodInlinePass.h index 4eb51a9185..865ba10a5d 100644 --- a/opt/methodinline/MethodInlinePass.h +++ b/opt/methodinline/MethodInlinePass.h @@ -14,5 +14,11 @@ class MethodInlinePass : public Pass { public: MethodInlinePass() : Pass("MethodInlinePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/methodinline/PerfMethodInlinePass.h b/opt/methodinline/PerfMethodInlinePass.h index 71f97e50e6..2a29188880 100644 --- a/opt/methodinline/PerfMethodInlinePass.h +++ b/opt/methodinline/PerfMethodInlinePass.h @@ -13,6 +13,13 @@ class PerfMethodInlinePass : public Pass { public: PerfMethodInlinePass() : Pass("PerfMethodInlinePass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.requires_ = true, .preserves = true}}}; + } + ~PerfMethodInlinePass(); void bind_config() override; diff --git a/opt/nullcheck_conversion/IntrinsifyNullChecksPass.h b/opt/nullcheck_conversion/IntrinsifyNullChecksPass.h index 79cafc5476..98df380eb9 100644 --- a/opt/nullcheck_conversion/IntrinsifyNullChecksPass.h +++ b/opt/nullcheck_conversion/IntrinsifyNullChecksPass.h @@ -52,6 +52,13 @@ class IntrinsifyNullChecksPass : public Pass { }; explicit IntrinsifyNullChecksPass() : Pass("IntrinsifyNullChecksPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; bool is_editable_cfg_friendly() override { return true; } Stats convert_getClass(DexMethod* method); diff --git a/opt/nullcheck_conversion/MaterializeNullChecksPass.h b/opt/nullcheck_conversion/MaterializeNullChecksPass.h index 250a487ed5..d59b642f5f 100644 --- a/opt/nullcheck_conversion/MaterializeNullChecksPass.h +++ b/opt/nullcheck_conversion/MaterializeNullChecksPass.h @@ -36,6 +36,13 @@ class MaterializeNullChecksPass : public Pass { }; explicit MaterializeNullChecksPass() : Pass("MaterializeNullChecksPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; bool is_editable_cfg_friendly() override { return true; } Stats rewrite_null_check(DexMethod* method); diff --git a/opt/obfuscate/Obfuscate.h b/opt/obfuscate/Obfuscate.h index 0ca0078329..337b0d26a9 100644 --- a/opt/obfuscate/Obfuscate.h +++ b/opt/obfuscate/Obfuscate.h @@ -13,6 +13,12 @@ class ObfuscatePass : public Pass { public: ObfuscatePass() : Pass("ObfuscatePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; void bind_config() final { trait(Traits::Pass::unique, true); } diff --git a/opt/obfuscate_resources/ObfuscateResourcesPass.h b/opt/obfuscate_resources/ObfuscateResourcesPass.h index 262a607e60..1010f3eb3d 100644 --- a/opt/obfuscate_resources/ObfuscateResourcesPass.h +++ b/opt/obfuscate_resources/ObfuscateResourcesPass.h @@ -33,7 +33,10 @@ class ObfuscateResourcesPass : public Pass { redex_properties::PropertyInteractions get_property_interactions() const override { using namespace redex_properties::names; - return {{NoInitClassInstructions, {.preserves = true}}}; + return { + {NoInitClassInstructions, {.preserves = true}}, + {HasSourceBlocks, {.preserves = true}}, + }; } void bind_config() override { diff --git a/opt/object-escape-analysis/ObjectEscapeAnalysis.h b/opt/object-escape-analysis/ObjectEscapeAnalysis.h index 337f4fbde8..70386e9655 100644 --- a/opt/object-escape-analysis/ObjectEscapeAnalysis.h +++ b/opt/object-escape-analysis/ObjectEscapeAnalysis.h @@ -13,6 +13,12 @@ class ObjectEscapeAnalysisPass : public Pass { public: ObjectEscapeAnalysisPass() : Pass("ObjectEscapeAnalysisPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/object-sensitive-dce/ObjectSensitiveDcePass.h b/opt/object-sensitive-dce/ObjectSensitiveDcePass.h index da63ebe35b..55e1ce01b4 100644 --- a/opt/object-sensitive-dce/ObjectSensitiveDcePass.h +++ b/opt/object-sensitive-dce/ObjectSensitiveDcePass.h @@ -20,6 +20,12 @@ class ObjectSensitiveDcePass final : public Pass { public: ObjectSensitiveDcePass() : Pass("ObjectSensitiveDcePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("side_effect_summaries", {boost::none}, m_external_side_effect_summaries_file, "TODO: Document me!", diff --git a/opt/optimize_enums/OptimizeEnums.h b/opt/optimize_enums/OptimizeEnums.h index fdb3fc7c07..de02b49945 100644 --- a/opt/optimize_enums/OptimizeEnums.h +++ b/opt/optimize_enums/OptimizeEnums.h @@ -16,6 +16,12 @@ class OptimizeEnumsPass : public Pass { public: OptimizeEnumsPass() : Pass("OptimizeEnumsPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/optimize_resources/OptimizeResources.h b/opt/optimize_resources/OptimizeResources.h index 6e4c79fdab..0495a52178 100644 --- a/opt/optimize_resources/OptimizeResources.h +++ b/opt/optimize_resources/OptimizeResources.h @@ -112,6 +112,13 @@ struct ReachableResourcesPluginRegistry { class OptimizeResourcesPass : public Pass { public: OptimizeResourcesPass() : Pass("OptimizeResourcesPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + explicit OptimizeResourcesPass(const std::string& name) : Pass(name) {} void bind_config() override { diff --git a/opt/original_name/OriginalNamePass.h b/opt/original_name/OriginalNamePass.h index 1a400a0d48..0bf1bc8ad6 100644 --- a/opt/original_name/OriginalNamePass.h +++ b/opt/original_name/OriginalNamePass.h @@ -14,6 +14,12 @@ class OriginalNamePass : public Pass { public: OriginalNamePass() : Pass("OriginalNamePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("hierarchy_roots", {}, m_hierarchy_roots); trait(Traits::Pass::unique, true); diff --git a/opt/outliner/InstructionSequenceOutliner.h b/opt/outliner/InstructionSequenceOutliner.h index e3065b31e5..9f265c63f1 100644 --- a/opt/outliner/InstructionSequenceOutliner.h +++ b/opt/outliner/InstructionSequenceOutliner.h @@ -33,6 +33,12 @@ class InstructionSequenceOutliner : public Pass { public: InstructionSequenceOutliner() : Pass("InstructionSequenceOutlinerPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.requires_ = true, .preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector& stores, ConfigFiles& config, diff --git a/opt/partial-application/PartialApplication.h b/opt/partial-application/PartialApplication.h index 82ca21782e..42b77c8548 100644 --- a/opt/partial-application/PartialApplication.h +++ b/opt/partial-application/PartialApplication.h @@ -14,6 +14,12 @@ class PartialApplicationPass : public Pass { public: PartialApplicationPass() : Pass("PartialApplicationPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/peephole/Peephole.h b/opt/peephole/Peephole.h index 7fc5f5b1af..70718523fe 100644 --- a/opt/peephole/Peephole.h +++ b/opt/peephole/Peephole.h @@ -14,6 +14,12 @@ class PeepholePass : public Pass { public: PeepholePass() : Pass("PeepholePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; void bind_config() override { diff --git a/opt/print-kotlin-stats/PrintKotlinStats.h b/opt/print-kotlin-stats/PrintKotlinStats.h index 3e2a5cec2f..4f79fca8d1 100644 --- a/opt/print-kotlin-stats/PrintKotlinStats.h +++ b/opt/print-kotlin-stats/PrintKotlinStats.h @@ -56,6 +56,13 @@ class PrintKotlinStats : public Pass { }; PrintKotlinStats() : Pass("PrintKotlinStatsPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void setup(); void eval_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/print-members/PrintMembers.h b/opt/print-members/PrintMembers.h index 10b9a488cd..e9485aef1a 100644 --- a/opt/print-members/PrintMembers.h +++ b/opt/print-members/PrintMembers.h @@ -15,6 +15,12 @@ class PrintMembersPass : public Pass { public: PrintMembersPass() : Pass("PrintMembersPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("show_code", false, m_config.show_code); bind("show_sfields", true, m_config.show_sfields); diff --git a/opt/reachable-natives/ReachableNatives.h b/opt/reachable-natives/ReachableNatives.h index 0ae3addc6c..e87f35fec3 100644 --- a/opt/reachable-natives/ReachableNatives.h +++ b/opt/reachable-natives/ReachableNatives.h @@ -39,6 +39,12 @@ class ReachableNativesPass : public Pass { public: ReachableNativesPass() : Pass("ReachableNativesPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/reduce-array-literals/ReduceArrayLiterals.h b/opt/reduce-array-literals/ReduceArrayLiterals.h index 110304bc0b..581ccec7ce 100644 --- a/opt/reduce-array-literals/ReduceArrayLiterals.h +++ b/opt/reduce-array-literals/ReduceArrayLiterals.h @@ -72,6 +72,12 @@ class ReduceArrayLiteralsPass : public Pass { public: ReduceArrayLiteralsPass() : Pass("ReduceArrayLiteralsPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/reduce-boolean-branches/ReduceBooleanBranchesPass.h b/opt/reduce-boolean-branches/ReduceBooleanBranchesPass.h index 43222f90c4..5124581d7a 100644 --- a/opt/reduce-boolean-branches/ReduceBooleanBranchesPass.h +++ b/opt/reduce-boolean-branches/ReduceBooleanBranchesPass.h @@ -13,6 +13,13 @@ class ReduceBooleanBranchesPass : public Pass { public: ReduceBooleanBranchesPass() : Pass("ReduceBooleanBranchesPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; private: diff --git a/opt/reduce-gotos/ReduceGotos.h b/opt/reduce-gotos/ReduceGotos.h index f774d71e95..515389e01e 100644 --- a/opt/reduce-gotos/ReduceGotos.h +++ b/opt/reduce-gotos/ReduceGotos.h @@ -37,7 +37,10 @@ class ReduceGotosPass : public Pass { redex_properties::PropertyInteractions get_property_interactions() const override { using namespace redex_properties::names; - return {{NoInitClassInstructions, {.preserves = true}}}; + return { + {NoInitClassInstructions, {.preserves = true}}, + {HasSourceBlocks, {.preserves = true}}, + }; } void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/regalloc-fast/FastRegAlloc.h b/opt/regalloc-fast/FastRegAlloc.h index 4d2c1e854d..b81ae59ea9 100644 --- a/opt/regalloc-fast/FastRegAlloc.h +++ b/opt/regalloc-fast/FastRegAlloc.h @@ -20,6 +20,12 @@ class FastRegAllocPass : public Pass { public: FastRegAllocPass() : Pass("FastRegAllocPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void eval_pass(DexStoresVector& stores, ConfigFiles& conf, PassManager& mgr) override; diff --git a/opt/regalloc/RegAlloc.h b/opt/regalloc/RegAlloc.h index 6a3549b14f..652c47726f 100644 --- a/opt/regalloc/RegAlloc.h +++ b/opt/regalloc/RegAlloc.h @@ -21,7 +21,10 @@ class RegAllocPass : public Pass { redex_properties::PropertyInteractions get_property_interactions() const override { using namespace redex_properties::names; - return {{NoInitClassInstructions, {.preserves = true}}}; + return { + {NoInitClassInstructions, {.preserves = true}}, + {HasSourceBlocks, {.preserves = true}}, + }; } void bind_config() override { diff --git a/opt/remove-apilevel-checks/RemoveApiLevelChecks.h b/opt/remove-apilevel-checks/RemoveApiLevelChecks.h index 469ee45683..21eb374b36 100644 --- a/opt/remove-apilevel-checks/RemoveApiLevelChecks.h +++ b/opt/remove-apilevel-checks/RemoveApiLevelChecks.h @@ -18,6 +18,12 @@ class RemoveApiLevelChecksPass : public Pass { public: RemoveApiLevelChecksPass() : Pass("RemoveApiLevelChecksPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; private: diff --git a/opt/remove-builders/RemoveBuilders.h b/opt/remove-builders/RemoveBuilders.h index 4f5be14cc0..14237267e0 100644 --- a/opt/remove-builders/RemoveBuilders.h +++ b/opt/remove-builders/RemoveBuilders.h @@ -13,6 +13,12 @@ class RemoveBuildersPass : public Pass { public: RemoveBuildersPass() : Pass("RemoveBuildersPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("enable_buildee_constr_change", false, m_enable_buildee_constr_change); bind("blocklist", {}, m_blocklist); diff --git a/opt/remove-interfaces/RemoveInterfacePass.h b/opt/remove-interfaces/RemoveInterfacePass.h index 1e4def769a..2ec743c333 100644 --- a/opt/remove-interfaces/RemoveInterfacePass.h +++ b/opt/remove-interfaces/RemoveInterfacePass.h @@ -35,6 +35,12 @@ class RemoveInterfacePass : public Pass { public: RemoveInterfacePass() : Pass("RemoveInterfacePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/remove-nullcheck-string-arg/RemoveNullcheckStringArg.h b/opt/remove-nullcheck-string-arg/RemoveNullcheckStringArg.h index 644b6ffe35..a503b6394b 100644 --- a/opt/remove-nullcheck-string-arg/RemoveNullcheckStringArg.h +++ b/opt/remove-nullcheck-string-arg/RemoveNullcheckStringArg.h @@ -76,6 +76,13 @@ class RemoveNullcheckStringArg : public Pass { }; RemoveNullcheckStringArg() : Pass("RemoveNullcheckStringArgPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + bool setup(TransferMapForParam& transfer_map_param, TransferMapForExpr& transfer_map_expr, NewMethodSet& new_methods); diff --git a/opt/remove-recursive-locks/RemoveRecursiveLocks.h b/opt/remove-recursive-locks/RemoveRecursiveLocks.h index e6166fb1ad..ad43abc2d9 100644 --- a/opt/remove-recursive-locks/RemoveRecursiveLocks.h +++ b/opt/remove-recursive-locks/RemoveRecursiveLocks.h @@ -17,6 +17,12 @@ class RemoveRecursiveLocksPass : public Pass { public: RemoveRecursiveLocksPass() : Pass("RemoveRecursiveLocksPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; // For testing, only. As long as the run will not fail, it is permissible diff --git a/opt/remove-uninstantiables/RemoveUninstantiablesPass.h b/opt/remove-uninstantiables/RemoveUninstantiablesPass.h index d41950ba40..118e603dc9 100644 --- a/opt/remove-uninstantiables/RemoveUninstantiablesPass.h +++ b/opt/remove-uninstantiables/RemoveUninstantiablesPass.h @@ -35,6 +35,12 @@ class RemoveUninstantiablesPass : public Pass { public: RemoveUninstantiablesPass() : Pass("RemoveUninstantiablesPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + /// Counts of references to uninstantiable classes removed. struct Stats { int instance_ofs = 0; diff --git a/opt/remove-unreachable/RemoveUnreachable.h b/opt/remove-unreachable/RemoveUnreachable.h index a7484ccf58..bdc9adfd50 100644 --- a/opt/remove-unreachable/RemoveUnreachable.h +++ b/opt/remove-unreachable/RemoveUnreachable.h @@ -14,6 +14,12 @@ class RemoveUnreachablePassBase : public Pass { public: explicit RemoveUnreachablePassBase(const std::string& name) : Pass(name) {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("ignore_string_literals", {}, m_ignore_sets.string_literals); bind("ignore_string_literal_annos", {}, m_ignore_sets.string_literal_annos); diff --git a/opt/remove-unused-args/RemoveUnusedArgs.h b/opt/remove-unused-args/RemoveUnusedArgs.h index 26b71177b2..dd29c42a27 100644 --- a/opt/remove-unused-args/RemoveUnusedArgs.h +++ b/opt/remove-unused-args/RemoveUnusedArgs.h @@ -92,6 +92,12 @@ class RemoveUnusedArgsPass : public Pass { public: RemoveUnusedArgsPass() : Pass("RemoveUnusedArgsPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("blocklist", {}, m_blocklist); } void run_pass(DexStoresVector&, ConfigFiles&, PassManager& mgr) override; diff --git a/opt/remove-unused-fields/RemoveUnusedFields.h b/opt/remove-unused-fields/RemoveUnusedFields.h index d1d08ea458..edde798d4d 100644 --- a/opt/remove-unused-fields/RemoveUnusedFields.h +++ b/opt/remove-unused-fields/RemoveUnusedFields.h @@ -43,6 +43,12 @@ class PassImpl : public Pass { public: PassImpl() : Pass("RemoveUnusedFieldsPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("remove_unread_fields", true, m_config.remove_unread_fields); bind("remove_unwritten_fields", true, m_config.remove_unwritten_fields); diff --git a/opt/remove_empty_classes/RemoveEmptyClasses.h b/opt/remove_empty_classes/RemoveEmptyClasses.h index e29fc54d84..8168102dff 100644 --- a/opt/remove_empty_classes/RemoveEmptyClasses.h +++ b/opt/remove_empty_classes/RemoveEmptyClasses.h @@ -13,5 +13,11 @@ class RemoveEmptyClassesPass : public Pass { public: RemoveEmptyClassesPass() : Pass("RemoveEmptyClassesPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/remove_redundant_check_casts/RemoveRedundantCheckCasts.h b/opt/remove_redundant_check_casts/RemoveRedundantCheckCasts.h index 8e6c231388..e14a45db18 100644 --- a/opt/remove_redundant_check_casts/RemoveRedundantCheckCasts.h +++ b/opt/remove_redundant_check_casts/RemoveRedundantCheckCasts.h @@ -16,6 +16,12 @@ class RemoveRedundantCheckCastsPass : public Pass { public: RemoveRedundantCheckCastsPass() : Pass("RemoveRedundantCheckCastsPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/renameclasses/RenameClassesV2.h b/opt/renameclasses/RenameClassesV2.h index d411c98174..07953852ab 100644 --- a/opt/renameclasses/RenameClassesV2.h +++ b/opt/renameclasses/RenameClassesV2.h @@ -41,6 +41,12 @@ class RenameClassesPassV2 : public Pass { public: RenameClassesPassV2() : Pass("RenameClassesPassV2") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("rename_annotations", false, m_rename_annotations); bind("force_rename_hierarchies", {}, m_force_rename_hierarchies); diff --git a/opt/reorder-interfaces-decl/ReorderInterfacesDecl.h b/opt/reorder-interfaces-decl/ReorderInterfacesDecl.h index f490029945..1c349bafec 100644 --- a/opt/reorder-interfaces-decl/ReorderInterfacesDecl.h +++ b/opt/reorder-interfaces-decl/ReorderInterfacesDecl.h @@ -13,5 +13,11 @@ class ReorderInterfacesDeclPass : public Pass { public: ReorderInterfacesDeclPass() : Pass("ReorderInterfacesDeclPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/resolve-proguard-values/ResolveProguardAssumeValues.h b/opt/resolve-proguard-values/ResolveProguardAssumeValues.h index d5ed506d12..47c72537ff 100644 --- a/opt/resolve-proguard-values/ResolveProguardAssumeValues.h +++ b/opt/resolve-proguard-values/ResolveProguardAssumeValues.h @@ -53,6 +53,13 @@ class ResolveProguardAssumeValuesPass : public Pass { // } // ResolveProguardAssumeValuesPass() : Pass("ResolveProguardAssumeValuesPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + static ResolveProguardAssumeValuesPass::Stats process_for_code(IRCode* code); void run_pass(DexStoresVector& stores, ConfigFiles&, diff --git a/opt/resolve-refs/ExternalRefsManglingPass.h b/opt/resolve-refs/ExternalRefsManglingPass.h index 41047139c5..f57f26120b 100644 --- a/opt/resolve-refs/ExternalRefsManglingPass.h +++ b/opt/resolve-refs/ExternalRefsManglingPass.h @@ -21,6 +21,12 @@ class ExternalRefsManglingPass : public Pass { public: explicit ExternalRefsManglingPass(const std::string& name) : Pass(name) {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("refine_to_external", true, m_refine_to_external, "Allowing resolving method ref to an external one"); diff --git a/opt/result-propagation/ResultPropagation.h b/opt/result-propagation/ResultPropagation.h index 2399322c48..cf5444fb88 100644 --- a/opt/result-propagation/ResultPropagation.h +++ b/opt/result-propagation/ResultPropagation.h @@ -145,6 +145,12 @@ class ResultPropagationPass : public Pass { public: ResultPropagationPass() : Pass("ResultPropagationPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + bool is_editable_cfg_friendly() override { return true; } void bind_config() override { diff --git a/opt/shorten-srcstrings/Shorten.h b/opt/shorten-srcstrings/Shorten.h index 7fd6307622..e9535efbca 100644 --- a/opt/shorten-srcstrings/Shorten.h +++ b/opt/shorten-srcstrings/Shorten.h @@ -13,6 +13,12 @@ class ShortenSrcStringsPass : public Pass { public: ShortenSrcStringsPass() : Pass("ShortenSrcStringsPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("filename_mappings", "redex-src-strings-map.txt", m_filename_mappings); trait(Traits::Pass::unique, true); diff --git a/opt/shrinker/ShrinkerPass.h b/opt/shrinker/ShrinkerPass.h index e746e19fd9..33c8f44c7c 100644 --- a/opt/shrinker/ShrinkerPass.h +++ b/opt/shrinker/ShrinkerPass.h @@ -14,6 +14,12 @@ class ShrinkerPass : public Pass { public: ShrinkerPass() : Pass("ShrinkerPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/singleimpl/SingleImpl.h b/opt/singleimpl/SingleImpl.h index 9786862586..6959a4e4cd 100644 --- a/opt/singleimpl/SingleImpl.h +++ b/opt/singleimpl/SingleImpl.h @@ -26,6 +26,12 @@ class SingleImplPass : public Pass { public: SingleImplPass() : Pass("SingleImplPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("allowlist", {}, m_pass_config.allowlist); bind("package_allowlist", {}, m_pass_config.package_allowlist); diff --git a/opt/split_huge_switches/SplitHugeSwitchPass.h b/opt/split_huge_switches/SplitHugeSwitchPass.h index 2ab6be7718..53bacf2fe1 100644 --- a/opt/split_huge_switches/SplitHugeSwitchPass.h +++ b/opt/split_huge_switches/SplitHugeSwitchPass.h @@ -45,6 +45,12 @@ class SplitHugeSwitchPass : public Pass { SplitHugeSwitchPass() : Pass("SplitHugeSwitchPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/split_resource_tables/SplitResourceTables.h b/opt/split_resource_tables/SplitResourceTables.h index 648c1219fb..5630f2d37f 100644 --- a/opt/split_resource_tables/SplitResourceTables.h +++ b/opt/split_resource_tables/SplitResourceTables.h @@ -83,6 +83,12 @@ class SplitResourceTablesPass : public Pass { public: SplitResourceTablesPass() : Pass("SplitResourceTablesPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("allowed_types", {}, m_allowed_types); bind("static_ids", "", m_static_ids_file_path); diff --git a/opt/staticrelo/StaticReloV2.h b/opt/staticrelo/StaticReloV2.h index 26b80c5a22..1a5f0dd556 100644 --- a/opt/staticrelo/StaticReloV2.h +++ b/opt/staticrelo/StaticReloV2.h @@ -14,6 +14,13 @@ namespace static_relo_v2 { class StaticReloPassV2 : public Pass { public: StaticReloPassV2() : Pass("StaticReloPassV2") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + static std::vector gen_candidates(const Scope&); static int run_relocation(const Scope&, std::vector&); void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/string_concatenator/StringConcatenator.h b/opt/string_concatenator/StringConcatenator.h index 5005e115e8..5d63cea6eb 100644 --- a/opt/string_concatenator/StringConcatenator.h +++ b/opt/string_concatenator/StringConcatenator.h @@ -13,5 +13,11 @@ class StringConcatenatorPass : public Pass { public: StringConcatenatorPass() : Pass("StringConcatenatorPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/stringbuilder-outliner/StringBuilderOutliner.h b/opt/stringbuilder-outliner/StringBuilderOutliner.h index e4669814d5..7d2b041376 100644 --- a/opt/stringbuilder-outliner/StringBuilderOutliner.h +++ b/opt/stringbuilder-outliner/StringBuilderOutliner.h @@ -262,6 +262,12 @@ class StringBuilderOutlinerPass : public Pass { public: StringBuilderOutlinerPass() : Pass("StringBuilderOutlinerPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("max_outline_length", m_config.max_outline_length, m_config.max_outline_length); diff --git a/opt/strip-debug-info/StripDebugInfo.h b/opt/strip-debug-info/StripDebugInfo.h index fdb7631857..3709aff3c2 100644 --- a/opt/strip-debug-info/StripDebugInfo.h +++ b/opt/strip-debug-info/StripDebugInfo.h @@ -15,6 +15,12 @@ class StripDebugInfoPass : public Pass { public: StripDebugInfoPass() : Pass("StripDebugInfoPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("drop_all_dbg_info", false, m_config.drop_all_dbg_info); bind("drop_local_variables", true, m_config.drop_local_variables); diff --git a/opt/test_cfg/TestCFG.h b/opt/test_cfg/TestCFG.h index e8ddf303eb..93dd67bbe5 100644 --- a/opt/test_cfg/TestCFG.h +++ b/opt/test_cfg/TestCFG.h @@ -13,5 +13,11 @@ class TestCFGPass : public Pass { public: TestCFGPass() : Pass("TestCFGPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/throw-propagation/ThrowPropagationPass.h b/opt/throw-propagation/ThrowPropagationPass.h index 31fa4e0b71..0bd9e1c435 100644 --- a/opt/throw-propagation/ThrowPropagationPass.h +++ b/opt/throw-propagation/ThrowPropagationPass.h @@ -33,6 +33,12 @@ class ThrowPropagationPass : public Pass { public: ThrowPropagationPass() : Pass("ThrowPropagationPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override; static std::unordered_set get_no_return_methods( diff --git a/opt/track_resources/TrackResources.h b/opt/track_resources/TrackResources.h index e725353560..9467ee3171 100644 --- a/opt/track_resources/TrackResources.h +++ b/opt/track_resources/TrackResources.h @@ -15,6 +15,12 @@ class TrackResourcesPass : public Pass { public: TrackResourcesPass() : Pass("TrackResourcesPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("classes_to_track", {}, m_classes_to_track); } diff --git a/opt/type-analysis/GlobalTypeAnalysisPass.h b/opt/type-analysis/GlobalTypeAnalysisPass.h index f780dbe2e8..deab21e85c 100644 --- a/opt/type-analysis/GlobalTypeAnalysisPass.h +++ b/opt/type-analysis/GlobalTypeAnalysisPass.h @@ -48,6 +48,12 @@ class GlobalTypeAnalysisPass : public Pass { explicit GlobalTypeAnalysisPass(Config config) : Pass("GlobalTypeAnalysisPass", Pass::ANALYSIS), m_config(config) {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + GlobalTypeAnalysisPass() : GlobalTypeAnalysisPass(Config()) {} void bind_config() override { diff --git a/opt/type-analysis/TypeAnalysisCallGraphGenerationPass.h b/opt/type-analysis/TypeAnalysisCallGraphGenerationPass.h index 9b5041a33b..11b0ab07bf 100644 --- a/opt/type-analysis/TypeAnalysisCallGraphGenerationPass.h +++ b/opt/type-analysis/TypeAnalysisCallGraphGenerationPass.h @@ -27,6 +27,12 @@ class TypeAnalysisCallGraphGenerationPass : public Pass { : Pass("TypeAnalysisCallGraphGenerationPass", Pass::ANALYSIS), m_config(config) {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + TypeAnalysisCallGraphGenerationPass() : TypeAnalysisCallGraphGenerationPass(Config()) {} diff --git a/opt/unreferenced_interfaces/UnreferencedInterfaces.h b/opt/unreferenced_interfaces/UnreferencedInterfaces.h index 4b097197d6..62bb3500b4 100644 --- a/opt/unreferenced_interfaces/UnreferencedInterfaces.h +++ b/opt/unreferenced_interfaces/UnreferencedInterfaces.h @@ -19,6 +19,12 @@ class UnreferencedInterfacesPass : public Pass { public: UnreferencedInterfacesPass() : Pass("UnreferencedInterfacesPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; struct Metric { diff --git a/opt/up-code-motion/UpCodeMotion.h b/opt/up-code-motion/UpCodeMotion.h index 54dbf96400..d015c83781 100644 --- a/opt/up-code-motion/UpCodeMotion.h +++ b/opt/up-code-motion/UpCodeMotion.h @@ -32,6 +32,12 @@ class UpCodeMotionPass : public Pass { UpCodeMotionPass() : Pass("UpCodeMotionPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.requires_ = true, .preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; void bind_config() override { bind("check_branch_hotness", diff --git a/opt/uses-names/UsesNames.h b/opt/uses-names/UsesNames.h index 86e32fa26a..bdaa26d3e5 100644 --- a/opt/uses-names/UsesNames.h +++ b/opt/uses-names/UsesNames.h @@ -23,6 +23,12 @@ class ProcessUsesNamesAnnoPass : public Pass { ProcessUsesNamesAnnoPass() : Pass("ProcessUsesNamesAnnoPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("uses_names_annotation", DexType::get_type("Lcom/facebook/redex/annotations/UsesNames;"), diff --git a/opt/verifier/Verifier.h b/opt/verifier/Verifier.h index 275d4737bd..66aaa2953e 100644 --- a/opt/verifier/Verifier.h +++ b/opt/verifier/Verifier.h @@ -13,5 +13,11 @@ class VerifierPass : public Pass { public: VerifierPass() : Pass("VerifierPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; }; diff --git a/opt/vertical_merging/VerticalMerging.h b/opt/vertical_merging/VerticalMerging.h index 55c785d3eb..238d6b14de 100644 --- a/opt/vertical_merging/VerticalMerging.h +++ b/opt/vertical_merging/VerticalMerging.h @@ -25,6 +25,13 @@ class VerticalMergingPass : public Pass { public: VerticalMergingPass() : Pass("VerticalMergingPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("blocklist", {}, m_blocklist); } void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/virtual_merging/VirtualMerging.h b/opt/virtual_merging/VirtualMerging.h index 59bfcfca75..dc73b2b2f3 100644 --- a/opt/virtual_merging/VirtualMerging.h +++ b/opt/virtual_merging/VirtualMerging.h @@ -178,6 +178,12 @@ class VirtualMergingPass : public Pass { public: VirtualMergingPass() : Pass("VirtualMergingPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.requires_ = true, .preserves = true}}}; + } + void bind_config() override; void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override; diff --git a/opt/virtual_scope/MethodDevirtualizationPass.h b/opt/virtual_scope/MethodDevirtualizationPass.h index 34e866c0c4..9d76da9d5c 100644 --- a/opt/virtual_scope/MethodDevirtualizationPass.h +++ b/opt/virtual_scope/MethodDevirtualizationPass.h @@ -13,6 +13,12 @@ class MethodDevirtualizationPass : public Pass { public: MethodDevirtualizationPass() : Pass("MethodDevirtualizationPass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void bind_config() override { bind("staticize_vmethods_not_using_this", true, diff --git a/test/integ/MaxDepthAnalysisTest.cpp b/test/integ/MaxDepthAnalysisTest.cpp index 483ae68b5b..b8bb2b9148 100644 --- a/test/integ/MaxDepthAnalysisTest.cpp +++ b/test/integ/MaxDepthAnalysisTest.cpp @@ -19,6 +19,13 @@ class AnalysisConsumerPass : public Pass { public: AnalysisConsumerPass() : Pass("AnalysisConsumerPass") {} + + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void set_analysis_usage(AnalysisUsage& au) const override { au.add_required(); au.set_preserve_all(); diff --git a/test/unit/AnalysisUsageTest.cpp b/test/unit/AnalysisUsageTest.cpp index 4c9a0a31ae..c6ed4d07fa 100644 --- a/test/unit/AnalysisUsageTest.cpp +++ b/test/unit/AnalysisUsageTest.cpp @@ -37,6 +37,12 @@ class MyAnalysisPass : public Pass { MyAnalysisPass() : Pass("MyAnalysisPass", Pass::ANALYSIS) {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector& /* stores */, ConfigFiles& /* conf */, PassManager& /* mgr */) override { @@ -59,6 +65,12 @@ class MyAnalysisPass2 : public Pass { MyAnalysisPass2() : Pass("MyAnalysisPass2", Pass::ANALYSIS) {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void run_pass(DexStoresVector& /* stores */, ConfigFiles& /* conf */, PassManager& /* mgr */) override { @@ -80,6 +92,12 @@ class ConsumeAnalysisAndInvalidatePass : public Pass { ConsumeAnalysisAndInvalidatePass() : Pass("ConsumeAnalysisAndInvalidatePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void set_analysis_usage(AnalysisUsage& au) const override { au.add_required(); } @@ -98,6 +116,12 @@ class ConsumeAnalysisAndPreservePass : public Pass { public: ConsumeAnalysisAndPreservePass() : Pass("ConsumeAnalysisAndPreservePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void set_analysis_usage(AnalysisUsage& au) const override { au.add_required(); au.set_preserve_all(); @@ -118,6 +142,12 @@ class ConsumeAnalysisAndPreserveOnePass : public Pass { ConsumeAnalysisAndPreserveOnePass() : Pass("ConsumeAnalysisAndPreserveOnePass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void set_analysis_usage(AnalysisUsage& au) const override { au.add_required(); au.add_preserve_specific(); @@ -137,6 +167,12 @@ class ConsumeAnalysis2Pass : public Pass { public: ConsumeAnalysis2Pass() : Pass("ConsumeAnalysis2Pass") {} + redex_properties::PropertyInteractions get_property_interactions() + const override { + using namespace redex_properties::names; + return {{HasSourceBlocks, {.preserves = true}}}; + } + void set_analysis_usage(AnalysisUsage& au) const override { au.add_required(); }