[Lldb-commits] [lldb] [LLDB] Add AST node classes, functions, etc. for Data Inspection Lang… (PR #95738)
Andy Hippo via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 27 13:21:12 PDT 2024
================
@@ -0,0 +1,165 @@
+(* LLDB Debug Expressions, a subset of C++ *)
+(* Insired by https://www.nongnu.org/hcb *)
+
+expression = assignment_expression ;
+
+assignment_expression = conditional_expression
+ logical_or_expression assignment_operator assignment_expression ;
+
+assignment_operator = "="
+ | "*="
+ | "/="
+ | "%="
+ | "+="
+ | "-="
+ | ">>="
+ | "<<="
+ | "&="
+ | "^="
+ | "|=" ;
+
+conditional_expression = logical_or_expression
+ | logical_or_expression "?" expression ":" assignment_expression ;
+
+logical_or_expression = logical_and_expression {"||" logical_and_expression} ;
+
+logical_and_expression = inclusive_or_expression {"&&" inclusive_or_expression} ;
+
+inclusive_or_expression = exclusive_or_expression {"|" exclusive_or_expression} ;
+
+exclusive_or_expression = and_expression {"^" and_expression} ;
+
+and_expression = equality_expression {"&" equality_expression} ;
+
+equality_expression = relational_expression {"==" relational_expression}
+ | relational_expression {"!=" relational_expression} ;
+
+relational_expression = shift_expression {"<" shift_expression}
+ | shift_expression {">" shift_expression}
+ | shift_expression {"<=" shift_expression}
+ | shift_expression {">=" shift_expression} ;
+
+shift_expression = additive_expression {"<<" additive_expression}
+ | additive_expression {">>" additive_expression} ;
+
+additive_expression = multiplicative_expression {"+" multiplicative_expression}
+ | multiplicative_expression {"-" multiplicative_expression} ;
+
+multiplicative_expression = cast_expression {"*" cast_expression}
+ | cast_expression {"/" cast_expression}
+ | cast_expression {"%" cast_expression} ;
+
+cast_expression = unary_expression
+ | "(" type_id ")" cast_expression ;
+
+unary_expression = postfix_expression
+ | "++" cast_expression
+ | "--" cast_expression
+ | unary_operator cast_expression
+ | "sizeof" unary_expression
+ | "sizeof" "(" type_id ")" ;
+
+unary_operator = "*" | "&" | "+" | "-" | "!" | "~" ;
+
+postfix_expression = primary_expression
+ | postfix_expression "[" expression "]"
+ | postfix_expression "." id_expression
+ | postfix_expression "->" id_expression
+ | postfix_expression "++"
+ | postfix_expression "--"
+ | static_cast "<" type_id ">" "(" expression ")"
+ | dynamic_cast "<" type_id ">" "(" expression ")"
+ | reinterpret_cast "<" type_id ">" "(" expression ")" ;
+
+primary_expression = numeric_literal
+ | boolean_literal
+ | pointer_literal
+ | id_expression
+ | "this"
+ | "(" expression ")"
+ | builtin_func ;
+
+type_id = type_specifier_seq [abstract_declarator] ;
+
+type_specifier_seq = type_specifier [type_specifier_seq] ;
+
+type_specifier = simple_type_specifier
+ | cv_qualifier ;
+
+simple_type_specifier = ["::"] [nested_name_specifier] type_name
+ | "char"
+ | "char16_t"
+ | "char32_t"
+ | "wchar_t"
+ | "bool"
+ | "short"
+ | "int"
+ | "long"
+ | "signed"
+ | "unsigned"
+ | "float"
+ | "double"
+ | "void" ;
+
+nested_name_specifier = type_name "::"
+ | namespace_name '::'
+ | nested_name_specifier identifier "::"
+ | nested_name_specifier simple_template_id "::";
+
+type_name = class_name
+ | enum_name
+ | typedef_name
+ | simple_template_id ;
+
+class_name = identifier ;
+
+enum_name = identifier ;
+
+typedef_name = identifier ;
+
+simple_template_id = template_name "<" [template_argument_list] ">" ;
----------------
werat wrote:
Typically this is used in casts like `((Foo<int>)some_ptr)->field`. In the world of dynamic typing this is not necessary, however VisualStudio debugger doesn't support dynamic typing like this, so everyone is casting things.
https://github.com/llvm/llvm-project/pull/95738
More information about the lldb-commits
mailing list