JuliaInterop / Clang.jl

C binding generator and Julia interface to libclang
https://juliainterop.github.io/Clang.jl/
MIT License
219 stars 68 forks source link

Allow -x c++ to work #432

Closed vchuravy closed 5 months ago

vchuravy commented 1 year ago

Attempt at fixing https://github.com/JuliaInterop/Clang.jl/issues/430#issuecomment-1548781755

vchuravy commented 1 year ago

Struggles still with:

/// Severity of a diagnostic.
enum MlirDiagnosticSeverity {
  MlirDiagnosticError,
  MlirDiagnosticWarning,
  MlirDiagnosticNote,
  MlirDiagnosticRemark
};
typedef enum MlirDiagnosticSeverity MlirDiagnosticSeverity;
vchuravy commented 1 year ago

Motivating PR in MLIR.jl https://github.com/JuliaLabs/MLIR.jl/pull/10, but of course kinda ugly since we suddenly have to deal with new things...

Gnimuc commented 1 year ago

Allowing -x c++ is not enough for generic C++ support, we need to add C++ standard library and system headers like what has been done in ClangCompiler.jl: https://github.com/Gnimuc/ClangCompiler.jl/blob/master/src/platform/system.jl

Gnimuc commented 1 year ago

Struggles still with:

/// Severity of a diagnostic.
enum MlirDiagnosticSeverity {
  MlirDiagnosticError,
  MlirDiagnosticWarning,
  MlirDiagnosticNote,
  MlirDiagnosticRemark
};
typedef enum MlirDiagnosticSeverity MlirDiagnosticSeverity;

Is this problem caused by the audit step?

I added an option no_audit in this PR which might be helpful...

vchuravy commented 1 year ago

is not enough for generic C++ support, we need to add C++ standard library and system headers like what has been done in ClangCompiler.jl

Yeah I don't need generic C++ support, more C headers written by C++ people... E.g. MLIR headers contain some C++-ism

vchuravy commented 1 year ago

Is this problem caused by the audit step?

No the issue is that C++ mode changes the representation of some of the Clang nodes. I needed https://github.com/JuliaInterop/Clang.jl/pull/435 to sucesfully parse the MLIR headers.