summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/Mangle.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-17 03:53:28 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-17 03:53:28 +0000
commita96f56fba8879d785216665d951abb7d753a1444 (patch)
tree309d965ff178405fbb153a4c85a1f2030bbacd3b /clang/lib/CodeGen/Mangle.cpp
parent3e0d1e07475c801cc877f95cc3949d238e56231c (diff)
downloadbcm5719-llvm-a96f56fba8879d785216665d951abb7d753a1444.tar.gz
bcm5719-llvm-a96f56fba8879d785216665d951abb7d753a1444.zip
Add mangleSubstitution/addSubstitution variants that take a NamedDecl.
llvm-svn: 82116
Diffstat (limited to 'clang/lib/CodeGen/Mangle.cpp')
-rw-r--r--clang/lib/CodeGen/Mangle.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp
index c0451bfa02c..6429bd7c463 100644
--- a/clang/lib/CodeGen/Mangle.cpp
+++ b/clang/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 {
OpenPOWER on IntegriCloud