• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2010, The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef BCC_INTERNAL_H
18 #define BCC_INTERNAL_H
19 
20 #include <bcc/bcc.h>
21 
22 #if defined(__cplusplus)
23 
24 #define BCC_OPAQUE_TYPE_CONVERSION(TRANSPARENT_TYPE, OPAQUE_TYPE)           \
25   inline OPAQUE_TYPE wrap(TRANSPARENT_TYPE ptr) {                           \
26     return reinterpret_cast<OPAQUE_TYPE>(ptr);                              \
27   }                                                                         \
28                                                                             \
29   inline TRANSPARENT_TYPE unwrap(OPAQUE_TYPE ptr) {                         \
30     return reinterpret_cast<TRANSPARENT_TYPE>(ptr);                         \
31   }
32 
33 namespace llvm {
34   class Module;
35 }
36 
37 namespace bcc {
38   class Script;
39 
40   /* Function information struct */
41   struct FuncInfo {
42     char const *name;
43     void *addr;
44     size_t size;
45   };
46 
47   BCC_OPAQUE_TYPE_CONVERSION(bcc::Script *, BCCScriptRef);
48   BCC_OPAQUE_TYPE_CONVERSION(llvm::Module *, LLVMModuleRef);
49 
50 } // namespace bcc
51 
52 #undef BCC_OPAQUE_TYPE_CONVERSION
53 
54 #endif // defined(__cplusplus)
55 
56 #endif // BCC_INTERNAL_H
57