@@ -45,7 +45,7 @@ DILDiagnosticError::DILDiagnosticError(llvm::StringRef expr,
4545}
4646
4747llvm::Expected<lldb::TypeSystemSP>
48- DILGetTypeSystemFromCU (std::shared_ptr<StackFrame> ctx) {
48+ GetTypeSystemFromCU (std::shared_ptr<StackFrame> ctx) {
4949 SymbolContext symbol_context =
5050 ctx->GetSymbolContext (lldb::eSymbolContextCompUnit);
5151 lldb::LanguageType language = symbol_context.comp_unit ->GetLanguage ();
@@ -102,18 +102,14 @@ ResolveTypeByName(const std::string &name,
102102 for (uint32_t i = 0 ; i < result_type_list.size (); ++i) {
103103 CompilerType type = result_type_list[i];
104104 llvm::StringRef type_name_ref = type.GetTypeName ().GetStringRef ();
105- ;
106105
107- if (type_name_ref == name_ref)
108- full_match = type;
109- else if (type_name_ref.ends_with (name_ref))
106+ if (type_name_ref == name_ref && type.IsValid ())
107+ return type;
108+
109+ if (type_name_ref.ends_with (name_ref))
110110 partial_matches.push_back (type);
111111 }
112112
113- // Full match is always correct.
114- if (full_match.IsValid ())
115- return full_match;
116-
117113 // If we have partial matches, pick a "random" one.
118114 if (partial_matches.size () > 0 )
119115 return partial_matches.back ();
@@ -198,8 +194,6 @@ ASTNodeUP DILParser::ParseCastExpression() {
198194 m_dil_lexer.Advance ();
199195 auto rhs = ParseCastExpression ();
200196
201- // return BuildCStyleCast(type_id.value(), std::move(rhs),
202- // token.GetLocation());
203197 return std::make_unique<CStyleCastNode>(
204198 loc, type_id.value (), std::move (rhs), CStyleCastKind::eNone);
205199 }
@@ -436,7 +430,7 @@ std::optional<CompilerType> DILParser::ParseTypeId(bool must_be_type_id) {
436430 CompilerType type;
437431 if (type_decl.m_is_builtin ) {
438432 llvm::Expected<lldb::TypeSystemSP> type_system =
439- DILGetTypeSystemFromCU (m_ctx_scope);
433+ GetTypeSystemFromCU (m_ctx_scope);
440434 if (!type_system)
441435 return {};
442436 // type = GetBasicType(m_ctx_scope, type_decl.GetBasicType());
@@ -751,11 +745,7 @@ bool DILParser::HandleSimpleTypeSpecifier(TypeDeclaration *type_decl) {
751745 uint32_t loc = CurToken ().GetLocation ();
752746 std::string kind = CurToken ().GetSpelling ();
753747
754- // switch (kind) {
755748 if (kind == " int" ) {
756- // case Token::kw_int: {
757- // "int" can have signedness and be combined with "short", "long" and
758- // "long long" (but not with another "int").
759749 if (type_decl->m_has_int_specifier ) {
760750 BailOut (" cannot combine with previous 'int' declaration specifier" , loc,
761751 CurToken ().GetSpelling ().length ());
0 commit comments