]> granicus.if.org Git - llvm/commitdiff
[llvm-cov] Clean up an awkward capture-by-reference (NFC)
authorVedant Kumar <vsk@apple.com>
Fri, 15 Jul 2016 01:19:35 +0000 (01:19 +0000)
committerVedant Kumar <vsk@apple.com>
Fri, 15 Jul 2016 01:19:35 +0000 (01:19 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275515 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-cov/CodeCoverage.cpp

index eda074cc44e6105ad6f184c652ca249364d39a92..c2989f43963e0244b0aa5d7bbc69370b3106e351 100644 (file)
@@ -551,8 +551,8 @@ int CodeCoverageTool::show(int argc, const char **argv,
     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.");