[Lldb-commits] [lldb] f63155a - [clang] Show line numbers in diagnostic code snippets

2023-05-30 Thread Timm Bäder via lldb-commits

Author: Timm Bäder
Date: 2023-05-31T07:26:03+02:00
New Revision: f63155aaa6467bd2610820dfd1996af3bb6029a7

URL: 
https://github.com/llvm/llvm-project/commit/f63155aaa6467bd2610820dfd1996af3bb6029a7
DIFF: 
https://github.com/llvm/llvm-project/commit/f63155aaa6467bd2610820dfd1996af3bb6029a7.diff

LOG: [clang] Show line numbers in diagnostic code snippets

Show line numbers to the left of diagnostic code snippets and increase
the numbers of lines shown from 1 to 16.

Differential Revision: https://reviews.llvm.org/D147875

Added: 


Modified: 

clang-tools-extra/test/clang-tidy/checkers/cert/uppercase-literal-suffix-integer.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-float16.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-floating-point-opencl-half.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-floating-point.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-hexadecimal-floating-point.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-integer-custom-list.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-integer-ms.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-integer.cpp
clang/docs/ReleaseNotes.rst
clang/docs/UsersManual.rst
clang/include/clang/Basic/DiagnosticOptions.def
clang/include/clang/Basic/DiagnosticOptions.h
clang/include/clang/Driver/Options.td
clang/include/clang/Frontend/TextDiagnostic.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/TextDiagnostic.cpp
clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures.cpp
clang/test/FixIt/fixit-function-call.cpp
clang/test/FixIt/fixit-newline-style.c
clang/test/FixIt/fixit-unicode-with-utf8-output.c
clang/test/FixIt/fixit-unicode.c
clang/test/Frontend/source-col-map.c
clang/test/Lexer/header.cpp
clang/test/Lexer/string-literal-errors.cpp
clang/test/Misc/caret-diags-macros.c
clang/test/Misc/caret-diags-multiline.cpp
clang/test/Misc/diag-macro-backtrace.c
clang/test/Misc/message-length.c
clang/test/Misc/tabstop.c
clang/test/Misc/unnecessary-elipses.cpp
clang/test/Misc/unprintable.c
clang/test/Misc/wrong-encoding.c
clang/test/Parser/brackets.c
clang/test/Parser/brackets.cpp
clang/test/Preprocessor/ucn-pp-identifier.c
clang/test/Sema/caret-diags-complex-init.cpp
clang/test/SemaCXX/struct-class-redecl.cpp
lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py

Removed: 




diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/cert/uppercase-literal-suffix-integer.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/cert/uppercase-literal-suffix-integer.cpp
index 0dc06df4f18b4..6fa700bf06d4f 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/cert/uppercase-literal-suffix-integer.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/cert/uppercase-literal-suffix-integer.cpp
@@ -31,7 +31,7 @@ void integer_suffix() {
   // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'l', 
which is not uppercase
   // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1l;
   // CHECK-MESSAGES-NEXT: ^~
-  // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}}
+  // CHECK-MESSAGES-NEXT: {{^ *| *}}L{{$}}
   // CHECK-FIXES: static constexpr auto v5 = 1L;
   static_assert(is_same::value, "");
   static_assert(v5 == 1, "");
@@ -46,7 +46,7 @@ void integer_suffix() {
   // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 
'll', which is not uppercase
   // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1ll;
   // CHECK-MESSAGES-NEXT: ^~~
-  // CHECK-MESSAGES-NEXT: {{^ *}}LL{{$}}
+  // CHECK-MESSAGES-NEXT: {{^ *| *}}LL{{$}}
   // CHECK-FIXES: static constexpr auto v7 = 1LL;
   static_assert(is_same::value, "");
   static_assert(v7 == 1, "");
@@ -79,7 +79,7 @@ void integer_suffix() {
   // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 
'lu', which is not uppercase
   // CHECK-MESSAGES-NEXT: static constexpr auto v13 = 1lu;
   // CHECK-MESSAGES-NEXT: ^~~
-  // CHECK-MESSAGES-NEXT: {{^ *}}LU{{$}}
+  // CHECK-MESSAGES-NEXT: {{^ *| *}}LU{{$}}
   // CHECK-FIXES: static constexpr auto v13 = 1LU;
   static_assert(is_same::value, "");
   static_assert(v13 == 1, "");
@@ -88,7 +88,7 @@ void integer_suffix() {
   // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 
'Lu', which is not uppercase
   // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1Lu;
   // CHECK-MESSAGES-NEXT: ^~~
-  // CHECK-MESSAGES-NEXT: {{^ *}}LU{{$}}
+  // CHECK-MESSAGES-NEXT: {{^ *| *}}LU{{$}}
   // CHECK-FIXES: static constexpr auto v14 = 1LU;
   static_assert(is_same::value, "");
   static_assert(v14 == 1, "");
@@ -97,7 +97,7 @@ voi

[Lldb-commits] [lldb] e1b88c8 - [clang] Only use major version in resource dir

2022-11-10 Thread Timm Bäder via lldb-commits

Author: Timm Bäder
Date: 2022-11-10T15:02:03+01:00
New Revision: e1b88c8a09be25b86b13f98755a9bd744b4dbf14

URL: 
https://github.com/llvm/llvm-project/commit/e1b88c8a09be25b86b13f98755a9bd744b4dbf14
DIFF: 
https://github.com/llvm/llvm-project/commit/e1b88c8a09be25b86b13f98755a9bd744b4dbf14.diff

LOG: [clang] Only use major version in resource dir

This causes unnecessary churn for downstreams.

For the full discussion, see 
https://discourse.llvm.org/t/should-we-continue-embed-the-full-llvm-version-in-lib-clang/62094

Differential Revision: https://reviews.llvm.org/D125860

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/Version.inc.in
clang/lib/Driver/Driver.cpp
clang/lib/Headers/CMakeLists.txt
clang/lib/Tooling/CMakeLists.txt
clang/runtime/CMakeLists.txt
compiler-rt/cmake/base-config-ix.cmake
lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
lldb/unittests/Expression/ClangParserTest.cpp
llvm/cmake/modules/LLVMExternalProjectUtils.cmake
polly/lib/External/isl/interface/extract_interface.cc

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index b0c01dd283e56..9ea3666b0ed72 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -176,6 +176,11 @@ code bases.
   g(42);
 }
 
+- Clang's resource dir used to include the full clang version. It will now
+  include only the major version. The new resource directory is
+  ``$prefix/lib/clang/$CLANG_MAJOR_VERSION`` and can be queried using
+  ``clang -print-resource-dir``, just like before.
+
 What's New in Clang |release|?
 ==
 Some of the major new features and improvements to Clang are listed

diff  --git a/clang/include/clang/Basic/Version.inc.in 
b/clang/include/clang/Basic/Version.inc.in
index fd80af4b51106..370da8506d142 100644
--- a/clang/include/clang/Basic/Version.inc.in
+++ b/clang/include/clang/Basic/Version.inc.in
@@ -1,5 +1,6 @@
 #define CLANG_VERSION @CLANG_VERSION@
 #define CLANG_VERSION_STRING "@CLANG_VERSION@"
 #define CLANG_VERSION_MAJOR @CLANG_VERSION_MAJOR@
+#define CLANG_VERSION_MAJOR_STRING "@CLANG_VERSION_MAJOR@"
 #define CLANG_VERSION_MINOR @CLANG_VERSION_MINOR@
 #define CLANG_VERSION_PATCHLEVEL @CLANG_VERSION_PATCHLEVEL@

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index a45c9e7f4957c..fd9d5c21e67c9 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -182,7 +182,7 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath,
 // ../lib gets us to lib/ in both cases.
 P = llvm::sys::path::parent_path(Dir);
 llvm::sys::path::append(P, CLANG_INSTALL_LIBDIR_BASENAME, "clang",
-CLANG_VERSION_STRING);
+CLANG_VERSION_MAJOR_STRING);
   }
 
   return std::string(P.str());

diff  --git a/clang/lib/Headers/CMakeLists.txt 
b/clang/lib/Headers/CMakeLists.txt
index 874693c55af6f..b756dfed19abb 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -281,7 +281,7 @@ set(openmp_wrapper_files
   openmp_wrappers/new
 )
 
-set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
+set(output_dir 
${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION_MAJOR}/include)
 set(out_files)
 set(generated_files)
 
@@ -434,7 +434,7 @@ add_header_target("openmp-resource-headers" 
${openmp_wrapper_files})
 add_header_target("windows-resource-headers" ${windows_only_files})
 add_header_target("utility-resource-headers" ${utility_files})
 
-set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+set(header_install_dir 
lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR}/include)
 
 #
 # Install rules for the catch-all clang-resource-headers target

diff  --git a/clang/lib/Tooling/CMakeLists.txt 
b/clang/lib/Tooling/CMakeLists.txt
index 403d2dfb45e8e..595b3be585869 100644
--- a/clang/lib/Tooling/CMakeLists.txt
+++ b/clang/lib/Tooling/CMakeLists.txt
@@ -60,7 +60,7 @@ else()
   $
 # Skip this in debug mode because parsing AST.h is too slow
 --skip-processing=${skip_expensive_processing}
--I ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include
+-I ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION_MAJOR}/include
 -I ${CLANG_SOURCE_DIR}/include
 -I ${LLVM_BINARY_DIR}/tools/clang/include
 -I ${LLVM_BINARY_DIR}/include

diff  --git a/clang/runtime/CMakeLists.txt b/clang/runtime/CMakeLists.txt
index 9f4633bc85b12..0cccf730e417d 100644
--- a/clang/runtime/CMakeLists.txt
+++ b/clang/runtime/CMakeLists.txt
@@ -82,9 +82,9 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS 
${COMPILER_RT_SRC_ROOT}/)
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
-DLLVM_CONFIG_PATH=${LLVM_RUNTIME_