Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 1fa34b404ec6d1b7295d28459727733d7795b7ae 1 parent 67c4b8b
@bacek bacek authored
Showing with 13 additions and 9 deletions.
  1. +13 −9 src/llvm_extra.cpp
View
22 src/llvm_extra.cpp
@@ -28,21 +28,25 @@ src/llvm_extra.c - Extra functions to extend LLVM C API.
/* Helper method for LLVMDumpXXXToString() methods. */
-template <typename Type>
-STRING *dump_to_string(PARROT_INTERP, Type obj)
+template <typename T, typename O>
+void do_print(T ptr, O &buf)
{
- std::string s;
- llvm::raw_string_ostream buf(s);
- llvm::unwrap(obj)->print(buf);
- return Parrot_str_from_platform_cstring(interp, s.c_str());
+ ptr->print(buf);
}
-template <>
-STRING *dump_to_string(PARROT_INTERP, LLVMModuleRef obj)
+template <typename O>
+void do_print(llvm::Module *ptr, O &buf)
+{
+ ptr->print(buf, NULL);
+}
+
+
+template <typename Type>
+STRING *dump_to_string(PARROT_INTERP, Type obj)
{
std::string s;
llvm::raw_string_ostream buf(s);
- llvm::unwrap(obj)->print(buf, NULL);
+ do_print(llvm::unwrap(obj), buf);
return Parrot_str_from_platform_cstring(interp, s.c_str());
}
Please sign in to comment.
Something went wrong with that request. Please try again.