alexfh added inline comments. ================ Comment at: clang-tidy/readability/NonConstParameterCheck.cpp:20 @@ +19,3 @@ +void NonConstParameterCheck::registerMatchers(MatchFinder *Finder) { + // TODO: This checker doesn't handle C++ to start with. There are problems + // for example with parameters to template functions. ---------------- I'd prefer the problem to be fixed right away instead of disabling this check for C++. The specific issue of parameters of template functions can probably be addressed by disabling matches in template instantiations (add `unless(isInTemplateInstantiation())` or `unless(isInstantiated())` depending on what kind of node is being matched).
================ Comment at: clang-tidy/readability/NonConstParameterCheck.cpp:83 @@ +82,3 @@ +void NonConstParameterCheck::ref(const DeclRefExpr *Ref) { + struct ParInfo *PI = getParInfo(Ref->getDecl()); + if (PI) ---------------- Use the `if (T *x = ...) {...}` pattern, please. ================ Comment at: clang-tidy/readability/NonConstParameterCheck.cpp:89 @@ +88,3 @@ +struct ParInfo *NonConstParameterCheck::getParInfo(const Decl *D) { + for (struct ParInfo &ParamInfo : Params) { + if (ParamInfo.Par == D) ---------------- aaron.ballman wrote: > This loop can be replaced with std::find_if(). While I agree with similar comments in general, it seems that here it wouldn't make the code any better. ================ Comment at: clang-tidy/readability/NonConstParameterCheck.cpp:168 @@ +167,3 @@ + if (auto *Par = dyn_cast<ParmVarDecl>(D->getDecl())) { + struct ParInfo *PI = getParInfo(Par); + if (PI) ---------------- `if (ParInfo *PI = ...) ...` ================ Comment at: docs/clang-tidy/checks/readability-non-const-parameter.rst:14 @@ +13,3 @@ + // warning here; p should be const + char f1(char *p) + { ---------------- Let's format the code examples in LLVM style. ================ Comment at: test/clang-tidy/readability-non-const-parameter.c:211 @@ +210,3 @@ +// avoid fp for const pointer array +void constPointerArray(const char *remapped[][2]) +{ ---------------- clang-format? http://reviews.llvm.org/D15332 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits