Remove the default constructor and count variable from the Mangler since
authorEric Christopher <echristo@gmail.com>
Thu, 29 Sep 2016 02:03:50 +0000 (02:03 +0000)
committerEric Christopher <echristo@gmail.com>
Thu, 29 Sep 2016 02:03:50 +0000 (02:03 +0000)
we can just use the size of the DenseMap as a unique counter.

llvm-svn: 282674

llvm/include/llvm/IR/Mangler.h
llvm/lib/IR/Mangler.cpp

index 349218e..0eb91a3 100644 (file)
@@ -29,12 +29,7 @@ class Mangler {
   /// This keeps track of the number we give to anonymous ones.
   mutable DenseMap<const GlobalValue*, unsigned> AnonGlobalIDs;
 
-  /// This simple counter is used to unique value names.
-  mutable unsigned NextAnonGlobalID;
-
 public:
-  Mangler() : NextAnonGlobalID(1) {}
-
   /// Print the appropriate prefix and the specified global variable's name.
   /// If the global variable doesn't have a name, this fills in a unique name
   /// for the global.
index ddf024d..41e11b3 100644 (file)
@@ -121,7 +121,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
     // already.
     unsigned &ID = AnonGlobalIDs[GV];
     if (ID == 0)
-      ID = NextAnonGlobalID++;
+      ID = AnonGlobalIDs.size();
 
     // Must mangle the global into a unique ID.
     getNameWithPrefixImpl(OS, "__unnamed_" + Twine(ID), DL, PrefixTy);