diff options
author | Anders Carlsson <andersca@mac.com> | 2009-09-17 03:53:28 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-09-17 03:53:28 +0000 |
commit | d3a932a2980eef3c3ea2cd28f7946a185215d4e1 (patch) | |
tree | 939ae97266f28c59d7503021d03beb6a6e56d5a4 /lib/CodeGen/Mangle.cpp | |
parent | 511ec0579593296d28f63a940847c38867329073 (diff) |
Add mangleSubstitution/addSubstitution variants that take a NamedDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82116 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/Mangle.cpp')
-rw-r--r-- | lib/CodeGen/Mangle.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index c0451bfa02..6429bd7c46 100644 --- a/lib/CodeGen/Mangle.cpp +++ b/lib/CodeGen/Mangle.cpp @@ -55,8 +55,17 @@ namespace { void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type); private: + bool mangleSubstitution(const NamedDecl *ND) { + return mangleSubstitution(reinterpret_cast<uintptr_t>(ND)); + } bool mangleSubstitution(QualType T); + bool mangleSubstitution(uintptr_t Ptr); + + void addSubstitution(const NamedDecl *ND) { + addSubstitution(reinterpret_cast<uintptr_t>(ND)); + } void addSubstitution(QualType T); + void addSubstitution(uintptr_t Ptr); bool mangleFunctionDecl(const FunctionDecl *FD); @@ -912,8 +921,12 @@ void CXXNameMangler::mangleTemplateArgument(const TemplateArgument &A) { bool CXXNameMangler::mangleSubstitution(QualType T) { uintptr_t TypePtr = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr()); + return mangleSubstitution(TypePtr); +} + +bool CXXNameMangler::mangleSubstitution(uintptr_t Ptr) { llvm::DenseMap<uintptr_t, unsigned>::iterator I = - Substitutions.find(TypePtr); + Substitutions.find(Ptr); if (I == Substitutions.end()) return false; @@ -947,10 +960,14 @@ bool CXXNameMangler::mangleSubstitution(QualType T) { void CXXNameMangler::addSubstitution(QualType T) { uintptr_t TypePtr = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr()); + addSubstitution(TypePtr); +} + +void CXXNameMangler::addSubstitution(uintptr_t Ptr) { unsigned SeqID = Substitutions.size(); - assert(!Substitutions.count(TypePtr) && "Substitution already exists!"); - Substitutions[TypePtr] = SeqID; + assert(!Substitutions.count(Ptr) && "Substitution already exists!"); + Substitutions[Ptr] = SeqID; } namespace clang { |