diff mbox series

[4/6] wstring: add helper is_wchar_type()

Message ID 20200808161143.28272-5-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series teach sparse about wide string initializers | expand

Commit Message

Luc Van Oostenryck Aug. 8, 2020, 4:11 p.m. UTC
Like is_byte_type() but for wide chars.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 symbol.h | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/symbol.h b/symbol.h
index 8e7a286019c7..0e15f7bf6ba8 100644
--- a/symbol.h
+++ b/symbol.h
@@ -430,6 +430,13 @@  static inline int is_byte_type(struct symbol *type)
 	return type->bit_size == bits_in_char && type->type != SYM_BITFIELD;
 }
 
+static inline int is_wchar_type(struct symbol *type)
+{
+	if (type->type == SYM_NODE)
+		type = type->ctype.base_type;
+	return type == wchar_ctype;
+}
+
 static inline int is_void_type(struct symbol *type)
 {
 	if (type->type == SYM_NODE)