Switch kernel header parsing to python libclang

Replace the tokenizer in cpp.py with libclang.

Bug: 18937958
Change-Id: I27630904c6d2849418cd5ca3d3c612ec3078686d
diff --git a/libc/kernel/uapi/linux/can/bcm.h b/libc/kernel/uapi/linux/can/bcm.h
index 72c36bf..25d71e8 100644
--- a/libc/kernel/uapi/linux/can/bcm.h
+++ b/libc/kernel/uapi/linux/can/bcm.h
@@ -22,32 +22,32 @@
 #include <linux/can.h>
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 struct bcm_msg_head {
- __u32 opcode;
- __u32 flags;
- __u32 count;
+  __u32 opcode;
+  __u32 flags;
+  __u32 count;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- struct timeval ival1, ival2;
- canid_t can_id;
- __u32 nframes;
- struct can_frame frames[0];
+  struct timeval ival1, ival2;
+  canid_t can_id;
+  __u32 nframes;
+  struct can_frame frames[0];
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
 enum {
- TX_SETUP = 1,
- TX_DELETE,
+  TX_SETUP = 1,
+  TX_DELETE,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- TX_READ,
- TX_SEND,
- RX_SETUP,
- RX_DELETE,
+  TX_READ,
+  TX_SEND,
+  RX_SETUP,
+  RX_DELETE,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- RX_READ,
- TX_STATUS,
- TX_EXPIRED,
- RX_STATUS,
+  RX_READ,
+  TX_STATUS,
+  TX_EXPIRED,
+  RX_STATUS,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- RX_TIMEOUT,
- RX_CHANGED
+  RX_TIMEOUT,
+  RX_CHANGED
 };
 #define SETTIMER 0x0001
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/uapi/linux/can/gw.h b/libc/kernel/uapi/linux/can/gw.h
index cafc1ec..37703fe 100644
--- a/libc/kernel/uapi/linux/can/gw.h
+++ b/libc/kernel/uapi/linux/can/gw.h
@@ -22,38 +22,38 @@
 #include <linux/can.h>
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 struct rtcanmsg {
- __u8 can_family;
- __u8 gwtype;
- __u16 flags;
+  __u8 can_family;
+  __u8 gwtype;
+  __u16 flags;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
 enum {
- CGW_TYPE_UNSPEC,
- CGW_TYPE_CAN_CAN,
+  CGW_TYPE_UNSPEC,
+  CGW_TYPE_CAN_CAN,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __CGW_TYPE_MAX
+  __CGW_TYPE_MAX
 };
 #define CGW_TYPE_MAX (__CGW_TYPE_MAX - 1)
 enum {
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- CGW_UNSPEC,
- CGW_MOD_AND,
- CGW_MOD_OR,
- CGW_MOD_XOR,
+  CGW_UNSPEC,
+  CGW_MOD_AND,
+  CGW_MOD_OR,
+  CGW_MOD_XOR,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- CGW_MOD_SET,
- CGW_CS_XOR,
- CGW_CS_CRC8,
- CGW_HANDLED,
+  CGW_MOD_SET,
+  CGW_CS_XOR,
+  CGW_CS_CRC8,
+  CGW_HANDLED,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- CGW_DROPPED,
- CGW_SRC_IF,
- CGW_DST_IF,
- CGW_FILTER,
+  CGW_DROPPED,
+  CGW_SRC_IF,
+  CGW_DST_IF,
+  CGW_FILTER,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- CGW_DELETED,
- CGW_LIM_HOPS,
- __CGW_MAX
+  CGW_DELETED,
+  CGW_LIM_HOPS,
+  __CGW_MAX
 };
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define CGW_MAX (__CGW_MAX - 1)
@@ -69,41 +69,41 @@
 #define CGW_FRAME_MODS 3
 #define MAX_MODFUNCTIONS (CGW_MOD_FUNCS * CGW_FRAME_MODS)
 struct cgw_frame_mod {
- struct can_frame cf;
+  struct can_frame cf;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 modtype;
+  __u8 modtype;
 } __attribute__((packed));
 #define CGW_MODATTR_LEN sizeof(struct cgw_frame_mod)
 struct cgw_csum_xor {
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __s8 from_idx;
- __s8 to_idx;
- __s8 result_idx;
- __u8 init_xor_val;
+  __s8 from_idx;
+  __s8 to_idx;
+  __s8 result_idx;
+  __u8 init_xor_val;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 } __attribute__((packed));
 struct cgw_csum_crc8 {
- __s8 from_idx;
- __s8 to_idx;
+  __s8 from_idx;
+  __s8 to_idx;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __s8 result_idx;
- __u8 init_crc_val;
- __u8 final_xor_val;
- __u8 crctab[256];
+  __s8 result_idx;
+  __u8 init_crc_val;
+  __u8 final_xor_val;
+  __u8 crctab[256];
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 profile;
- __u8 profile_data[20];
+  __u8 profile;
+  __u8 profile_data[20];
 } __attribute__((packed));
 #define CGW_CS_XOR_LEN sizeof(struct cgw_csum_xor)
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define CGW_CS_CRC8_LEN sizeof(struct cgw_csum_crc8)
 enum {
- CGW_CRC8PRF_UNSPEC,
- CGW_CRC8PRF_1U8,
+  CGW_CRC8PRF_UNSPEC,
+  CGW_CRC8PRF_1U8,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- CGW_CRC8PRF_16U8,
- CGW_CRC8PRF_SFFID_XOR,
- __CGW_CRC8PRF_MAX
+  CGW_CRC8PRF_16U8,
+  CGW_CRC8PRF_SFFID_XOR,
+  __CGW_CRC8PRF_MAX
 };
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define CGW_CRC8PRF_MAX (__CGW_CRC8PRF_MAX - 1)
diff --git a/libc/kernel/uapi/linux/can/netlink.h b/libc/kernel/uapi/linux/can/netlink.h
index dc8f393..96a90ff 100644
--- a/libc/kernel/uapi/linux/can/netlink.h
+++ b/libc/kernel/uapi/linux/can/netlink.h
@@ -21,54 +21,54 @@
 #include <linux/types.h>
 struct can_bittiming {
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 bitrate;
- __u32 sample_point;
- __u32 tq;
- __u32 prop_seg;
+  __u32 bitrate;
+  __u32 sample_point;
+  __u32 tq;
+  __u32 prop_seg;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 phase_seg1;
- __u32 phase_seg2;
- __u32 sjw;
- __u32 brp;
+  __u32 phase_seg1;
+  __u32 phase_seg2;
+  __u32 sjw;
+  __u32 brp;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
 struct can_bittiming_const {
- char name[16];
- __u32 tseg1_min;
+  char name[16];
+  __u32 tseg1_min;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 tseg1_max;
- __u32 tseg2_min;
- __u32 tseg2_max;
- __u32 sjw_max;
+  __u32 tseg1_max;
+  __u32 tseg2_min;
+  __u32 tseg2_max;
+  __u32 sjw_max;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 brp_min;
- __u32 brp_max;
- __u32 brp_inc;
+  __u32 brp_min;
+  __u32 brp_max;
+  __u32 brp_inc;
 };
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 struct can_clock {
- __u32 freq;
+  __u32 freq;
 };
 enum can_state {
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- CAN_STATE_ERROR_ACTIVE = 0,
- CAN_STATE_ERROR_WARNING,
- CAN_STATE_ERROR_PASSIVE,
- CAN_STATE_BUS_OFF,
+  CAN_STATE_ERROR_ACTIVE = 0,
+  CAN_STATE_ERROR_WARNING,
+  CAN_STATE_ERROR_PASSIVE,
+  CAN_STATE_BUS_OFF,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- CAN_STATE_STOPPED,
- CAN_STATE_SLEEPING,
- CAN_STATE_MAX
+  CAN_STATE_STOPPED,
+  CAN_STATE_SLEEPING,
+  CAN_STATE_MAX
 };
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 struct can_berr_counter {
- __u16 txerr;
- __u16 rxerr;
+  __u16 txerr;
+  __u16 rxerr;
 };
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 struct can_ctrlmode {
- __u32 mask;
- __u32 flags;
+  __u32 mask;
+  __u32 flags;
 };
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define CAN_CTRLMODE_LOOPBACK 0x01
@@ -81,30 +81,30 @@
 #define CAN_CTRLMODE_PRESUME_ACK 0x40
 struct can_device_stats {
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 bus_error;
- __u32 error_warning;
- __u32 error_passive;
- __u32 bus_off;
+  __u32 bus_error;
+  __u32 error_warning;
+  __u32 error_passive;
+  __u32 bus_off;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 arbitration_lost;
- __u32 restarts;
+  __u32 arbitration_lost;
+  __u32 restarts;
 };
 enum {
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- IFLA_CAN_UNSPEC,
- IFLA_CAN_BITTIMING,
- IFLA_CAN_BITTIMING_CONST,
- IFLA_CAN_CLOCK,
+  IFLA_CAN_UNSPEC,
+  IFLA_CAN_BITTIMING,
+  IFLA_CAN_BITTIMING_CONST,
+  IFLA_CAN_CLOCK,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- IFLA_CAN_STATE,
- IFLA_CAN_CTRLMODE,
- IFLA_CAN_RESTART_MS,
- IFLA_CAN_RESTART,
+  IFLA_CAN_STATE,
+  IFLA_CAN_CTRLMODE,
+  IFLA_CAN_RESTART_MS,
+  IFLA_CAN_RESTART,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- IFLA_CAN_BERR_COUNTER,
- IFLA_CAN_DATA_BITTIMING,
- IFLA_CAN_DATA_BITTIMING_CONST,
- __IFLA_CAN_MAX
+  IFLA_CAN_BERR_COUNTER,
+  IFLA_CAN_DATA_BITTIMING,
+  IFLA_CAN_DATA_BITTIMING_CONST,
+  __IFLA_CAN_MAX
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
 #define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
diff --git a/libc/kernel/uapi/linux/can/raw.h b/libc/kernel/uapi/linux/can/raw.h
index 77cce9b..a70d881 100644
--- a/libc/kernel/uapi/linux/can/raw.h
+++ b/libc/kernel/uapi/linux/can/raw.h
@@ -22,12 +22,12 @@
 #define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 enum {
- CAN_RAW_FILTER = 1,
- CAN_RAW_ERR_FILTER,
- CAN_RAW_LOOPBACK,
+  CAN_RAW_FILTER = 1,
+  CAN_RAW_ERR_FILTER,
+  CAN_RAW_LOOPBACK,
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- CAN_RAW_RECV_OWN_MSGS,
- CAN_RAW_FD_FRAMES,
+  CAN_RAW_RECV_OWN_MSGS,
+  CAN_RAW_FD_FRAMES,
 };
 #endif
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */