[DynInst_API:] [PATCH] Reduce namespace pollution


Date: Wed, 27 Apr 2016 17:21:53 -0400
From: Peter Foley <pefoley2@xxxxxxxxxxx>
Subject: [DynInst_API:] [PATCH] Reduce namespace pollution
Remove 'using namespace std' from public header files.
Add it where necessary to internal files.

Signed-off-by: Peter Foley <pefoley2@xxxxxxxxxxx>
---
 common/h/IBSTree-fast.h               | 14 +++++-----
 common/h/IBSTree.h                    | 48 +++++++++++++++++------------------
 dataflowAPI/h/liveness.h              |  9 +++----
 dataflowAPI/src/SymEval.C             |  1 +
 dataflowAPI/src/liveness.C            |  5 ++--
 dataflowAPI/src/stackanalysis.C       |  1 +
 dyninstAPI/h/BPatch_snippet.h         |  2 +-
 dyninstAPI/src/BPatch.C               |  1 +
 dyninstAPI/src/StackMod/StackAccess.C |  1 +
 dyninstAPI/src/image.h                |  1 +
 dyninstAPI/src/mapped_object.h        |  1 +
 dyninstAPI/src/parse-cfg.h            |  1 +
 parseAPI/h/CFG.h                      | 38 +++++++++++++--------------
 parseAPI/h/CodeObject.h               |  4 +--
 parseAPI/h/CodeSource.h               |  6 ++---
 parseAPI/h/GraphAdapter.h             |  1 -
 parseAPI/h/Location.h                 |  1 -
 parseAPI/h/SymLiteCodeSource.h        |  2 +-
 parseAPI/src/CFGFactory.C             |  1 +
 parseAPI/src/IA_IAPI.h                |  2 ++
 parseAPI/src/InstructionAdapter.C     |  1 +
 parseAPI/src/LoopAnalyzer.h           |  2 ++
 parseAPI/src/LoopTreeNode.C           |  1 +
 parseAPI/src/ThunkData.h              |  1 +
 parseAPI/src/dominator.h              |  2 ++
 patchAPI/h/PatchCFG.h                 |  2 +-
 patchAPI/src/AddrSpace.C              |  1 +
 patchAPI/src/PatchBlock.C             |  1 +
 patchAPI/src/PatchCallback.C          |  1 +
 patchAPI/src/PatchEdge.C              |  1 +
 patchAPI/src/PatchFunction.C          |  1 +
 patchAPI/src/PatchModifier.C          |  1 +
 patchAPI/src/PatchObject.C            |  1 +
 symtabAPI/h/Aggregate.h               |  2 +-
 symtabAPI/h/Archive.h                 | 32 +++++++++++------------
 symtabAPI/h/Function.h                |  2 +-
 symtabAPI/src/Archive-elf.C           |  1 +
 symtabAPI/src/Archive.C               |  1 +
 38 files changed, 107 insertions(+), 87 deletions(-)

diff --git a/common/h/IBSTree-fast.h b/common/h/IBSTree-fast.h
index 4cc91c9..de91274 100644
--- a/common/h/IBSTree-fast.h
+++ b/common/h/IBSTree-fast.h
@@ -19,7 +19,7 @@ namespace Dyninst
     ordered_unique<const_mem_fun<ITYPE, interval_type, &ITYPE::high> >
     > > interval_set;
       
-    //typedef set<ITYPE*, order_by_lower<ITYPE> > interval_set;
+    //typedef std::set<ITYPE*, order_by_lower<ITYPE> > interval_set;
     interval_set unique_intervals;
 
   public:
@@ -39,9 +39,9 @@ namespace Dyninst
     }
     void insert(ITYPE*);
     void remove(ITYPE*);
-    int find(interval_type, set<ITYPE*> &) const;
-    int find(ITYPE* I, set<ITYPE*>&) const;
-    void successor(interval_type X, set<ITYPE*>& ) const;
+    int find(interval_type, std::set<ITYPE*> &) const;
+    int find(ITYPE* I, std::set<ITYPE*>&) const;
+    void successor(interval_type X, std::set<ITYPE*>& ) const;
     ITYPE* successor(interval_type X) const;
     void clear();
       
@@ -86,7 +86,7 @@ namespace Dyninst
     if(found != unique_intervals.end() && *found == entry) unique_intervals.erase(found);
   }
   template<class ITYPE>
-  int IBSTree_fast<ITYPE>::find(interval_type X, set<ITYPE*> &results) const
+  int IBSTree_fast<ITYPE>::find(interval_type X, std::set<ITYPE*> &results) const
   {
     int num_old_results = results.size();
       
@@ -102,7 +102,7 @@ namespace Dyninst
     return results.size() - num_old_results;
   }
   template <typename ITYPE>
-  int IBSTree_fast<ITYPE>::find(ITYPE* I, set<ITYPE*>&results) const
+  int IBSTree_fast<ITYPE>::find(ITYPE* I, std::set<ITYPE*>&results) const
   {
     int num_old_results = results.size();
     int num_overlapping = overlapping_intervals.find(I, results);
@@ -116,7 +116,7 @@ namespace Dyninst
     return results.size() - num_old_results;
   }
   template<typename ITYPE>
-  void IBSTree_fast<ITYPE>::successor(interval_type X, set<ITYPE*>& results) const
+  void IBSTree_fast<ITYPE>::successor(interval_type X, std::set<ITYPE*>& results) const
   {
     ITYPE* overlapping_ub = overlapping_intervals.successor(X);
       
diff --git a/common/h/IBSTree.h b/common/h/IBSTree.h
index 613e545..6725214 100644
--- a/common/h/IBSTree.h
+++ b/common/h/IBSTree.h
@@ -45,8 +45,6 @@
 #include <set>
 #include <limits>
 
-using namespace std;
-
 /** Template class for Interval Binary Search Tree. The implementation is
   * based on a red-black tree (derived from our codeRange implementation)
   * to control the tree height and thus insertion and search cost.
@@ -150,9 +148,9 @@ class IBSNode {
     interval_type val_;
 
     /* Intervals indexed by this node */
-    set<ITYPE *> less;
-    set<ITYPE *> greater;
-    set<ITYPE *> equal;
+    std::set<ITYPE *> less;
+    std::set<ITYPE *> greater;
+    std::set<ITYPE *> equal;
 
     IBS::color_t color;
 
@@ -210,8 +208,8 @@ class IBSTree {
     /** Delete all nodes in the subtree rooted at the parameter **/
     void destroy(IBSNode<ITYPE> *);
 
-    void findIntervals(interval_type X, IBSNode<ITYPE> *R, set<ITYPE *> &S) const;
-    void findIntervals(ITYPE *I, IBSNode<ITYPE> *R, set<ITYPE *> &S) const;
+    void findIntervals(interval_type X, IBSNode<ITYPE> *R, std::set<ITYPE *> &S) const;
+    void findIntervals(ITYPE *I, IBSNode<ITYPE> *R, std::set<ITYPE *> &S) const;
 
     void PrintPreorder(IBSNode<ITYPE> *n);
 
@@ -248,12 +246,12 @@ class IBSTree {
 
     /** Find all intervals that overlap the provided point. Returns
         the number of intervals found **/  
-    int find(interval_type, set<ITYPE *> &) const;
-    int find(ITYPE *I, set<ITYPE *> &) const;
+    int find(interval_type, std::set<ITYPE *> &) const;
+    int find(ITYPE *I, std::set<ITYPE *> &) const;
 
     /** Finds the very next interval(s) with left endpoint
         = supremum(X) **/
-    void successor(interval_type X, set<ITYPE *> &) const; 
+    void successor(interval_type X, std::set<ITYPE *> &) const; 
     /** Use only when no two intervals share the same lower bound **/
     ITYPE * successor(interval_type X) const;
 
@@ -303,18 +301,18 @@ void IBSTree<ITYPE>::rightRotate(IBSNode<ITYPE> *pivot)
     //    (before rotation), remove the mark from pivot's > and = slots
     //    (preserving maximality).
 
-    typename set< ITYPE * >::iterator it = y->greater.begin();
+    typename std::set< ITYPE * >::iterator it = y->greater.begin();
     while( it != y->greater.end() )
     {
         ITYPE *tmp = *it;
     
-        typename set< ITYPE *>::iterator pit = pivot->greater.find( tmp );
+        typename std::set< ITYPE *>::iterator pit = pivot->greater.find( tmp );
         if(pit == pivot->greater.end()) {
             // Case 2
             pivot->less.insert( tmp );
             // remove from y's >. This invalidates the iterator, so
             // update first
-            typename set< ITYPE * >::iterator del = it;
+            typename std::set< ITYPE * >::iterator del = it;
             ++it;
             y->greater.erase( del );
         } else {
@@ -361,18 +359,18 @@ void IBSTree<ITYPE>::leftRotate(IBSNode<ITYPE> *pivot)
     y->greater.insert(pivot->greater.begin(),pivot->greater.end());
     y->equal.insert(pivot->greater.begin(),pivot->greater.end());
 
-    typename set< ITYPE * >::iterator it = y->less.begin();
+    typename std::set< ITYPE * >::iterator it = y->less.begin();
     while( it != y->less.end() )
     {
         ITYPE *tmp = *it;
     
-        typename set< ITYPE *>::iterator pit = pivot->less.find( tmp );
+        typename std::set< ITYPE *>::iterator pit = pivot->less.find( tmp );
         if(pit == pivot->less.end()) {
             // Case 2
             pivot->greater.insert( tmp );
             // remove from y's <. This invalidates the iterator, so
             // update first
-            typename set< ITYPE * >::iterator del = it;
+            typename std::set< ITYPE * >::iterator del = it;
             ++it;
             y->less.erase( del );
         } else {
@@ -551,7 +549,7 @@ IBSTree<ITYPE>::rightUp(IBSNode<ITYPE> *R)
             return R->parent->value();
         R = R->parent; 
     }
-    return numeric_limits<interval_type>::max();
+    return std::numeric_limits<interval_type>::max();
 }
 
 /* Same as rightUp, only looking for the nearest ancestor node that
@@ -566,7 +564,7 @@ IBSTree<ITYPE>::leftUp(IBSNode<ITYPE> *R)
         R = R->parent;
     }
     // XXX is this right? for unsigned values, min() is a possible value
-    return numeric_limits<interval_type>::min();
+    return std::numeric_limits<interval_type>::min();
 }
 
 /* Restore RB-tree invariants after node insertion */
@@ -635,7 +633,7 @@ void IBSTree<ITYPE>::destroy(IBSNode<ITYPE> *n)
 }*/
 
 template<class ITYPE>
-void IBSTree<ITYPE>::findIntervals(interval_type X, IBSNode<ITYPE> *R, set<ITYPE *> &S) const
+void IBSTree<ITYPE>::findIntervals(interval_type X, IBSNode<ITYPE> *R, std::set<ITYPE *> &S) const
 {
     while(R != nil) {
         if(X == R->value()) {
@@ -663,7 +661,7 @@ void IBSTree<ITYPE>::findIntervals(interval_type X, IBSNode<ITYPE> *R, set<ITYPE
       than a pointwise stabbing query.
 */
 template<class ITYPE>
-void IBSTree<ITYPE>::findIntervals(ITYPE * I, IBSNode<ITYPE> *R, set<ITYPE *> &S) const
+void IBSTree<ITYPE>::findIntervals(ITYPE * I, IBSNode<ITYPE> *R, std::set<ITYPE *> &S) const
 {
     if(R == nil) return;
 
@@ -771,7 +769,7 @@ void IBSTree<ITYPE>::remove(ITYPE * range)
 }
 
 template<class ITYPE>
-int IBSTree<ITYPE>::find(interval_type X, set<ITYPE *> &out) const
+int IBSTree<ITYPE>::find(interval_type X, std::set<ITYPE *> &out) const
 {
     unsigned size = out.size();
     findIntervals(X,root,out);
@@ -779,7 +777,7 @@ int IBSTree<ITYPE>::find(interval_type X, set<ITYPE *> &out) const
 }
 
 template<class ITYPE>
-int IBSTree<ITYPE>::find(ITYPE * I, set<ITYPE *> &out) const
+int IBSTree<ITYPE>::find(ITYPE * I, std::set<ITYPE *> &out) const
 {
     unsigned size = out.size();
     findIntervals(I,root,out);
@@ -787,7 +785,7 @@ int IBSTree<ITYPE>::find(ITYPE * I, set<ITYPE *> &out) const
 }
 
 template<class ITYPE>
-void IBSTree<ITYPE>::successor(interval_type X, set<ITYPE *> &out) const
+void IBSTree<ITYPE>::successor(interval_type X, std::set<ITYPE *> &out) const
 {
     IBSNode<ITYPE> *n = root;
     IBSNode<ITYPE> *last = nil;
@@ -798,7 +796,7 @@ void IBSTree<ITYPE>::successor(interval_type X, set<ITYPE *> &out) const
     while(1) {
         if(n == nil) {
             if(last != nil) {
-                typename set<ITYPE *>::iterator sit = last->equal.begin();
+                typename std::set<ITYPE *>::iterator sit = last->equal.begin();
                 for( ; sit != last->equal.end(); ++sit) {
                    if((*sit)->low() == last->value()) out.insert(*sit);
                 }
@@ -834,7 +832,7 @@ void IBSTree<ITYPE>::successor(interval_type X, set<ITYPE *> &out) const
 template<class ITYPE>
 ITYPE * IBSTree<ITYPE>::successor(interval_type X) const
 {
-    set<ITYPE *> out;
+    std::set<ITYPE *> out;
     successor(X,out);
     assert( out.size() <= 1 );
     if(!out.empty())
diff --git a/dataflowAPI/h/liveness.h b/dataflowAPI/h/liveness.h
index acd798a..a6ef46e 100644
--- a/dataflowAPI/h/liveness.h
+++ b/dataflowAPI/h/liveness.h
@@ -44,7 +44,6 @@
 #include <set>
 
 
-using namespace std;
 using namespace Dyninst;
 using namespace Dyninst::InstructionAPI;
 
@@ -53,9 +52,9 @@ struct livenessData{
 };
 
 class DATAFLOW_EXPORT LivenessAnalyzer{
-	map<ParseAPI::Block*, livenessData> blockLiveInfo;
-	map<ParseAPI::Function*, bool> liveFuncCalculated;
-        map<ParseAPI::Function*, bitArray> funcRegsDefined;
+	std::map<ParseAPI::Block*, livenessData> blockLiveInfo;
+	std::map<ParseAPI::Function*, bool> liveFuncCalculated;
+        std::map<ParseAPI::Function*, bitArray> funcRegsDefined;
 	InstructionCache cachedLivenessInfo;
 
 	const bitArray& getLivenessIn(ParseAPI::Block *block);
@@ -84,7 +83,7 @@ public:
 	bool query(ParseAPI::Location loc, Type type, OutputIterator outIter){
 		bitArray liveRegs;
 		if (query(loc,type, liveRegs)){
-			for (map<MachRegister,int>::const_iterator iter = abi->getIndexMap()->begin(); iter != abi->getIndexMap()->end(); ++iter)
+			for (std::map<MachRegister,int>::const_iterator iter = abi->getIndexMap()->begin(); iter != abi->getIndexMap()->end(); ++iter)
 				if (liveRegs[iter->second]){
 					outIter = iter->first;
 					++outIter;
diff --git a/dataflowAPI/src/SymEval.C b/dataflowAPI/src/SymEval.C
index 4ff6d74..a47d6df 100644
--- a/dataflowAPI/src/SymEval.C
+++ b/dataflowAPI/src/SymEval.C
@@ -57,6 +57,7 @@
 
 #include "boost/tuple/tuple.hpp"
 
+using namespace std;
 using namespace Dyninst;
 using namespace InstructionAPI;
 using namespace DataflowAPI;
diff --git a/dataflowAPI/src/liveness.C b/dataflowAPI/src/liveness.C
index 0cd89a2..f6b9f8c 100644
--- a/dataflowAPI/src/liveness.C
+++ b/dataflowAPI/src/liveness.C
@@ -37,8 +37,6 @@
 #include "instructionAPI/h/Register.h"
 #include "instructionAPI/h/Instruction.h"
 
-using namespace Dyninst;
-using namespace Dyninst::InstructionAPI;
 #include "dataflowAPI/h/liveness.h"
 #include "dataflowAPI/h/ABI.h"
 #include <boost/bind.hpp>
@@ -47,7 +45,10 @@ std::string regs1 = " ttttttttddddddddcccccccmxxxxxxxxxxxxxxxxgf
 std::string regs2 = " rrrrrrrrrrrrrrrrrrrrrrrm1111110000000000ssoscgfedrnoditszapci11111100dsbsbdca";
 std::string regs3 = " 7654321076543210765432105432109876543210bbrssssssftfffffffffp54321098iippxxxx";
 
+using namespace std;
+using namespace Dyninst;
 using namespace Dyninst::ParseAPI;
+using namespace Dyninst::InstructionAPI;
 
 // Code for register liveness detection
 
diff --git a/dataflowAPI/src/stackanalysis.C b/dataflowAPI/src/stackanalysis.C
index 2a2eaf7..ec838e4 100644
--- a/dataflowAPI/src/stackanalysis.C
+++ b/dataflowAPI/src/stackanalysis.C
@@ -51,6 +51,7 @@
 #include "parseAPI/h/CFG.h"
 #include "parseAPI/h/CodeObject.h"
 
+using namespace std;
 using namespace Dyninst;
 using namespace InstructionAPI;
 using namespace Dyninst::ParseAPI;
diff --git a/dyninstAPI/h/BPatch_snippet.h b/dyninstAPI/h/BPatch_snippet.h
index de41d8f..728d4fb 100644
--- a/dyninstAPI/h/BPatch_snippet.h
+++ b/dyninstAPI/h/BPatch_snippet.h
@@ -366,7 +366,7 @@ class BPATCH_DLL_EXPORT BPatch_variableExpr : public BPatch_snippet
     friend class BPatch_image;
     friend class BPatch_function;
 
-    string		name;
+    std::string		name;
     BPatch_addressSpace     *appAddSpace;
     AddressSpace *lladdrSpace;
     void		*address;
diff --git a/dyninstAPI/src/BPatch.C b/dyninstAPI/src/BPatch.C
index e43de34..f12e521 100644
--- a/dyninstAPI/src/BPatch.C
+++ b/dyninstAPI/src/BPatch.C
@@ -63,6 +63,7 @@
 
 #include <fstream>
 
+using namespace std;
 using namespace SymtabAPI;
 
 extern void loadNativeDemangler();
diff --git a/dyninstAPI/src/StackMod/StackAccess.C b/dyninstAPI/src/StackMod/StackAccess.C
index 03db5f3..039a398 100644
--- a/dyninstAPI/src/StackMod/StackAccess.C
+++ b/dyninstAPI/src/StackMod/StackAccess.C
@@ -48,6 +48,7 @@
 
 #include "StackAccess.h"
 
+using namespace std;
 using namespace Dyninst;
 
 std::string StackAccess::printStackAccessType(StackAccess::StackAccessType t)
diff --git a/dyninstAPI/src/image.h b/dyninstAPI/src/image.h
index e29e545..921dc40 100644
--- a/dyninstAPI/src/image.h
+++ b/dyninstAPI/src/image.h
@@ -73,6 +73,7 @@
 #include "dyninstAPI/src/Parsing.h"
 
 
+using namespace std;
 using namespace Dyninst;
 
 typedef bool (*functionNameSieve_t)(const char *test,void *data);
diff --git a/dyninstAPI/src/mapped_object.h b/dyninstAPI/src/mapped_object.h
index 02fc05e..89869a3 100644
--- a/dyninstAPI/src/mapped_object.h
+++ b/dyninstAPI/src/mapped_object.h
@@ -48,6 +48,7 @@ class edge_instance;
 //  we really do not want to have this defined, but I'm defining it for the moment to get thru paradyn seperation
 #define CHECK_ALL_CALL_POINTS  // we depend on this for Paradyn
 
+using namespace std;
 using namespace Dyninst;
 using Dyninst::PatchAPI::DynCFGMaker;
 
diff --git a/dyninstAPI/src/parse-cfg.h b/dyninstAPI/src/parse-cfg.h
index 22dfba2..276d583 100644
--- a/dyninstAPI/src/parse-cfg.h
+++ b/dyninstAPI/src/parse-cfg.h
@@ -52,6 +52,7 @@
 
 #include <queue>
 
+using namespace std;
 using namespace Dyninst;
 
 class pdmodule;
diff --git a/parseAPI/h/CFG.h b/parseAPI/h/CFG.h
index 5816d09..de65524 100644
--- a/parseAPI/h/CFG.h
+++ b/parseAPI/h/CFG.h
@@ -474,12 +474,12 @@ class PARSER_EXPORT Function : public allocatable, public AnnotatableSparse {
     typedef boost::iterator_range<bmap_const_iterator> const_blocklist;
     typedef std::set<Edge*> edgelist;
     
-    Function(Address addr, string name, CodeObject * obj, 
+    Function(Address addr, std::string name, CodeObject * obj, 
         CodeRegion * region, InstructionSource * isource);
 
     virtual ~Function();
 
-    virtual const string & name() const;
+    virtual const std::string & name() const;
 
     Address addr() const { return _start; }
     CodeRegion * region() const { return _region; }
@@ -513,24 +513,24 @@ class PARSER_EXPORT Function : public allocatable, public AnnotatableSparse {
     /* Loops */    
     LoopTreeNode* getLoopTree() const;
     Loop* findLoop(const char *name) const;
-    bool getLoops(vector<Loop*> &loops) const;
-    bool getOuterLoops(vector<Loop*> &loops) const;
+    bool getLoops(std::vector<Loop*> &loops) const;
+    bool getOuterLoops(std::vector<Loop*> &loops) const;
 
     /* Dominator info */
 
     /* Return true if A dominates B in this function */
     bool dominates(Block* A, Block *B) const;
     Block* getImmediateDominator(Block *A) const;
-    void getImmediateDominates(Block *A, set<Block*> &) const;
-    void getAllDominates(Block *A, set<Block*> &) const;
+    void getImmediateDominates(Block *A, std::set<Block*> &) const;
+    void getAllDominates(Block *A, std::set<Block*> &) const;
 
     /* Post-dominator info */
 
     /* Return true if A post-dominates B in this function */
     bool postDominates(Block* A, Block *B) const;
     Block* getImmediatePostDominator(Block *A) const;
-    void getImmediatePostDominates(Block *A, set<Block*> &) const;
-    void getAllPostDominates(Block *A, set<Block*> &) const;
+    void getImmediatePostDominates(Block *A, std::set<Block*> &) const;
+    void getAllPostDominates(Block *A, std::set<Block*> &) const;
 
 
     /* Parse updates and obfuscation */
@@ -624,7 +624,7 @@ class PARSER_EXPORT Function : public allocatable, public AnnotatableSparse {
     mutable bool _loop_analyzed; // true if loops in the function have been found and stored in _loops
     mutable std::set<Loop*> _loops;
     mutable LoopTreeNode *_loop_root; // NULL if the tree structure has not be calculated
-    void getLoopsByNestingLevel(vector<Loop*>& lbb, bool outerMostOnly) const;
+    void getLoopsByNestingLevel(std::vector<Loop*>& lbb, bool outerMostOnly) const;
 
 
     /* Dominator and post-dominator info details */
@@ -720,34 +720,34 @@ public:
 	/** Loop::getBackEdges */
         /** Sets edges to the set of back edges that define this loop,
             returns the number of back edges that define this loop */
-        int getBackEdges(vector<Edge*> &edges);
+        int getBackEdges(std::vector<Edge*> &edges);
 
         /* returns the entry blocks of the loop.
 	 * A natural loop has a single entry block
 	 * and an irreducible loop has mulbile entry blocks
 	 * */
-	int getLoopEntries(vector<Block*>&);
+	int getLoopEntries(std::vector<Block*>&);
 
 	/** Loop::getContainedLoops    */
 	/** returns vector of contained loops */
 
-        bool getContainedLoops(vector<Loop*> &loops);
+        bool getContainedLoops(std::vector<Loop*> &loops);
 
 	/** Loop::getOuterLoops    */
 	/** returns vector of outer contained loops */
 
-	bool getOuterLoops(vector<Loop*> &loops);
+	bool getOuterLoops(std::vector<Loop*> &loops);
 
 	/** Loop::getLoopBasicBlocks    */
 	/** returns all basic blocks in the loop */
 
-        bool getLoopBasicBlocks(vector<Block*> &blocks);
+        bool getLoopBasicBlocks(std::vector<Block*> &blocks);
 
 	/** Loop::getLoopBasicBlocksExclusive    */
 	/** returns all basic blocks in this loop, exluding the blocks
 	    of its sub loops. */
 
-        bool getLoopBasicBlocksExclusive(vector<Block*> &blocks);
+        bool getLoopBasicBlocksExclusive(std::vector<Block*> &blocks);
 
         /** does this loop or its subloops contain the given block? */
 
@@ -783,7 +783,7 @@ private:
 	Loop(Edge *, const Function *);
 
 	/** get either contained or outer loops, determined by outerMostOnly */
-	bool getLoops(vector<Loop*>&, 
+	bool getLoops(std::vector<Loop*>&, 
 		      bool outerMostOnly) const;
 
         }; // class Loop
@@ -802,7 +802,7 @@ class PARSER_EXPORT LoopTreeNode {
     Loop *loop;
 
     // The LoopTreeNode instances nested within this loop.
-    vector<LoopTreeNode *> children;
+    std::vector<LoopTreeNode *> children;
 
     //  LoopTreeNode::LoopTreeNode
     //  Create a loop tree node for Loop with name n 
@@ -824,7 +824,7 @@ class PARSER_EXPORT LoopTreeNode {
     unsigned int numCallees();
 
     //Returns a vector of the functions called by this loop.
-    bool getCallees(vector<Function *> &v);
+    bool getCallees(std::vector<Function *> &v);
     
 
     //  BPatch_loopTreeNode::findLoop
@@ -838,7 +838,7 @@ class PARSER_EXPORT LoopTreeNode {
 
     // A vector of functions called within the body of this loop (and
     // not the body of sub loops). 
-    vector<Function *> callees;
+    std::vector<Function *> callees;
 
 }; // class LoopTreeNode 
 
diff --git a/parseAPI/h/CodeObject.h b/parseAPI/h/CodeObject.h
index fe149b2..c8af4d7 100644
--- a/parseAPI/h/CodeObject.h
+++ b/parseAPI/h/CodeObject.h
@@ -92,7 +92,7 @@ class CodeObject {
         NewEdgeToParse(Block* a, Address b, bool c, EdgeTypeEnum d) : source(a), target(b), edge_type(d), checked(c) { }
 	};
 
-    PARSER_EXPORT bool parseNewEdges( vector<NewEdgeToParse> & worklist ); 
+    PARSER_EXPORT bool parseNewEdges( std::vector<NewEdgeToParse> & worklist ); 
 
     // `speculative' parsing
     PARSER_EXPORT void parseGaps(CodeRegion *cr, GapParsingType type=IdiomMatching);
@@ -180,7 +180,7 @@ class CodeObject {
 // We need CFG.h, which is included by this
 template <class OutputIterator>
 void Block::getFuncs(OutputIterator result) {
-  set<Function *> stab;
+  std::set<Function *> stab;
   _obj->findFuncs(region(), start(), stab);
   std::copy(stab.begin(), stab.end(), result);
 }
diff --git a/parseAPI/h/CodeSource.h b/parseAPI/h/CodeSource.h
index 7f338be..4875a5b 100644
--- a/parseAPI/h/CodeSource.h
+++ b/parseAPI/h/CodeSource.h
@@ -63,7 +63,7 @@ class PARSER_EXPORT CodeRegion : public Dyninst::InstructionSource, public Dynin
 
        Optional
     */
-    virtual void names(Address, vector<std::string> &) { return; }
+    virtual void names(Address, std::vector<std::string> &) { return; }
 
     /* Finds the exception handler block for a given address
        in the region.
@@ -176,7 +176,7 @@ class PARSER_EXPORT CodeSource : public Dyninst::InstructionSource {
     std::map< Address, std::string > & linkage() const { return _linkage; }
     std::vector< Hint > const& hints() const { return _hints; } 
     std::vector<CodeRegion *> const& regions() const { return _regions; }
-    int findRegions(Address addr, set<CodeRegion *> & ret) const;
+    int findRegions(Address addr, std::set<CodeRegion *> & ret) const;
     bool regionsOverlap() const { return _regions_overlap; }
 
     Address getTOC() const { return _table_of_contents; }
@@ -220,7 +220,7 @@ class PARSER_EXPORT SymtabCodeRegion : public CodeRegion {
     SymtabCodeRegion(SymtabAPI::Symtab *, SymtabAPI::Region *);
     ~SymtabCodeRegion();
 
-    void names(Address, vector<std::string> &);
+    void names(Address, std::vector<std::string> &);
     bool findCatchBlock(Address addr, Address & catchStart);
 
     /** InstructionSource implementation **/
diff --git a/parseAPI/h/GraphAdapter.h b/parseAPI/h/GraphAdapter.h
index 384740f..2d2b732 100644
--- a/parseAPI/h/GraphAdapter.h
+++ b/parseAPI/h/GraphAdapter.h
@@ -6,7 +6,6 @@
 
 using namespace Dyninst;
 using namespace ParseAPI;
-using namespace std;
 
 namespace boost
 {
diff --git a/parseAPI/h/Location.h b/parseAPI/h/Location.h
index 0880dd0..8651ed8 100644
--- a/parseAPI/h/Location.h
+++ b/parseAPI/h/Location.h
@@ -39,7 +39,6 @@
 #include "Instruction.h"
 
 #include <string>
-using namespace std;
 
 namespace Dyninst{
 namespace ParseAPI{
diff --git a/parseAPI/h/SymLiteCodeSource.h b/parseAPI/h/SymLiteCodeSource.h
index 5cf9ce5..0e947b0 100644
--- a/parseAPI/h/SymLiteCodeSource.h
+++ b/parseAPI/h/SymLiteCodeSource.h
@@ -58,7 +58,7 @@ class SymReaderCodeRegion : public CodeRegion {
     PARSER_EXPORT SymReaderCodeRegion(SymReader *, SymSegment *);
     PARSER_EXPORT ~SymReaderCodeRegion();
 
-    PARSER_EXPORT void names(Address, vector<std::string> &);
+    PARSER_EXPORT void names(Address, std::vector<std::string> &);
     PARSER_EXPORT bool findCatchBlock(Address addr, Address & catchStart);
 
     /** InstructionSource implementation **/
diff --git a/parseAPI/src/CFGFactory.C b/parseAPI/src/CFGFactory.C
index 8ced7cd..dbf845d 100644
--- a/parseAPI/src/CFGFactory.C
+++ b/parseAPI/src/CFGFactory.C
@@ -34,6 +34,7 @@
 #include "CFG.h"
 #include <iostream>
 
+using namespace std;
 using namespace Dyninst;
 using namespace Dyninst::ParseAPI;
 
diff --git a/parseAPI/src/IA_IAPI.h b/parseAPI/src/IA_IAPI.h
index cbf51bf..dbf8851 100644
--- a/parseAPI/src/IA_IAPI.h
+++ b/parseAPI/src/IA_IAPI.h
@@ -42,6 +42,8 @@
 
 #include "CFG.h"
 
+using namespace std;
+
 namespace Dyninst {
 namespace InsnAdapter {
 
diff --git a/parseAPI/src/InstructionAdapter.C b/parseAPI/src/InstructionAdapter.C
index bc54955..9f2fb24 100644
--- a/parseAPI/src/InstructionAdapter.C
+++ b/parseAPI/src/InstructionAdapter.C
@@ -36,6 +36,7 @@
 #include "parseAPI/h/CodeObject.h"
 #include "boost/tuple/tuple.hpp"
 
+using namespace std;
 using namespace Dyninst;
 using namespace Dyninst::InsnAdapter;
 using namespace Dyninst::ParseAPI;
diff --git a/parseAPI/src/LoopAnalyzer.h b/parseAPI/src/LoopAnalyzer.h
index c77521b..34fa1a7 100644
--- a/parseAPI/src/LoopAnalyzer.h
+++ b/parseAPI/src/LoopAnalyzer.h
@@ -36,6 +36,8 @@
 #include "Annotatable.h"
 #include "CFG.h"
 
+using namespace std;
+
 /** class which finds loops in a function 
   *
   */
diff --git a/parseAPI/src/LoopTreeNode.C b/parseAPI/src/LoopTreeNode.C
index fa11f15..9bc145f 100644
--- a/parseAPI/src/LoopTreeNode.C
+++ b/parseAPI/src/LoopTreeNode.C
@@ -31,6 +31,7 @@
 
 #include "CFG.h"
 
+using namespace std;
 using namespace Dyninst;
 using namespace Dyninst::ParseAPI;
 
diff --git a/parseAPI/src/ThunkData.h b/parseAPI/src/ThunkData.h
index 1e4cd410..7b81b8b 100644
--- a/parseAPI/src/ThunkData.h
+++ b/parseAPI/src/ThunkData.h
@@ -5,6 +5,7 @@
 //#include "Instruction.h"
 #include "DynAST.h"
 
+using namespace std;
 using namespace Dyninst;
 using namespace Dyninst::ParseAPI;
 //using namespace Dyninst::InstructionAPI;
diff --git a/parseAPI/src/dominator.h b/parseAPI/src/dominator.h
index c5d0dac..f7b70ed 100644
--- a/parseAPI/src/dominator.h
+++ b/parseAPI/src/dominator.h
@@ -36,6 +36,8 @@
 #include <unordered_map>
 #include <set>
 
+using namespace std;
+
 namespace Dyninst{
 namespace ParseAPI{
 
diff --git a/patchAPI/h/PatchCFG.h b/patchAPI/h/PatchCFG.h
index 2d8f019..64f3258 100644
--- a/patchAPI/h/PatchCFG.h
+++ b/patchAPI/h/PatchCFG.h
@@ -197,7 +197,7 @@ class PATCHAPI_EXPORT PatchFunction {
      PatchFunction(const PatchFunction* parFunc, PatchObject* child);
      virtual ~PatchFunction();
 
-     const string &name() const { return func_->name(); }
+     const std::string &name() const { return func_->name(); }
      Address addr() const { return addr_;  }
      ParseAPI::Function *function() const { return func_; }
      PatchObject *obj() const { return obj_; }
diff --git a/patchAPI/src/AddrSpace.C b/patchAPI/src/AddrSpace.C
index a0a68c2..19f7ac5 100644
--- a/patchAPI/src/AddrSpace.C
+++ b/patchAPI/src/AddrSpace.C
@@ -34,6 +34,7 @@
 #include "PatchObject.h"
 #include "PatchMgr.h"
 
+using namespace std;
 using Dyninst::PatchAPI::AddrSpace;
 using Dyninst::PatchAPI::PatchObject;
 using Dyninst::PatchAPI::PatchMgr;
diff --git a/patchAPI/src/PatchBlock.C b/patchAPI/src/PatchBlock.C
index e33cb42..e144a5c 100644
--- a/patchAPI/src/PatchBlock.C
+++ b/patchAPI/src/PatchBlock.C
@@ -38,6 +38,7 @@
 #include "Point.h"
 #include <boost/shared_ptr.hpp>
 
+using namespace std;
 using namespace Dyninst;
 using namespace PatchAPI;
 using namespace InstructionAPI;
diff --git a/patchAPI/src/PatchCallback.C b/patchAPI/src/PatchCallback.C
index 80e886b..b08876a 100644
--- a/patchAPI/src/PatchCallback.C
+++ b/patchAPI/src/PatchCallback.C
@@ -31,6 +31,7 @@
 #include "PatchCFG.h"
 #include "Point.h"
 
+using namespace std;
 using namespace Dyninst;
 using namespace PatchAPI;
 
diff --git a/patchAPI/src/PatchEdge.C b/patchAPI/src/PatchEdge.C
index 28e0c2e..8954e54 100644
--- a/patchAPI/src/PatchEdge.C
+++ b/patchAPI/src/PatchEdge.C
@@ -32,6 +32,7 @@
 #include "PatchCFG.h"
 #include "PatchCallback.h"
 
+using namespace std;
 using namespace Dyninst;
 using namespace PatchAPI;
 
diff --git a/patchAPI/src/PatchFunction.C b/patchAPI/src/PatchFunction.C
index fdbd884..36d3b6f 100644
--- a/patchAPI/src/PatchFunction.C
+++ b/patchAPI/src/PatchFunction.C
@@ -35,6 +35,7 @@
 
 #include "CFG.h"
 
+using namespace std;
 using namespace Dyninst;
 using namespace PatchAPI;
 
diff --git a/patchAPI/src/PatchModifier.C b/patchAPI/src/PatchModifier.C
index 52c7eae..a126d2a 100644
--- a/patchAPI/src/PatchModifier.C
+++ b/patchAPI/src/PatchModifier.C
@@ -37,6 +37,7 @@
 #include <set>
 #include <vector>
 
+using namespace std;
 using namespace Dyninst;
 using namespace PatchAPI;
 
diff --git a/patchAPI/src/PatchObject.C b/patchAPI/src/PatchObject.C
index 43f1477..c8230a3 100644
--- a/patchAPI/src/PatchObject.C
+++ b/patchAPI/src/PatchObject.C
@@ -36,6 +36,7 @@
 #include "PatchCallback.h"
 #include "ParseCallback.h"
 
+using namespace std;
 using namespace Dyninst;
 using namespace PatchAPI;
 
diff --git a/symtabAPI/h/Aggregate.h b/symtabAPI/h/Aggregate.h
index 586a927..d65aa9e 100644
--- a/symtabAPI/h/Aggregate.h
+++ b/symtabAPI/h/Aggregate.h
@@ -87,7 +87,7 @@ class SYMTAB_EXPORT Aggregate
       //std::vector<std::string> getAllMangledNames();
       //std::vector<std::string> getAllPrettyNames();
       //std::vector<std::string> getAllTypedNames();
-      typedef boost::transform_iterator<std::const_mem_fun_t<string, Symbol>, vector<Symbol*>::const_iterator> name_iter;
+      typedef boost::transform_iterator<std::const_mem_fun_t<std::string, Symbol>, std::vector<Symbol*>::const_iterator> name_iter;
       name_iter mangled_names_begin() const;
       name_iter mangled_names_end() const;
       name_iter pretty_names_begin() const;
diff --git a/symtabAPI/h/Archive.h b/symtabAPI/h/Archive.h
index 3ade396..2e33790 100644
--- a/symtabAPI/h/Archive.h
+++ b/symtabAPI/h/Archive.h
@@ -31,8 +31,6 @@
 #ifndef __ARCHIVE_H__
 #define __ARCHIVE_H__
  
-using namespace std;
-
 class MappedFile;
 
 namespace Dyninst{
@@ -46,7 +44,7 @@ class Symtab;
 class SYMTAB_EXPORT ArchiveMember {
     public:
         ArchiveMember() : name_(""), offset_(0), member_(NULL) {}
-        ArchiveMember(const string name, const Offset offset,
+        ArchiveMember(const std::string name, const Offset offset,
                 Symtab * img = NULL) :
             name_(name), 
             offset_(offset), 
@@ -60,37 +58,37 @@ class SYMTAB_EXPORT ArchiveMember {
             }
         }
 
-        const string& getName()  { return name_; }
+        const std::string& getName()  { return name_; }
         Offset getOffset() { return offset_; }
         Symtab * getSymtab() { return member_; }
         void setSymtab(Symtab *img) { member_ = img; }
 
     private:
-        const string name_;
+        const std::string name_;
         Offset offset_;
         Symtab *member_;
 };
 
 class SYMTAB_EXPORT Archive : public AnnotatableSparse {
    public:
-      static bool openArchive(Archive *&img, string filename);
+      static bool openArchive(Archive *&img, std::string filename);
       static bool openArchive(Archive *&img, char *mem_image, size_t image_size);
       static SymtabError getLastError();
-      static string printError(SymtabError err);
+      static std::string printError(SymtabError err);
 
       ~Archive();
-      bool getMember(Symtab *&img, string& member_name);
+      bool getMember(Symtab *&img, std::string& member_name);
       bool getMemberByOffset(Symtab *&img, Offset memberOffset);
-      bool getMemberByGlobalSymbol(Symtab *&img, string& symbol_name);
-      bool getAllMembers(vector<Symtab *> &members);
-      bool isMemberInArchive(string& member_name);
-      bool findMemberWithDefinition(Symtab *&obj, string& name);
+      bool getMemberByGlobalSymbol(Symtab *&img, std::string& symbol_name);
+      bool getAllMembers(std::vector<Symtab *> &members);
+      bool isMemberInArchive(std::string& member_name);
+      bool findMemberWithDefinition(Symtab *&obj, std::string& name);
       std::string name();
 
-      bool getMembersBySymbol(string name, std::vector<Symtab *> &matches);
+      bool getMembersBySymbol(std::string name, std::vector<Symtab *> &matches);
 
    private:
-      Archive(string &filename, bool &err);
+      Archive(std::string &filename, bool &err);
       Archive(char *mem_image, size_t image_size, bool &err);
 
       /**
@@ -116,16 +114,16 @@ class SYMTAB_EXPORT Archive : public AnnotatableSparse {
       //For ELF the elf pointer for the archive
       void *basePtr;
 
-      dyn_hash_map<string, ArchiveMember *> membersByName;
+      dyn_hash_map<std::string, ArchiveMember *> membersByName;
       dyn_hash_map<Offset, ArchiveMember *> membersByOffset;
-      std::multimap<string, ArchiveMember *> membersBySymbol;
+      std::multimap<std::string, ArchiveMember *> membersBySymbol;
 
       // The symbol table is lazily parsed
       bool symbolTableParsed;
 
       // A vector of all Archives. Used to avoid duplicating
       // an Archive that already exists.
-      static vector<Archive *> allArchives;
+      static std::vector<Archive *> allArchives;
 
       static SymtabError serr;
       static std::string errMsg;
diff --git a/symtabAPI/h/Function.h b/symtabAPI/h/Function.h
index 607de55..b942e42 100644
--- a/symtabAPI/h/Function.h
+++ b/symtabAPI/h/Function.h
@@ -189,7 +189,7 @@ class SYMTAB_EXPORT InlinedFunction : public FunctionBase
    ~InlinedFunction();
    virtual Module* getModule() const { return module_; }
   public:
-   typedef vector<std::string>::const_iterator name_iter;
+   typedef std::vector<std::string>::const_iterator name_iter;
    std::pair<std::string, Dyninst::Offset> getCallsite();
    virtual bool removeSymbol(Symbol *sym);
    virtual bool addMangledName(std::string name, bool isPrimary);
diff --git a/symtabAPI/src/Archive-elf.C b/symtabAPI/src/Archive-elf.C
index 828a289..b7f2159 100644
--- a/symtabAPI/src/Archive-elf.C
+++ b/symtabAPI/src/Archive-elf.C
@@ -34,6 +34,7 @@
 #include "symtabAPI/h/Archive.h"
 #include "symtabAPI/src/Object.h"
 
+using namespace std;
 using namespace Dyninst;
 using namespace Dyninst::SymtabAPI;
 
diff --git a/symtabAPI/src/Archive.C b/symtabAPI/src/Archive.C
index 55cb3b9..f0ac69c 100644
--- a/symtabAPI/src/Archive.C
+++ b/symtabAPI/src/Archive.C
@@ -34,6 +34,7 @@
 
 #include <iostream>
 
+using namespace std;
 using namespace Dyninst;
 using namespace Dyninst::SymtabAPI;
 
-- 
2.8.1

[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [PATCH] Reduce namespace pollution, Peter Foley <=