[cfe-commits] r82113 - /cfe/trunk/lib/CodeGen/Mangle.cpp

Anders Carlsson andersca at mac.com
Wed Sep 16 20:17:02 PDT 2009


Author: andersca
Date: Wed Sep 16 22:17:01 2009
New Revision: 82113

URL: http://llvm.org/viewvc/llvm-project?rev=82113&view=rev
Log:
Add new functions to the mangler for the <unscoped-name> and <unscoped-template-name> productions.

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=82113&r1=82112&r2=82113&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Wed Sep 16 22:17:01 2009
@@ -63,6 +63,8 @@
     void mangleFunctionEncoding(const FunctionDecl *FD);
     void mangleName(const NamedDecl *ND);
     void mangleUnqualifiedName(const NamedDecl *ND);
+    void mangleUnscopedName(const NamedDecl *ND);
+    void mangleUnscopedTemplateName(const FunctionDecl *ND);
     void mangleSourceName(const IdentifierInfo *II);
     void mangleLocalName(const NamedDecl *ND);
     void mangleNestedName(const NamedDecl *ND);
@@ -233,21 +235,36 @@
   //  <name> ::= <nested-name>
   //         ::= <unscoped-name>
   //         ::= <unscoped-template-name> <template-args>
-  //         ::= <local-name>     # See Scope Encoding below
+  //         ::= <local-name>
   //
-  //  <unscoped-name> ::= <unqualified-name>
-  //                  ::= St <unqualified-name>   # ::std::
-  if (ND->getDeclContext()->isTranslationUnit())
-    mangleUnqualifiedName(ND);
-  else if (isStdNamespace(ND->getDeclContext())) {
-    Out << "St";
-    mangleUnqualifiedName(ND);
+  if (ND->getDeclContext()->isTranslationUnit() ||
+      isStdNamespace(ND->getDeclContext())) {
+    const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND);
+    if (FD && FD->getPrimaryTemplate()) 
+      mangleUnscopedTemplateName(FD);
+    else
+      mangleUnscopedName(ND);
   } else if (isa<FunctionDecl>(ND->getDeclContext()))
     mangleLocalName(ND);
   else
     mangleNestedName(ND);
 }
 
+void CXXNameMangler::mangleUnscopedName(const NamedDecl *ND) {
+  //  <unscoped-name> ::= <unqualified-name>
+  //                  ::= St <unqualified-name>   # ::std::
+  if (isStdNamespace(ND->getDeclContext()))
+    Out << "St";
+  
+  mangleUnqualifiedName(ND);
+}
+
+void CXXNameMangler::mangleUnscopedTemplateName(const FunctionDecl *FD) {
+  //     <unscoped-template-name> ::= <unscoped-name>
+  //                              ::= <substitution>
+  mangleUnscopedName(FD);
+}
+
 void CXXNameMangler::mangleCalloffset(int64_t nv, int64_t v) {
   //  <call-offset>  ::= h <nv-offset> _
   //                 ::= v <v-offset> _





More information about the cfe-commits mailing list