mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00

Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers.
50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
#ifndef NVIM_CONTEXT_H
|
|
#define NVIM_CONTEXT_H
|
|
|
|
#include <msgpack.h>
|
|
#include <msgpack/sbuffer.h>
|
|
#include <stddef.h>
|
|
|
|
#include "klib/kvec.h"
|
|
#include "nvim/api/private/defs.h"
|
|
|
|
typedef struct {
|
|
msgpack_sbuffer regs; ///< Registers.
|
|
msgpack_sbuffer jumps; ///< Jumplist.
|
|
msgpack_sbuffer bufs; ///< Buffer list.
|
|
msgpack_sbuffer gvars; ///< Global variables.
|
|
Array funcs; ///< Functions.
|
|
} Context;
|
|
typedef kvec_t(Context) ContextVec;
|
|
|
|
#define MSGPACK_SBUFFER_INIT (msgpack_sbuffer) { \
|
|
.size = 0, \
|
|
.data = NULL, \
|
|
.alloc = 0, \
|
|
}
|
|
|
|
#define CONTEXT_INIT (Context) { \
|
|
.regs = MSGPACK_SBUFFER_INIT, \
|
|
.jumps = MSGPACK_SBUFFER_INIT, \
|
|
.bufs = MSGPACK_SBUFFER_INIT, \
|
|
.gvars = MSGPACK_SBUFFER_INIT, \
|
|
.funcs = ARRAY_DICT_INIT, \
|
|
}
|
|
|
|
typedef enum {
|
|
kCtxRegs = 1, ///< Registers
|
|
kCtxJumps = 2, ///< Jumplist
|
|
kCtxBufs = 4, ///< Buffer list
|
|
kCtxGVars = 8, ///< Global variables
|
|
kCtxSFuncs = 16, ///< Script functions
|
|
kCtxFuncs = 32, ///< Functions
|
|
} ContextTypeFlags;
|
|
|
|
extern int kCtxAll;
|
|
|
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
|
# include "context.h.generated.h"
|
|
#endif
|
|
|
|
#endif // NVIM_CONTEXT_H
|