Pass -fopenmp=libiomp5 flag to Libtooling front-end in clang3.6

hi there:

My Clang version is 3.6.

i can use the following command to dump my OpenMP code:

clang -cc1 -ast-dump openmp.c -fopenmp=libiomp5

it works well(PS: I add dump support roughly) :

OMPTaskDirective 0x8c3caa8 <line:6:9, col:17>
`-CapturedStmt 0x8c3c880 <line:7:1, line:11:1>

-Capture byref Var 0x8bfb280 ‘k’ ‘char’
-Capture byref Var 0x8bfb170 ‘d’ ‘int’
-CapturedDecl 0x8c3c510 <>
`-ImplicitParamDecl 0x8c3c5a0 line:6:9 col:9 implicit __context ‘struct (anonymous at openmp.c:6:9) *’
-CompoundStmt 0x8c3c858 <line:7:1, line:11:1>

-BinaryOperator 0x8c3c708 <line:8:1, col:3> ‘char’ ‘=’

-DeclRefExpr 0x8c3c628 col:1 ‘char’ lvalue Var 0x8bfb280 ‘k’ ‘char’
-ImplicitCastExpr 0x8c3c6f0 <col:3> 'char' <IntegralCast> -IntegerLiteral 0x8c3c6d0 col:3 ‘int’ 0
-BinaryOperator 0x8c3c830 <line:9:1, col:3> 'int' '=' -DeclRefExpr 0x8c3c758 <col:1> 'int' lvalue Var 0x8bfb170 'd' 'int' -IntegerLiteral 0x8c3c810 col:3 ‘int’ 0
-DeclRefExpr 0x8c3c6a8 line:8:1 ‘char’ lvalue Var 0x8bfb280 ‘k’ ‘char’
`-DeclRefExpr 0x8c3c7e8 line:9:1 ‘int’ lvalue Var 0x8bfb170 ‘d’ ‘int’

i wrote a source-to-source tool using Libtooling, and i want to pass -fopenmp=libiomp5 flag to the tool in this way:

mytool openmp.c – -fopenmp=libiomp5

it does not work, -fopenmp=libiomp5 is not received by the front-end, see the output:

warning: argument unused during compilation: ‘-fopenmp=libiomp5’

`-CompoundStmt 0x33d69b8 <line:7:1, line:11:1>

-BinaryOperator 0x33957d8 <line:8:1, col:3> ‘char’ ‘=’

-DeclRefExpr 0x3395778 col:1 ‘char’ lvalue Var 0x33956f0 ‘k’ ‘char’
-ImplicitCastExpr 0x33957c0 <col:3> 'char' <IntegralCast> -IntegerLiteral 0x33957a0 col:3 ‘int’ 0
-BinaryOperator 0x33d6990 <line:9:1, col:3> 'int' '=' -DeclRefExpr 0x3395800 <col:1> 'int' lvalue Var 0x33955e0 'd' 'int' -IntegerLiteral 0x33d6970 col:3 ‘int’ 0

, what is the right way to pass fopenmp=libiomp5 to the frontend?

this commands works:
mytool openmp.c – -Xclang -fopenmp=libiomp5

mytool openmp.c – -Xclang -fopenmp=libiomp5

-OMPTaskDirective 0x3bb8e98 <line:6:9, col:17>
`-CapturedStmt 0x3bb8c70 <line:7:1, line:11:1>

-Capture byref Var 0x3b77640 ‘k’ ‘char’
-Capture byref Var 0x3b77530 ‘d’ ‘int’
-CapturedDecl 0x3bb8900 <>
`-ImplicitParamDecl 0x3bb8990 line:6:9 col:9 implicit __context ‘struct (anonymous at /home/metafork/test/openmp.c:6:9) *’
-CompoundStmt 0x3bb8c48 <line:7:1, line:11:1>

-BinaryOperator 0x3bb8af8 <line:8:1, col:3> ‘char’ ‘=’

-DeclRefExpr 0x3bb8a18 col:1 ‘char’ lvalue Var 0x3b77640 ‘k’ ‘char’
-ImplicitCastExpr 0x3bb8ae0 <col:3> 'char' <IntegralCast> -IntegerLiteral 0x3bb8ac0 col:3 ‘int’ 0
-BinaryOperator 0x3bb8c20 <line:9:1, col:3> 'int' '=' -DeclRefExpr 0x3bb8b48 <col:1> 'int' lvalue Var 0x3b77530 'd' 'int' -IntegerLiteral 0x3bb8c00 col:3 ‘int’ 0
-DeclRefExpr 0x3bb8a98 line:8:1 ‘char’ lvalue Var 0x3b77640 ‘k’ ‘char’
`-DeclRefExpr 0x3bb8bd8 line:9:1 ‘int’ lvalue Var 0x3b77530 ‘d’ ‘int’