[cfe-commits] r82116 - /cfe/trunk/lib/CodeGen/Mangle.cpp
Anders Carlsson
andersca at mac.com
Wed Sep 16 20:53:28 PDT 2009
Author: andersca
Date: Wed Sep 16 22:53:28 2009
New Revision: 82116
URL: http://llvm.org/viewvc/llvm-project?rev=82116&view=rev
Log:
Add mangleSubstitution/addSubstitution variants that take a NamedDecl.
Modified:
cfe/trunk/lib/CodeGen/Mangle.cpp
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=82116&r1=82115&r2=82116&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Wed Sep 16 22:53:28 2009
@@ -55,8 +55,17 @@
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 @@
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 @@
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 {
More information about the cfe-commits
mailing list