0x8000-0000 (Florin Iucha)
User

Projects

User does not belong to any projects.

User Details

User Since
Mon, Jul 9, 5:24 PM (1 w, 4 d)

Recent Activity

Thu, Jul 19

0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Avoid parsing and reformatting the input literal - just print the original source code.

Thu, Jul 19, 11:08 PM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".
./tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -clang-tidy-binary ../llvm.rel/bin/clang-tidy -checks="-*,readability-magic-numbers" -j 12 -p ../llvm.rel -j 12 -quiet > /tmp/llvm.magic
grep "warning:" /tmp/llvm.magic | cut -d: -f5 | cut -d" " -f2 | sort | uniq -c | sort -rn | head -40
Thu, Jul 19, 10:33 PM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Filter out synthetic integers (such as _LINE_) from the report.

Thu, Jul 19, 9:20 PM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Add a (presently failing) test for not tripping up on LINE through several layers of macro expansion (as in GoogleTest library). This creates a lot of false positives in the unit tests and needs to be fixed.

Thu, Jul 19, 8:04 PM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Small refactoring and documentation update.

Thu, Jul 19, 4:56 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Thu, Jul 19, 3:00 PM

Wed, Jul 18

0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Wed, Jul 18, 7:18 PM
0x8000-0000 added a comment to D45444: [clang-tidy] implement new check for const-correctness.

Any plans for fix-its that will add the suggested 'const' qualifiers?

Wed, Jul 18, 7:16 PM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Significant refactoring to address review comments - mainly to reduce duplication and implement in functional style.

Wed, Jul 18, 7:15 PM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

I think this requires a separate discussion - do we accept magic values only when they are used directly to initialize a constant of the same type? Or do we allow them generically when they are used to initialize any constant? Or do we only accept several layers of nesting, but not too much?

Wed, Jul 18, 5:13 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Wed, Jul 18, 5:06 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Wed, Jul 18, 4:48 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Wed, Jul 18, 3:08 PM

Tue, Jul 17

0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

florin@helios:~/tools/llvm$ find . -name .clang-format | sort
./.clang-format
./projects/compiler-rt/lib/asan/.clang-format
./projects/compiler-rt/lib/dfsan/.clang-format
./projects/compiler-rt/lib/hwasan/.clang-format
./projects/compiler-rt/lib/interception/.clang-format
./projects/compiler-rt/lib/lsan/.clang-format
./projects/compiler-rt/lib/msan/.clang-format
./projects/compiler-rt/lib/safestack/.clang-format
./projects/compiler-rt/lib/sanitizer_common/.clang-format
./projects/compiler-rt/lib/tsan/.clang-format
./projects/libcxxabi/.clang-format
./projects/libcxx/.clang-format
./projects/libunwind/.clang-format
./projects/lld/.clang-format
./projects/openmp/runtime/.clang-format
./test/.clang-format
./tools/clang/.clang-format
./tools/clang/test/.clang-format
./tools/clang/tools/extra/test/.clang-format
florin@helios:~/tools/llvm$ cat ./tools/clang/tools/extra/test/.clang-format
BasedOnStyle: LLVM
ColumnLimit: 0

Tue, Jul 17, 6:12 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Tue, Jul 17, 6:06 PM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Address several review comments. Create alias for cppcoreguidelines-avoid-magic-numbers .

Tue, Jul 17, 5:13 PM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

@Eugene.Zelenko thank you for suggesting the alias - I didn't know it is that easy, but a grep on "alias" led me to the right place.

Tue, Jul 17, 4:27 PM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

@aaron.ballman , @JonasToth , @Eugene.Zelenko Is there anything missing from this patch? What do I need to do to get it merged? This is my first contribution to LLVM so I'm not quite sure. Thank you!

Tue, Jul 17, 3:43 AM
0x8000-0000 added a comment to D45444: [clang-tidy] implement new check for const-correctness.

@0x8000-0000 are you interested in working on the check? If i recall correctly the branch for 7.0 will happen on 1. august. That would be the timewindow in which it makes sense to give you the patch. I will have time in september following, but not right now.
I try to commit 2 bug fixes in this time, because they are almost done already.

Tue, Jul 17, 3:41 AM

Sat, Jul 14

0x8000-0000 added a comment to D45444: [clang-tidy] implement new check for const-correctness.

Time :/

Sat, Jul 14, 11:59 AM

Fri, Jul 13

0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Accept magic values arbitrarily deep in a constant initialization

Fri, Jul 13, 10:12 PM

Wed, Jul 11

0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

Remove extraneous .html. Sorry for not seeing it earlier.

Wed, Jul 11, 5:06 PM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Fix typo

Wed, Jul 11, 5:06 PM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

Thank you for your review @Eugene.Zelenko

Wed, Jul 11, 4:41 PM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Update documentation to clean up formatting

Wed, Jul 11, 4:40 PM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Updated examples code and added several references

Wed, Jul 11, 4:01 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Wed, Jul 11, 3:23 PM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

C++ Core Guidelines contains ES.45: Avoid "magic constants"; use symbolic constants, so I think check should be moved into cppcoreguidelines module.

Wed, Jul 11, 3:19 PM

Tue, Jul 10

0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Incorporate review comments. Add support for floating point detection.

Tue, Jul 10, 7:24 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Tue, Jul 10, 6:42 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Tue, Jul 10, 4:30 PM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

I think some of the logic you have in your check code could be done via matchers. That is usually better for performance, because you analyze less code.

Tue, Jul 10, 3:54 AM

Mon, Jul 9

0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Mon, Jul 9, 8:08 PM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

The cult of "no magic numbers" is horrible and we should be trying to deprogram its adherents, not create a whole new generation of them. I would be happy if this clang-tidy patch were quickly abandoned. But, it's just a clang-tidy check — it's easy for people who don't want it to ignore its existence — so I'll just plan to be in that group of people.

Mon, Jul 9, 8:05 PM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

I suspect that the check will be very noisy for powers of 2 and 10 that are used as multiplicands. You might wish to exclude those.

Mon, Jul 9, 6:51 PM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

Perhaps M_PI wasn't the best example, as its value won't change soon, but other numbers should be defined in relation to constants.

Mon, Jul 9, 6:36 PM
0x8000-0000 created D49114: [clang-tidy] Add a check for "magic numbers".
Mon, Jul 9, 5:44 PM