r206418 - Added dump method for global module index.

Dmitri Gribenko gribozavr at gmail.com
Wed Apr 16 14:14:24 PDT 2014


On Wed, Apr 16, 2014 at 10:03 PM, John Thompson
<John.Thompson.JTSoftware at gmail.com> wrote:
> Author: jtsoftware
> Date: Wed Apr 16 16:03:41 2014
> New Revision: 206418
>
> URL: http://llvm.org/viewvc/llvm-project?rev=206418&view=rev
> Log:
> Added dump method for global module index.
>
> Modified:
>     cfe/trunk/include/clang/Serialization/GlobalModuleIndex.h
>     cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp
>
> Modified: cfe/trunk/include/clang/Serialization/GlobalModuleIndex.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/GlobalModuleIndex.h?rev=206418&r1=206417&r2=206418&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Serialization/GlobalModuleIndex.h (original)
> +++ cfe/trunk/include/clang/Serialization/GlobalModuleIndex.h Wed Apr 16 16:03:41 2014
> @@ -186,6 +186,9 @@ public:
>    /// \brief Print statistics to standard error.
>    void printStats();
>
> +  /// \brief Print debugging view to standard error.
> +  void dump();
> +
>    /// \brief Write a global index into the given
>    ///
>    /// \param FileMgr The file manager to use to load module files.
>
> Modified: cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp?rev=206418&r1=206417&r2=206418&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp (original)
> +++ cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp Wed Apr 16 16:03:41 2014
> @@ -349,6 +349,21 @@ void GlobalModuleIndex::printStats() {
>    std::fprintf(stderr, "\n");
>  }
>
> +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();
> +    else
> +      std::fprintf(stderr, "\n");
> +  }
> +  std::fprintf(stderr, "\n");
> +}

Why not llvm::errs()?  Also, range-based for loop would be shorter.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list