Skip to content

Commit 2e7dc09

Browse files
committed
clang: add missing clang-v3.9 files
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
1 parent 578ed1d commit 2e7dc09

File tree

3 files changed

+102
-1
lines changed

3 files changed

+102
-1
lines changed

clang/clang-c/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// Package clang-c holds clang binding C header files.
1+
// Package clang_c holds clang binding C header files.
22
package clang_c

clang/modulemapdescriptor_gen.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,59 @@ package clang
33
// #include "./clang-c/BuildSystem.h"
44
// #include "go-clang.h"
55
import "C"
6+
import "unsafe"
67

78
// Object encapsulating information about a module.map file.
89
type ModuleMapDescriptor struct {
910
c C.CXModuleMapDescriptor
1011
}
12+
13+
/*
14+
Create a CXModuleMapDescriptor object.
15+
Must be disposed with clang_ModuleMapDescriptor_dispose().
16+
17+
Parameter options is reserved, always pass 0.
18+
*/
19+
func NewModuleMapDescriptor(options uint32) ModuleMapDescriptor {
20+
return ModuleMapDescriptor{C.clang_ModuleMapDescriptor_create(C.uint(options))}
21+
}
22+
23+
// Sets the framework module name that the module.map describes. Returns 0 for success, non-zero to indicate an error.
24+
func (mmd ModuleMapDescriptor) SetFrameworkModuleName(name string) ErrorCode {
25+
c_name := C.CString(name)
26+
defer C.free(unsafe.Pointer(c_name))
27+
28+
return ErrorCode(C.clang_ModuleMapDescriptor_setFrameworkModuleName(mmd.c, c_name))
29+
}
30+
31+
// Sets the umbrealla header name that the module.map describes. Returns 0 for success, non-zero to indicate an error.
32+
func (mmd ModuleMapDescriptor) SetUmbrellaHeader(name string) ErrorCode {
33+
c_name := C.CString(name)
34+
defer C.free(unsafe.Pointer(c_name))
35+
36+
return ErrorCode(C.clang_ModuleMapDescriptor_setUmbrellaHeader(mmd.c, c_name))
37+
}
38+
39+
/*
40+
Write out the CXModuleMapDescriptor object to a char buffer.
41+
42+
Parameter options is reserved, always pass 0.
43+
Parameter out_buffer_ptr pointer to receive the buffer pointer, which should be
44+
disposed using clang_free().
45+
Parameter out_buffer_size pointer to receive the buffer size.
46+
Returns 0 for success, non-zero to indicate an error.
47+
*/
48+
func (mmd ModuleMapDescriptor) WriteToBuffer(options uint32) (string, uint32, ErrorCode) {
49+
var outBufferPtr *C.char
50+
defer C.free(unsafe.Pointer(outBufferPtr))
51+
var outBufferSize C.uint
52+
53+
o := ErrorCode(C.clang_ModuleMapDescriptor_writeToBuffer(mmd.c, C.uint(options), &outBufferPtr, &outBufferSize))
54+
55+
return C.GoString(outBufferPtr), uint32(outBufferSize), o
56+
}
57+
58+
// Dispose a CXModuleMapDescriptor object.
59+
func (mmd ModuleMapDescriptor) Dispose() {
60+
C.clang_ModuleMapDescriptor_dispose(mmd.c)
61+
}

clang/virtualfileoverlay_gen.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,58 @@ package clang
33
// #include "./clang-c/BuildSystem.h"
44
// #include "go-clang.h"
55
import "C"
6+
import "unsafe"
67

78
// Object encapsulating information about overlaying virtual file/directories over the real file system.
89
type VirtualFileOverlay struct {
910
c C.CXVirtualFileOverlay
1011
}
12+
13+
/*
14+
Create a CXVirtualFileOverlay object.
15+
Must be disposed with clang_VirtualFileOverlay_dispose().
16+
17+
Parameter options is reserved, always pass 0.
18+
*/
19+
func NewVirtualFileOverlay(options uint32) VirtualFileOverlay {
20+
return VirtualFileOverlay{C.clang_VirtualFileOverlay_create(C.uint(options))}
21+
}
22+
23+
// Map an absolute virtual file path to an absolute real one. The virtual path must be canonicalized (not contain "."/".."). Returns 0 for success, non-zero to indicate an error.
24+
func (vfo VirtualFileOverlay) AddFileMapping(virtualPath string, realPath string) ErrorCode {
25+
c_virtualPath := C.CString(virtualPath)
26+
defer C.free(unsafe.Pointer(c_virtualPath))
27+
c_realPath := C.CString(realPath)
28+
defer C.free(unsafe.Pointer(c_realPath))
29+
30+
return ErrorCode(C.clang_VirtualFileOverlay_addFileMapping(vfo.c, c_virtualPath, c_realPath))
31+
}
32+
33+
// Set the case sensitivity for the CXVirtualFileOverlay object. The CXVirtualFileOverlay object is case-sensitive by default, this option can be used to override the default. Returns 0 for success, non-zero to indicate an error.
34+
func (vfo VirtualFileOverlay) SetCaseSensitivity(caseSensitive int32) ErrorCode {
35+
return ErrorCode(C.clang_VirtualFileOverlay_setCaseSensitivity(vfo.c, C.int(caseSensitive)))
36+
}
37+
38+
/*
39+
Write out the CXVirtualFileOverlay object to a char buffer.
40+
41+
Parameter options is reserved, always pass 0.
42+
Parameter out_buffer_ptr pointer to receive the buffer pointer, which should be
43+
disposed using clang_free().
44+
Parameter out_buffer_size pointer to receive the buffer size.
45+
Returns 0 for success, non-zero to indicate an error.
46+
*/
47+
func (vfo VirtualFileOverlay) WriteToBuffer(options uint32) (string, uint32, ErrorCode) {
48+
var outBufferPtr *C.char
49+
defer C.free(unsafe.Pointer(outBufferPtr))
50+
var outBufferSize C.uint
51+
52+
o := ErrorCode(C.clang_VirtualFileOverlay_writeToBuffer(vfo.c, C.uint(options), &outBufferPtr, &outBufferSize))
53+
54+
return C.GoString(outBufferPtr), uint32(outBufferSize), o
55+
}
56+
57+
// Dispose a CXVirtualFileOverlay object.
58+
func (vfo VirtualFileOverlay) Dispose() {
59+
C.clang_VirtualFileOverlay_dispose(vfo.c)
60+
}

0 commit comments

Comments
 (0)