For a down-stream analysis that reads CIL instrumented files, I need #line pragmas for local variables. I can do that by redefining 'pVDecl' in my CIL printer.

But, when printing a function definition, defaultCilPrinterClass doesn't add a new line after the opening curly brace. So, it prints

foo()
{ int cil_tmp;

This causes a pre-processor error if I print the #line before the variable declaration.

foo()
{ #  12 bar.c
  int cil_tmp;


This patch adds a new line after the curly brace. Since pFunDecl is private, I cannot solve it by redefining pFunDecl in a subclass of defaultCilPrinterClass.

I'm submitting this patch so it can make it in the new release. Having local changes to the CIL tree (albeit 1 line) is still a headache :)

Thanks,
-Arumuga
--- /src/cil.ml	2009-04-24 13:50:33.000000000 -0500
+++ src/cil.ml	2011-10-27 13:31:21.000000000 -0500
@@ -4102,11 +4102,14 @@
       ++ text "{ "
       ++ (align
             (* locals. *)
+            ++ line
             ++ (docList ~sep:line (fun vi -> self#pVDecl () vi ++ text ";") 
                   () f.slocals)
             ++ line ++ line
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to