Skip to content

Commit 4a61917

Browse files
committed
use llvm::unwrap and wrap
1 parent f000d33 commit 4a61917

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mlir/lib/CAPI/Target/LLVMIR.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "llvm-c/Support.h"
1212

1313
#include "llvm/IR/LLVMContext.h"
14+
#include "llvm/IR/Module.h"
1415
#include <memory>
1516

1617
#include "mlir/CAPI/IR.h"
@@ -25,14 +26,13 @@ LLVMModuleRef mlirTranslateModuleToLLVMIR(MlirOperation module,
2526
MlirStringRef llvmModuleName) {
2627
Operation *moduleOp = unwrap(module);
2728

28-
llvm::LLVMContext *ctx = reinterpret_cast<llvm::LLVMContext *>(context);
29+
llvm::LLVMContext *ctx = llvm::unwrap(context);
2930

3031
std::unique_ptr<llvm::Module> llvmModule = mlir::translateModuleToLLVMIR(
3132
moduleOp, *ctx,
3233
llvm::StringRef(llvmModuleName.data, llvmModuleName.length));
3334

34-
LLVMModuleRef moduleRef = reinterpret_cast<LLVMModuleRef>(
35-
const_cast<llvm::Module *>(llvmModule.release()));
35+
LLVMModuleRef moduleRef = llvm::wrap(llvmModule.release());
3636

3737
return moduleRef;
3838
}

0 commit comments

Comments
 (0)