[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:03 PST 2024


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

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.

>From d518576a24c2217bb42e5d7288e8f128f29219b1 Mon Sep 17 00:00:00 2001
From: cppcloud <admin at cplusplus.cloud>
Date: Sun, 14 Jan 2024 13:38:45 +0800
Subject: [PATCH] Fix 'newline in constant' encoding issue in clangd sources

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.
---
 clang-tools-extra/clangd/CodeComplete.h  | 2 +-
 clang-tools-extra/clangd/Diagnostics.cpp | 2 +-
 clang-tools-extra/clangd/Selection.cpp   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

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.



More information about the cfe-commits mailing list