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 14 package llvm 15 16 /* 17 #include "InstrumentationBindings.h" 18 #include <stdlib.h> 19 */ 20 import "C" 21 import "unsafe" 22 23 func (pm PassManager) AddAddressSanitizerFunctionPass() { 24 C.LLVMAddAddressSanitizerFunctionPass(pm.C) 25 } 26 27 func (pm PassManager) AddAddressSanitizerModulePass() { 28 C.LLVMAddAddressSanitizerModulePass(pm.C) 29 } 30 31 func (pm PassManager) AddThreadSanitizerPass() { 32 C.LLVMAddThreadSanitizerPass(pm.C) 33 } 34 35 func (pm PassManager) AddMemorySanitizerPass() { 36 C.LLVMAddMemorySanitizerPass(pm.C) 37 } 38 39 func (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