[clang-tools-extra] r178214 - modularize - Fixed poor array usage.

Michael Gottesman mgottesman at apple.com
Wed Mar 27 23:08:27 PDT 2013


This commit is causing buildbot failures:

http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/3194

For some reason your commit did not show up in the buildbot view at all = /. I think that is because perhaps the master scheduler is not tracking clang-tools-extra. Reverted in r178223.

Michael

On Mar 27, 2013, at 7:44 PM, John Thompson <John.Thompson.JTSoftware at gmail.com> wrote:

> Author: jtsoftware
> Date: Wed Mar 27 21:44:31 2013
> New Revision: 178214
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=178214&view=rev
> Log:
> modularize - Fixed poor array usage.
> 
> Modified:
>    clang-tools-extra/trunk/modularize/Modularize.cpp
> 
> Modified: clang-tools-extra/trunk/modularize/Modularize.cpp
> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=178214&r1=178213&r2=178214&view=diff
> ==============================================================================
> --- clang-tools-extra/trunk/modularize/Modularize.cpp (original)
> +++ clang-tools-extra/trunk/modularize/Modularize.cpp Wed Mar 27 21:44:31 2013
> @@ -465,13 +465,8 @@ int main(int argc, const char **argv) {
> 
>   // Create a place to save duplicate entity locations, separate bins per kind.
>   typedef SmallVector<Location, 8> LocationArray;
> -  typedef SmallVector<LocationArray *, Entry::NumberOfKinds> EntryBinArray;
> +  typedef SmallVector<LocationArray, Entry::NumberOfKinds> EntryBinArray;
>   EntryBinArray EntryBins;
> -  Entry::KindType kind;
> -  int kindIndex;
> -  for (kindIndex = 0; kindIndex < Entry::NumberOfKinds; ++kindIndex) {
> -    EntryBins.push_back(new LocationArray);
> -  }
> 
>   // Check for the same entity being defined in multiple places.
>   for (EntityMap::iterator E = Entities.begin(), EEnd = Entities.end();
> @@ -482,28 +477,27 @@ int main(int argc, const char **argv) {
>     // Clear entity locations.
>     for (EntryBinArray::iterator CI = EntryBins.begin(), CE = EntryBins.end();
>          CI != CE; ++CI) {
> -      (**CI).clear();
> +      CI->clear();
>     }
>     // Walk the entities of a single name, collecting the locations,
>     // separated into separate bins.
>     for (unsigned I = 0, N = E->second.size(); I != N; ++I) {
> -      kind = E->second[I].Kind;
> -      LocationArray *locationArray = EntryBins[kind];
> +      LocationArray *locationArray = &EntryBins[E->second[I].Kind];
>       locationArray->push_back(E->second[I].Loc);
>     }
>     // Report any duplicate entity definition errors.
>     int kindIndex = 0;
>     for (EntryBinArray::iterator DI = EntryBins.begin(), DE = EntryBins.end();
>          DI != DE; ++DI, ++kindIndex) {
> -      int eCount = (**DI).size();
> +      int eCount = DI->size();
>       // If only 1 occurance, skip;
>       if (eCount <= 1)
>         continue;
> -      LocationArray::iterator FI = (**DI).begin();
> +      LocationArray::iterator FI = DI->begin();
>       StringRef kindName = Entry::getKindName((Entry::KindType) kindIndex);
>       errs() << "error: " << kindName << " '" << E->first()
>              << "' defined at multiple locations:\n";
> -      for (LocationArray::iterator FE = (**DI).end(); FI != FE; ++FI) {
> +      for (LocationArray::iterator FE = DI->end(); FI != FE; ++FI) {
>         errs() << "    " << FI->File->getName() << ":" << FI->Line << ":"
>                << FI->Column << "\n";
>       }
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list