mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
35 lines
923 B
C++
35 lines
923 B
C++
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include <system_error>
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include "llvm/Support/FileSystem.h"
|
|
#include "llvm/Support/Path.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
#include "revng/Pipeline/GlobalsMap.h"
|
|
|
|
using namespace std;
|
|
using namespace pipeline;
|
|
using namespace llvm;
|
|
|
|
llvm::Error GlobalsMap::store(const revng::DirectoryPath &Path) const {
|
|
for (const auto &Global : Map) {
|
|
revng::FilePath Filename = Path.getFile(Global.first);
|
|
if (auto Error = Global.second->store(Filename); Error)
|
|
return Error;
|
|
}
|
|
return llvm::Error::success();
|
|
}
|
|
|
|
llvm::Error GlobalsMap::load(const revng::DirectoryPath &Path) {
|
|
for (const auto &Global : Map) {
|
|
revng::FilePath Filename = Path.getFile(Global.first);
|
|
if (auto Error = Global.second->load(Filename); Error)
|
|
return Error;
|
|
}
|
|
return llvm::Error::success();
|
|
}
|