Diff Detail
Event Timeline
docs/clang-tidy/checks/modernize-use-using.rst | ||
---|---|---|
14 | add cases with pointers to function / members |
clang-tidy/modernize/UseUsingCheck.cpp | ||
---|---|---|
27 | add static | |
28 | Stick to the LLVM coding style - local variables starts with capital letter. | |
33–36 | you can extract this to another static function | |
49 | check if it is clang-formatted |
clang-tidy/modernize/ModernizeTidyModule.cpp | ||
---|---|---|
49 | You can put it in one-line, which will not exceed 80 characters. | |
clang-tidy/modernize/UseUsingCheck.cpp | ||
24 | Add a blank line. | |
25 | A blank between /// and F, please use clang-format to make sure your code align with LLVM style. | |
26 | replace parameter can be const std::string&. | |
27 | code indentation. | |
39 | const auto &p | |
42 | You can use replaceAll(subject, p.first, p.second). | |
47 | You need to filter out the non-c++11 code here. | |
clang-tidy/modernize/UseUsingCheck.h | ||
20 | Please use a complete sentence. | |
test/clang-tidy/modernize-use-using.cpp | ||
3 | Remove the extra blank line. | |
10 | No need to check the whole message except the first one. So here you can use warning: use using instead of typedef. |
clang-tidy/modernize/UseUsingCheck.cpp | ||
---|---|---|
23 | BTW is there any policy about that? I see that some checks from modernize require C++11 (e.g. modernize-make-unique which is in C++14) and other require just C++ (modernize-loop-convert), and it even has a comment // Only register the matchers for C++. Because this checker is used for // modernization, it is reasonable to run it on any C++ standard with the // assumption the user is trying to modernize their codebase. if (!getLangOpts().CPlusPlus) return; I have 2 thoughts for this:
e.g. loop-convert should require C++11, make-shared C++14, this check also C++11, |
clang-tidy/modernize/UseUsingCheck.cpp | ||
---|---|---|
23 | This is a good point. As far as I know, we don't have detailed policy about the modernized checks. It depends on the check author. Basically the modern words means "C++11" feature. I'm +1 on adding a note in each modernized check's document. |
clang-tidy/modernize/UseUsingCheck.cpp | ||
---|---|---|
23 | Cool. I sent email to mailing list to ask other devs for opinion. Krystyna, please add note at the end of documentation "This check requires using C++11 or higher to run." |
I'm really interested in the manner this check works when a typedef has multiple declarations in it (same example as in the comment):
typedef int m_int, *m_int_p, &m_int_r, m_int_arr[10], (&m_int_fun)(int, int);
I tried to implement such a check once, but this was the hard part. FYI, that's my stub: https://github.com/llvm-mirror/clang-tools-extra/compare/master...mkurdej:feature/use-using.
docs/clang-tidy/checks/modernize-use-using.rst | ||
---|---|---|
22 | Typo: varible -> variable. | |
test/clang-tidy/modernize-use-using.cpp | ||
2 | Could you add tests for the case where there are multiple type declarations in one statement? E.g.: typedef int m_int, *m_int_p, &m_int_r, m_int_arr[10], (&m_int_fun)(int, int); Would it be transformed to multiple using statements or only a warning will be emitted? |
I don't think that this featcher is necessary. I don't know a lot of code using it. I am curious how this check will behave.
clang-tidy/modernize/UseUsingCheck.cpp | ||
---|---|---|
13 | Is this required? |
clang-tidy/modernize/UseUsingCheck.cpp | ||
---|---|---|
13 | It'll be reasonable to run Include What You Use at least on new files. |
LGTM
clang-tidy/modernize/UseUsingCheck.cpp | ||
---|---|---|
72 | There should be method called 'isInvalid()' |
Please see PR28334.
I'm not sure if Krystyna has Bugzilla account, so I report problem here.
You can put it in one-line, which will not exceed 80 characters.