[clang-tools-extra] r329949 - Revert "[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 13:33:24 PDT 2018
Author: zinovy.nis
Date: Thu Apr 12 13:33:24 2018
New Revision: 329949
URL: http://llvm.org/viewvc/llvm-project?rev=329949&view=rev
Log:
Revert "[clang-tidy] [modernize-use-auto] Get only a length of token, not the token itself"
This reverts r329873 as getting only a single token length is wrong for multi-token type names,
like 'unsigned long int'.
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=329949&r1=329948&r2=329949&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp Thu Apr 12 13:33:24 2018
@@ -11,7 +11,6 @@
#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;
@@ -420,8 +419,8 @@ void UseAutoCheck::replaceExpr(
SourceRange Range(Loc.getSourceRange());
if (MinTypeNameLength != 0 &&
- Lexer::MeasureTokenLength(Loc.getLocStart(), Context->getSourceManager(),
- getLangOpts()) < MinTypeNameLength)
+ tooling::fixit::getText(Loc.getSourceRange(), FirstDecl->getASTContext())
+ .size() < MinTypeNameLength)
return;
auto Diag = diag(Range.getBegin(), Message);
More information about the cfe-commits
mailing list