Page MenuHomePhabricator
Feed Advanced Search

Jan 12 2020

0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

As an aside, once this is merged in, I dream of a "fix-it" for old style C code:

int foo;

...
/* page of code which does not use either foo or bar */
...
foo = 5;

Moves the foo declaration to the line where it is actually first initialized. Then run the constify tool on top.

You are not first :-) See PR21983.

Jan 12 2020, 9:44 AM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

As an aside, once this is merged in, I dream of a "fix-it" for old style C code:

Jan 12 2020, 7:06 AM · Restricted Project, Restricted Project

Jan 11 2020

0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

One more mis-constification that I can't explain, nor reduce to a small test case (when I extract the code, the check behaves as expected / desired)

Jan 11 2020, 9:26 PM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

Summary of "misses"

Jan 11 2020, 8:41 PM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

I have built diff14 and tried to apply it on an internal code base with ~7500 translation units.

Jan 11 2020, 7:47 PM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

@0x8000-0000 i did remove dependentTypes from matching. Locally that works with your reported test-case (i was running clang-tidy wrong :().

I do understand the auto & issues now (i think).
If the type is deduced to a template-type or something that depends the standard ways of detecting that do not work, because in each template instantiation this information is not available.

Having a auto & local = TemplatedVariable does not have the isInstantiationDependentType()-bits set and for each instantiation of the template the const-analysis is run.
The false positives happened in different template instantiations, i think because the overloaded operators were sometimes const and sometimes not. I tried many ways to detect, if the type comes from a template, but had no success.
This is probably an issue in Sema or requires adjustments there.
I added tests in clang-tidy, but #if 0 them out because are not working right now.

Jan 11 2020, 9:06 AM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

Here is a minimal example that shows the problem:

I can not reproduce that case :(
It gives me a compilation error in const DoGooder anInstanceOf..., because DoGooder requires an template parameter. I then add DoGooder<int> and the variable gets no transformation.
Did you reproduce the error with exactly that code?

And which version did you run? Maybe that was a previous false positive, that might be fixed right now?

Jan 11 2020, 6:56 AM · Restricted Project, Restricted Project

Jan 10 2020

0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

Here is a minimal example that shows the problem:

Jan 10 2020, 7:34 PM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

Applied the fix-it on one of our smaller (but C++ code bases) and it builds and passes the tests. Comments:

  1. I'm still seeing some false positives, where some locals that are const are flagged as could be made const - I'm working to create a minimal reproduction recipe.
  2. We're a west const shop :) so adding a bunch of east-consts will not fly well. Is there a way to configure where 'const' is placed by the fixit? (Specifically 'auto const', we prefer it 'const auto').

Does it build now? I couldn't find a way to reproduce that and gave up, tbh.

  1. Template context? Auto involved? I saw some double-analysis for auto&, because clang-tidy didn't ignore those properly. And are you using run-clang-tidy? It deduplicates fixits, maybe that is involved?
  2. YesNo, The utility for adding const is able to do both, west const has problems with typedef int * MyType; scenarios, where the const will apply to the wrong thing. Doing that right requires special care. BUT: clang-format has a east-const/west-const feature now (i think new with this release). So I am now somewhat considering to let clang-format do that for me.

    Thanks again for taking a look at it. But if the issues you found are new, i think we should maybe not commit this weekend.
Jan 10 2020, 3:57 PM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

Applied the fix-it on one of our smaller (but C++ code bases) and it builds and passes the tests. Comments:

Jan 10 2020, 2:52 PM · Restricted Project, Restricted Project

Jan 6 2020

0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

This last version too builds with RelWithDebInfo and fails with Debug configuration (both clean builds).

So it only fails in debug-build?

Jan 6 2020, 4:34 PM · Restricted Project, Restricted Project

Jan 5 2020

0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.
  • Merge branch 'master' into feature_transform_const.patch
  • link clangAnalysis to the cppcoreguidelines-module
  • fix InitListExpr as well
Jan 5 2020, 5:02 PM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

I can't build this on top of current llvm-project tree (6a6e6f04ec2cd2f4f07ec4943036c5c2d47ce0c7):

/usr/bin/ld: lib/libclangTidyCppCoreGuidelinesModule.a(ConstCorrectnessCheck.cpp.o): in function `clang::tidy::cppcoreguidelines::ConstCorrectnessCheck::registerMatchers(clang::ast_matchers::MatchFinder*)':
/home/florin/tools/llvm-project/clang-tools-extra/clang-tidy/cppcoreguidelines/ConstCorrectnessCheck.cpp:65: undefined reference to `clang::ast_matchers::decompositionDecl'

I am building using clang++-9 from Debian, and diff7 applied cleanly.

Jonas, is it possible to rebase this on top of llvm-project and push it to a branch on https://github.com/JonasToth/llvm-project ?

I just merged master into the branch and pushed to feature_transform_const.patch branch in my fork. Maybe that works?
If you want you can join IRC, its faster to get this fixed there :)

Jan 5 2020, 10:48 AM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

I can't build this on top of current llvm-project tree (6a6e6f04ec2cd2f4f07ec4943036c5c2d47ce0c7):

Jan 5 2020, 10:33 AM · Restricted Project, Restricted Project
0x8000-0000 added inline comments to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.
Jan 5 2020, 8:03 AM · Restricted Project, Restricted Project

Jan 4 2020

0x8000-0000 added inline comments to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.
Jan 4 2020, 12:42 PM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

This patch does not build on top of current tree:

/usr/bin/ld: lib/libclangTidyCppCoreGuidelinesModule.a(ConstCorrectnessCheck.cpp.o): in function `clang::tidy::cppcoreguidelines::ConstCorrectnessCheck::registerMatchers(clang::ast_matchers::MatchFinder*)':
/home/florin/tools/llvm-project/clang-tools-extra/clang-tidy/cppcoreguidelines/ConstCorrectnessCheck.cpp:65: undefined reference to `clang::ast_matchers::decompositionDecl'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[2771/4997] Building CXX object tools/clang/tools/extra/clang-include-fixer/find-all-symbols/CMakeFiles/obj.findAllSymbols.dir/PragmaCommentHandler.cpp.o
ninja: build stopped: subcommand failed.

This is my top of the tree right now:

b7ecf1c1c373c53183ef6ef66efbe4237ff7b96d (origin/master, origin/HEAD, master) NFC: Fix trivial typos in comments

did the changes to clang/include/clang/ASTMatchers/ASTMatchers.h and clang/lib/ASTMatchers/Dynamic/Registry.cpp apply? They provide the decompositionDecl matcher. It seems odd, they are not available :/

Jan 4 2020, 11:56 AM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

This patch does not build on top of current tree:

Jan 4 2020, 8:41 AM · Restricted Project, Restricted Project
0x8000-0000 added inline comments to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.
Jan 4 2020, 7:41 AM · Restricted Project, Restricted Project
0x8000-0000 added inline comments to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.
Jan 4 2020, 7:31 AM · Restricted Project, Restricted Project

Jan 3 2020

0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

Indicated where the new test code should go.

Jan 3 2020, 6:59 PM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

shows a couple of false positives.

I added your tests, but some did not show false positives anymore. I think i will remove some, that i find redundant.
But could you please recheck with the current version first, if this is actually correct and the original false positives are gone?

Jan 3 2020, 6:58 PM · Restricted Project, Restricted Project

Dec 31 2019

0x8000-0000 added a comment to D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.

shows a couple of false positives.

Dec 31 2019, 2:41 PM · Restricted Project, Restricted Project

Dec 30 2019

Herald updated subscribers of D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness.
Dec 30 2019, 8:03 AM · Restricted Project, Restricted Project

Dec 22 2019

0x8000-0000 added a comment to D71686: Fix false positive in magic number checker.

@aaron.ballman updated as suggested; please commit/integrate when you have a moment. Thank you!

Dec 22 2019, 9:47 AM · Restricted Project, Restricted Project
0x8000-0000 updated the diff for D71686: Fix false positive in magic number checker.

Minor comment fixes; capitalization, full stop.

Dec 22 2019, 9:35 AM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D71686: Fix false positive in magic number checker.

My take: this change fixes a user-reported bug, and does not cause any known regressions. I think we should integrate this.

I sort of wonder whether we want to document this as a blessed approach to silencing the warning. I'm not certain if it's too obtuse or not, but I notice the check has no documented ways to silence the diagnostic aside from using the correct kind of magic number or adding it to a list of excluded magic numbers.

You mean Hyrum's Law is not sufficient?

The check can be silenced with the regular NOLINT, or with defining and using a constant/enum. Using this "backdoor" way seems even more cumbersome and confusing than the NOLINT. At least with NOLINT it is clear what you're doing, and somebody else can grep for it and fix it if it is appropriate.

My concern is that NOLINT is insufficient. Consider: foo(12, 42, 18); where the 42 is not desired to be warned about due to domain-specific knowledge but the 12 and 18 are.

However, I am not convinced that you're wrong either -- casting is cumbersome. But it's also a somewhat well-used workaround to silence warnings (casting to void silencing unused value warnings being a common example).

For right now, we can leave it as a bug -- we can decide to bless the approach later.

Dec 22 2019, 9:35 AM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D71686: Fix false positive in magic number checker.

My take: this change fixes a user-reported bug, and does not cause any known regressions. I think we should integrate this.

I sort of wonder whether we want to document this as a blessed approach to silencing the warning. I'm not certain if it's too obtuse or not, but I notice the check has no documented ways to silence the diagnostic aside from using the correct kind of magic number or adding it to a list of excluded magic numbers.

Dec 22 2019, 9:11 AM · Restricted Project, Restricted Project

Dec 21 2019

0x8000-0000 added a comment to D71686: Fix false positive in magic number checker.

My take: this change fixes a user-reported bug, and does not cause any known regressions. I think we should integrate this.

Dec 21 2019, 3:50 PM · Restricted Project, Restricted Project

Dec 20 2019

0x8000-0000 added inline comments to D71686: Fix false positive in magic number checker.
Dec 20 2019, 8:16 PM · Restricted Project, Restricted Project
0x8000-0000 updated the diff for D71686: Fix false positive in magic number checker.

Add a test file for expected failures

Dec 20 2019, 8:10 PM · Restricted Project, Restricted Project
0x8000-0000 added inline comments to D71686: Fix false positive in magic number checker.
Dec 20 2019, 5:48 PM · Restricted Project, Restricted Project
0x8000-0000 added inline comments to D71686: Fix false positive in magic number checker.
Dec 20 2019, 4:07 PM · Restricted Project, Restricted Project

Dec 19 2019

0x8000-0000 updated the diff for D71686: Fix false positive in magic number checker.

Fix typo.

Dec 19 2019, 5:47 PM · Restricted Project, Restricted Project
0x8000-0000 updated the diff for D71686: Fix false positive in magic number checker.

Update release notes.

Dec 19 2019, 5:44 PM · Restricted Project, Restricted Project

Dec 18 2019

0x8000-0000 added inline comments to D71686: Fix false positive in magic number checker.
Dec 18 2019, 8:11 PM · Restricted Project, Restricted Project
0x8000-0000 added reviewers for D71686: Fix false positive in magic number checker: alexfh, Eugene.Zelenko.
Dec 18 2019, 8:11 PM · Restricted Project, Restricted Project
0x8000-0000 created D71686: Fix false positive in magic number checker.
Dec 18 2019, 8:02 PM · Restricted Project, Restricted Project

Dec 8 2019

0x8000-0000 added a comment to D67265: [clang-tidy] Magic number checker shouldn't warn on user defined string literals.

@aaron.ballman - can you please review this patch and if you find it acceptable please integrate it?

Dec 8 2019, 9:41 AM · Restricted Project

Dec 7 2019

0x8000-0000 updated the diff for D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.

Small documentation fixes.

Dec 7 2019, 7:55 AM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.

LGTM aside from a few small things to correct.

Dec 7 2019, 7:20 AM · Restricted Project, Restricted Project

Dec 6 2019

0x8000-0000 updated the diff for D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.

Flipped the default to ignore bit fields. Moved static functions out of the anonymous namespace into the clang namespace.

Dec 6 2019, 3:11 PM · Restricted Project, Restricted Project
0x8000-0000 added inline comments to D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.
Dec 6 2019, 3:11 PM · Restricted Project, Restricted Project
0x8000-0000 added inline comments to D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.
Dec 6 2019, 2:15 PM · Restricted Project, Restricted Project
0x8000-0000 added inline comments to D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.
Dec 6 2019, 2:06 PM · Restricted Project, Restricted Project

Dec 5 2019

0x8000-0000 updated the diff for D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.

Updated release notes. Removed empty lines.

Dec 5 2019, 3:40 PM · Restricted Project, Restricted Project
0x8000-0000 added inline comments to D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.
Dec 5 2019, 3:22 PM · Restricted Project, Restricted Project
0x8000-0000 added a comment to D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.

Please mention new option in Release Notes (changes section, in alphabetical order).

Dec 5 2019, 3:22 PM · Restricted Project, Restricted Project
0x8000-0000 updated the diff for D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.

Document the new 'IgnoreBitFieldsWidths' option.

Dec 5 2019, 4:23 AM · Restricted Project, Restricted Project

Dec 4 2019

0x8000-0000 updated the diff for D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.

Simplified the test cases by removing extraneous code.

Dec 4 2019, 8:16 PM · Restricted Project, Restricted Project
0x8000-0000 removed a reviewer for D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check: lebedev.ri.
Dec 4 2019, 7:48 PM · Restricted Project, Restricted Project
0x8000-0000 created D71043: [clang-tidy] Exclude bitfield definitions from magic numbers check.
Dec 4 2019, 7:48 PM · Restricted Project, Restricted Project

Dec 3 2019

0x8000-0000 added a comment to D45444: [clang-tidy] implement new check for const-correctness.
Dec 3 2019, 6:18 PM · Restricted Project

Dec 2 2019

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

Thank you for rebasing on current master.

Dec 2 2019, 3:44 PM · Restricted Project

Sep 6 2019

0x8000-0000 accepted D67265: [clang-tidy] Magic number checker shouldn't warn on user defined string literals.

Looks good to me. Thank you for the fix.

Sep 6 2019, 5:45 AM · Restricted Project

Aug 12 2018

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

Alex has had plenty of time to respond, so I'm fine handling any concerns he has post-commit. Do you need me to commit this on your behalf?

Aug 12 2018, 7:05 AM

Aug 11 2018

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

Rebased on curent master.

Aug 11 2018, 12:27 PM

Aug 5 2018

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

Address several style comments. Rebase to current trunk (8.0).

Aug 5 2018, 9:07 AM

Jul 31 2018

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

Add reference to 5.1.1 Use symbolic names instead of literal values in code in the documentation.

Jul 31 2018, 7:05 PM
0x8000-0000 updated the summary of D49114: [clang-tidy] Add a check for "magic numbers".
Jul 31 2018, 7:02 PM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Add tests to show that we can detect, report and ignore floating point numbers represented using hexadecimal notation

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

The state of this patch:

  • user interface is as agreed-upon, giving end-users the capability to filter out floats and ints as it makes sense for their code base
  • code is clean
  • documentation is up to date
  • default ignore lists are sensible
Jul 31 2018, 4:45 AM

Jul 29 2018

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

Update the list of magic values ignored by default.

Jul 29 2018, 1:15 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 29 2018, 12:58 PM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

Based on this, I think the integer list should also include 2, 3, and 4 as defaults -- those show up a lot more than I'd have expected. As for floating-point values, 1.0 certainly jumps out at me, but none of the rest seem particularly common. What do you think?

Jul 29 2018, 11:58 AM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 29 2018, 11:46 AM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 29 2018, 11:29 AM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

Top 40 magic numbers in https://github.com/qt/qtbase

4859 2
2901 3
1855 4
 985 5
 968 8
 605 6
 600 7
 439 16
 432 10
 363 
 356 32
 241 1.0f
 217 12
 209 255
 207 100
 205 9
 205 20
 204 50
 177 0.5
 174 15
 162 0x2
 144 24
 140 0x80
 135 11
 127 256
 113 14
 110 0xff
 101 1.0
  99 64
  99 200
  96 13
  86 30
  84 1000
  68 18
  66 150
  62 127
  62 0xFF
  58 19
  58 0.05f
  57 128
Jul 29 2018, 11:26 AM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Add a flag to ignore all powers of two integral values.

Jul 29 2018, 10:27 AM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 29 2018, 9:43 AM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 29 2018, 9:31 AM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 29 2018, 9:14 AM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 29 2018, 8:56 AM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 29 2018, 8:27 AM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 29 2018, 7:22 AM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

See inline comments. Basically we need two arrays because APFloats of different semantics don't compare well, and even if we coerce them, they sometimes are not equal.

Jul 29 2018, 6:51 AM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Indicate that 0 and 0.0 are accepted unconditionally (because it makes sense in the source code, and speeds-up many checks as 0s are very common and we don't want to spend log2(n) to find them at the beginning of the vector).

Jul 29 2018, 6:43 AM

Jul 28 2018

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

Add support for ignoring specific floating point numbers.

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

Not trying to be difficult here - I have attempted to implement the straight-forward check.

Jul 28 2018, 6:27 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 28 2018, 1:31 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 28 2018, 11:23 AM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Add option to ignore all floating point values.

Jul 28 2018, 11:17 AM
0x8000-0000 added a comment to D49114: [clang-tidy] Add a check for "magic numbers".

I will add one more option: IgnoreFloatingPointValues, to ignore all floats and doubles, because the FloatingLiteral does not distinguish between them (as implementation detail), and I don't see a good reason to be strict about doubles and lenient about floats, or viceversa. The default value for this option is false.

Jul 28 2018, 10:53 AM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 28 2018, 10:47 AM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 28 2018, 10:46 AM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 28 2018, 10:13 AM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Address review comments to improve documentation and readability

Jul 28 2018, 10:07 AM

Jul 26 2018

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

Remove extra verbose namespaces and update documentation to indicate why -1 is accepted even when not explicitly called out.

Jul 26 2018, 5:23 PM
0x8000-0000 added inline comments to D49114: [clang-tidy] Add a check for "magic numbers".
Jul 26 2018, 5:14 PM

Jul 24 2018

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

Update links in documentation

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

Fix a few typos

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

@aaron.ballman , @JonasToth , @Eugene.Zelenko - would you be so kind to do one more review pass and let me know if there are any blockers or if this is ready to merge? I do not have commit privileges, so if it is alright, feel free to merge it.

Jul 24 2018, 6:56 PM
0x8000-0000 updated the diff for D49114: [clang-tidy] Add a check for "magic numbers".

Bail out early if a [grand-]parent node is a declaration, but not a constant declaration.
Search for enumerations and declarations in the same tree traversal.

Jul 24 2018, 4:18 AM

Jul 23 2018

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

Ignore literals implicitly added by the compiler, such as when using a range-for loop over a constant array.

Jul 23 2018, 6:25 PM

Jul 19 2018

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.

Jul 19 2018, 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
Jul 19 2018, 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. All the tests are passing now.

Jul 19 2018, 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.

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

Small refactoring and documentation update.

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