All Projects → joshpeterson → layout

joshpeterson / layout

Licence: other
Determine the layout of C and C++ types, including their size, and the size, offset, and padding of each field in the type.

Programming Languages

C++
36643 projects - #6 most used programming language

Labels

Projects that are alternatives of or similar to layout

Cmake Ide
Use Emacs as a C/C++ IDE
Stars: ✭ 661 (+3047.62%)
Mutual labels:  libclang
Dstep
A tool for converting C and Objective-C headers to D modules
Stars: ✭ 177 (+742.86%)
Mutual labels:  libclang
cxxd
C/C++ language server implemented on top of Clang frontend.
Stars: ✭ 145 (+590.48%)
Mutual labels:  libclang
Color coded
A vim plugin for libclang-based highlighting of C, C++, ObjC
Stars: ✭ 841 (+3904.76%)
Mutual labels:  libclang
Clang.jl
Julia interface to libclang and C wrapper generator
Stars: ✭ 142 (+576.19%)
Mutual labels:  libclang
Dpp
Directly include C headers in D source code
Stars: ✭ 189 (+800%)
Mutual labels:  libclang
Cpp Reflection
C++ Reflection Parser / Runtime Skeleton
Stars: ✭ 440 (+1995.24%)
Mutual labels:  libclang
ffi-clang
Ruby FFI bindings for libclang 3.4+.
Stars: ✭ 41 (+95.24%)
Mutual labels:  libclang
Siplasplas
A library for C++ reflection and introspection
Stars: ✭ 167 (+695.24%)
Mutual labels:  libclang
regen
Easy C++ reflection and code generation
Stars: ✭ 29 (+38.1%)
Mutual labels:  libclang
Irony Mode
A C/C++ minor mode for Emacs powered by libclang
Stars: ✭ 851 (+3952.38%)
Mutual labels:  libclang
Cppast
Library to parse and work with the C++ AST
Stars: ✭ 1,003 (+4676.19%)
Mutual labels:  libclang
Cppast.net
CppAst is a .NET library providing a C/C++ parser for header files powered by Clang/libclang with access to the full AST, comments and macros
Stars: ✭ 228 (+985.71%)
Mutual labels:  libclang
Jucipp
A lightweight & cross-platform IDE supporting the most recent C++ standards. This project has moved to https://gitlab.com/cppit/jucipp.
Stars: ✭ 887 (+4123.81%)
Mutual labels:  libclang
pywrap
C++ binding generator based on libclang and pybind11
Stars: ✭ 17 (-19.05%)
Mutual labels:  libclang
Easyclangcomplete
💥 Robust C/C++ code completion for Sublime Text 3
Stars: ✭ 537 (+2457.14%)
Mutual labels:  libclang
Deoplete Clang
deoplete.nvim source for C/C++/Obj-C/Obj-C++ with clang-python3
Stars: ✭ 186 (+785.71%)
Mutual labels:  libclang
cide
A fast, lightweight C/C++ IDE for Linux and Windows
Stars: ✭ 33 (+57.14%)
Mutual labels:  libclang
bootstrap
Bootstrap Go bindings for Clang's C API
Stars: ✭ 18 (-14.29%)
Mutual labels:  libclang
hcparse
High-level nim bindings for parsing C/C++ code
Stars: ✭ 37 (+76.19%)
Mutual labels:  libclang

Build Status

Layout

Determine the layout of C and C++ types, including their size, and the size, offset, and padding of each field in the type.

The layout utility uses libclang to generate a C or C++ file with calls to sizeof and offsetof that can be used with a specific compiler to understand the layout of a given type.o

Example

Suppose we have the following C++ struct defined in a file named test.cpp:

struct Type;
struct String;
struct Method;
struct Array;

struct EventInfo
{
  Type* declaringType;
  Type* reflectedType;
  String* name;
  Method* addMethod;
  Method* removeMethod;
  Method* raiseMethod;
  int eventAttributes;
  Array* otherMethods;
};

Then we can run layout like this:

$ layout test.cpp | g++ -xc++ -;./a.out
EventInfo (64b):
          Field |     Type | Offset | Size | Padding
  declaringType |   Type * |      0 |    8 |       0
  reflectedType |   Type * |      8 |    8 |       0
           name | String * |     16 |    8 |       0
      addMethod | Method * |     24 |    8 |       0
   removeMethod | Method * |     32 |    8 |       0
    raiseMethod | Method * |     40 |    8 |       0
eventAttributes |      int |     48 |    4 |       4
   otherMethods |  Array * |     56 |    8 |       0

Building

The layout utility depends on libclang. It uses CMake and Ninja to build.

Linux

$ sudo apt-get install -y llvm-9-dev libclang-9-dev cmake ninja-build
$ ./build.sh

License

This source code is licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].