r206474 - Revised per Dmitri's comments. My first exposure to range-based for loops, thanks!

Richard Smith richard at metafoo.co.uk
Thu Apr 17 10:41:15 PDT 2014


On Thu, Apr 17, 2014 at 10:06 AM, John Thompson <
John.Thompson.JTSoftware at gmail.com> wrote:

> Author: jtsoftware
> Date: Thu Apr 17 12:06:13 2014
> New Revision: 206474
>
> URL: http://llvm.org/viewvc/llvm-project?rev=206474&view=rev
> Log:
> Revised per Dmitri's comments. My first exposure to range-based for loops,
> thanks!
>
> Modified:
>     cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp
>
> Modified: cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp?rev=206474&r1=206473&r2=206474&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp (original)
> +++ cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp Thu Apr 17 12:06:13
> 2014
> @@ -350,18 +350,16 @@ void GlobalModuleIndex::printStats() {
>  }
>
>  void GlobalModuleIndex::dump() {
> -  std::fprintf(stderr, "*** Global Module Index Dump:\n");
> -  std::fprintf(stderr, "Module files:\n");
> -  for (llvm::SmallVector<ModuleInfo, 16>::iterator I = Modules.begin(),
> -      E = Modules.end(); I != E; ++I) {
> -    ModuleInfo *MI = (ModuleInfo*)I;
> -    std::fprintf(stderr, "** %s\n", MI->FileName.c_str());
> -    if (MI->File)
> -      MI->File->dump();
> +  llvm::errs() << "*** Global Module Index Dump:\n";
> +  llvm::errs() << "Module files:\n";
> +  for (auto MI : Modules) {
>

It doesn't make much difference in a dump() method, but this should be

  for (auto &MI : Modules) {

... to avoid copying each ModuleInfo into the local variable.


> +    llvm::errs() << "** " << MI.FileName << "\n";
> +    if (MI.File)
> +      MI.File->dump();
>      else
> -      std::fprintf(stderr, "\n");
> +      llvm::errs() << "\n";
>    }
> -  std::fprintf(stderr, "\n");
> +  llvm::errs() << "\n";
>  }
>
>
>  //----------------------------------------------------------------------------//
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140417/a2805a6a/attachment.html>


More information about the cfe-commits mailing list