Files
revng-revng/lib/Pipes/ApplyDiffAnalysis.cpp
Ivan Krysak 7d235f4fd0 Enforce licence header consistency
Also do some basic cleanup: capitalize first letters, add `.`
at the end of the sentences, and so on.
2023-07-03 15:23:10 +00:00

37 lines
942 B
C++

/// \file ApplyDiffAnalysis.cpp
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "llvm/Support/Error.h"
#include "revng/Pipeline/Context.h"
#include "revng/Pipeline/RegisterAnalysis.h"
#include "revng/Pipes/ApplyDiffAnalysis.h"
#include "revng/Pipes/ModelGlobal.h"
#include "revng/Support/YAMLTraits.h"
#include "revng/TupleTree/TupleTreeDiff.h"
namespace revng::pipes {
llvm::Error ApplyDiffAnalysis::run(pipeline::Context &Ctx,
std::string DiffLocation) {
if (DiffLocation == "")
return llvm::Error::success();
auto &Model = getWritableModelFromContext(Ctx);
using DiffT = TupleTreeDiff<model::Binary>;
auto MaybeDiff = deserializeFileOrSTDIN<DiffT>(DiffLocation);
if (!MaybeDiff)
return MaybeDiff.takeError();
return MaybeDiff->apply(Model);
}
static pipeline::RegisterAnalysis<ApplyDiffAnalysis> X;
} // namespace revng::pipes