llvm.org GIT mirror llvm / ea28a67
Revert r369210 which got committed to the branch by mistake git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_80@369350 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg a month ago
1 changed file(s) with 0 addition(s) and 37 deletion(s). Raw diff Collapse all Expand all
+0
-37
bindings/go/llvm/irreader.go less more
None //===- irreader.go - Bindings for irreader --------------------------------===//
1 //
2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 // See https://llvm.org/LICENSE.txt for license information.
4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file defines bindings for the irreader component.
9 //
10 //===----------------------------------------------------------------------===//
11
12 package llvm
13
14 /*
15 #include "llvm-c/IRReader.h"
16 #include
17 */
18 import "C"
19
20 import (
21 "errors"
22 "unsafe"
23 )
24
25 // ParseIR parses the textual IR given in the memory buffer and returns a new
26 // LLVM module in this context.
27 func (c *Context) ParseIR(buf MemoryBuffer) (Module, error) {
28 var m Module
29 var errmsg *C.char
30 if C.LLVMParseIRInContext(c.C, buf.C, &m.C, &errmsg) != 0 {
31 err := errors.New(C.GoString(errmsg))
32 C.free(unsafe.Pointer(errmsg))
33 return Module{}, err
34 }
35 return m, nil
36 }