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 #1286

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Clang tidy #1286

wants to merge 4 commits into from

Conversation

uqs
Copy link
Contributor

@uqs uqs commented Nov 27, 2020

Various clang-tidy inspired cleanups, they shrink the binary size by about 4k :)

They should speed things up as the Position ctor will be called less often.

I'm a bit surprised about the float math though, sure on a i386 it was faster than double math, but these days?

This is in addition to generating Makefiles or Ninja files. It can be
used by various LLVM tooling like clang-tidy or YouCompleteMe
Ran: clang-tidy -p . -header-filter=".*" "-checks=-*,performance-inefficient-string-concatenation" -fix **/*.cpp

To solve: warning: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation]
floor(3) as used previously is the libc floor, which takes a double
always, so the cast to float is superfluous. floorf(3) would take a
float argument, but instead of switching to that, use std::floor which
has the proper overload for double/float, and as of C++11 also has one
for integral types, so use that directly.

The clang-tidy fixes were massaged manually, as it wasn't quite as
smart.
The fixes that added std::move (C++11 only) were manually reverted
again. This sprinkles a ton of const refs all over the place, obviating
the need to copy-construct Position all the time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant