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.h b/lib/CodeGen/Mangle.h
index 8d96295..97f94b6 100644
--- a/lib/CodeGen/Mangle.h
+++ b/lib/CodeGen/Mangle.h
@@ -44,7 +44,9 @@
ASTContext &Context;
llvm::DenseMap<const TagDecl *, uint64_t> AnonStructIds;
-
+ unsigned Discriminator;
+ llvm::DenseMap<const NamedDecl*, unsigned> Uniquifier;
+
public:
explicit MangleContext(ASTContext &Context)
: Context(Context) { }
@@ -85,7 +87,20 @@
llvm::SmallVectorImpl<char> &);
void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type,
llvm::SmallVectorImpl<char> &);
+
+ void mangleInitDiscriminator() {
+ Discriminator = 0;
+ }
+ bool getNextDiscriminator(const NamedDecl *ND, unsigned &disc) {
+ unsigned &discriminator = Uniquifier[ND];
+ if (!discriminator)
+ discriminator = ++Discriminator;
+ if (discriminator == 1)
+ return false;
+ disc = discriminator-2;
+ return true;
+ }
/// @}
};