Adding parallelism construct.

I'm adding a set of extensions to clang to support a language we're developing and one of those extensions is a new statement type of the form:

par function_call_expression;

I'm detecting the new keyword "par" in ParseStatementOrDeclaration and then passing parsing over to a new function. My question is how to structure that function. Is there any existing function in clang which parses something that is a priori known (or expected) to be a function call? It doesn't seems that clang would need such a function so perhaps a better approach is to use one of existing generic expression parsing functions (ParseCastExpression or something else?) and then check to see if the resulting expression was of a single function call type. Is there any easy way to check if an expression generated with an existing function is a function call?

All input appreciated.

Thanks,
Todd

I'm adding a set of extensions to clang to support a language we're developing and one of those extensions is a new statement type of the form:

par function_call_expression;

I'm detecting the new keyword "par" in ParseStatementOrDeclaration and then passing parsing over to a new function. My question is how to structure that function. Is there any existing function in clang which parses something that is a priori known (or expected) to be a function call? It doesn't seems that clang would need such a function so perhaps a better approach is to use one of existing generic expression parsing functions (ParseCastExpression or something else?) and then check to see if the resulting expression was of a single function call type.

Yes, this is the best option.

Is there any easy way to check if an expression generated with an existing function is a function call?

The expression will be a CallExpr if it's a simple call, which can be queried with isa<CallExpr>(some expr) or extracted with dyn_cast<CallExpr>(some expr). You can use

  clang -cc1 -ast-dump <filename>

to see the parsed structure of an expression.

  - Doug