<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Apr 12, 2018 at 7:44 AM Zinovy Nis via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: zinovy.nis<br>
Date: Wed Apr 11 22:41:24 2018<br>
New Revision: 329873<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=329873&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=329873&view=rev</a><br>
Log:<br>
[clang-tidy] [modernize-use-auto] Get only a length of token, not the token itself<br>
<br>
<br>
Modified:<br>
    clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp<br>
<br>
Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp?rev=329873&r1=329872&r2=329873&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp?rev=329873&r1=329872&r2=329873&view=diff</a><br>
==============================================================================<br>
--- clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp (original)<br>
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp Wed Apr 11 22:41:24 2018<br>
@@ -11,6 +11,7 @@<br>
 #include "clang/AST/ASTContext.h"<br>
 #include "clang/ASTMatchers/ASTMatchFinder.h"<br>
 #include "clang/ASTMatchers/ASTMatchers.h"<br>
+#include "clang/Lex/Lexer.h"<br>
 #include "clang/Tooling/FixIt.h"<br>
<br>
 using namespace clang;<br>
@@ -419,8 +420,8 @@ void UseAutoCheck::replaceExpr(<br>
   SourceRange Range(Loc.getSourceRange());<br>
<br>
   if (MinTypeNameLength != 0 &&<br>
-      tooling::fixit::getText(Loc.getSourceRange(), FirstDecl->getASTContext())<br>
-              .size() < MinTypeNameLength)<br>
+      Lexer::MeasureTokenLength(Loc.getLocStart(), Context->getSourceManager(),<br>
+                                getLangOpts()) < MinTypeNameLength)<br></blockquote><div><br></div><div>What about type names consisting of multiple tokens (`unsigned long long`, `struct VeryLongStructName`, etc.)?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
     return;<br>
<br>
   auto Diag = diag(Range.getBegin(), Message);<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>