Commit 72c20c1c authored by Brenden Blanco's avatar Brenden Blanco Committed by GitHub

Merge pull request #821 from palmtenor/adjust_headers

Improve the structure of exception related header files
parents b06d97c1 3b4e31f0
...@@ -23,10 +23,9 @@ ...@@ -23,10 +23,9 @@
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#include "bcc_exception.h"
#include "bcc_syms.h" #include "bcc_syms.h"
#include "bpf_module.h" #include "bpf_module.h"
#include "common.h"
#include "exception.h"
#include "libbpf.h" #include "libbpf.h"
#include "perf_reader.h" #include "perf_reader.h"
......
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
#include <string> #include <string>
#include "BPFTable.h" #include "BPFTable.h"
#include "bcc_exception.h"
#include "bcc_syms.h" #include "bcc_syms.h"
#include "bpf_module.h" #include "bpf_module.h"
#include "common.h"
#include "compat/linux/bpf.h" #include "compat/linux/bpf.h"
#include "libbpf.h" #include "libbpf.h"
......
...@@ -21,9 +21,8 @@ ...@@ -21,9 +21,8 @@
#include "BPFTable.h" #include "BPFTable.h"
#include "bcc_exception.h"
#include "bcc_syms.h" #include "bcc_syms.h"
#include "common.h"
#include "exception.h"
#include "libbpf.h" #include "libbpf.h"
#include "perf_reader.h" #include "perf_reader.h"
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "bcc_exception.h"
#include "bpf_module.h" #include "bpf_module.h"
#include "common.h"
#include "libbpf.h" #include "libbpf.h"
#include "perf_reader.h" #include "perf_reader.h"
......
...@@ -63,7 +63,7 @@ target_link_libraries(bcc-static b_frontend clang_frontend bcc-loader-static ${c ...@@ -63,7 +63,7 @@ target_link_libraries(bcc-static b_frontend clang_frontend bcc-loader-static ${c
install(TARGETS bcc-shared LIBRARY COMPONENT libbcc install(TARGETS bcc-shared LIBRARY COMPONENT libbcc
DESTINATION ${CMAKE_INSTALL_LIBDIR}) DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES bpf_common.h bpf_module.h bcc_syms.h common.h exception.h libbpf.h perf_reader.h BPF.h BPFTable.h COMPONENT libbcc install(FILES bpf_common.h bpf_module.h bcc_syms.h bcc_exception.h libbpf.h perf_reader.h BPF.h BPFTable.h COMPONENT libbcc
DESTINATION include/bcc) DESTINATION include/bcc)
install(DIRECTORY compat/linux/ COMPONENT libbcc install(DIRECTORY compat/linux/ COMPONENT libbcc
DESTINATION include/bcc/compat/linux DESTINATION include/bcc/compat/linux
......
...@@ -26,24 +26,26 @@ ...@@ -26,24 +26,26 @@
namespace ebpf { namespace ebpf {
typedef std::tuple<int, std::string> StatusTuple;
template <typename... Args> template <typename... Args>
std::tuple<int, std::string> mkstatus(int ret, const char *fmt, Args... args) { StatusTuple mkstatus(int ret, const char *fmt, Args... args) {
char buf[1024]; char buf[1024];
snprintf(buf, sizeof(buf), fmt, args...); snprintf(buf, sizeof(buf), fmt, args...);
return std::make_tuple(ret, std::string(buf)); return std::make_tuple(ret, std::string(buf));
} }
static inline std::tuple<int, std::string> mkstatus(int ret, const char *msg) { static inline StatusTuple mkstatus(int ret, const char *msg) {
return std::make_tuple(ret, std::string(msg)); return std::make_tuple(ret, std::string(msg));
} }
static inline std::tuple<int, std::string> mkstatus( static inline StatusTuple mkstatus(
int ret, const std::string& msg int ret, const std::string& msg
) { ) {
return std::make_tuple(ret, msg); return std::make_tuple(ret, msg);
} }
static inline std::tuple<int, std::string> mkstatus(int ret) { static inline StatusTuple mkstatus(int ret) {
return std::make_tuple(ret, std::string()); return std::make_tuple(ret, std::string());
} }
...@@ -57,7 +59,7 @@ static inline std::tuple<int, std::string> mkstatus(int ret) { ...@@ -57,7 +59,7 @@ static inline std::tuple<int, std::string> mkstatus(int ret) {
#define TRY2(CMD) \ #define TRY2(CMD) \
do { \ do { \
std::tuple<int, std::string> __stp = (CMD); \ StatusTuple __stp = (CMD); \
if (std::get<0>(__stp) != 0) { \ if (std::get<0>(__stp) != 0) { \
return __stp; \ return __stp; \
} \ } \
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include <llvm/Transforms/IPO/PassManagerBuilder.h> #include <llvm/Transforms/IPO/PassManagerBuilder.h>
#include <llvm-c/Transforms/IPO.h> #include <llvm-c/Transforms/IPO.h>
#include "exception.h" #include "bcc_exception.h"
#include "frontends/b/loader.h" #include "frontends/b/loader.h"
#include "frontends/clang/loader.h" #include "frontends/clang/loader.h"
#include "frontends/clang/b_frontend_action.h" #include "frontends/clang/b_frontend_action.h"
......
...@@ -28,6 +28,4 @@ make_unique(Args &&... args) { ...@@ -28,6 +28,4 @@ make_unique(Args &&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
} }
typedef std::tuple<int, std::string> StatusTuple;
} // namespace ebpf } // namespace ebpf
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <llvm/IR/LLVMContext.h> #include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Module.h> #include <llvm/IR/Module.h>
#include "exception.h" #include "bcc_exception.h"
#include "codegen_llvm.h" #include "codegen_llvm.h"
#include "lexer.h" #include "lexer.h"
#include "table_desc.h" #include "table_desc.h"
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <stdint.h> #include <stdint.h>
#include "common.h" #include "common.h"
#include "bcc_exception.h"
#include "scope.h" #include "scope.h"
#define REVISION_MASK 0xfff #define REVISION_MASK 0xfff
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <algorithm> #include <algorithm>
#include <assert.h> #include <assert.h>
#include "exception.h" #include "bcc_exception.h"
#include "parser.h" #include "parser.h"
#include "type_helper.h" #include "type_helper.h"
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "printer.h" #include "printer.h"
#include "lexer.h" #include "lexer.h"
#include "exception.h" #include "bcc_exception.h"
namespace ebpf { namespace ebpf {
namespace cc { namespace cc {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <set> #include <set>
#include <algorithm> #include <algorithm>
#include "exception.h" #include "bcc_exception.h"
#include "type_check.h" #include "type_check.h"
#include "lexer.h" #include "lexer.h"
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include <llvm/IR/Module.h> #include <llvm/IR/Module.h>
#include "common.h" #include "common.h"
#include "exception.h" #include "bcc_exception.h"
#include "exported_files.h" #include "exported_files.h"
#include "kbuild_helper.h" #include "kbuild_helper.h"
#include "b_frontend_action.h" #include "b_frontend_action.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment