• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===- transforms_instrumentation.go - Bindings for instrumentation -------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines bindings for the instrumentation component.
11//
12//===----------------------------------------------------------------------===//
13
14package llvm
15
16/*
17#include "InstrumentationBindings.h"
18#include <stdlib.h>
19*/
20import "C"
21import "unsafe"
22
23func (pm PassManager) AddAddressSanitizerFunctionPass() {
24	C.LLVMAddAddressSanitizerFunctionPass(pm.C)
25}
26
27func (pm PassManager) AddAddressSanitizerModulePass() {
28	C.LLVMAddAddressSanitizerModulePass(pm.C)
29}
30
31func (pm PassManager) AddThreadSanitizerPass() {
32	C.LLVMAddThreadSanitizerPass(pm.C)
33}
34
35func (pm PassManager) AddMemorySanitizerPass() {
36	C.LLVMAddMemorySanitizerPass(pm.C)
37}
38
39func (pm PassManager) AddDataFlowSanitizerPass(abilist []string) {
40	abiliststrs := make([]*C.char, len(abilist))
41	for i, arg := range abilist {
42		abiliststrs[i] = C.CString(arg)
43		defer C.free(unsafe.Pointer(abiliststrs[i]))
44	}
45	C.LLVMAddDataFlowSanitizerPass(pm.C, C.int(len(abilist)), &abiliststrs[0])
46}
47