Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support direct abstract declarator processing #332

Open
Tracked by #61
ForNeVeR opened this issue Oct 19, 2022 · 4 comments
Open
Tracked by #61

Support direct abstract declarator processing #332

ForNeVeR opened this issue Oct 19, 2022 · 4 comments
Labels
good-first-issue An issue considered simple enough for new contributors kind:feature New feature or request status:help-wanted Open for contributors

Comments

@ForNeVeR
Copy link
Owner

ForNeVeR commented Oct 19, 2022

Follow-up from #234: we should support processing of any IDirectAbstractDeclarator in LocalDeclarationInfo::ProcessDirectAbstractDeclarator.

Look for the number 332 in our code when looking how to implement this feature.

@ForNeVeR ForNeVeR added kind:feature New feature or request status:help-wanted Open for contributors good-first-issue An issue considered simple enough for new contributors labels Oct 19, 2022
@kant2002
Copy link
Contributor

What kind of code trigger this code path? What test do we need for this ?

@ForNeVeR
Copy link
Owner Author

In a declaration of typedef void(*function)(int, const int*, const int*), const int* is an AbstractDeclarator, but it has IDirectAbstractDeclarator = null.

I sugges to take a look at the implementations of IDirectAbstractDeclarator and maybe figure out what's this all about from their types.

Sadly, I have no examples of such code, yet.

@abrahamFerga
Copy link
Contributor

(#450 not finished yet)
This issue makes the following code fail to compile:

int main() {
    return sizeof(int[5]);
}

@ForNeVeR
Copy link
Owner Author

Encountered in #61:

Cesium.Core.WipException: This work is in progress. Direct abstract declarator is not supported, yet: ArrayDirectAbstractDeclarator { Base = , TypeQualifiers = , Size = ConstantLiteralExpression { Constant = Yoakke.SynKit.C.Syntax.CToken } }.. See https://github.com/ForNeVeR/Cesium/issues/332.
   at Cesium.CodeGen.Ir.Declarations.LocalDeclarationInfo.ProcessDirectAbstractDeclarator(IDirectAbstractDeclarator directAbstractDeclarator, IType type) in G:\Projects\Cesium\Cesium.CodeGen\Ir\Declarations\LocalDeclarationInfo.cs:line 294
   at Cesium.CodeGen.Ir.Declarations.LocalDeclarationInfo.Of(IReadOnlyList`1 specifiers, AbstractDeclarator abstractDeclarator) in G:\Projects\Cesium\Cesium.CodeGen\Ir\Declarations\LocalDeclarationInfo.cs:line 52
   at Cesium.CodeGen.Ir.ParameterInfo.Of(ParameterDeclaration declaration, Int32 index) in G:\Projects\Cesium\Cesium.CodeGen\Ir\ParametersInfo.cs:line 49
   at System.Linq.Enumerable.SelectIterator[TSource,TResult](IEnumerable`1 source, Func`3 selector)+MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Cesium.CodeGen.Ir.ParametersInfo.Of(ParameterTypeList parameters) in G:\Projects\Cesium\Cesium.CodeGen\Ir\ParametersInfo.cs:line 35
   at Cesium.CodeGen.Ir.Declarations.LocalDeclarationInfo.ProcessFunctionParameters(IType returnType, ParameterTypeList parameters) in G:\Projects\Cesium\Cesium.CodeGen\Ir\Declarations\LocalDeclarationInfo.cs:line 416
   at Cesium.CodeGen.Ir.Declarations.LocalDeclarationInfo.ProcessDirectDeclarator(IDirectDeclarator directDeclarator, IType type, Initializer initializer) in G:\Projects\Cesium\Cesium.CodeGen\Ir\Declarations\LocalDeclarationInfo.cs:line 205
   at Cesium.CodeGen.Ir.Declarations.LocalDeclarationInfo.Of(IReadOnlyList`1 specifiers, Declarator declarator, Initializer initializer) in G:\Projects\Cesium\Cesium.CodeGen\Ir\Declarations\LocalDeclarationInfo.cs:line 39
   at Cesium.CodeGen.Ir.Declarations.IScopedDeclarationInfo.IdentifierOf(IReadOnlyList`1 specifiers, InitDeclarator initDeclarator) in G:\Projects\Cesium\Cesium.CodeGen\Ir\Declarations\ScopedDeclarationInfo.cs:line 96
   at Cesium.CodeGen.Ir.Declarations.IScopedDeclarationInfo.<>c__DisplayClass2_0.<IdentifierOf>b__0(InitDeclarator id) in G:\Projects\Cesium\Cesium.CodeGen\Ir\Declarations\ScopedDeclarationInfo.cs:line 85
   at System.Linq.Enumerable.SelectIListIterator`2.Fill(IList`1 source, Span`1 results, Func`2 func)
   at System.Linq.Enumerable.SelectIListIterator`2.ToList()
   at Cesium.CodeGen.Ir.Declarations.IScopedDeclarationInfo.IdentifierOf(IReadOnlyList`1 specifiers, IEnumerable`1 initDeclarators) in G:\Projects\Cesium\Cesium.CodeGen\Ir\Declarations\ScopedDeclarationInfo.cs:line 84
   at Cesium.CodeGen.Ir.Declarations.IScopedDeclarationInfo.Of(Declaration declaration) in G:\Projects\Cesium\Cesium.CodeGen\Ir\Declarations\ScopedDeclarationInfo.cs:line 59
   at Cesium.CodeGen.Extensions.TranslationUnitEx.GetTopLevelDeclarations(SymbolDeclaration sym)+MoveNext() in G:\Projects\Cesium\Cesium.CodeGen\Extensions\TranslationUnitEx.cs:line 22
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToList()
   at Cesium.CodeGen.Contexts.AssemblyContext.EmitTranslationUnit(String name, TranslationUnit translationUnit) in G:\Projects\Cesium\Cesium.CodeGen\Contexts\AssemblyContext.cs:line 53
   at Cesium.Compiler.Compilation.GenerateCode(AssemblyContext context, String inputFilePath) in G:\Projects\Cesium\Cesium.Compiler\Compilation.cs:line 118
   at Cesium.Compiler.Compilation.Compile(IEnumerable`1 inputFilePaths, String outputFilePath, CompilationOptions compilationOptions) in G:\Projects\Cesium\Cesium.Compiler\Compilation.cs:line 40
   at Program.<>c.<<<Main>$>b__0_0>d.MoveNext() in G:\Projects\Cesium\Cesium.Compiler\Main.cs:line 39
--- End of stack trace from previous location ---
   at Cesium.Compiler.CommandLineParser.<>c__DisplayClass0_0.<<ParseCommandLineArgs>b__1>d.MoveNext() in G:\Projects\Cesium\Cesium.Compiler\CommandLineParser.cs:line 37
--- End of stack trace from previous location ---
   at Cesium.Compiler.CommandLineParser.ParseCommandLineArgs(String[] args, ICompilerReporter reporter, Func`2 worker) in G:\Projects\Cesium\Cesium.Compiler\CommandLineParser.cs:line 18
   at Program.<Main>$(String[] args) in G:\Projects\Cesium\Cesium.Compiler\Main.cs:line 6
   at Program.<Main>(String[] args)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue An issue considered simple enough for new contributors kind:feature New feature or request status:help-wanted Open for contributors
Projects
None yet
Development

No branches or pull requests

3 participants