From 4efb2b33f998200bf74d03685e7fe9b523f3a343 Mon Sep 17 00:00:00 2001 From: emmmm <155267286+eeemmmmmm@users.noreply.github.com> Date: Wed, 2 Jul 2025 08:21:00 +0200 Subject: [PATCH 1/2] Replace string comparison with empty() method in DocStringParser --- libsolidity/parsing/DocStringParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsolidity/parsing/DocStringParser.cpp b/libsolidity/parsing/DocStringParser.cpp index b9f358e020a0..13e43a9488ed 100644 --- a/libsolidity/parsing/DocStringParser.cpp +++ b/libsolidity/parsing/DocStringParser.cpp @@ -163,7 +163,7 @@ DocStringParser::iter DocStringParser::parseDocTag(iter _pos, iter _end, std::st { // TODO: need to check for @(start of a tag) between here and the end of line // for all cases. - if (!m_lastTag || _tag != "") + if (!m_lastTag || !_tag.empty()) { if (_tag == "param") return parseDocTagParam(_pos, _end); From a81065a01e9b0d3ab10849d3b2ca50f2bc9af6fd Mon Sep 17 00:00:00 2001 From: emmmm <155267286+eeemmmmmm@users.noreply.github.com> Date: Wed, 2 Jul 2025 08:21:32 +0200 Subject: [PATCH 2/2] Replace string comparison with empty() method in Parser --- libsolidity/parsing/Parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 8889e65087fa..ddffdb600229 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -217,7 +217,7 @@ void Parser::parsePragmaVersion(SourceLocation const& _location, std::vector Parser::parseStructuredDocumentation() { - if (m_scanner->currentCommentLiteral() != "") + if (!m_scanner->currentCommentLiteral().empty()) { ASTNodeFactory nodeFactory{*this}; nodeFactory.setLocation(m_scanner->currentCommentLocation()); @@ -1445,7 +1445,7 @@ ASTPointer Parser::parseStatement(bool _allowUnchecked) RecursionGuard recursionGuard(*this); ASTPointer docString; ASTPointer statement; - if (m_scanner->currentCommentLiteral() != "") + if (!m_scanner->currentCommentLiteral().empty()) docString = std::make_shared(m_scanner->currentCommentLiteral()); switch (m_scanner->currentToken()) {