summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Gottesman <mgottesman@apple.com>2013-03-28 06:07:15 +0000
committerMichael Gottesman <mgottesman@apple.com>2013-03-28 06:07:15 +0000
commit4b24921965684aee31dbca70f4772f33fc827752 (patch)
tree1a3fc1ad2cda170ad75d5a5899b127e794060a56
parentf23bb4e5585761007cb2cc4718ec2454b25167ee (diff)
downloadbcm5719-llvm-4b24921965684aee31dbca70f4772f33fc827752.tar.gz
bcm5719-llvm-4b24921965684aee31dbca70f4772f33fc827752.zip
Revert "modularize - Fixed poor array usage."
This has broken buildbots for a few hours. llvm-svn: 178223
-rw-r--r--clang-tools-extra/modularize/Modularize.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/clang-tools-extra/modularize/Modularize.cpp b/clang-tools-extra/modularize/Modularize.cpp
index 9de78bfea63..1a9f309d3d5 100644
--- a/clang-tools-extra/modularize/Modularize.cpp
+++ b/clang-tools-extra/modularize/Modularize.cpp
@@ -463,8 +463,13 @@ 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();
@@ -475,27 +480,28 @@ 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) {
- LocationArray *locationArray = &EntryBins[E->second[I].Kind];
+ kind = E->second[I].Kind;
+ LocationArray *locationArray = EntryBins[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";
}
OpenPOWER on IntegriCloud