Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang-Tidy fixes #757

Merged
merged 3 commits into from
Feb 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ private static void generateGroupClassHeader(
indent + " return *m_positionPtr;\n" +
indent + " }\n\n" +

indent + " // NOLINTNEXTLINE(readability-convert-member-functions-to-static)\n" +
indent + " std::uint64_t sbeCheckPosition(const std::uint64_t position)\n" +
indent + " {\n" +
indent + " if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false))\n" +
Expand Down Expand Up @@ -668,7 +669,7 @@ private void generateVarDataDescriptors(
sizeOfLengthField);

new Formatter(sb).format("\n" +
indent + " %4$s %1$sLength() const\n" +
indent + " SBE_NODISCARD %4$s %1$sLength() const\n" +
indent + " {\n" +
"%2$s" +
indent + " %4$s length;\n" +
Expand Down Expand Up @@ -1524,7 +1525,7 @@ private void generateArrayProperty(
if (encodingToken.encoding().primitiveType() == PrimitiveType.CHAR)
{
new Formatter(sb).format("\n" +
indent + " std::string get%1$sAsString() const\n" +
indent + " SBE_NODISCARD std::string get%1$sAsString() const\n" +
indent + " {\n" +
indent + " const char *buffer = m_buffer + m_offset + %2$d;\n" +
indent + " size_t length = 0;\n\n" +
Expand All @@ -1542,7 +1543,7 @@ private void generateArrayProperty(

new Formatter(sb).format("\n" +
indent + " #if __cplusplus >= 201703L\n" +
indent + " std::string_view get%1$sAsStringView() const SBE_NOEXCEPT\n" +
indent + " SBE_NODISCARD std::string_view get%1$sAsStringView() const SBE_NOEXCEPT\n" +
indent + " {\n" +
indent + " const char *buffer = m_buffer + m_offset + %2$d;\n" +
indent + " size_t length = 0;\n\n" +
Expand Down Expand Up @@ -1609,9 +1610,9 @@ private void generateJsonEscapedStringGetter(
"%2$s" +
indent + " std::ostringstream oss;\n" +
indent + " std::string s = get%1$sAsString();\n\n" +
indent + " for (auto c = s.cbegin(); c != s.cend(); c++)\n" +
indent + " for (const auto c : s)\n" +
indent + " {\n" +
indent + " switch (*c)\n" +
indent + " switch (c)\n" +
indent + " {\n" +
indent + " case '\"': oss << \"\\\\\\\"\"; break;\n" +
indent + " case '\\\\': oss << \"\\\\\\\\\"; break;\n" +
Expand All @@ -1621,14 +1622,14 @@ private void generateJsonEscapedStringGetter(
indent + " case '\\r': oss << \"\\\\r\"; break;\n" +
indent + " case '\\t': oss << \"\\\\t\"; break;\n\n" +
indent + " default:\n" +
indent + " if ('\\x00' <= *c && *c <= '\\x1f')\n" +
indent + " if ('\\x00' <= c && c <= '\\x1f')\n" +
indent + " {\n" +
indent + " oss << \"\\\\u\"" + " << std::hex << std::setw(4)\n" +
indent + " << std::setfill('0') << (int)(*c);\n" +
indent + " << std::setfill('0') << (int)(c);\n" +
indent + " }\n" +
indent + " else\n" +
indent + " {\n" +
indent + " oss << *c;\n" +
indent + " oss << c;\n" +
indent + " }\n" +
indent + " }\n" +
indent + " }\n\n" +
Expand Down Expand Up @@ -1988,6 +1989,7 @@ private CharSequence generateMessageFlyweightCode(final String className, final
" return m_position;\n" +
" }\n\n" +

" // NOLINTNEXTLINE(readability-convert-member-functions-to-static)\n" +
" std::uint64_t sbeCheckPosition(const std::uint64_t position)\n" +
" {\n" +
" if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false))\n" +
Expand Down