This is implemented originally by Alexander Kornienko.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Thanks! A few comments.
clang-tidy/google/NonConstReferences.cpp | ||
---|---|---|
54 ↗ | (On Diff #46510) | This could be auto to avoid duplicating the type name. |
81 ↗ | (On Diff #46510) | The return should be on the next line (clang-format -style=llvm should get this right). |
105 ↗ | (On Diff #46510) | We can avoid calling (the more expensive) getNameAsString here: if (Function->getDeclName().isIdentifier() && Function->getName() == "swap") ... |
109 ↗ | (On Diff #46510) | I'd better avoid calling getAsString here as well, but I don't see an easy way to do this. |
test/clang-tidy/google-runtime-references.cpp | ||
1 ↗ | (On Diff #46510) | I think, this test can use the %check_clang_tidy script, since it doesn't seem to do anything the script doesn't support (you'll need to s/CHECK/CHECK-MESSAGES/ to make it work, though). |
Looks good with one nit.
Thank you!
test/clang-tidy/google-runtime-references.cpp | ||
---|---|---|
1 ↗ | (On Diff #46628) | -std=c++11 is added by default. Please remove everything after the %t. |
// Don't warn on dependent types in templates.
Hmm, i wanted to try to fix my Bug 32683 about templated references being ignored, and i found out that it is actually intentional...
Reading https://google.github.io/styleguide/cppguide.html#Reference_Arguments i do not see why non-const T & should be ignored.
Is there a reason for this? Or perhaps, looking at the g9()/g10(), this implicit whitelisting should be more fine-grained, specific?