[llvm] r275515 - [llvm-cov] Clean up an awkward capture-by-reference (NFC)

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 18:19:35 PDT 2016


Author: vedantk
Date: Thu Jul 14 20:19:35 2016
New Revision: 275515

URL: http://llvm.org/viewvc/llvm-project?rev=275515&view=rev
Log:
[llvm-cov] Clean up an awkward capture-by-reference (NFC)

Writing `for (StringRef &SourceFile : ...)` is strange to begin with.
Subsequently capturing "SourceFile" by reference is even stranger. Just
copy the StringRef, since that's cheap to do.

Modified:
    llvm/trunk/tools/llvm-cov/CodeCoverage.cpp

Modified: llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CodeCoverage.cpp?rev=275515&r1=275514&r2=275515&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CodeCoverage.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CodeCoverage.cpp Thu Jul 14 20:19:35 2016
@@ -551,8 +551,8 @@ int CodeCoverageTool::show(int argc, con
     ThreadCount = std::thread::hardware_concurrency();
   ThreadPool Pool(ThreadCount);
 
-  for (StringRef &SourceFile : SourceFiles) {
-    Pool.async([this, &SourceFile, &Coverage, &Printer, ShowFilenames] {
+  for (StringRef SourceFile : SourceFiles) {
+    Pool.async([this, SourceFile, &Coverage, &Printer, ShowFilenames] {
       auto View = createSourceFileView(SourceFile, *Coverage);
       if (!View) {
         deferWarning("The file '" + SourceFile.str() + "' isn't covered.");




More information about the llvm-commits mailing list