CppAst.NET icon indicating copy to clipboard operation
CppAst.NET copied to clipboard

Parser Option "ParseAsCpp" problem when parsing as C

Open danyhm opened this issue 4 years ago • 2 comments

Hello,

if the parser option ParseAsCpp is set to false, the compilation is always returned empty regardless of the input files or texts.

Is Parsing as C not supported?

danyhm avatar May 15 '21 11:05 danyhm

Not sure if this is a bug. It looks like CppParser just excludes passing the -xc++ option to clang if ParseAsCpp is false. I think you can work around it for now by passing -xc or --language=c into AdditionalArguments.

var options = new CSharpConverterOptions();
options.AdditionalArguments.Add("--language=c");

waldnercharles avatar Mar 08 '22 23:03 waldnercharles

Correct, ParseAsCpp is doing this:

https://github.com/xoofx/CppAst.NET/blob/f2d7445e2d81d7eebc559a7f4284ec8a5967cd44/src/CppAst/CppParser.cs#L97-L100

But you can pass other arguments to clang directly.

xoofx avatar Mar 09 '22 07:03 xoofx