sighingnow/libclang

Problem after package update

MikhailGorobets opened this issue · 11 comments

After updating libclang from version 12.0.0 to 13.0.0, this error appeared

Traceback (most recent call last):
  File "cxx_parser.py", line 150, in generate_file
    translation_unit = index.parse(input_filename, args=['-std=c++14'])
  File "C:\Python\lib\site-packages\clang\cindex.py", line 2721, in parse
    return TranslationUnit.from_source(path, args, unsaved_files, options,
  File "C:\Python\lib\site-packages\clang\cindex.py", line 2836, in from_source
    raise TranslationUnitLoadError("Error parsing translation unit.")
clang.cindex.TranslationUnitLoadError: Error parsing translation unit.

Which platform you are working with?

Could you provide some snippets that can trigger this issue?

I see, you are working on Windows.

I cannot reproduce the issue with some complex cpp files (see *.vineyard-mod under https://github.com/v6d-io/v6d/tree/main/modules/basic/ds).

I will try to retest on Windows later. It would be great if you could provide me some minimal examples.

@sighingnow
Crashes on all platforms (Linux, MacOS, Windows).
I'm trying to parse this file https://github.com/DiligentGraphics/DiligentCore/blob/master/Graphics/GraphicsEngine/interface/BlendState.h
When I used package version 12.0.0 everything works fine

@sighingnow Crashes on all platforms (Linux, MacOS, Windows). I'm trying to parse this file https://github.com/DiligentGraphics/DiligentCore/blob/master/Graphics/GraphicsEngine/interface/BlendState.h When I used package version 12.0.0 everything works fine

Let me take a try..

Also I can provide a minimal example of python code if you need it.

Graphics/GraphicsEngine/interface/BlendState.h

Could you provide your python code? I cannot reproduce the issue with both version of libclang on Mac.

Graphics/GraphicsEngine/interface/BlendState.h

Could you provide your python code? I cannot reproduce the issue with both version of libclang on Mac.

I can reproduce the issue now.

Could you try if

index.parse(input_filename, args=['-x', 'c++', '-std=c++14'])

solve your issue?

I think it is because -std=c++14 requires it be a C++ source file. There might some changes on the command line flags in clang 13.

Could you try if

index.parse(input_filename, args=['-x', 'c++', '-std=c++14'])

solve your issue?

Thank you. This solves my problem.
Before I passed arguments like this

index.parse(input_filename, args=['-std=c++14'])