Просмотр исходного кода

HPCC-8361 Provide a function to convert a type to IR text

Also export a couple of other helper functions.

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 12 лет назад
Родитель
Сommit
501a4c1457
2 измененных файлов с 13 добавлено и 2 удалено
  1. 8 1
      ecl/hql/hqlir.cpp
  2. 5 1
      ecl/hql/hqlir.hpp

+ 8 - 1
ecl/hql/hqlir.cpp

@@ -2101,7 +2101,7 @@ extern HQL_API void getIRText(StringBuffer & target, unsigned options, IHqlExpre
     reader.play(expr);
 }
 
-static void getIRText(StringArray & target, unsigned options, IHqlExpression * expr)
+extern HQL_API void getIRText(StringArray & target, unsigned options, IHqlExpression * expr)
 {
     StringArrayIRBuilder output(target, options);
     ExpressionIRPlayer reader(&output);
@@ -2116,6 +2116,13 @@ extern HQL_API const char * getIRText(IHqlExpression * expr)
     return staticDebuggingStringBuffer.str();
 }
 
+extern HQL_API const char * getIRText(ITypeInfo * type)
+{
+    StringBufferIRBuilder output(staticDebuggingStringBuffer, defaultDumpOptions);
+    playIR(output, NULL, NULL, type);
+    return staticDebuggingStringBuffer.str();
+}
+
 } // end namespace
 
 

+ 5 - 1
ecl/hql/hqlir.hpp

@@ -59,8 +59,12 @@ extern HQL_API void dbglogIR(IHqlExpression * expr);
 extern HQL_API void dbglogIR(ITypeInfo * type);
 extern HQL_API void dbglogIR(const HqlExprArray & exprs);
 
-//This is not thread safe, as is only designed to be called from within a debugger
+extern HQL_API void getIRText(StringBuffer & target, unsigned options, IHqlExpression * expr);
+extern HQL_API void getIRText(StringArray & target, unsigned options, IHqlExpression * expr);
+
+//These functions are not thread safe, they are only designed to be called from within a debugger
 extern HQL_API const char * getIRText(IHqlExpression * expr);
+extern HQL_API const char * getIRText(ITypeInfo * type);
 
 } // namespace EclIR