Skip to content

Commit 305372b

Browse files
committed
Format
1 parent db59326 commit 305372b

File tree

8 files changed

+245
-244
lines changed

8 files changed

+245
-244
lines changed

.clang-format

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ AccessModifierOffset: -4
1313
AlignAfterOpenBracket: Align
1414
AlignConsecutiveAssignments: false
1515
AlignConsecutiveDeclarations: false
16-
AlignEscapedNewlines: Left
16+
AlignEscapedNewlines: DontAlign
1717
AlignOperands: true
18-
AlignTrailingComments: false
18+
AlignTrailingComments:
19+
Kind: Always
20+
OverEmptyLines: 2
1921
AllowAllParametersOfDeclarationOnNextLine: false
2022
AllowShortBlocksOnASingleLine: false
2123
AllowShortCaseLabelsOnASingleLine: false
@@ -116,4 +118,3 @@ SpacesInSquareBrackets: false
116118
Standard: Cpp03
117119
TabWidth: 8
118120
UseTab: Always
119-
...

MCInst.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ typedef struct MCOperand MCOperand;
3131
/// This is a simple discriminated union.
3232
struct MCOperand {
3333
enum {
34-
kInvalid = 0, ///< Uninitialized.
35-
kRegister, ///< Register operand.
36-
kImmediate, ///< Immediate operand.
37-
kFPImmediate, ///< Floating-point immediate operand.
34+
kInvalid = 0, ///< Uninitialized.
35+
kRegister, ///< Register operand.
36+
kImmediate, ///< Immediate operand.
37+
kFPImmediate, ///< Floating-point immediate operand.
3838
kDFPImmediate, ///< Double-Floating-point immediate operand.
39-
kExpr, ///< Relocatable immediate operand.
40-
kInst ///< Sub-instruction operand.
39+
kExpr, ///< Relocatable immediate operand.
40+
kInst ///< Sub-instruction operand.
4141

4242
} MachineOperandType;
4343
unsigned char Kind;
@@ -119,7 +119,7 @@ struct MCInst {
119119
// This is copied from cs_x86 struct
120120
uint8_t x86_prefix[4];
121121
uint8_t imm_size; // immediate size for X86_OP_IMM operand
122-
bool writeback; // writeback for ARM
122+
bool writeback; // writeback for ARM
123123
int8_t tied_op_idx
124124
[MAX_MC_OPS]; ///< Tied operand indices. Index = Src op; Value: Dest op
125125
// operand access index for list of registers sharing the same access right (for ARM)

Mapping.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,14 @@ const cs_ac_type mapping_get_op_access(MCInst *MI, unsigned OpNum,
239239

240240
/// Returns the operand at detail->arch.operands[op_count + offset]
241241
/// Or NULL if detail is not set.
242-
#define DEFINE_get_detail_op(arch, ARCH) \
243-
cs_##arch##_op *ARCH##_get_detail_op(MCInst *MI, int offset) \
244-
{ \
245-
if (!MI->flat_insn->detail) \
246-
return NULL; \
242+
#define DEFINE_get_detail_op(arch, ARCH) \
243+
cs_##arch##_op *ARCH##_get_detail_op(MCInst *MI, int offset) \
244+
{ \
245+
if (!MI->flat_insn->detail) \
246+
return NULL; \
247247
int OpIdx = MI->flat_insn->detail->arch.op_count + offset; \
248-
assert(OpIdx >= 0 && OpIdx < MAX_MC_OPS); \
249-
return &MI->flat_insn->detail->arch.operands[OpIdx]; \
248+
assert(OpIdx >= 0 && OpIdx < MAX_MC_OPS); \
249+
return &MI->flat_insn->detail->arch.operands[OpIdx]; \
250250
}
251251

252252
DEFINE_get_detail_op(arm, ARM);

Mapping.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717

1818
// map instruction to its characteristics
1919
typedef struct insn_map {
20-
unsigned short id; // The LLVM instruction id
21-
unsigned short mapid; // The Capstone instruction id
20+
unsigned short id; // The LLVM instruction id
21+
unsigned short mapid; // The Capstone instruction id
2222
#ifndef CAPSTONE_DIET
2323
uint16_t regs_use[MAX_IMPL_R_REGS]; ///< list of implicit registers used by
24-
///< this instruction
24+
///< this instruction
2525
uint16_t regs_mod[MAX_IMPL_W_REGS]; ///< list of implicit registers modified
26-
///< by this instruction
26+
///< by this instruction
2727
unsigned char groups
2828
[MAX_NUM_GROUPS]; ///< list of group this instruction belong to
29-
bool branch; // branch instruction?
30-
bool indirect_branch; // indirect branch instruction?
29+
bool branch; // branch instruction?
30+
bool indirect_branch; // indirect branch instruction?
3131
#endif
3232
} insn_map;
3333

@@ -43,11 +43,11 @@ unsigned int find_cs_id(unsigned MC_Opcode, const insn_map *imap,
4343

4444
///< A LLVM<->CS Mapping entry of an MCOperand.
4545
typedef struct {
46-
uint8_t /* cs_op_type */ type; ///< Operand type (e.g.: reg, imm, mem)
46+
uint8_t /* cs_op_type */ type; ///< Operand type (e.g.: reg, imm, mem)
4747
uint8_t /* cs_ac_type */ access; ///< The access type (read, write)
48-
uint8_t /* cs_data_type */
48+
uint8_t /* cs_data_type */
4949
dtypes[MAX_NO_DATA_TYPES]; ///< List of op types. Terminated by
50-
///< CS_DATA_TYPE_LAST
50+
///< CS_DATA_TYPE_LAST
5151
} mapping_op;
5252

5353
#define MAX_NO_INSN_MAP_OPS 16
@@ -71,16 +71,16 @@ const cs_ac_type mapping_get_op_access(MCInst *MI, unsigned OpNum,
7171
/// Macro for easier access of operand types from the map.
7272
/// Assumes the istruction operands map is called "insn_operands"
7373
/// Only usable by `auto-sync` archs!
74-
#define map_get_op_type(MI, OpNum) \
74+
#define map_get_op_type(MI, OpNum) \
7575
mapping_get_op_type(MI, OpNum, (const map_insn_ops *)insn_operands, \
7676
sizeof(insn_operands) / sizeof(insn_operands[0]))
7777

7878
/// Macro for easier access of operand access flags from the map.
7979
/// Assumes the istruction operands map is called "insn_operands"
8080
/// Only usable by `auto-sync` archs!
81-
#define map_get_op_access(MI, OpNum) \
81+
#define map_get_op_access(MI, OpNum) \
8282
mapping_get_op_access(MI, OpNum, (const map_insn_ops *)insn_operands, \
83-
sizeof(insn_operands) / \
83+
sizeof(insn_operands) / \
8484
sizeof(insn_operands[0]))
8585

8686
///< Map for ids to their string
@@ -115,17 +115,17 @@ DECL_get_detail_op(ppc, PPC);
115115
DECL_get_detail_op(tricore, TriCore);
116116

117117
/// Increments the detail->arch.op_count by one.
118-
#define DEFINE_inc_detail_op_count(arch, ARCH) \
118+
#define DEFINE_inc_detail_op_count(arch, ARCH) \
119119
static inline void ARCH##_inc_op_count(MCInst *MI) \
120-
{ \
121-
MI->flat_insn->detail->arch.op_count++; \
120+
{ \
121+
MI->flat_insn->detail->arch.op_count++; \
122122
}
123123

124124
/// Decrements the detail->arch.op_count by one.
125-
#define DEFINE_dec_detail_op_count(arch, ARCH) \
125+
#define DEFINE_dec_detail_op_count(arch, ARCH) \
126126
static inline void ARCH##_dec_op_count(MCInst *MI) \
127-
{ \
128-
MI->flat_insn->detail->arch.op_count--; \
127+
{ \
128+
MI->flat_insn->detail->arch.op_count--; \
129129
}
130130

131131
DEFINE_inc_detail_op_count(arm, ARM);
@@ -148,11 +148,11 @@ static inline void set_doing_mem(const MCInst *MI, bool status)
148148
}
149149

150150
/// Returns detail->arch
151-
#define DEFINE_get_arch_detail(arch, ARCH) \
152-
static inline cs_##arch *ARCH##_get_detail(const MCInst *MI) \
153-
{ \
151+
#define DEFINE_get_arch_detail(arch, ARCH) \
152+
static inline cs_##arch *ARCH##_get_detail(const MCInst *MI) \
153+
{ \
154154
assert(MI && MI->flat_insn && MI->flat_insn->detail); \
155-
return &MI->flat_insn->detail->arch; \
155+
return &MI->flat_insn->detail->arch; \
156156
}
157157

158158
DEFINE_get_arch_detail(arm, ARM);

arch/TriCore/TriCoreMapping.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ const char *TriCore_group_name(csh handle, unsigned int id)
125125
#ifndef CAPSTONE_DIET
126126
/// A LLVM<->CS Mapping entry of an operand.
127127
typedef struct insn_op {
128-
uint8_t /* cs_op_type */ type; ///< Operand type (e.g.: reg, imm, mem)
128+
uint8_t /* cs_op_type */ type; ///< Operand type (e.g.: reg, imm, mem)
129129
uint8_t /* cs_ac_type */ access; ///< The access type (read, write)
130-
uint8_t /* cs_data_type */
130+
uint8_t /* cs_data_type */
131131
dtypes[10]; ///< List of op types. Terminated by CS_DATA_TYPE_LAST
132132
} insn_op;
133133

0 commit comments

Comments
 (0)