CppAst.NET
CppAst.NET copied to clipboard
Parser Option "ParseAsCpp" problem when parsing as C
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");
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.