[cfe-dev] Pass -fopenmp=libiomp5 flag to Libtooling front-end in clang3.6

xiaohui chen xchen198812 at gmail.com
Tue Jan 13 12:55:01 PST 2015


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 <<invalid sloc>> <invalid sloc>
        | `-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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150113/fdc18b7e/attachment.html>


More information about the cfe-dev mailing list