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

Deterministic generator #24

Closed
t-bltg opened this issue Mar 11, 2023 · 4 comments · Fixed by JuliaInterop/Clang.jl#421
Closed

Deterministic generator #24

t-bltg opened this issue Mar 11, 2023 · 4 comments · Fixed by JuliaInterop/Clang.jl#421

Comments

@t-bltg
Copy link
Contributor

t-bltg commented Mar 11, 2023

I wanted to update the generator for llvm 14.0.6 for julia 1.9 in #25, however it seems that the generator handles headers in a non-deterministic way. Re-running the generator thus changes the generated signatures every time.

This, probably because julia Sets used in Clang.jl are un-ordered:
https://github.com/JuliaInterop/Clang.jl/blob/c95896f223b88b74e51ceeee65ad74a8108e9474/src/generator/context.jl#L252-L253

Should we fix this ?

@Gnimuc
Copy link
Owner

Gnimuc commented Mar 11, 2023

Another way to keep the order of headers deterministic is to include all of the headers in https://github.com/Gnimuc/libclangex/blob/master/include/clang-ex/libclangex.h and only pass libclangex.h to Clang.jl's generator without using detect_headers.

@t-bltg
Copy link
Contributor Author

t-bltg commented Mar 11, 2023

List all the headers manually ?
That quite a big list to maintain:

CXError.h
CXTypes.h
libclangex.h
AST/CXASTConsumer.h
AST/CXASTContext.h
AST/CXDecl.h
AST/CXDeclBase.h
AST/CXDeclCXX.h
AST/CXDeclGroup.h
AST/CXDeclTemplate.h
AST/CXDeclarationName.h
AST/CXExpr.h
AST/CXMangle.h
AST/CXNestedNameSpecifier.h
AST/CXOperationKinds.h
AST/CXTemplateBase.h
AST/CXTemplateName.h
AST/CXType.h
Basic/CXCodeGenOptions.h
Basic/CXDiagnostic.h
Basic/CXDiagnosticIDs.h
Basic/CXDiagnosticOptions.h
Basic/CXExceptionSpecificationType.h
Basic/CXFileEntry.h
Basic/CXFileManager.h
Basic/CXIdentifierTable.h
Basic/CXLambda.h
Basic/CXLangOptions.h
Basic/CXLinkage.h
Basic/CXModule.h
Basic/CXPragmaKinds.h
Basic/CXSourceLocation.h
Basic/CXSourceManager.h
Basic/CXSpecifiers.h
Basic/CXTargetInfo.h
Basic/CXTargetOptions.h
Basic/CXVisibility.h
CodeGen/CXCodeGenABITypes.h
CodeGen/CXCodeGenAction.h
CodeGen/CXModuleBuilder.h
Driver/CXDriver.h
Frontend/CXCompilerInstance.h
Frontend/CXCompilerInvocation.h
Frontend/CXFrontendOptions.h
Frontend/CXTextDiagnosticPrinter.h
Lex/CXHeaderSearch.h
Lex/CXHeaderSearchOptions.h
Lex/CXLexer.h
Lex/CXPreprocessor.h
Lex/CXPreprocessorOptions.h
Lex/CXToken.h
Parse/CXParseAST.h
Parse/CXParser.h
Sema/CXDeclSpec.h
Sema/CXLookup.h
Sema/CXScope.h
Sema/CXSema.h

@Gnimuc
Copy link
Owner

Gnimuc commented Mar 11, 2023

Comparing what I've done in libclangex, this is nothing.

@t-bltg
Copy link
Contributor Author

t-bltg commented Mar 11, 2023

Oh I didn't notice libclangex.h belonging to the libclangex repository sorry, no need to maintain the list outside.
Let's update it then, I will make a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants