Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Specialize only related part of dumping of LLVM::Stuff.

  • Loading branch information...
commit 1fa34b404ec6d1b7295d28459727733d7795b7ae 1 parent 67c4b8b
Vasily Chekalkin authored April 25, 2011

Showing 1 changed file with 13 additions and 9 deletions. Show diff stats Hide diff stats

  1. 22  src/llvm_extra.cpp
22  src/llvm_extra.cpp
@@ -28,21 +28,25 @@ src/llvm_extra.c - Extra functions to extend LLVM C API.
28 28
 
29 29
 
30 30
 /* Helper method for LLVMDumpXXXToString() methods. */
31  
-template <typename Type>
32  
-STRING *dump_to_string(PARROT_INTERP, Type obj)
  31
+template <typename T, typename O>
  32
+void do_print(T ptr, O &buf)
33 33
 {
34  
-    std::string s;
35  
-    llvm::raw_string_ostream buf(s);
36  
-    llvm::unwrap(obj)->print(buf);
37  
-    return Parrot_str_from_platform_cstring(interp, s.c_str());
  34
+    ptr->print(buf);
38 35
 }
39 36
 
40  
-template <>
41  
-STRING *dump_to_string(PARROT_INTERP, LLVMModuleRef obj)
  37
+template <typename O>
  38
+void do_print(llvm::Module *ptr, O &buf)
  39
+{
  40
+    ptr->print(buf, NULL);
  41
+}
  42
+
  43
+
  44
+template <typename Type>
  45
+STRING *dump_to_string(PARROT_INTERP, Type obj)
42 46
 {
43 47
     std::string s;
44 48
     llvm::raw_string_ostream buf(s);
45  
-    llvm::unwrap(obj)->print(buf, NULL);
  49
+    do_print(llvm::unwrap(obj), buf);
46 50
     return Parrot_str_from_platform_cstring(interp, s.c_str());
47 51
 }
48 52
 

0 notes on commit 1fa34b4

Please sign in to comment.
Something went wrong with that request. Please try again.