From 1192283096de782da55b3ac0a7ff15abfde8866c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 21 Nov 2003 21:52:10 +0000 Subject: [PATCH] Get rid of using decls, finegrainify namespacification git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10137 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/SimpleStructMutation.cpp | 41 +++++++++------------ 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/lib/Transforms/IPO/SimpleStructMutation.cpp b/lib/Transforms/IPO/SimpleStructMutation.cpp index 0c7091696e4..809ca403dd3 100644 --- a/lib/Transforms/IPO/SimpleStructMutation.cpp +++ b/lib/Transforms/IPO/SimpleStructMutation.cpp @@ -19,11 +19,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/DerivedTypes.h" #include -using std::vector; -using std::set; -using std::pair; - -namespace llvm { +using namespace llvm; namespace { struct SimpleStructMutation : public MutateStructTypes { @@ -76,8 +72,9 @@ Pass *createSortElementsPass() { return new SortStructElements(); } // PruneTypes - Given a type Ty, make sure that neither it, or one of its // subtypes, occur in TypesToModify. // -static void PruneTypes(const Type *Ty, set &TypesToModify, - set &ProcessedTypes) { +static void PruneTypes(const Type *Ty, + std::set &TypesToModify, + std::set &ProcessedTypes) { if (ProcessedTypes.count(Ty)) return; // Already been checked ProcessedTypes.insert(Ty); @@ -98,19 +95,19 @@ static void PruneTypes(const Type *Ty, set &TypesToModify, } } -static bool FirstLess(const pair &LHS, - const pair &RHS) { +static bool FirstLess(const std::pair &LHS, + const std::pair &RHS) { return LHS.second < RHS.second; } -static unsigned getIndex(const vector > &Vec, +static unsigned getIndex(const std::vector > &Vec, unsigned Field) { for (unsigned i = 0; ; ++i) if (Vec[i].first == Field) return i; } static inline void GetTransformation(const TargetData &TD, const StructType *ST, - vector &Transform, + std::vector &Transform, enum SimpleStructMutation::Transform XForm) { unsigned NumElements = ST->getElementTypes().size(); Transform.reserve(NumElements); @@ -123,7 +120,7 @@ static inline void GetTransformation(const TargetData &TD, const StructType *ST, break; case SimpleStructMutation::SortElements: { - vector > ElList; + std::vector > ElList; // Build mapping from index to size for (unsigned i = 0; i < NumElements; ++i) @@ -148,17 +145,16 @@ SimpleStructMutation::TransformsType // Get the results out of the analyzers... FindUsedTypes &FUT = getAnalysis(); - const set &UsedTypes = FUT.getTypes(); + const std::set &UsedTypes = FUT.getTypes(); FindUnsafePointerTypes &FUPT = getAnalysis(); - const set &UnsafePTys = FUPT.getUnsafeTypes(); - + const std::set &UnsafePTys = FUPT.getUnsafeTypes(); // Combine the two sets, weeding out non structure types. Closures in C++ // sure would be nice. - set TypesToModify; - for (set::const_iterator I = UsedTypes.begin(), + std::set TypesToModify; + for (std::set::const_iterator I = UsedTypes.begin(), E = UsedTypes.end(); I != E; ++I) if (const StructType *ST = dyn_cast(*I)) TypesToModify.insert(ST); @@ -167,8 +163,8 @@ SimpleStructMutation::TransformsType // Go through the Unsafe types and remove all types from TypesToModify that we // are not allowed to modify, because that would be unsafe. // - set ProcessedTypes; - for (set::const_iterator I = UnsafePTys.begin(), + std::set ProcessedTypes; + for (std::set::const_iterator I = UnsafePTys.begin(), E = UnsafePTys.end(); I != E; ++I) { //cerr << "Pruning type: " << *I << "\n"; PruneTypes(*I, TypesToModify, ProcessedTypes); @@ -177,18 +173,17 @@ SimpleStructMutation::TransformsType // Build up a set of structure types that we are going to modify, and // information describing how to modify them. - std::map > Transforms; + std::map > Transforms; TargetData &TD = getAnalysis(); - for (set::iterator I = TypesToModify.begin(), + for (std::set::iterator I = TypesToModify.begin(), E = TypesToModify.end(); I != E; ++I) { const StructType *ST = *I; - vector &Transform = Transforms[ST]; // Fill in the map directly + std::vector &Transform = Transforms[ST]; // Fill in the map directly GetTransformation(TD, ST, Transform, XForm); } return Transforms; } -} // End llvm namespace -- 2.34.1