[PATCH] D16310: new clang-tidy checker misc-long-cast
Daniel Marjamäki via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 8 05:42:36 PST 2016
danielmarjamaki added inline comments.
================
Comment at: clang-tidy/misc/MisplacedWideningCastCheck.cpp:31
@@ +30,3 @@
+
+ Finder->addMatcher(returnStmt(has(Cast)), this);
+ Finder->addMatcher(varDecl(has(Cast)), this);
----------------
alexfh wrote:
> FYI, these matchers can be combined using `anyOf`. Not sure whether this will be better (readability-wise and performance-wise) or not.
hmm.. are you sure .. for instance this does not work: stmt(anyOf(returnStmt(), varDecl()))
================
Comment at: clang-tidy/misc/MisplacedWideningCastCheck.h:16
@@ +15,3 @@
+namespace clang {
+namespace tidy {
+
----------------
alexfh wrote:
> Please add `namespace misc {`. BTW, do you know the `add_new_check.py` script that uses the currently recommended template?
yes I used add_new_check.py to create this checker, thank you.. so I did not think I would have to run it again. I'll try to rerun add_new_check.py in the future.
================
Comment at: docs/clang-tidy/checks/misc-misplaced-widening-cast.rst:1
@@ +1,2 @@
+.. title:: clang-tidy - misc-misplaced-widening-cast
+
----------------
alexfh wrote:
> If you wonder how to test the RST you write:
>
> 1. when running cmake, specify `-DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=ON` (you can also turn on `LLVM_INCLUDE_DOCS` and `CLANG_INCLUDE_DOCS`, if you wish, but this shouldn't be necessary)
> 2. `make/ninja docs-clang-tools-html`, the results should be generated in "<your-build-directory>/tools/clang/tools/extra/docs/html"
thanks.. something does not work.
mkdir ~/llvm/build && cd ~/llvm/build
cmake -DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=ON ..
make -j4
make docs-clang-tools-html
=>
make: *** No rule to create target ”docs-clang-tools-html”. Stopping.
I have debian on my computer.
http://reviews.llvm.org/D16310
More information about the cfe-commits
mailing list