[InstCombine] Signed saturation tests. NFC
[llvm-complete.git] / bindings / go / llvm / SupportBindings.cpp
blobaac69a7c788d1ae425731c6fa1b214938f82e994
1 //===- SupportBindings.cpp - Additional bindings for support --------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines additional C bindings for the support component.
11 //===----------------------------------------------------------------------===//
13 #include "SupportBindings.h"
14 #include "llvm/Support/DynamicLibrary.h"
15 #include <stdlib.h>
16 #include <string.h>
18 void LLVMLoadLibraryPermanently2(const char *Filename, char **ErrMsg) {
19 std::string ErrMsgStr;
20 if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Filename, &ErrMsgStr)) {
21 *ErrMsg = static_cast<char *>(malloc(ErrMsgStr.size() + 1));
22 memcpy(static_cast<void *>(*ErrMsg),
23 static_cast<const void *>(ErrMsgStr.c_str()), ErrMsgStr.size() + 1);