Files
carbon-lang/llvm/lib/ExecutionEngine/Orc/ObjectTransformLayer.cpp
T
Lang Hames 079df9ab2c [ORC] Rename ORC layers to make the "new" ORC layers the default.
This commit adds a 'Legacy' prefix to old ORC layers and utilities, and removes
the '2' suffix from the new ORC layers. If you wish to continue using the old
ORC layers you will need to add a 'Legacy' prefix to your classes. If you were
already using the new ORC layers you will need to drop the '2' suffix.

The legacy layers will remain in-tree until the new layers reach feature
parity with them. This will involve adding support for removing code from the
new layers, and ensuring that performance is comperable.

llvm-svn: 344572
2018-10-15 22:56:10 +00:00

35 lines
1.2 KiB
C++

//===---------- ObjectTransformLayer.cpp - Object Transform Layer ---------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/ObjectTransformLayer.h"
#include "llvm/Support/MemoryBuffer.h"
namespace llvm {
namespace orc {
ObjectTransformLayer::ObjectTransformLayer(ExecutionSession &ES,
ObjectLayer &BaseLayer,
TransformFunction Transform)
: ObjectLayer(ES), BaseLayer(BaseLayer), Transform(std::move(Transform)) {}
void ObjectTransformLayer::emit(MaterializationResponsibility R, VModuleKey K,
std::unique_ptr<MemoryBuffer> O) {
assert(O && "Module must not be null");
if (auto TransformedObj = Transform(std::move(O)))
BaseLayer.emit(std::move(R), std::move(K), std::move(*TransformedObj));
else {
R.failMaterialization();
getExecutionSession().reportError(TransformedObj.takeError());
}
}
} // End namespace orc.
} // End namespace llvm.