================
@@ -274,6 +323,81 @@ std::string DILParser::ParseNestedNameSpecifier() {
}
}
+// Parse a type_id.
+//
+// type_id:
+// type_specifier_seq [abstract_declarator]
+//
+// type_specifier_seq:
+// type_specifier [type_specifier]
+//
+// type_specifier:
+// ["::"] [nested_name_specifier] type_name // not handled for now!
+// builtin_typename
+//
+std::optional<CompilerType> DILParser::ParseTypeId() {
+ CompilerType type;
+ // For now only allow builtin types -- will expand add to this later.
+ auto maybe_builtin_type = ParseBuiltinType();
+ if (maybe_builtin_type) {
+ type = *maybe_builtin_type;
+ } else
+ return {};
+
+ //
+ // abstract_declarator:
+ // ptr_operator [abstract_declarator]
+ //
+ std::vector<Token> ptr_operators;
+ while (CurToken().IsOneOf({Token::star, Token::amp})) {
+ Token tok = CurToken();
+ ptr_operators.push_back(std::move(tok));
+ m_dil_lexer.Advance();
+ }
+ type = ResolveTypeDeclarators(type, ptr_operators);
+
+ return type;
+}
+
+// Parse a built-in type
+//
+// builtin_typename:
+// identifer_seq
+//
+// identifier_seq
+// identifer [identifier_seq]
+//
+// A built-in type can be a single identifier or a space-separated
+// list of identifiers (e.g. "short" or "long long").
+std::optional<CompilerType> DILParser::ParseBuiltinType() {
+ std::string type_name = "";
+ uint32_t save_token_idx = m_dil_lexer.GetCurrentTokenIdx();
+ bool first_word = true;
+ while (CurToken().GetKind() == Token::identifier) {
+ if (CurToken().GetSpelling() == "const" ||
+ CurToken().GetSpelling() == "volatile")
----------------
kuilpd wrote:
>From what I understand, only `const_cast` can be used to cast to
>cv-qualifiers. The compiler also drops them when using a C-style cast.
https://github.com/llvm/llvm-project/pull/165199
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits