#include "clang.h" #include "clang-c.h" #include "llvm/IR/Function.h" #include "llvm/IR/LLVMContext.h" #include #include #include class perf_clang_scope { public: explicit perf_clang_scope() {perf_clang__init();} ~perf_clang_scope() {perf_clang__cleanup();} }; static std::unique_ptr __test__clang_to_IR(void) { unsigned int kernel_version; if (fetch_kernel_version(&kernel_version, NULL, 0)) return std::unique_ptr(nullptr); std::string cflag_kver("-DLINUX_VERSION_CODE=" + std::to_string(kernel_version)); std::unique_ptr M = perf::getModuleFromSource({cflag_kver.c_str()}, "perf-test.c", test_llvm__bpf_base_prog); return M; } extern "C" { int test__clang_to_IR(void) { perf_clang_scope _scope; auto M = __test__clang_to_IR(); if (!M) return -1; for (llvm::Function& F : *M) if (F.getName() == "bpf_func__SyS_epoll_wait") return 0; return -1; } int test__clang_to_obj(void) { perf_clang_scope _scope; auto M = __test__clang_to_IR(); if (!M) return -1; auto Buffer = perf::getBPFObjectFromModule(&*M); if (!Buffer) return -1; return 0; } } emove net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2016-12-05 19:37:24 +0800
committerJiri Kosina <jkosina@suse.cz>2016-12-09 13:46:29 +0100
commitc60fa555b11b25386b355c141d90cbee361c3eec (patch)
tree144f457fbc9ebfcb02a4c98a4009fd0f3b402d62 /tools/perf/pmu-events
parent2ae3986b84e9d325bc92a1efbcf0c6b0f5016b35 (diff)
HID: usbhid: fix improper return value
Function hid_post_reset() should return negative error codes on failures. However, in its implementation, it incorrectly returns 1. This patch fixes the bug, returning proper error codes on failures. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'tools/perf/pmu-events')