[cfe-commits] r68969 - in /cfe/trunk/lib/CodeGen: Mangle.cpp Mangle.h

Anders Carlsson andersca at mac.com
Mon Apr 13 11:02:10 PDT 2009


Author: andersca
Date: Mon Apr 13 13:02:10 2009
New Revision: 68969

URL: http://llvm.org/viewvc/llvm-project?rev=68969&view=rev
Log:
Add support for mangling guard variables.

Modified:
    cfe/trunk/lib/CodeGen/Mangle.cpp
    cfe/trunk/lib/CodeGen/Mangle.h

Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=68969&r1=68968&r2=68969&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Mon Apr 13 13:02:10 2009
@@ -34,6 +34,7 @@
       : Context(C), Out(os) { }
 
     bool mangle(const NamedDecl *D);
+    void mangleGuardVariable(const VarDecl *D);
     
   private:
     bool mangleFunctionDecl(const FunctionDecl *FD);
@@ -124,6 +125,15 @@
   return false;
 }
 
+void CXXNameMangler::mangleGuardVariable(const VarDecl *D)
+{
+  //  <special-name> ::= GV <object name>	# Guard variable for one-time 
+  //                                      # initialization
+
+  Out << "_ZGV";
+  mangleName(D);
+}
+
 void CXXNameMangler::mangleFunctionEncoding(const FunctionDecl *FD) {
   // <encoding> ::= <function name> <bare-function-type>
   mangleName(FD);
@@ -586,5 +596,14 @@
     os.flush();
     return true;
   }
+  
+  /// mangleGuardVariable - Mangles the m
+  void mangleGuardVariable(const VarDecl *D, ASTContext &Context,
+                           llvm::raw_ostream &os) {
+    CXXNameMangler Mangler(Context, os);
+    Mangler.mangleGuardVariable(D);
+
+    os.flush();
+  }
 }
 

Modified: cfe/trunk/lib/CodeGen/Mangle.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.h?rev=68969&r1=68968&r2=68969&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.h (original)
+++ cfe/trunk/lib/CodeGen/Mangle.h Mon Apr 13 13:02:10 2009
@@ -25,9 +25,12 @@
 namespace clang {
   class ASTContext;
   class NamedDecl;
-
+  class VarDecl;
+  
   bool mangleName(const NamedDecl *D, ASTContext &Context, 
                   llvm::raw_ostream &os);
+  void mangleGuardVariable(const VarDecl *D, ASTContext &Context,
+                           llvm::raw_ostream &os);
 }
 
 #endif 





More information about the cfe-commits mailing list