mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
7d235f4fd0
Also do some basic cleanup: capitalize first letters, add `.` at the end of the sentences, and so on.
39 lines
1007 B
C++
39 lines
1007 B
C++
/// \file GlobalsMap.cpp
|
|
|
|
//
|
|
// 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::storeToDisk(llvm::StringRef Path) const {
|
|
for (const auto &Global : Map) {
|
|
llvm::SmallString<128> Filename;
|
|
llvm::sys::path::append(Filename, Path, Global.first);
|
|
if (auto E = Global.second->storeToDisk(Filename); !!E)
|
|
return E;
|
|
}
|
|
return llvm::Error::success();
|
|
}
|
|
|
|
llvm::Error GlobalsMap::loadFromDisk(llvm::StringRef Path) {
|
|
for (const auto &Global : Map) {
|
|
llvm::SmallString<128> Filename;
|
|
llvm::sys::path::append(Filename, Path, Global.first);
|
|
if (auto E = Global.second->loadFromDisk(Filename); !!E)
|
|
return E;
|
|
}
|
|
return llvm::Error::success();
|
|
}
|