Author: sbenza Date: Mon Jun 6 09:21:11 2016 New Revision: 271896 URL: http://llvm.org/viewvc/llvm-project?rev=271896&view=rev Log: [clang-tidy] Do not try to suggest a fix if the parameter is partially in a macro.
It is not easy to tell where to do the suggestion and whether the suggestion will be correct. Modified: clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp Modified: clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp?rev=271896&r1=271895&r2=271896&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp Mon Jun 6 09:21:11 2016 @@ -88,6 +88,12 @@ void AvoidConstParamsInDecls::check(cons Diag << Param; } + if (Param->getLocStart().isMacroID() != Param->getLocEnd().isMacroID()) { + // Do not offer a suggestion if the part of the variable declaration comes + // from a macro. + return; + } + CharSourceRange FileRange = Lexer::makeFileCharRange( CharSourceRange::getTokenRange(getTypeRange(*Param)), *Result.SourceManager, Result.Context->getLangOpts()); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits