mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
31 lines
988 B
C++
31 lines
988 B
C++
#include "revng/AutoEnforcer/AutoEnforcer.h"
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
using namespace std;
|
|
using namespace llvm;
|
|
using namespace AutoEnforcer;
|
|
|
|
using InvalidationMap = StringMap<BackingContainersStatus>;
|
|
Expected<InvalidationMap>
|
|
PipelineRunner::getInvalidations(const AutoEnforcerTarget &Target) const {
|
|
llvm::StringMap<BackingContainersStatus> Invalidations;
|
|
for (const auto &Step : Pipeline)
|
|
for (const auto &Container : Step.getBackingContainers())
|
|
if (Container.second->contains(Target))
|
|
Invalidations[Step.getName()].add(Container.first(), Target);
|
|
if (auto Error = deduceInvalidations(Invalidations); Error)
|
|
return move(Error);
|
|
|
|
return move(Invalidations);
|
|
}
|
|
|
|
Error PipelineRunner::invalidate(const AutoEnforcerTarget &Target) {
|
|
auto Invalidations = getInvalidations(Target);
|
|
if (not Invalidations)
|
|
return Invalidations.takeError();
|
|
return Pipeline.invalidate(*Invalidations);
|
|
}
|