grayout.vim
grayout.vim copied to clipboard
Return "Error Parsing translation Unit" when run ":GrayoutUpdate" in *.h headerfile
Describe the bug
- using Ubuntu 20.04 + clang 16.0 + neovim 0.8
- using the "commpile_commands.json"
- working well with *the .c file but once run in *.h file returns the error, tried with several different project, same issue. May related to clang 16.0?
Log file grayout.log
downgrade to clang 10.0 and related libclang llvm... It works again.
Thank you for the bug report, I will look into it. Could you test it with clang version 15, 14, etc., to determine in which version exactly the issue appears?
I have a same issue, but it still exists when I back to clang-15:
` Loading libclang: <CDLL '/usr/lib64//libclang.so', handle 2c3e9b0 at 0x7faca8115278> Initialized Querying arguments for /mnt/nvme0/git/kernel-6.6/include/linux/rcupdate.h Searching /mnt/nvme0/git/kernel-6.6/include/linux/compile_commands.json Searching /mnt/nvme0/git/kernel-6.6/include/compile_commands.json Searching /mnt/nvme0/git/kernel-6.6/compile_commands.json Found config file /mnt/nvme0/git/kernel-6.6/compile_commands.json CompilationDatabase loaded and stored in cache /mnt/nvme0/git/kernel-6.6 /mnt/nvme0/git/kernel-6.6/include/linux/rcupdate.h Compile flags: ['clang', '-Wp,-MMD,init/.calibrate.o.d', '-nostdinc', '-I./arch/x86/include', '-I./arch/x86/include/generated', '-I./include', '-I./arch/x86/i nclude/uapi', '-I./arch/x86/include/generated/uapi', '-I./include/uapi', '-I./include/generated/uapi', '-include', './include/linux/compiler-version.h', '-inc lude', './include/linux/kconfig.h', '-include', './include/linux/compiler_types.h', '-D__KERNEL__', '--target=x86_64-linux-gnu', '-fintegrated-as', '-Werror=u nknown-warning-option', '-Werror=ignored-optimization-argument', '-Werror=option-ignored', '-Werror=unused-command-line-argument', '-fmacro-prefix-map=./=', ' -fshort-wchar', '-funsigned-char', '-fno-common', '-fno-PIE', '-fno-strict-aliasing', '-mno-sse', '-mno-mmx', '-mno-sse2', '-mno-3dnow', '-mno-avx', '-fcf-pro tection=branch', '-fno-jump-tables', '-m64', '-falign-loops=1', '-mno-80387', '-mno-fp-ret-in-387', '-mstack-alignment=8', '-mskip-rax-setup', '-mtune=generic ', '-mno-red-zone', '-mcmodel=kernel', '-Wno-sign-compare', '-fno-asynchronous-unwind-tables', '-fno-delete-null-pointer-checks', '-O2', '-fstack-protector-st rong', '-fno-omit-frame-pointer', '-fno-optimize-sibling-calls', '-fno-stack-clash-protection', '-pg', '-mfentry', '-DCC_USING_NOP_MCOUNT', '-DCC_USING_FENTRY ', '-falign-functions=16', '-fstrict-flex-arrays=3', '-fno-strict-overflow', '-fno-stack-check', '-Wall', '-Wundef', '-Werror=implicit-function-declaration', '-Werror=implicit-int', '-Werror=return-type', '-Werror=strict-prototypes', '-Wno-format-security', '-Wno-trigraphs', '-Wno-frame-address', '-Wno-address-of-p acked-member', '-Wframe-larger-than=2048', '-Wno-gnu', '-Wno-unused-but-set-variable', '-Wno-unused-const-variable', '-Wvla', '-Wno-pointer-sign', '-Wcast-fun ction-type', '-Wimplicit-fallthrough', '-Werror=date-time', '-Werror=incompatible-pointer-types', '-Wenum-conversion', '-Wno-unused-but-set-variable', '-Wno-u nused-const-variable', '-Wno-format', '-Wformat-extra-args', '-Wformat-invalid-specifier', '-Wformat-zero-length', '-Wnonnull', '-Wformat-insufficient-args', '-Wno-pointer-to-enum-cast', '-Wno-tautological-constant-out-of-range-compare', '-Wno-unaligned-access', '-Wno-enum-compare-conditional', '-Wno-enum-enum-conv ersion', '-Wno-missing-field-initializers', '-Wno-type-limits', '-Wno-shift-negative-value', '-Wno-initializer-overrides', '-Wno-sign-compare', '-g', '-fno-fu nction-sections', '-fno-data-sections', '-DKBUILD_MODFILE="init/calibrate"', '-DKBUILD_BASENAME="calibrate"', '-DKBUILD_MODNAME="calibrate"', '-D__KBUILD_MODN AME=kmod_calibrate', '-x', 'c-header', '-std=gnu11', '--'] Error parsing translation unit.
` Above log is print with clang-15.
New: It happens also when I back to clang-14, the normal .c works well, .h file can not works. New: clang-12 works well, but clang-13 I have not test.
Thank you for your report and investigating different clang versions!
Unfortunately, it is difficult to debug for me without having an MRP, especially since libclang is not very helpful with errors like "Error parsing translation unit.".
To be honest, I also don't see much value in further maintaining this plugin, since common LSPs like clangd or ccls support the same functionality as part of their semantic highlighting feature in addition to completion, syntax checking, code actions, etc. in a much more efficient manner. I don't see much of a reason to not use LSPs nowadays.
If there is a certain demand for it and an MRP, I'd investigate the problem further, but for now I just don't see a reason to spend my time debugging weird edge cases of a pretty much obsolete plugin.