[clang-tools-extra] Fix 'newline in constant' encoding issue in clangd sources (PR #78085)

via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 19 00:49:29 PST 2024


atomictoquark wrote:

> I am not sure if this is a viable solution in the long term as LLVM don't really use BOMs in the sources (a quick scan shows only 4 files with BOMs), hence these changes can easily be overridden without someone noticing.
> 
> Any reason you can't configure MSVC to treat all of the LLVM sources as UTF8 ?

On Windows with chinese env,the vs cmd console's default page code is 936(GBK),this makes the problem.if edit file "llvm-project\llvm\cmake\modules\AddLLVM.cmake" line 37 ,add config like this
`    elseif(MSVC)
      list(APPEND LLVM_COMPILE_DEFINITIONS _HAS_EXCEPTIONS=0)
      list(APPEND LLVM_COMPILE_FLAGS "/EHs-c-")
      list(APPEND LLVM_COMPILE_FLAGS "/utf-8")`
will solve this problem completely.
It's been a busy day,just for this problem...

https://github.com/llvm/llvm-project/pull/78085


More information about the cfe-commits mailing list