1//===- transforms_instrumentation.go - Bindings for instrumentation -------===// 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 bindings for the instrumentation component. 10// 11//===----------------------------------------------------------------------===// 12 13package llvm 14 15/* 16#include "InstrumentationBindings.h" 17#include <stdlib.h> 18*/ 19import "C" 20import "unsafe" 21 22func (pm PassManager) AddAddressSanitizerFunctionPass() { 23 C.LLVMAddAddressSanitizerFunctionPass(pm.C) 24} 25 26func (pm PassManager) AddAddressSanitizerModulePass() { 27 C.LLVMAddAddressSanitizerModulePass(pm.C) 28} 29 30func (pm PassManager) AddThreadSanitizerPass() { 31 C.LLVMAddThreadSanitizerPass(pm.C) 32} 33 34func (pm PassManager) AddMemorySanitizerLegacyPassPass() { 35 C.LLVMAddMemorySanitizerLegacyPassPass(pm.C) 36} 37 38func (pm PassManager) AddDataFlowSanitizerPass(abilist []string) { 39 abiliststrs := make([]*C.char, len(abilist)) 40 for i, arg := range abilist { 41 abiliststrs[i] = C.CString(arg) 42 defer C.free(unsafe.Pointer(abiliststrs[i])) 43 } 44 C.LLVMAddDataFlowSanitizerPass(pm.C, C.int(len(abilist)), &abiliststrs[0]) 45} 46