mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
Cache TTRs in Model tools
This commit is contained in:
committed by
Alessandro Di Federico
parent
fff0fbd874
commit
d520fd5aea
@@ -213,8 +213,15 @@ public:
|
||||
return *Module;
|
||||
}
|
||||
|
||||
TupleTree<model::Binary> &getModel() { return Model; }
|
||||
const TupleTree<model::Binary> &getModel() const { return Model; }
|
||||
TupleTree<model::Binary> &getWriteableModel() {
|
||||
Model.evictCachedReferences();
|
||||
return Model;
|
||||
}
|
||||
|
||||
const model::Binary &getReadOnlyModel() {
|
||||
Model.cacheReferences();
|
||||
return *std::as_const(Model);
|
||||
}
|
||||
|
||||
public:
|
||||
llvm::Error save(const llvm::Twine &Path, ModelOutputType::Values Type) {
|
||||
|
||||
@@ -51,7 +51,7 @@ int main(int Argc, char *Argv[]) {
|
||||
if (not Diff)
|
||||
ExitOnError(Diff.takeError());
|
||||
|
||||
Diff->apply(Model->getModel());
|
||||
Diff->apply(Model->getWriteableModel());
|
||||
|
||||
auto DesiredOutput = Options.getDesiredOutput(Model->hasModule());
|
||||
ExitOnError(Model->save(Options.getPath(), DesiredOutput));
|
||||
|
||||
@@ -43,7 +43,7 @@ int main(int Argc, char *Argv[]) {
|
||||
revng_abort(EC.message().c_str());
|
||||
|
||||
TypeSystemPrinter TSPrinter(Out);
|
||||
TSPrinter.print(*MaybeModel->getModel());
|
||||
TSPrinter.print(MaybeModel->getReadOnlyModel());
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user