Refactor local class name mangling and make it
ABI conforming.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97702 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index e053f78..20d54b3 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -65,8 +65,6 @@
}
static const unsigned UnknownArity = ~0U;
-static unsigned Discriminator = 0;
-static llvm::DenseMap<const NamedDecl*, unsigned> Uniquifier;
/// CXXNameMangler - Manage the mangling of a single name.
class CXXNameMangler {
@@ -672,17 +670,14 @@
Out << 'E';
mangleNestedName(ND, DC, true /*NoFunction*/);
- // FIXME. This still does not conform to ABI and does not cover all cases.
- unsigned &discriminator = Uniquifier[ND];
- if (!discriminator)
- discriminator = ++Discriminator;
- if (discriminator == 1)
- return;
- unsigned disc = discriminator-2;
- if (disc < 10)
- Out << '_' << disc;
- else
- Out << "__" << disc << '_';
+ // FIXME. This still does not cover all cases.
+ unsigned disc;
+ if (Context.getNextDiscriminator(ND, disc)) {
+ if (disc < 10)
+ Out << '_' << disc;
+ else
+ Out << "__" << disc << '_';
+ }
return;
}