From b0965fa2a5c703214f60a6c5af01f6ddf21e6f42 Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Sat, 3 May 2025 07:42:51 -0700 Subject: [SharedCache] Add activities to core.function.metaAnalysis rather than a new named workflow Activities are registered with a `viewType` predicate to ensure they only run in shared cache views. Adding activities to `core.function.metaAnalysis` lets activities registered by plug-ins run in the shared cache without the plug-ins having to be aware of the shared cache. Work towards #6779. --- view/sharedcache/workflow/SharedCacheWorkflow.cpp | 25 +++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'view/sharedcache/workflow/SharedCacheWorkflow.cpp') diff --git a/view/sharedcache/workflow/SharedCacheWorkflow.cpp b/view/sharedcache/workflow/SharedCacheWorkflow.cpp index dcccfe74..71160e44 100644 --- a/view/sharedcache/workflow/SharedCacheWorkflow.cpp +++ b/view/sharedcache/workflow/SharedCacheWorkflow.cpp @@ -365,21 +365,28 @@ void AnalyzeFunction(Ref ctx) void SharedCacheWorkflow::Register() { - Ref workflow = Workflow::Instance("core.function.baseAnalysis")->Clone("core.function.sharedCache"); + Ref workflow = Workflow::Instance("core.function.metaAnalysis")->Clone("core.function.metaAnalysis"); // Register and insert activities here. ObjCActivity::Register(*workflow); - workflow->RegisterActivity(new Activity("core.analysis.sharedCache.analysis", &AnalyzeFunction)); + workflow->RegisterActivity(new Activity(R"({ + "name": "core.analysis.sharedCache.analysis", + "eligibility": { + "predicates": [ + { + "type": "viewType", + "operator": "in", + "value": [ + "DSCView" + ] + } + ] + } + })", &AnalyzeFunction)); std::vector inserted = { "core.analysis.sharedCache.analysis" }; workflow->Insert("core.function.analyzeTailCalls", inserted); - static constexpr auto WORKFLOW_DESCRIPTION = R"({ - "title": "Shared Cache Workflow", - "description": "Shared Cache Workflow", - "capabilities": [] - })"; - - Workflow::RegisterWorkflow(workflow, WORKFLOW_DESCRIPTION); + Workflow::RegisterWorkflow(workflow); } extern "C" -- cgit v1.3.1