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

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 13 21:48:45 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangd

Author: BinVerse (BinVerse)

<details>
<summary>Changes</summary>

Files within clang-tools-extra/clangd encountered 'newline in constant' errors while compiling with Visual Studio Community 2022 Preview (amd64). The affected files were CodeComplete.h, Diagnostics.cpp, and Selection.cpp.

This issue stems from the MSVC compiler mishandling UTF-8 encoded files without a Byte Order Mark (BOM). To address this, the encoding of these three files has been changed from UTF-8 to UTF-8 with BOM.

Affected files:
- clang-tools-extra/clangd/CodeComplete.h
- clang-tools-extra/clangd/Diagnostics.cpp
- clang-tools-extra/clangd/Selection.cpp

The fix has been verified to resolve the build issues without introducing further problems in other parts of the LLVM project.

---
Full diff: https://github.com/llvm/llvm-project/pull/78082.diff


3 Files Affected:

- (modified) clang-tools-extra/clangd/CodeComplete.h (+1-1) 
- (modified) clang-tools-extra/clangd/Diagnostics.cpp (+1-1) 
- (modified) clang-tools-extra/clangd/Selection.cpp (+1-1) 


``````````diff
diff --git a/clang-tools-extra/clangd/CodeComplete.h b/clang-tools-extra/clangd/CodeComplete.h
index a7c1ae95dcbf49..571defc7cf1b8e 100644
--- a/clang-tools-extra/clangd/CodeComplete.h
+++ b/clang-tools-extra/clangd/CodeComplete.h
@@ -1,4 +1,4 @@
-//===--- CodeComplete.h ------------------------------------------*- C++-*-===//
+//===--- CodeComplete.h ------------------------------------------*- C++-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang-tools-extra/clangd/Diagnostics.cpp b/clang-tools-extra/clangd/Diagnostics.cpp
index 704e61b1e4dd79..68ed94262a6bff 100644
--- a/clang-tools-extra/clangd/Diagnostics.cpp
+++ b/clang-tools-extra/clangd/Diagnostics.cpp
@@ -1,4 +1,4 @@
-//===--- Diagnostics.cpp -----------------------------------------*- C++-*-===//
+//===--- Diagnostics.cpp -----------------------------------------*- C++-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang-tools-extra/clangd/Selection.cpp b/clang-tools-extra/clangd/Selection.cpp
index 277cb8769a1b12..1514cf49532504 100644
--- a/clang-tools-extra/clangd/Selection.cpp
+++ b/clang-tools-extra/clangd/Selection.cpp
@@ -1,4 +1,4 @@
-//===--- Selection.cpp ----------------------------------------------------===//
+//===--- Selection.cpp ----------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

``````````

</details>


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


More information about the cfe-commits mailing list