Skip to content

Commit

Permalink
Remove the default constructor and count variable from the Mangler since
Browse files Browse the repository at this point in the history
we can just use the size of the DenseMap as a unique counter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282674 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
echristo committed Sep 29, 2016
1 parent cfc9fcc commit b660c90
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions include/llvm/IR/Mangler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/IR/Mangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b660c90

Please sign in to comment.