Make WindowsManifestMerger::merge() take a MemoryBufferRef

No behavior change.
This commit is contained in:
Nico Weber 2021-08-24 16:38:34 -04:00
parent 9b96b0865d
commit 67ffce68bc
3 changed files with 7 additions and 7 deletions

View File

@ -30,6 +30,7 @@
namespace llvm { namespace llvm {
class MemoryBuffer; class MemoryBuffer;
class MemoryBufferRef;
namespace windows_manifest { namespace windows_manifest {
@ -49,7 +50,7 @@ class WindowsManifestMerger {
public: public:
WindowsManifestMerger(); WindowsManifestMerger();
~WindowsManifestMerger(); ~WindowsManifestMerger();
Error merge(const MemoryBuffer &Manifest); Error merge(MemoryBufferRef Manifest);
// Returns vector containing merged xml manifest, or uninitialized vector for // Returns vector containing merged xml manifest, or uninitialized vector for
// empty manifest. // empty manifest.

View File

@ -35,7 +35,7 @@ void WindowsManifestError::log(raw_ostream &OS) const { OS << Msg; }
class WindowsManifestMerger::WindowsManifestMergerImpl { class WindowsManifestMerger::WindowsManifestMergerImpl {
public: public:
~WindowsManifestMergerImpl(); ~WindowsManifestMergerImpl();
Error merge(const MemoryBuffer &Manifest); Error merge(MemoryBufferRef Manifest);
std::unique_ptr<MemoryBuffer> getMergedManifest(); std::unique_ptr<MemoryBuffer> getMergedManifest();
private: private:
@ -620,7 +620,7 @@ WindowsManifestMerger::WindowsManifestMergerImpl::~WindowsManifestMergerImpl() {
} }
Error WindowsManifestMerger::WindowsManifestMergerImpl::merge( Error WindowsManifestMerger::WindowsManifestMergerImpl::merge(
const MemoryBuffer &Manifest) { MemoryBufferRef Manifest) {
if (Merged) if (Merged)
return make_error<WindowsManifestError>( return make_error<WindowsManifestError>(
"merge after getMergedManifest is not supported"); "merge after getMergedManifest is not supported");
@ -690,7 +690,7 @@ WindowsManifestMerger::WindowsManifestMergerImpl::~WindowsManifestMergerImpl() {
} }
Error WindowsManifestMerger::WindowsManifestMergerImpl::merge( Error WindowsManifestMerger::WindowsManifestMergerImpl::merge(
const MemoryBuffer &Manifest) { MemoryBufferRef Manifest) {
return make_error<WindowsManifestError>("no libxml2"); return make_error<WindowsManifestError>("no libxml2");
} }
@ -708,7 +708,7 @@ WindowsManifestMerger::WindowsManifestMerger()
WindowsManifestMerger::~WindowsManifestMerger() {} WindowsManifestMerger::~WindowsManifestMerger() {}
Error WindowsManifestMerger::merge(const MemoryBuffer &Manifest) { Error WindowsManifestMerger::merge(MemoryBufferRef Manifest) {
return Impl->merge(Manifest); return Impl->merge(Manifest);
} }

View File

@ -135,8 +135,7 @@ int main(int Argc, const char **Argv) {
MemoryBuffer::getFile(File); MemoryBuffer::getFile(File);
if (!ManifestOrErr) if (!ManifestOrErr)
reportError(File, ManifestOrErr.getError()); reportError(File, ManifestOrErr.getError());
MemoryBuffer &Manifest = *ManifestOrErr.get(); error(Merger.merge(*ManifestOrErr.get()));
error(Merger.merge(Manifest));
} }
std::unique_ptr<MemoryBuffer> OutputBuffer = Merger.getMergedManifest(); std::unique_ptr<MemoryBuffer> OutputBuffer = Merger.getMergedManifest();