[clang-tools-extra] r329873 - [clang-tidy] [modernize-use-auto] Get only a length of token, not the token itself

Zinovy Nis via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 12 00:30:16 PDT 2018


Yes, due to to incorrect token length returned by the old code, the test
was passing. I fixed it.

Hm, you are right, clangTooling is not requirted anymore.

чт, 12 апр. 2018 г. в 10:25, Roman Lebedev <lebedev.ri at gmail.com>:

> Also, i guess you now can remove linking to clangTooling that was
> required to unbreak the build.
> I'm guessing clangLex contains Lexer::MeasureTokenLength() ?
>
> On Thu, Apr 12, 2018 at 10:22 AM, Roman Lebedev <lebedev.ri at gmail.com>
> wrote:
> > Test?
> >
> > On Thu, Apr 12, 2018 at 8:41 AM, Zinovy Nis via cfe-commits
> > <cfe-commits at lists.llvm.org> wrote:
> >> Author: zinovy.nis
> >> Date: Wed Apr 11 22:41:24 2018
> >> New Revision: 329873
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=329873&view=rev
> >> Log:
> >> [clang-tidy] [modernize-use-auto] Get only a length of token, not the
> token itself
> >>
> >>
> >> Modified:
> >>     clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
> >>
> >> Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
> >> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp?rev=329873&r1=329872&r2=329873&view=diff
> >>
> ==============================================================================
> >> --- clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
> (original)
> >> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp Wed
> Apr 11 22:41:24 2018
> >> @@ -11,6 +11,7 @@
> >>  #include "clang/AST/ASTContext.h"
> >>  #include "clang/ASTMatchers/ASTMatchFinder.h"
> >>  #include "clang/ASTMatchers/ASTMatchers.h"
> >> +#include "clang/Lex/Lexer.h"
> >>  #include "clang/Tooling/FixIt.h"
> >>
> >>  using namespace clang;
> >> @@ -419,8 +420,8 @@ void UseAutoCheck::replaceExpr(
> >>    SourceRange Range(Loc.getSourceRange());
> >>
> >>    if (MinTypeNameLength != 0 &&
> >> -      tooling::fixit::getText(Loc.getSourceRange(),
> FirstDecl->getASTContext())
> >> -              .size() < MinTypeNameLength)
> >> +      Lexer::MeasureTokenLength(Loc.getLocStart(),
> Context->getSourceManager(),
> >> +                                getLangOpts()) < MinTypeNameLength)
> >>      return;
> >>
> >>    auto Diag = diag(Range.getBegin(), Message);
> >>
> >>
> >> _______________________________________________
> >> cfe-commits mailing list
> >> cfe-commits at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180412/c062b2eb/attachment.html>


More information about the cfe-commits mailing list