From dfaa021e990238902823882858b873d96eacb4da Mon Sep 17 00:00:00 2001 From: Zinovy Nis Date: Thu, 12 Apr 2018 05:41:24 +0000 Subject: [PATCH] [clang-tidy] [modernize-use-auto] Get only a length of token, not the token itself llvm-svn: 329873 --- clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp index 23478ae..75e84c1 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp @@ -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); -- 2.7.4