<div dir="auto">Thanks! One nit: StringRef doesn't need to be qualified.</div><div class="gmail_extra"><br><div class="gmail_quote">On Apr 18, 2017 11:00 PM, "Haojian Wu via cfe-commits" <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: hokein<br>
Date: Tue Apr 18 15:47:34 2017<br>
New Revision: 300588<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=300588&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=300588&view=rev</a><br>
Log:<br>
[clang-tidy] Address a few late comments.<br>
<br>
Modified:<br>
    clang-tools-extra/trunk/clang-<wbr>tidy/performance/<wbr>InefficientVectorOperationChec<wbr>k.cpp<br>
<br>
Modified: clang-tools-extra/trunk/clang-<wbr>tidy/performance/<wbr>InefficientVectorOperationChec<wbr>k.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp?rev=300588&r1=300587&r2=300588&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/clang-tools-extra/<wbr>trunk/clang-tidy/performance/<wbr>InefficientVectorOperationChec<wbr>k.cpp?rev=300588&r1=300587&r2=<wbr>300588&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy/performance/<wbr>InefficientVectorOperationChec<wbr>k.cpp (original)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy/performance/<wbr>InefficientVectorOperationChec<wbr>k.cpp Tue Apr 18 15:47:34 2017<br>
@@ -99,7 +99,8 @@ void InefficientVectorOperationChec<wbr>k::re<br>
<br>
 void InefficientVectorOperationChec<wbr>k::check(<br>
     const MatchFinder::MatchResult &Result) {<br>
-  if (Result.Context-><wbr>getDiagnostics().<wbr>hasUncompilableErrorOccurred()<wbr>)<br>
+  auto* Context = Result.Context;<br>
+  if (Context->getDiagnostics().<wbr>hasUncompilableErrorOccurred()<wbr>)<br>
     return;<br>
<br>
   const SourceManager &SM = *Result.SourceManager;<br>
@@ -113,7 +114,7 @@ void InefficientVectorOperationChec<wbr>k::ch<br>
<br>
   llvm::SmallPtrSet<const DeclRefExpr *, 16> AllVectorVarRefs =<br>
       utils::decl_ref_expr::<wbr>allDeclRefExprs(*<wbr>VectorVarDecl, *LoopParent,<br>
-                                            *Result.Context);<br>
+                                            *Context);<br>
   for (const auto *Ref : AllVectorVarRefs) {<br>
     // Skip cases where there are usages (defined as DeclRefExpr that refers to<br>
     // "v") of vector variable `v` before the for loop. We consider these usages<br>
@@ -128,19 +129,19 @@ void InefficientVectorOperationChec<wbr>k::ch<br>
     }<br>
   }<br>
<br>
-  llvm::StringRef LoopEndSource = clang::Lexer::getSourceText(<br>
+  llvm::StringRef LoopEndSource = Lexer::getSourceText(<br>
       CharSourceRange::<wbr>getTokenRange(LoopEndExpr-><wbr>getSourceRange()), SM,<br>
-      clang::LangOptions());<br>
-  llvm::StringRef VectorVarName = clang::Lexer::getSourceText(<br>
+      Context->getLangOpts());<br>
+  llvm::StringRef VectorVarName = Lexer::getSourceText(<br>
       CharSourceRange::<wbr>getTokenRange(<br>
           PushBackCall-><wbr>getImplicitObjectArgument()-><wbr>getSourceRange()),<br>
-      SM, clang::LangOptions());<br>
+      SM, Context->getLangOpts());<br>
   std::string ReserveStmt =<br>
       (VectorVarName + ".reserve(" + LoopEndSource + ");\n").str();<br>
<br>
   diag(PushBackCall-><wbr>getLocStart(),<br>
        "'push_back' is called inside a loop; "<br>
-       "consider pre-allocating the vector capacity before the loop.")<br>
+       "consider pre-allocating the vector capacity before the loop")<br>
       << FixItHint::CreateInsertion(<wbr>ForLoop->getLocStart(), ReserveStmt);<br>
 }<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">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/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>