xoofx/CppAst.NET

Parser Option "ParseAsCpp" problem when parsing as C

danyhm opened this issue · 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?

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");
xoofx commented

Correct, ParseAsCpp is doing this:

if (options.ParseAsCpp && !arguments.Contains("-xc++"))
{
arguments.Add("-xc++");
}

But you can pass other arguments to clang directly.