[PATCH] D138402: [clang-format] Correctly count a tab's width in a comment

2022-11-20 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks created this revision.
HazardyKnusperkeks added reviewers: owenpan, MyDeveloperDay, rymiel.
HazardyKnusperkeks added a project: clang-format.
Herald added a project: All.
HazardyKnusperkeks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

It worked only correct for a tab as the first char.

Fixes https://github.com/llvm/llvm-project/issues/56769


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138402

Files:
  clang/lib/Format/BreakableToken.cpp
  clang/unittests/Format/FormatTestComments.cpp


Index: clang/unittests/Format/FormatTestComments.cpp
===
--- clang/unittests/Format/FormatTestComments.cpp
+++ clang/unittests/Format/FormatTestComments.cpp
@@ -729,6 +729,11 @@
 "//: one line",
 format("//: A comment that doesn't fit on one line",
getLLVMStyleWithColumns(20)));
+
+  verifyFormat(
+  "//\t\t\t\tofMap(message.velocity, 0, 127, 0, ofGetWidth()\n"
+  "//* 0.2)",
+  "//\t\t\t\tofMap(message.velocity, 0, 127, 0, ofGetWidth() * 0.2)");
 }
 
 TEST_F(FormatTestComments, PreservesHangingIndentInCxxComments) {
Index: clang/lib/Format/BreakableToken.cpp
===
--- clang/lib/Format/BreakableToken.cpp
+++ clang/lib/Format/BreakableToken.cpp
@@ -82,9 +82,9 @@
NumChars < MaxSplit && MaxSplitBytes < Text.size();) {
 unsigned BytesInChar =
 encoding::getCodePointNumBytes(Text[MaxSplitBytes], Encoding);
-NumChars +=
-encoding::columnWidthWithTabs(Text.substr(MaxSplitBytes, BytesInChar),
-  ContentStartColumn, TabWidth, Encoding);
+NumChars += encoding::columnWidthWithTabs(
+Text.substr(MaxSplitBytes, BytesInChar), ContentStartColumn + NumChars,
+TabWidth, Encoding);
 MaxSplitBytes += BytesInChar;
   }
 


Index: clang/unittests/Format/FormatTestComments.cpp
===
--- clang/unittests/Format/FormatTestComments.cpp
+++ clang/unittests/Format/FormatTestComments.cpp
@@ -729,6 +729,11 @@
 "//: one line",
 format("//: A comment that doesn't fit on one line",
getLLVMStyleWithColumns(20)));
+
+  verifyFormat(
+  "//\t\t\t\tofMap(message.velocity, 0, 127, 0, ofGetWidth()\n"
+  "//* 0.2)",
+  "//\t\t\t\tofMap(message.velocity, 0, 127, 0, ofGetWidth() * 0.2)");
 }
 
 TEST_F(FormatTestComments, PreservesHangingIndentInCxxComments) {
Index: clang/lib/Format/BreakableToken.cpp
===
--- clang/lib/Format/BreakableToken.cpp
+++ clang/lib/Format/BreakableToken.cpp
@@ -82,9 +82,9 @@
NumChars < MaxSplit && MaxSplitBytes < Text.size();) {
 unsigned BytesInChar =
 encoding::getCodePointNumBytes(Text[MaxSplitBytes], Encoding);
-NumChars +=
-encoding::columnWidthWithTabs(Text.substr(MaxSplitBytes, BytesInChar),
-  ContentStartColumn, TabWidth, Encoding);
+NumChars += encoding::columnWidthWithTabs(
+Text.substr(MaxSplitBytes, BytesInChar), ContentStartColumn + NumChars,
+TabWidth, Encoding);
 MaxSplitBytes += BytesInChar;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D136906: [Clang][LoongArch] Implement __builtin_loongarch_dbar builtin

2022-11-20 Thread Gong LingQin via Phabricator via cfe-commits
gonglingqin added a comment.

In D136906#3940289 , 
@WowbaggersLiquidLunch wrote:

> Hi, this seems to be causing some problems when generating Xcode project.
>
> When I try to generate the Xcode project with the following command:
>
>   cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="X86" 
> -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_OPTIMIZED_TABLEGEN=ON 
> -DLLVM_ENABLE_IDE=ON -DLLVM_CCACHE_BUILD=ON ../../llvm
>
> I get the following error:
>
>> CMake Error in /path/to/llvm-project/clang/lib/Headers/CMakeLists.txt:
>>
>>   The custom command generating
>>   
>> 
>> /path/to/llvm-project/build/Xcode-Debug/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/lib/clang/16/include/larchintrin.h
>>   
>>   is attached to multiple targets:
>>   
>> clang-resource-headers
>> loongarch-resource-headers
>>   
>>   but none of these is a common dependency of the other(s).  This is not
>>   allowed by the Xcode "new build system".
>>
>> CMake Error in /path/to/llvm-project/third-party/benchmark/CMakeLists.txt:
>>
>>   The custom command generating
>>   
>> 
>> /path/to/llvm-project/build/Xcode-Debug/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/lib/clang/16/include/larchintrin.h
>>   
>>   is attached to multiple targets:
>>   
>> clang-resource-headers
>> loongarch-resource-headers
>>   
>>   but none of these is a common dependency of the other(s).  This is not
>>   allowed by the Xcode "new build system".

Thank you for your input. Correct me if I'm wrong,  when I create a new build 
directory and execute the following command:

  cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="X86" 
-DLLVM_ENABLE_PROJECTS="clang" -DLLVM_OPTIMIZED_TABLEGEN=ON 
-DLLVM_ENABLE_IDE=ON -DLLVM_CCACHE_BUILD=ON ../../llvm

I get the following error:

  CMake Error: Could not create named generator Xcode
  
  Generators
Unix Makefiles   = Generates standard UNIX makefiles.
Ninja= Generates build.ninja files.
Watcom WMake = Generates Watcom WMake makefiles.
CodeBlocks - Ninja   = Generates CodeBlocks project files.
CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
CodeLite - Ninja = Generates CodeLite project files.
CodeLite - Unix Makefiles= Generates CodeLite project files.
Sublime Text 2 - Ninja   = Generates Sublime Text 2 project files.
Sublime Text 2 - Unix Makefiles
 = Generates Sublime Text 2 project files.
Kate - Ninja = Generates Kate project files.
Kate - Unix Makefiles= Generates Kate project files.
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.

But when I change `Xcode` to `Ninja`, no error output is generated.
Do you have any suggestions for reproducing the bugs you mentioned?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136906/new/

https://reviews.llvm.org/D136906

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D136906: [Clang][LoongArch] Implement __builtin_loongarch_dbar builtin

2022-11-20 Thread 冀卓疌 via Phabricator via cfe-commits
WowbaggersLiquidLunch added a comment.

Hi, this seems to be causing some problems when generating Xcode project.

When I try to generate the Xcode project with the following command:

  cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="X86" 
-DLLVM_ENABLE_PROJECTS="clang" -DLLVM_OPTIMIZED_TABLEGEN=ON 
-DLLVM_ENABLE_IDE=ON -DLLVM_CCACHE_BUILD=ON ../../llvm

I get the following error:

> CMake Error in /path/to/llvm-project/clang/lib/Headers/CMakeLists.txt:
>
>   The custom command generating
>   
> 
> /path/to/llvm-project/build/Xcode-Debug/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/lib/clang/16/include/larchintrin.h
>   
>   is attached to multiple targets:
>   
> clang-resource-headers
> loongarch-resource-headers
>   
>   but none of these is a common dependency of the other(s).  This is not
>   allowed by the Xcode "new build system".
>
> CMake Error in /path/to/llvm-project/third-party/benchmark/CMakeLists.txt:
>
>   The custom command generating
>   
> 
> /path/to/llvm-project/build/Xcode-Debug/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/lib/clang/16/include/larchintrin.h
>   
>   is attached to multiple targets:
>   
> clang-resource-headers
> loongarch-resource-headers
>   
>   but none of these is a common dependency of the other(s).  This is not
>   allowed by the Xcode "new build system".




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136906/new/

https://reviews.llvm.org/D136906

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138399: HIP: Directly call isinf builtins

2022-11-20 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added reviewers: b-sumner, JonChesterfield, yaxunl.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.

https://reviews.llvm.org/D138399

Files:
  clang/lib/Headers/__clang_hip_math.h
  clang/test/Headers/__clang_hip_math.hip

Index: clang/test/Headers/__clang_hip_math.hip
===
--- clang/test/Headers/__clang_hip_math.hip
+++ clang/test/Headers/__clang_hip_math.hip
@@ -1135,23 +1135,31 @@
   return __finite(x);
 }
 
-// CHECK-LABEL: @test___isinff(
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[CALL_I:%.*]] = tail call i32 @__ocml_isinf_f32(float noundef [[X:%.*]]) #[[ATTR15]]
-// CHECK-NEXT:[[TOBOOL_I:%.*]] = icmp ne i32 [[CALL_I]], 0
-// CHECK-NEXT:[[CONV:%.*]] = zext i1 [[TOBOOL_I]] to i32
-// CHECK-NEXT:ret i32 [[CONV]]
+// DEFAULT-LABEL: @test___isinff(
+// DEFAULT-NEXT:  entry:
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract float @llvm.fabs.f32(float [[X:%.*]]) #[[ATTR18:[0-9]+]]
+// DEFAULT-NEXT:[[CMPINF_I:%.*]] = fcmp contract oeq float [[TMP0]], 0x7FF0
+// DEFAULT-NEXT:[[CONV:%.*]] = zext i1 [[CMPINF_I]] to i32
+// DEFAULT-NEXT:ret i32 [[CONV]]
+//
+// FINITEONLY-LABEL: @test___isinff(
+// FINITEONLY-NEXT:  entry:
+// FINITEONLY-NEXT:ret i32 0
 //
 extern "C" __device__ BOOL_TYPE test___isinff(float x) {
   return __isinff(x);
 }
 
-// CHECK-LABEL: @test___isinf(
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[CALL_I:%.*]] = tail call i32 @__ocml_isinf_f64(double noundef [[X:%.*]]) #[[ATTR15]]
-// CHECK-NEXT:[[TOBOOL_I:%.*]] = icmp ne i32 [[CALL_I]], 0
-// CHECK-NEXT:[[CONV:%.*]] = zext i1 [[TOBOOL_I]] to i32
-// CHECK-NEXT:ret i32 [[CONV]]
+// DEFAULT-LABEL: @test___isinf(
+// DEFAULT-NEXT:  entry:
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract double @llvm.fabs.f64(double [[X:%.*]]) #[[ATTR18]]
+// DEFAULT-NEXT:[[CMPINF_I:%.*]] = fcmp contract oeq double [[TMP0]], 0x7FF0
+// DEFAULT-NEXT:[[CONV:%.*]] = zext i1 [[CMPINF_I]] to i32
+// DEFAULT-NEXT:ret i32 [[CONV]]
+//
+// FINITEONLY-LABEL: @test___isinf(
+// FINITEONLY-NEXT:  entry:
+// FINITEONLY-NEXT:ret i32 0
 //
 extern "C" __device__ BOOL_TYPE test___isinf(double x) {
   return __isinf(x);
@@ -1674,11 +1682,11 @@
 // DEFAULT-LABEL: @test_modff(
 // DEFAULT-NEXT:  entry:
 // DEFAULT-NEXT:[[__TMP_I:%.*]] = alloca float, align 4, addrspace(5)
-// DEFAULT-NEXT:call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR18:[0-9]+]]
+// DEFAULT-NEXT:call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR19:[0-9]+]]
 // DEFAULT-NEXT:[[CALL_I:%.*]] = call contract float @__ocml_modf_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR17]]
 // DEFAULT-NEXT:[[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA13:![0-9]+]]
 // DEFAULT-NEXT:store float [[TMP0]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA13]]
-// DEFAULT-NEXT:call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR18]]
+// DEFAULT-NEXT:call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR19]]
 // DEFAULT-NEXT:ret float [[CALL_I]]
 //
 // FINITEONLY-LABEL: @test_modff(
@@ -1698,11 +1706,11 @@
 // DEFAULT-LABEL: @test_modf(
 // DEFAULT-NEXT:  entry:
 // DEFAULT-NEXT:[[__TMP_I:%.*]] = alloca double, align 8, addrspace(5)
-// DEFAULT-NEXT:call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR18]]
+// DEFAULT-NEXT:call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR19]]
 // DEFAULT-NEXT:[[CALL_I:%.*]] = call contract double @__ocml_modf_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR17]]
 // DEFAULT-NEXT:[[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA15:![0-9]+]]
 // DEFAULT-NEXT:store double [[TMP0]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA15]]
-// DEFAULT-NEXT:call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR18]]
+// DEFAULT-NEXT:call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR19]]
 // DEFAULT-NEXT:ret double [[CALL_I]]
 //
 // FINITEONLY-LABEL: @test_modf(
@@ -2325,11 +2333,11 @@
 // DEFAULT-LABEL: @test_remquof(
 // DEFAULT-NEXT:  entry:
 // DEFAULT-NEXT:[[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5)
-// DEFAULT-NEXT:call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR18]]
+// DEFAULT-NEXT:call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR19]]
 // DEFAULT-NEXT:[[CALL_I:%.*]] = call contract float @__ocml_remquo_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR17]]
 // DEFAULT-NEXT:[[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA19:![0-9]+]]
 

[PATCH] D138105: [PowerPC] Support test data class intrinsic of 128-bit float

2022-11-20 Thread ChenZheng via Phabricator via cfe-commits
shchenz added a comment.

The error message needs to be updated too:

  def err_ppc_invalid_test_data_class_type : Error<
"expected a 'float' or 'double' for the first argument">;

And can we add a test case for ibm float128 in the clang?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138105/new/

https://reviews.llvm.org/D138105

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 7994e51 - Revert "Revert "[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary""

2022-11-20 Thread Christopher Di Bella via cfe-commits

Author: Christopher Di Bella
Date: 2022-11-21T04:55:19Z
New Revision: 7994e5144aa52530fca9af0d81ca7134368034fe

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

LOG: Revert "Revert "[clang-tblgen][NFC] renames Diagnostic.Text to 
Diagnostic.Summary""

This reverts commit 196edb9f3f4a036371af0013a3d8b857fe0924d5.

Added: 


Modified: 
clang/include/clang/Basic/Diagnostic.td
clang/include/clang/Basic/DiagnosticCommonKinds.td
clang/include/clang/Basic/DiagnosticFrontendKinds.td
clang/include/clang/Basic/DiagnosticLexKinds.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/test/TableGen/DiagnosticBase.inc
clang/utils/TableGen/ClangDiagnosticsEmitter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/Diagnostic.td 
b/clang/include/clang/Basic/Diagnostic.td
index c932c90572786..21de05b707a58 100644
--- a/clang/include/clang/Basic/Diagnostic.td
+++ b/clang/include/clang/Basic/Diagnostic.td
@@ -75,10 +75,10 @@ include "DiagnosticGroups.td"
 
 
 // All diagnostics emitted by the compiler are an indirect subclass of this.
-class Diagnostic {
+class Diagnostic {
   /// Component is specified by the file with a big let directive.
   string Component = ?;
-  string Text = text;
+  string Summary = summary;
   DiagClass  Class = DC;
   SFINAEResponse SFINAE = SFINAE_Suppress;
   bitAccessControl = 0;

diff  --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td 
b/clang/include/clang/Basic/DiagnosticCommonKinds.td
index c8a1bae487d8c..c59adcc72a68b 100644
--- a/clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -269,7 +269,7 @@ def note_constexpr_invalid_template_arg : Note<
   "%select{type_info object|string literal|temporary object|"
   "predefined '%3' variable}2 is not allowed in a template argument">;
 def err_constexpr_invalid_template_arg : Error<
-  note_constexpr_invalid_template_arg.Text>;
+  note_constexpr_invalid_template_arg.Summary>;
 
 // Sema && Frontend
 let CategoryName = "Inline Assembly Issue" in {

diff  --git a/clang/include/clang/Basic/DiagnosticFrontendKinds.td 
b/clang/include/clang/Basic/DiagnosticFrontendKinds.td
index 6ac8537c74f34..26083e3fc8d88 100644
--- a/clang/include/clang/Basic/DiagnosticFrontendKinds.td
+++ b/clang/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -276,7 +276,7 @@ def warn_avx_calling_convention
 : Warning<"AVX vector %select{return|argument}0 of type %1 without '%2' "
   "enabled changes the ABI">,
   InGroup>;
-def err_avx_calling_convention : Error;
+def err_avx_calling_convention : Error;
 
 def err_alias_to_undefined : Error<
   "%select{alias|ifunc}0 must point to a defined "

diff  --git a/clang/include/clang/Basic/DiagnosticLexKinds.td 
b/clang/include/clang/Basic/DiagnosticLexKinds.td
index 908f4489d9a31..75a133d619d4d 100644
--- a/clang/include/clang/Basic/DiagnosticLexKinds.td
+++ b/clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -461,7 +461,7 @@ def ext_pp_gnu_line_directive : Extension<
 def err_pp_invalid_directive : Error<
   "invalid preprocessing directive%select{|, did you mean '#%1'?}0">;
 def warn_pp_invalid_directive : Warning<
-  err_pp_invalid_directive.Text>, InGroup>;
+  err_pp_invalid_directive.Summary>, InGroup>;
 def err_pp_directive_required : Error<
   "%0 must be used within a preprocessing directive">;
 def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal;
@@ -704,7 +704,7 @@ def ext_pp_bad_paste_ms : ExtWarn<
 def err_pp_operator_used_as_macro_name : Error<
   "C++ operator %0 (aka %1) used as a macro name">;
 def ext_pp_operator_used_as_macro_name : Extension<
-  err_pp_operator_used_as_macro_name.Text>, InGroup;
+  err_pp_operator_used_as_macro_name.Summary>, InGroup;
 def err_pp_illegal_floating_literal : Error<
   "floating point literal in preprocessor expression">;
 def err_pp_line_requires_integer : Error<

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 247d8e7401af5..ab06c1fea215b 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -184,7 +184,7 @@ def err_designator_for_scalar_or_sizeless_init : Error<
 def warn_initializer_overrides : Warning<
   "initializer %select{partially |}0overrides prior initialization of "
   "this subobject">, InGroup;
-def ext_initializer_overrides : ExtWarn,
+def ext_initializer_overrides : ExtWarn,
   InGroup, SFINAEFailure;
 def err_initializer_overrides_destructed : Error<
   "initializer would partially override prior initialization of object of "
@@ -456,7 +456,7 @@ def warn_decl_shadow :
   "structured binding}1">,
   InGroup, 

[PATCH] D138396: HIP: Directly call signbit builtins

2022-11-20 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added reviewers: JonChesterfield, b-sumner, yaxunl.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.

https://reviews.llvm.org/D138396

Files:
  clang/lib/Headers/__clang_hip_math.h
  clang/test/Headers/__clang_hip_math.hip


Index: clang/test/Headers/__clang_hip_math.hip
===
--- clang/test/Headers/__clang_hip_math.hip
+++ clang/test/Headers/__clang_hip_math.hip
@@ -2724,10 +2724,9 @@
 
 // CHECK-LABEL: @test___signbitf(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[CALL_I:%.*]] = tail call i32 @__ocml_signbit_f32(float 
noundef [[X:%.*]]) #[[ATTR15]]
-// CHECK-NEXT:[[TOBOOL_I:%.*]] = icmp ne i32 [[CALL_I]], 0
-// CHECK-NEXT:[[CONV:%.*]] = zext i1 [[TOBOOL_I]] to i32
-// CHECK-NEXT:ret i32 [[CONV]]
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast float [[X:%.*]] to i32
+// CHECK-NEXT:[[DOTLOBIT:%.*]] = lshr i32 [[TMP0]], 31
+// CHECK-NEXT:ret i32 [[DOTLOBIT]]
 //
 extern "C" __device__ BOOL_TYPE test___signbitf(float x) {
   return __signbitf(x);
@@ -2735,10 +2734,10 @@
 
 // CHECK-LABEL: @test___signbit(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[CALL_I:%.*]] = tail call i32 @__ocml_signbit_f64(double 
noundef [[X:%.*]]) #[[ATTR15]]
-// CHECK-NEXT:[[TOBOOL_I:%.*]] = icmp ne i32 [[CALL_I]], 0
-// CHECK-NEXT:[[CONV:%.*]] = zext i1 [[TOBOOL_I]] to i32
-// CHECK-NEXT:ret i32 [[CONV]]
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast double [[X:%.*]] to i64
+// CHECK-NEXT:[[DOTLOBIT:%.*]] = lshr i64 [[TMP0]], 63
+// CHECK-NEXT:[[TMP1:%.*]] = trunc i64 [[DOTLOBIT]] to i32
+// CHECK-NEXT:ret i32 [[TMP1]]
 //
 extern "C" __device__ BOOL_TYPE test___signbit(double x) {
   return __signbit(x);
Index: clang/lib/Headers/__clang_hip_math.h
===
--- clang/lib/Headers/__clang_hip_math.h
+++ clang/lib/Headers/__clang_hip_math.h
@@ -495,7 +495,7 @@
 float scalbnf(float __x, int __n) { return __ocml_scalbn_f32(__x, __n); }
 
 __DEVICE__
-__RETURN_TYPE __signbitf(float __x) { return __ocml_signbit_f32(__x); }
+__RETURN_TYPE __signbitf(float __x) { return __builtin_signbitf(__x); }
 
 __DEVICE__
 void sincosf(float __x, float *__sinptr, float *__cosptr) {
@@ -1057,7 +1057,7 @@
 double scalbn(double __x, int __n) { return __ocml_scalbn_f64(__x, __n); }
 
 __DEVICE__
-__RETURN_TYPE __signbit(double __x) { return __ocml_signbit_f64(__x); }
+__RETURN_TYPE __signbit(double __x) { return __builtin_signbit(__x); }
 
 __DEVICE__
 double sin(double __x) { return __ocml_sin_f64(__x); }


Index: clang/test/Headers/__clang_hip_math.hip
===
--- clang/test/Headers/__clang_hip_math.hip
+++ clang/test/Headers/__clang_hip_math.hip
@@ -2724,10 +2724,9 @@
 
 // CHECK-LABEL: @test___signbitf(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[CALL_I:%.*]] = tail call i32 @__ocml_signbit_f32(float noundef [[X:%.*]]) #[[ATTR15]]
-// CHECK-NEXT:[[TOBOOL_I:%.*]] = icmp ne i32 [[CALL_I]], 0
-// CHECK-NEXT:[[CONV:%.*]] = zext i1 [[TOBOOL_I]] to i32
-// CHECK-NEXT:ret i32 [[CONV]]
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast float [[X:%.*]] to i32
+// CHECK-NEXT:[[DOTLOBIT:%.*]] = lshr i32 [[TMP0]], 31
+// CHECK-NEXT:ret i32 [[DOTLOBIT]]
 //
 extern "C" __device__ BOOL_TYPE test___signbitf(float x) {
   return __signbitf(x);
@@ -2735,10 +2734,10 @@
 
 // CHECK-LABEL: @test___signbit(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[CALL_I:%.*]] = tail call i32 @__ocml_signbit_f64(double noundef [[X:%.*]]) #[[ATTR15]]
-// CHECK-NEXT:[[TOBOOL_I:%.*]] = icmp ne i32 [[CALL_I]], 0
-// CHECK-NEXT:[[CONV:%.*]] = zext i1 [[TOBOOL_I]] to i32
-// CHECK-NEXT:ret i32 [[CONV]]
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast double [[X:%.*]] to i64
+// CHECK-NEXT:[[DOTLOBIT:%.*]] = lshr i64 [[TMP0]], 63
+// CHECK-NEXT:[[TMP1:%.*]] = trunc i64 [[DOTLOBIT]] to i32
+// CHECK-NEXT:ret i32 [[TMP1]]
 //
 extern "C" __device__ BOOL_TYPE test___signbit(double x) {
   return __signbit(x);
Index: clang/lib/Headers/__clang_hip_math.h
===
--- clang/lib/Headers/__clang_hip_math.h
+++ clang/lib/Headers/__clang_hip_math.h
@@ -495,7 +495,7 @@
 float scalbnf(float __x, int __n) { return __ocml_scalbn_f32(__x, __n); }
 
 __DEVICE__
-__RETURN_TYPE __signbitf(float __x) { return __ocml_signbit_f32(__x); }
+__RETURN_TYPE __signbitf(float __x) { return __builtin_signbitf(__x); }
 
 __DEVICE__
 void sincosf(float __x, float *__sinptr, float *__cosptr) {
@@ -1057,7 +1057,7 @@
 double scalbn(double __x, int __n) { return __ocml_scalbn_f64(__x, __n); }
 
 __DEVICE__
-__RETURN_TYPE __signbit(double __x) { return __ocml_signbit_f64(__x); }
+__RETURN_TYPE __signbit(double __x) { return __builtin_signbit(__x); }
 
 __DEVICE__
 double sin(double __x) { return __ocml_sin_f64(__x); }

[PATCH] D138395: HIP: Directly call fmin/fmax builtins

2022-11-20 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added reviewers: yaxunl, b-sumner, JonChesterfield.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.

https://reviews.llvm.org/D138395

Files:
  clang/lib/Headers/__clang_hip_math.h
  clang/test/Headers/__clang_hip_math.hip

Index: clang/test/Headers/__clang_hip_math.hip
===
--- clang/test/Headers/__clang_hip_math.hip
+++ clang/test/Headers/__clang_hip_math.hip
@@ -985,13 +985,13 @@
 
 // DEFAULT-LABEL: @test_fmaxf(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract float @__ocml_fmax_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR15]]
-// DEFAULT-NEXT:ret float [[CALL_I]]
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
+// DEFAULT-NEXT:ret float [[TMP0]]
 //
 // FINITEONLY-LABEL: @test_fmaxf(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract float @__ocml_fmax_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR15]]
-// FINITEONLY-NEXT:ret float [[CALL_I]]
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
+// FINITEONLY-NEXT:ret float [[TMP0]]
 //
 extern "C" __device__ float test_fmaxf(float x, float y) {
   return fmaxf(x, y);
@@ -999,13 +999,13 @@
 
 // DEFAULT-LABEL: @test_fmax(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract double @__ocml_fmax_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR15]]
-// DEFAULT-NEXT:ret double [[CALL_I]]
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
+// DEFAULT-NEXT:ret double [[TMP0]]
 //
 // FINITEONLY-LABEL: @test_fmax(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract double @__ocml_fmax_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR15]]
-// FINITEONLY-NEXT:ret double [[CALL_I]]
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
+// FINITEONLY-NEXT:ret double [[TMP0]]
 //
 extern "C" __device__ double test_fmax(double x, double y) {
   return fmax(x, y);
@@ -1013,13 +1013,13 @@
 
 // DEFAULT-LABEL: @test_fminf(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract float @__ocml_fmin_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR15]]
-// DEFAULT-NEXT:ret float [[CALL_I]]
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
+// DEFAULT-NEXT:ret float [[TMP0]]
 //
 // FINITEONLY-LABEL: @test_fminf(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract float @__ocml_fmin_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR15]]
-// FINITEONLY-NEXT:ret float [[CALL_I]]
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
+// FINITEONLY-NEXT:ret float [[TMP0]]
 //
 extern "C" __device__ float test_fminf(float x, float y) {
   return fminf(x, y);
@@ -1027,13 +1027,13 @@
 
 // DEFAULT-LABEL: @test_fmin(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract double @__ocml_fmin_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR15]]
-// DEFAULT-NEXT:ret double [[CALL_I]]
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
+// DEFAULT-NEXT:ret double [[TMP0]]
 //
 // FINITEONLY-LABEL: @test_fmin(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract double @__ocml_fmin_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR15]]
-// FINITEONLY-NEXT:ret double [[CALL_I]]
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
+// FINITEONLY-NEXT:ret double [[TMP0]]
 //
 extern "C" __device__ double test_fmin(double x, double y) {
   return fmin(x, y);
@@ -3590,13 +3590,13 @@
 
 // DEFAULT-LABEL: @test_float_min(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I_I:%.*]] = tail call contract float @__ocml_fmin_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR15]]
-// DEFAULT-NEXT:ret float [[CALL_I_I]]
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
+// DEFAULT-NEXT:ret float [[TMP0]]
 //
 // FINITEONLY-LABEL: @test_float_min(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I_I:%.*]] = tail call nnan ninf contract float @__ocml_fmin_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR15]]
-// FINITEONLY-NEXT:

[PATCH] D138394: HIP: Directly call fma builtins

2022-11-20 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added reviewers: yaxunl, JonChesterfield, b-sumner.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.

https://reviews.llvm.org/D138394

Files:
  clang/lib/Headers/__clang_hip_math.h
  clang/test/Headers/__clang_hip_math.hip

Index: clang/test/Headers/__clang_hip_math.hip
===
--- clang/test/Headers/__clang_hip_math.hip
+++ clang/test/Headers/__clang_hip_math.hip
@@ -943,13 +943,13 @@
 
 // DEFAULT-LABEL: @test_fmaf(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract float @__ocml_fma_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR15]]
-// DEFAULT-NEXT:ret float [[CALL_I]]
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract float @llvm.fma.f32(float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]])
+// DEFAULT-NEXT:ret float [[TMP0]]
 //
 // FINITEONLY-LABEL: @test_fmaf(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract float @__ocml_fma_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR15]]
-// FINITEONLY-NEXT:ret float [[CALL_I]]
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract float @llvm.fma.f32(float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]])
+// FINITEONLY-NEXT:ret float [[TMP0]]
 //
 extern "C" __device__ float test_fmaf(float x, float y, float z) {
   return fmaf(x, y, z);
@@ -957,13 +957,13 @@
 
 // DEFAULT-LABEL: @test_fma(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract double @__ocml_fma_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR15]]
-// DEFAULT-NEXT:ret double [[CALL_I]]
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
+// DEFAULT-NEXT:ret double [[TMP0]]
 //
 // FINITEONLY-LABEL: @test_fma(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract double @__ocml_fma_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR15]]
-// FINITEONLY-NEXT:ret double [[CALL_I]]
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
+// FINITEONLY-NEXT:ret double [[TMP0]]
 //
 extern "C" __device__ double test_fma(double x, double y, double z) {
   return fma(x, y, z);
@@ -971,13 +971,13 @@
 
 // DEFAULT-LABEL: @test_fma_rn(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract double @__ocml_fma_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR15]]
-// DEFAULT-NEXT:ret double [[CALL_I]]
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
+// DEFAULT-NEXT:ret double [[TMP0]]
 //
 // FINITEONLY-LABEL: @test_fma_rn(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract double @__ocml_fma_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR15]]
-// FINITEONLY-NEXT:ret double [[CALL_I]]
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
+// FINITEONLY-NEXT:ret double [[TMP0]]
 //
 extern "C" __device__ double test_fma_rn(double x, double y, double z) {
   return __fma_rn(x, y, z);
@@ -3576,13 +3576,13 @@
 
 // DEFAULT-LABEL: @test__fma_rn(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract double @__ocml_fma_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR15]]
-// DEFAULT-NEXT:ret double [[CALL_I]]
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
+// DEFAULT-NEXT:ret double [[TMP0]]
 //
 // FINITEONLY-LABEL: @test__fma_rn(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract double @__ocml_fma_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR15]]
-// FINITEONLY-NEXT:ret double [[CALL_I]]
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
+// FINITEONLY-NEXT:ret double [[TMP0]]
 //
 extern "C" __device__ double test__fma_rn(double x, double y, double z) {
   return __fma_rn(x, y, z);
Index: clang/lib/Headers/__clang_hip_math.h
===
--- clang/lib/Headers/__clang_hip_math.h
+++ clang/lib/Headers/__clang_hip_math.h
@@ -255,7 +255,7 @@
 
 __DEVICE__
 float fmaf(float __x, float __y, float __z) {
-  return 

[PATCH] D138392: clang/HIP: Fix broken implementations of __make_mantissa* functions

2022-11-20 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added reviewers: yaxunl, JonChesterfield, saiislam, scchan, AlexVlx, 
b-sumner.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.

The optimizer was folding the entire function to return 0. This
meant to be checking the character content of the pointer is the
string terminator, not null.

  

Not sure if the null checks are necessary. I'm not sure what
the spec is for these, or why these would even be exposed.


https://reviews.llvm.org/D138392

Files:
  clang/lib/Headers/__clang_hip_math.h
  clang/test/Headers/__clang_hip_math.hip

Index: clang/test/Headers/__clang_hip_math.hip
===
--- clang/test/Headers/__clang_hip_math.hip
+++ clang/test/Headers/__clang_hip_math.hip
@@ -22,31 +22,32 @@
 
 // CHECK-LABEL: @test___make_mantissa_base8(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:br label [[WHILE_COND_I:%.*]]
+// CHECK-NEXT:[[TOBOOL_NOT_I:%.*]] = icmp eq ptr [[P:%.*]], null
+// CHECK-NEXT:br i1 [[TOBOOL_NOT_I]], label [[_ZL21__MAKE_MANTISSA_BASE8PKC_EXIT:%.*]], label [[WHILE_COND_I:%.*]]
 // CHECK:   while.cond.i:
-// CHECK-NEXT:[[__TAGP_ADDR_0_I:%.*]] = phi ptr [ [[P:%.*]], [[ENTRY:%.*]] ], [ [[__TAGP_ADDR_1_I:%.*]], [[CLEANUP_I:%.*]] ]
-// CHECK-NEXT:[[__R_0_I:%.*]] = phi i64 [ 0, [[ENTRY]] ], [ [[__R_1_I:%.*]], [[CLEANUP_I]] ]
-// CHECK-NEXT:[[TOBOOL_NOT_I:%.*]] = icmp eq ptr [[__TAGP_ADDR_0_I]], null
-// CHECK-NEXT:br i1 [[TOBOOL_NOT_I]], label [[_ZL21__MAKE_MANTISSA_BASE8PKC_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
-// CHECK:   while.body.i:
+// CHECK-NEXT:[[__TAGP_ADDR_0_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I:%.*]], [[CLEANUP_I:%.*]] ], [ [[P]], [[ENTRY:%.*]] ]
+// CHECK-NEXT:[[__R_0_I:%.*]] = phi i64 [ [[__R_1_I:%.*]], [[CLEANUP_I]] ], [ 0, [[ENTRY]] ]
 // CHECK-NEXT:[[TMP0:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I]], align 1, !tbaa [[TBAA3:![0-9]+]]
+// CHECK-NEXT:[[CMP_NOT_I:%.*]] = icmp eq i8 [[TMP0]], 0
+// CHECK-NEXT:br i1 [[CMP_NOT_I]], label [[_ZL21__MAKE_MANTISSA_BASE8PKC_EXIT]], label [[WHILE_BODY_I:%.*]]
+// CHECK:   while.body.i:
 // CHECK-NEXT:[[TMP1:%.*]] = and i8 [[TMP0]], -8
 // CHECK-NEXT:[[TMP2:%.*]] = icmp eq i8 [[TMP1]], 48
-// CHECK-NEXT:br i1 [[TMP2]], label [[IF_THEN_I:%.*]], label [[CLEANUP_I]]
-// CHECK:   if.then.i:
+// CHECK-NEXT:br i1 [[TMP2]], label [[IF_THEN5_I:%.*]], label [[CLEANUP_I]]
+// CHECK:   if.then5.i:
 // CHECK-NEXT:[[MUL_I:%.*]] = shl i64 [[__R_0_I]], 3
-// CHECK-NEXT:[[CONV3_I:%.*]] = sext i8 [[TMP0]] to i64
+// CHECK-NEXT:[[CONV6_I:%.*]] = sext i8 [[TMP0]] to i64
 // CHECK-NEXT:[[ADD_I:%.*]] = add i64 [[MUL_I]], -48
-// CHECK-NEXT:[[SUB_I:%.*]] = add i64 [[ADD_I]], [[CONV3_I]]
+// CHECK-NEXT:[[SUB_I:%.*]] = add i64 [[ADD_I]], [[CONV6_I]]
 // CHECK-NEXT:[[INCDEC_PTR_I:%.*]] = getelementptr inbounds i8, ptr [[__TAGP_ADDR_0_I]], i64 1
 // CHECK-NEXT:br label [[CLEANUP_I]]
 // CHECK:   cleanup.i:
-// CHECK-NEXT:[[__TAGP_ADDR_1_I]] = phi ptr [ [[INCDEC_PTR_I]], [[IF_THEN_I]] ], [ [[__TAGP_ADDR_0_I]], [[WHILE_BODY_I]] ]
-// CHECK-NEXT:[[__R_1_I]] = phi i64 [ [[SUB_I]], [[IF_THEN_I]] ], [ [[__R_0_I]], [[WHILE_BODY_I]] ]
+// CHECK-NEXT:[[__TAGP_ADDR_1_I]] = phi ptr [ [[INCDEC_PTR_I]], [[IF_THEN5_I]] ], [ [[__TAGP_ADDR_0_I]], [[WHILE_BODY_I]] ]
+// CHECK-NEXT:[[__R_1_I]] = phi i64 [ [[SUB_I]], [[IF_THEN5_I]] ], [ [[__R_0_I]], [[WHILE_BODY_I]] ]
 // CHECK-NEXT:br i1 [[TMP2]], label [[WHILE_COND_I]], label [[_ZL21__MAKE_MANTISSA_BASE8PKC_EXIT]], !llvm.loop [[LOOP6:![0-9]+]]
 // CHECK:   _ZL21__make_mantissa_base8PKc.exit:
-// CHECK-NEXT:[[RETVAL_2_I:%.*]] = phi i64 [ 0, [[CLEANUP_I]] ], [ [[__R_0_I]], [[WHILE_COND_I]] ]
-// CHECK-NEXT:ret i64 [[RETVAL_2_I]]
+// CHECK-NEXT:[[RETVAL_3_I:%.*]] = phi i64 [ 0, [[ENTRY]] ], [ 0, [[CLEANUP_I]] ], [ [[__R_0_I]], [[WHILE_COND_I]] ]
+// CHECK-NEXT:ret i64 [[RETVAL_3_I]]
 //
 extern "C" __device__ uint64_t test___make_mantissa_base8(const char *p) {
   return __make_mantissa_base8(p);
@@ -54,31 +55,32 @@
 
 // CHECK-LABEL: @test___make_mantissa_base10(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:br label [[WHILE_COND_I:%.*]]
+// CHECK-NEXT:[[TOBOOL_NOT_I:%.*]] = icmp eq ptr [[P:%.*]], null
+// CHECK-NEXT:br i1 [[TOBOOL_NOT_I]], label [[_ZL22__MAKE_MANTISSA_BASE10PKC_EXIT:%.*]], label [[WHILE_COND_I:%.*]]
 // CHECK:   while.cond.i:
-// CHECK-NEXT:[[__TAGP_ADDR_0_I:%.*]] = phi ptr [ [[P:%.*]], [[ENTRY:%.*]] ], [ [[__TAGP_ADDR_1_I:%.*]], [[CLEANUP_I:%.*]] ]
-// CHECK-NEXT:[[__R_0_I:%.*]] = phi i64 [ 0, [[ENTRY]] ], [ [[__R_1_I:%.*]], [[CLEANUP_I]] ]
-// CHECK-NEXT:[[TOBOOL_NOT_I:%.*]] = icmp eq ptr [[__TAGP_ADDR_0_I]], null
-// CHECK-NEXT:br i1 [[TOBOOL_NOT_I]], label [[_ZL22__MAKE_MANTISSA_BASE10PKC_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
-// CHECK:   while.body.i:
+// CHECK-NEXT:

[clang] 196edb9 - Revert "[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary"

2022-11-20 Thread Christopher Di Bella via cfe-commits

Author: Christopher Di Bella
Date: 2022-11-21T04:35:41Z
New Revision: 196edb9f3f4a036371af0013a3d8b857fe0924d5

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

LOG: Revert "[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary"

This reverts commit eb3f7880a272b818940e2bd2510ae04b0e32873f.

Added: 


Modified: 
clang/include/clang/Basic/Diagnostic.td
clang/include/clang/Basic/DiagnosticCommonKinds.td
clang/include/clang/Basic/DiagnosticFrontendKinds.td
clang/include/clang/Basic/DiagnosticLexKinds.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/test/TableGen/DiagnosticBase.inc
clang/utils/TableGen/ClangDiagnosticsEmitter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/Diagnostic.td 
b/clang/include/clang/Basic/Diagnostic.td
index 21de05b707a58..c932c90572786 100644
--- a/clang/include/clang/Basic/Diagnostic.td
+++ b/clang/include/clang/Basic/Diagnostic.td
@@ -75,10 +75,10 @@ include "DiagnosticGroups.td"
 
 
 // All diagnostics emitted by the compiler are an indirect subclass of this.
-class Diagnostic {
+class Diagnostic {
   /// Component is specified by the file with a big let directive.
   string Component = ?;
-  string Summary = summary;
+  string Text = text;
   DiagClass  Class = DC;
   SFINAEResponse SFINAE = SFINAE_Suppress;
   bitAccessControl = 0;

diff  --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td 
b/clang/include/clang/Basic/DiagnosticCommonKinds.td
index c59adcc72a68b..c8a1bae487d8c 100644
--- a/clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -269,7 +269,7 @@ def note_constexpr_invalid_template_arg : Note<
   "%select{type_info object|string literal|temporary object|"
   "predefined '%3' variable}2 is not allowed in a template argument">;
 def err_constexpr_invalid_template_arg : Error<
-  note_constexpr_invalid_template_arg.Summary>;
+  note_constexpr_invalid_template_arg.Text>;
 
 // Sema && Frontend
 let CategoryName = "Inline Assembly Issue" in {

diff  --git a/clang/include/clang/Basic/DiagnosticFrontendKinds.td 
b/clang/include/clang/Basic/DiagnosticFrontendKinds.td
index 26083e3fc8d88..6ac8537c74f34 100644
--- a/clang/include/clang/Basic/DiagnosticFrontendKinds.td
+++ b/clang/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -276,7 +276,7 @@ def warn_avx_calling_convention
 : Warning<"AVX vector %select{return|argument}0 of type %1 without '%2' "
   "enabled changes the ABI">,
   InGroup>;
-def err_avx_calling_convention : Error;
+def err_avx_calling_convention : Error;
 
 def err_alias_to_undefined : Error<
   "%select{alias|ifunc}0 must point to a defined "

diff  --git a/clang/include/clang/Basic/DiagnosticLexKinds.td 
b/clang/include/clang/Basic/DiagnosticLexKinds.td
index 75a133d619d4d..908f4489d9a31 100644
--- a/clang/include/clang/Basic/DiagnosticLexKinds.td
+++ b/clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -461,7 +461,7 @@ def ext_pp_gnu_line_directive : Extension<
 def err_pp_invalid_directive : Error<
   "invalid preprocessing directive%select{|, did you mean '#%1'?}0">;
 def warn_pp_invalid_directive : Warning<
-  err_pp_invalid_directive.Summary>, InGroup>;
+  err_pp_invalid_directive.Text>, InGroup>;
 def err_pp_directive_required : Error<
   "%0 must be used within a preprocessing directive">;
 def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal;
@@ -704,7 +704,7 @@ def ext_pp_bad_paste_ms : ExtWarn<
 def err_pp_operator_used_as_macro_name : Error<
   "C++ operator %0 (aka %1) used as a macro name">;
 def ext_pp_operator_used_as_macro_name : Extension<
-  err_pp_operator_used_as_macro_name.Summary>, InGroup;
+  err_pp_operator_used_as_macro_name.Text>, InGroup;
 def err_pp_illegal_floating_literal : Error<
   "floating point literal in preprocessor expression">;
 def err_pp_line_requires_integer : Error<

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index fdf19e7af1d1e..247d8e7401af5 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -184,7 +184,7 @@ def err_designator_for_scalar_or_sizeless_init : Error<
 def warn_initializer_overrides : Warning<
   "initializer %select{partially |}0overrides prior initialization of "
   "this subobject">, InGroup;
-def ext_initializer_overrides : ExtWarn,
+def ext_initializer_overrides : ExtWarn,
   InGroup, SFINAEFailure;
 def err_initializer_overrides_destructed : Error<
   "initializer would partially override prior initialization of object of "
@@ -456,7 +456,7 @@ def warn_decl_shadow :
   "structured binding}1">,
   InGroup, DefaultIgnore, 

[PATCH] D135820: [clang-tblgen] renames Diagnostic.Text to Diagnostic.Summary

2022-11-20 Thread Christopher Di Bella via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeb3f7880a272: [clang-tblgen][NFC] renames Diagnostic.Text to 
Diagnostic.Summary (authored by cjdb).

Changed prior to commit:
  https://reviews.llvm.org/D135820?vs=467283=476793#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135820/new/

https://reviews.llvm.org/D135820

Files:
  clang/include/clang/Basic/Diagnostic.td
  clang/include/clang/Basic/DiagnosticCommonKinds.td
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/test/TableGen/DiagnosticBase.inc
  clang/utils/TableGen/ClangDiagnosticsEmitter.cpp

Index: clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
===
--- clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
+++ clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
@@ -1165,7 +1165,7 @@
 DiagnosticTextBuilder::buildForDocumentation(StringRef Severity,
  const Record *R) {
   EvaluatingRecordGuard Guard(, R);
-  StringRef Text = R->getValueAsString("Text");
+  StringRef Text = R->getValueAsString("Summary");
 
   DiagText D(*this, Text);
   TextPiece *Prefix = D.New(Severity, Severity);
@@ -1184,7 +1184,7 @@
 
 std::string DiagnosticTextBuilder::buildForDefinition(const Record *R) {
   EvaluatingRecordGuard Guard(, R);
-  StringRef Text = R->getValueAsString("Text");
+  StringRef Text = R->getValueAsString("Summary");
   DiagText D(*this, Text);
   std::string Result;
   DiagTextPrinter{*this, Result}.Visit(D.Root);
@@ -1702,7 +1702,7 @@
 
 void writeDiagnosticText(DiagnosticTextBuilder , const Record *R,
  StringRef Role, raw_ostream ) {
-  StringRef Text = R->getValueAsString("Text");
+  StringRef Text = R->getValueAsString("Summary");
   if (Text == "%0")
 OS << "The text of this diagnostic is not controlled by Clang.\n\n";
   else {
Index: clang/test/TableGen/DiagnosticBase.inc
===
--- clang/test/TableGen/DiagnosticBase.inc
+++ clang/test/TableGen/DiagnosticBase.inc
@@ -67,10 +67,10 @@
 include "DiagnosticDocs.inc"
 
 // All diagnostics emitted by the compiler are an indirect subclass of this.
-class Diagnostic {
+class Diagnostic {
   /// Component is specified by the file with a big let directive.
   string Component = ?;
-  string Text = text;
+  string Summary = summary;
   DiagClass  Class = DC;
   SFINAEResponse SFINAE = SFINAE_Suppress;
   bitAccessControl = 0;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -184,7 +184,7 @@
 def warn_initializer_overrides : Warning<
   "initializer %select{partially |}0overrides prior initialization of "
   "this subobject">, InGroup;
-def ext_initializer_overrides : ExtWarn,
+def ext_initializer_overrides : ExtWarn,
   InGroup, SFINAEFailure;
 def err_initializer_overrides_destructed : Error<
   "initializer would partially override prior initialization of object of "
@@ -456,7 +456,7 @@
   "structured binding}1">,
   InGroup, DefaultIgnore, SuppressInSystemMacro;
 def warn_decl_shadow_uncaptured_local :
-  Warning,
+  Warning,
   InGroup, DefaultIgnore;
 def warn_ctor_parm_shadows_field:
   Warning<"constructor parameter %0 shadows the field %1 of %2">,
@@ -830,7 +830,7 @@
   InGroup>;
 
 def warn_fortify_source_overflow
-  : Warning, InGroup;
+  : Warning, InGroup;
 def warn_fortify_source_size_mismatch : Warning<
   "'%0' size argument is too large; destination buffer has size %1,"
   " but size argument is %2">, InGroup;
@@ -946,7 +946,7 @@
   "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
   InGroup;
 def err_pragma_pack_invalid_alignment : Error<
-  warn_pragma_pack_invalid_alignment.Text>;
+  warn_pragma_pack_invalid_alignment.Summary>;
 def warn_pragma_pack_non_default_at_include : Warning<
   "non-default #pragma pack value changes the alignment of struct or union "
   "members in the included file">, InGroup,
@@ -1083,7 +1083,7 @@
   "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
   "getter %1|with setter %1}0 was selected for synthesis">,
   InGroup>;
-def err_protocol_property_mismatch: Error;
+def err_protocol_property_mismatch: Error;
 def err_undef_interface : Error<"cannot find interface declaration for %0">;
 def err_category_forward_interface : Error<
   "cannot define %select{category|class extension}0 for undefined class %1">;
@@ -1300,7 +1300,7 @@
   "bitmasking for introspection of Objective-C object pointers is strongly "
   "discouraged">,
   InGroup;
-def warn_objc_pointer_masking_performSelector : 

[clang] eb3f788 - [clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary

2022-11-20 Thread Christopher Di Bella via cfe-commits

Author: Christopher Di Bella
Date: 2022-11-21T03:44:37Z
New Revision: eb3f7880a272b818940e2bd2510ae04b0e32873f

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

LOG: [clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary

The [Improving Clang's Diagnostics RFC][1] identifies eight broad fields
for Clang to surface, two of which are text-based. Since the current
diagnostics more closely map to the diagnostic summary (or headline), we
should rename them to ensure that there's no confusion when
Diagnostic.Reason is introduced in the near future.

[1]: https://discourse.llvm.org/t/rfc-improving-clang-s-diagnostics/62584

Reviewed By: aaron.ballman, erichkeane

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

Added: 


Modified: 
clang/include/clang/Basic/Diagnostic.td
clang/include/clang/Basic/DiagnosticCommonKinds.td
clang/include/clang/Basic/DiagnosticFrontendKinds.td
clang/include/clang/Basic/DiagnosticLexKinds.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/test/TableGen/DiagnosticBase.inc
clang/utils/TableGen/ClangDiagnosticsEmitter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/Diagnostic.td 
b/clang/include/clang/Basic/Diagnostic.td
index c932c90572786..21de05b707a58 100644
--- a/clang/include/clang/Basic/Diagnostic.td
+++ b/clang/include/clang/Basic/Diagnostic.td
@@ -75,10 +75,10 @@ include "DiagnosticGroups.td"
 
 
 // All diagnostics emitted by the compiler are an indirect subclass of this.
-class Diagnostic {
+class Diagnostic {
   /// Component is specified by the file with a big let directive.
   string Component = ?;
-  string Text = text;
+  string Summary = summary;
   DiagClass  Class = DC;
   SFINAEResponse SFINAE = SFINAE_Suppress;
   bitAccessControl = 0;

diff  --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td 
b/clang/include/clang/Basic/DiagnosticCommonKinds.td
index c8a1bae487d8c..c59adcc72a68b 100644
--- a/clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -269,7 +269,7 @@ def note_constexpr_invalid_template_arg : Note<
   "%select{type_info object|string literal|temporary object|"
   "predefined '%3' variable}2 is not allowed in a template argument">;
 def err_constexpr_invalid_template_arg : Error<
-  note_constexpr_invalid_template_arg.Text>;
+  note_constexpr_invalid_template_arg.Summary>;
 
 // Sema && Frontend
 let CategoryName = "Inline Assembly Issue" in {

diff  --git a/clang/include/clang/Basic/DiagnosticFrontendKinds.td 
b/clang/include/clang/Basic/DiagnosticFrontendKinds.td
index 6ac8537c74f34..26083e3fc8d88 100644
--- a/clang/include/clang/Basic/DiagnosticFrontendKinds.td
+++ b/clang/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -276,7 +276,7 @@ def warn_avx_calling_convention
 : Warning<"AVX vector %select{return|argument}0 of type %1 without '%2' "
   "enabled changes the ABI">,
   InGroup>;
-def err_avx_calling_convention : Error;
+def err_avx_calling_convention : Error;
 
 def err_alias_to_undefined : Error<
   "%select{alias|ifunc}0 must point to a defined "

diff  --git a/clang/include/clang/Basic/DiagnosticLexKinds.td 
b/clang/include/clang/Basic/DiagnosticLexKinds.td
index 908f4489d9a31..75a133d619d4d 100644
--- a/clang/include/clang/Basic/DiagnosticLexKinds.td
+++ b/clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -461,7 +461,7 @@ def ext_pp_gnu_line_directive : Extension<
 def err_pp_invalid_directive : Error<
   "invalid preprocessing directive%select{|, did you mean '#%1'?}0">;
 def warn_pp_invalid_directive : Warning<
-  err_pp_invalid_directive.Text>, InGroup>;
+  err_pp_invalid_directive.Summary>, InGroup>;
 def err_pp_directive_required : Error<
   "%0 must be used within a preprocessing directive">;
 def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal;
@@ -704,7 +704,7 @@ def ext_pp_bad_paste_ms : ExtWarn<
 def err_pp_operator_used_as_macro_name : Error<
   "C++ operator %0 (aka %1) used as a macro name">;
 def ext_pp_operator_used_as_macro_name : Extension<
-  err_pp_operator_used_as_macro_name.Text>, InGroup;
+  err_pp_operator_used_as_macro_name.Summary>, InGroup;
 def err_pp_illegal_floating_literal : Error<
   "floating point literal in preprocessor expression">;
 def err_pp_line_requires_integer : Error<

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 247d8e7401af5..fdf19e7af1d1e 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -184,7 +184,7 @@ def err_designator_for_scalar_or_sizeless_init : Error<
 def warn_initializer_overrides : Warning<
   "initializer 

[PATCH] D138350: [scudo] Add loongarch64 support for scudo

2022-11-20 Thread Lu Weining via Phabricator via cfe-commits
SixWeining accepted this revision.
SixWeining added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138350/new/

https://reviews.llvm.org/D138350

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D136594: [clangd] Add support for semantic token type "operator"

2022-11-20 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

A couple of high-level thoughts on this:

1. Based on the discussion in https://github.com/clangd/clangd/issues/1115, I 
believe highlighting of **built-in** operators should be out of scope for 
semantic highlighting, at least in the default mode; client-side highlighting 
should be sufficient for these, similar to strings and literals.
2. An alternative to assigning (user-provided) operators a new token kind would 
be to assign them the same token kind as the entity they invoke (i.e. function 
or method). Both approaches have their advantages:
  - If we use the function/method kinds, then uses of user-provided operators 
will be highlighted differently from built-in operators even when using a 
default / standard theme that doesn't know about clangd-specific token types.
  - If we use a dedicated operator kind, users can configure different styles 
for operators vs. function/methods (and they may want different styles given 
that syntactically the two look quite different).

One way to get the best of both worlds could be to use the function/method 
kinds in combination with an `operator` **modifier**. That would color 
overloaded operators out of the box while also allowing users to customize the 
style based on the presence of the modifier. What do you think about this 
approach?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136594/new/

https://reviews.llvm.org/D136594

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-11-20 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments.



Comment at: clang/lib/Format/WhitespaceManager.cpp:1433
   // assert((int)C.StartOfTokenColumn >= C.Spaces);
-  appendIndentText(
-  ReplacementText, C.Tok->IndentLevel, std::max(0, C.Spaces),
-  std::max((int)C.StartOfTokenColumn, C.Spaces) - std::max(0, 
C.Spaces),
-  C.IsAligned);
+  unsigned Spaces = std::max(0, C.Spaces);
+  if (Style.UseTab == FormatStyle::UT_Never) {

So that we don't have to worry about `signed` vs `unsigned`.



Comment at: clang/lib/Format/WhitespaceManager.cpp:1434-1436
+  if (Style.UseTab == FormatStyle::UT_Never) {
+ReplacementText.append(Spaces, ' ');
+  } else {

Doing this would lose some of the abstraction we have now without any gain in 
performance? Then we should leave it (and `appendIndentText` below) as is.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138378/new/

https://reviews.llvm.org/D138378

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138094: [LoongArch] Add intrinsics for ibar, break and syscall

2022-11-20 Thread Gong LingQin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc2ec455f183d: [LoongArch] Add intrinsics for ibar, break and 
syscall (authored by gonglingqin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138094/new/

https://reviews.llvm.org/D138094

Files:
  clang/include/clang/Basic/BuiltinsLoongArch.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/larchintrin.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/LoongArch/intrinsic-error.c
  clang/test/CodeGen/LoongArch/intrinsic.c
  llvm/include/llvm/IR/IntrinsicsLoongArch.td
  llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
  llvm/lib/Target/LoongArch/LoongArchISelLowering.h
  llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
  llvm/test/CodeGen/LoongArch/intrinsic-error.ll
  llvm/test/CodeGen/LoongArch/intrinsic-not-constant-error.ll
  llvm/test/CodeGen/LoongArch/intrinsic.ll

Index: llvm/test/CodeGen/LoongArch/intrinsic.ll
===
--- llvm/test/CodeGen/LoongArch/intrinsic.ll
+++ llvm/test/CodeGen/LoongArch/intrinsic.ll
@@ -3,6 +3,9 @@
 ; RUN: llc --mtriple=loongarch64 < %s | FileCheck %s
 
 declare void @llvm.loongarch.dbar(i32)
+declare void @llvm.loongarch.ibar(i32)
+declare void @llvm.loongarch.break(i32)
+declare void @llvm.loongarch.syscall(i32)
 
 define void @foo() nounwind {
 ; CHECK-LABEL: foo:
@@ -13,3 +16,33 @@
   call void @llvm.loongarch.dbar(i32 0)
   ret void
 }
+
+define void @ibar() nounwind {
+; CHECK-LABEL: ibar:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:ibar 0
+; CHECK-NEXT:ret
+entry:
+  call void @llvm.loongarch.ibar(i32 0)
+  ret void
+}
+
+define void @break() nounwind {
+; CHECK-LABEL: break:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:break 1
+; CHECK-NEXT:ret
+entry:
+  call void @llvm.loongarch.break(i32 1)
+  ret void
+}
+
+define void @syscall() nounwind {
+; CHECK-LABEL: syscall:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:syscall 1
+; CHECK-NEXT:ret
+entry:
+  call void @llvm.loongarch.syscall(i32 1)
+  ret void
+}
Index: llvm/test/CodeGen/LoongArch/intrinsic-not-constant-error.ll
===
--- /dev/null
+++ llvm/test/CodeGen/LoongArch/intrinsic-not-constant-error.ll
@@ -0,0 +1,35 @@
+; RUN: not llc --mtriple=loongarch32 < %s 2>&1 | FileCheck %s
+; RUN: not llc --mtriple=loongarch64 < %s 2>&1 | FileCheck %s
+
+declare void @llvm.loongarch.dbar(i32)
+declare void @llvm.loongarch.ibar(i32)
+declare void @llvm.loongarch.break(i32)
+declare void @llvm.loongarch.syscall(i32)
+
+define void @dbar_not_constant(i32 %x) nounwind {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+  call void @llvm.loongarch.dbar(i32 %x)
+  ret void
+}
+
+define void @ibar(i32 %x) nounwind {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+  call void @llvm.loongarch.ibar(i32 %x)
+  ret void
+}
+
+define void @break(i32 %x) nounwind {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+  call void @llvm.loongarch.break(i32 %x)
+  ret void
+}
+
+define void @syscall(i32 %x) nounwind {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+  call void @llvm.loongarch.syscall(i32 %x)
+  ret void
+}
Index: llvm/test/CodeGen/LoongArch/intrinsic-error.ll
===
--- llvm/test/CodeGen/LoongArch/intrinsic-error.ll
+++ llvm/test/CodeGen/LoongArch/intrinsic-error.ll
@@ -1,12 +1,10 @@
-; RUN: not llc --mtriple=loongarch32 --disable-verify < %s 2>&1 | FileCheck %s
-; RUN: not llc --mtriple=loongarch64 --disable-verify < %s 2>&1 | FileCheck %s
+; RUN: not llc --mtriple=loongarch32 < %s 2>&1 | FileCheck %s
+; RUN: not llc --mtriple=loongarch64 < %s 2>&1 | FileCheck %s
 
-define void @dbar_not_constant(i32 %x) nounwind {
-; CHECK: argument to '__builtin_loongarch_dbar' must be a constant integer
-entry:
-  call void @llvm.loongarch.dbar(i32 %x)
-  ret void
-}
+declare void @llvm.loongarch.dbar(i32)
+declare void @llvm.loongarch.ibar(i32)
+declare void @llvm.loongarch.break(i32)
+declare void @llvm.loongarch.syscall(i32)
 
 define void @dbar_imm_out_of_hi_range() nounwind {
 ; CHECK: argument to '__builtin_loongarch_dbar' out of range
@@ -22,4 +20,44 @@
   ret void
 }
 
-declare void @llvm.loongarch.dbar(i32)
+define void @ibar_imm_out_of_hi_range() nounwind {
+; CHECK: argument to '__builtin_loongarch_ibar' out of range
+entry:
+  call void @llvm.loongarch.ibar(i32 32769)
+  ret void
+}
+
+define void @ibar_imm_out_of_lo_range() nounwind {
+; CHECK: argument to '__builtin_loongarch_ibar' out of range
+entry:
+  call void @llvm.loongarch.ibar(i32 -1)
+  ret void
+}
+
+define void @break_imm_out_of_hi_range() nounwind {
+; CHECK: argument to '__builtin_loongarch_break' out of range
+entry:
+  call void @llvm.loongarch.break(i32 32769)
+  ret void
+}
+
+define void @break_imm_out_of_lo_range() nounwind {
+; CHECK: 

[clang] c2ec455 - [LoongArch] Add intrinsics for ibar, break and syscall

2022-11-20 Thread via cfe-commits

Author: gonglingqin
Date: 2022-11-21T09:31:26+08:00
New Revision: c2ec455f183d88a63d3cffe23ca6ff1acf0d7d07

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

LOG: [LoongArch] Add intrinsics for ibar, break and syscall

Diagnostics for intrinsic input parameters have also been added.

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

Added: 
llvm/test/CodeGen/LoongArch/intrinsic-not-constant-error.ll

Modified: 
clang/include/clang/Basic/BuiltinsLoongArch.def
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Headers/larchintrin.h
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGen/LoongArch/intrinsic-error.c
clang/test/CodeGen/LoongArch/intrinsic.c
llvm/include/llvm/IR/IntrinsicsLoongArch.td
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
llvm/lib/Target/LoongArch/LoongArchISelLowering.h
llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
llvm/test/CodeGen/LoongArch/intrinsic-error.ll
llvm/test/CodeGen/LoongArch/intrinsic.ll

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsLoongArch.def 
b/clang/include/clang/Basic/BuiltinsLoongArch.def
index a896ccfa18fa8..fe2900497a500 100644
--- a/clang/include/clang/Basic/BuiltinsLoongArch.def
+++ b/clang/include/clang/Basic/BuiltinsLoongArch.def
@@ -18,6 +18,9 @@
 // TODO: Support more builtins.
 // TODO: Added feature constraints.
 TARGET_BUILTIN(__builtin_loongarch_dbar, "vIUi", "nc", "")
+TARGET_BUILTIN(__builtin_loongarch_ibar, "vIUi", "nc", "")
+TARGET_BUILTIN(__builtin_loongarch_break, "vIUi", "nc", "")
+TARGET_BUILTIN(__builtin_loongarch_syscall, "vIUi", "nc", "")
 
 TARGET_BUILTIN(__builtin_loongarch_crc_w_d_w, "iLii", "nc", "64bit")
 

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 6000478bf545e..e45f1187e231d 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -19663,6 +19663,15 @@ Value 
*CodeGenFunction::EmitLoongArchBuiltinExpr(unsigned BuiltinID,
   case LoongArch::BI__builtin_loongarch_crc_w_d_w:
 ID = Intrinsic::loongarch_crc_w_d_w;
 break;
+  case LoongArch::BI__builtin_loongarch_break:
+ID = Intrinsic::loongarch_break;
+break;
+  case LoongArch::BI__builtin_loongarch_ibar:
+ID = Intrinsic::loongarch_ibar;
+break;
+  case LoongArch::BI__builtin_loongarch_syscall:
+ID = Intrinsic::loongarch_syscall;
+break;
 // TODO: Support more Intrinsics.
   }
 

diff  --git a/clang/lib/Headers/larchintrin.h b/clang/lib/Headers/larchintrin.h
index 7080bda8f3dca..ad284f62d815d 100644
--- a/clang/lib/Headers/larchintrin.h
+++ b/clang/lib/Headers/larchintrin.h
@@ -22,8 +22,14 @@ extern __inline int
 }
 #endif
 
+#define __break(/*ui15*/ _1) __builtin_loongarch_break((_1))
+
 #define __dbar(/*ui15*/ _1) __builtin_loongarch_dbar((_1))
 
+#define __ibar(/*ui15*/ _1) __builtin_loongarch_ibar((_1))
+
+#define __syscall(/*ui15*/ _1) __builtin_loongarch_syscall((_1))
+
 #ifdef __cplusplus
 }
 #endif

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index e3b1d5f7f9e45..75bd0ef57bcc0 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3710,7 +3710,10 @@ bool Sema::CheckLoongArchBuiltinFunctionCall(const 
TargetInfo ,
   diag::err_loongarch_builtin_requires_la64)
  << TheCall->getSourceRange();
 break;
+  case LoongArch::BI__builtin_loongarch_break:
   case LoongArch::BI__builtin_loongarch_dbar:
+  case LoongArch::BI__builtin_loongarch_ibar:
+  case LoongArch::BI__builtin_loongarch_syscall:
 // Check if immediate is in [0, 32767].
 return SemaBuiltinConstantArgRange(TheCall, 0, 0, 32767);
   }

diff  --git a/clang/test/CodeGen/LoongArch/intrinsic-error.c 
b/clang/test/CodeGen/LoongArch/intrinsic-error.c
index 6f2b2ea3409e3..8deed3693b254 100644
--- a/clang/test/CodeGen/LoongArch/intrinsic-error.c
+++ b/clang/test/CodeGen/LoongArch/intrinsic-error.c
@@ -7,10 +7,26 @@ int crc_w_d_w(long int a, int b) {
   return __builtin_loongarch_crc_w_d_w(a, b); // expected-error {{this builtin 
requires target: loongarch64}}
 }
 
-void dbar_out_of_hi_range() {
-  return __builtin_loongarch_dbar(32768); // expected-error {{argument value 
32768 is outside the valid range [0, 32767]}}
+void dbar(int a) {
+  __builtin_loongarch_dbar(32768); // expected-error {{argument value 32768 is 
outside the valid range [0, 32767]}}
+  __builtin_loongarch_dbar(-1); // expected-error {{argument value 4294967295 
is outside the valid range [0, 32767]}}
+  __builtin_loongarch_dbar(a); // expected-error {{argument to 
'__builtin_loongarch_dbar' must be a constant integer}}
 }
 
-void dbar_out_of_lo_range() {
-  return __builtin_loongarch_dbar(-1); // expected-error {{argument value 
4294967295 is outside the valid 

[PATCH] D138371: [clang-format] Fix a crash due to dereferencing null MatchingParen

2022-11-20 Thread Emilia Dreamer via Phabricator via cfe-commits
rymiel added a comment.

In D138371#3939938 , 
@HazardyKnusperkeks wrote:

> In D138371#3939682 , @rymiel wrote:
>
>> Oops, nevermind, I misunderstood the loop
>
> To understand this is really a tough one. Took me some minutes too, to see 
> why the return is needed.

I think the fact that almost every word is "Next" doesn't help 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138371/new/

https://reviews.llvm.org/D138371

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137043: [clang] add implicit include for Linux/gnu compatibility

2022-11-20 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added a comment.

In D137043#3935526 , @Origami404 
wrote:

> In D137043#3935129 , @aaronpuchert 
> wrote:
>
>> This include-if-exists mechanism seems brittle to me.
>
> Do you mean the way that we used to test a file and include it (inserting 
> `#if __has_include`) is brittle or compilation flags like 
> `--include-if-exists` themselves are?

The mechanism itself. For example, we might include the file even if it doesn't 
belong to the C library implementation that we want to use, just because it's 
there.

>> Can we not make it dependent on the triple, i.e. include the file if we're 
>> using a libc implementation that's known to provide (and require) this file?
>
> I am afarid that without depending on triples, we are not able to distinguish 
> what environment we are in or libc we use.  Can you explain more about this?

I was suggesting to have it depend on the triple, not be independent of it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137043/new/

https://reviews.llvm.org/D137043

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138387: [Clang] Implement static operator[]

2022-11-20 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment.

Thanks for working on this, it was fast!
It looks good except for an issue with the diagnostic (which was partly 
pre-existing)




Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:9111-9115
 def ext_operator_overload_static : ExtWarn<
   "declaring overloaded %0 as 'static' is a C++2b extension">,
   InGroup, DefaultIgnore;
-def err_call_operator_overload_static : ExtWarn<
+def err_future_operator_overload_static : ExtWarn<
   "declaring overloaded %0 as 'static' is a C++2b extension">, InGroup;

Hum, I did not notice that before but this looks wrong.
If I get that right, this is how it's usually done.

ie it should not be `err_` (it's a warning) and in C++23 mode it's not an 
ExtWarn (which are turned into error in pendantic mode afaik). There are many 
similar patterns in the same file




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138387/new/

https://reviews.llvm.org/D138387

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138387: [Clang] Implement static operator[]

2022-11-20 Thread Roy Jacobson via Phabricator via cfe-commits
royjacobson created this revision.
royjacobson added reviewers: cor3ntin, erichkeane.
Herald added a project: All.
royjacobson requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

After accepted in Kona, update the code to accept static operator[]
as well.

No big code changes, just accept this in SemaDeclCXX and update
feature macros + tests accordingly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138387

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CXX/over/over.oper/p7.cpp
  clang/test/CodeGenCXX/cxx2b-static-subscript-operator.cpp
  clang/test/Lexer/cxx-features.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -1518,7 +1518,7 @@
 
   static operator[]
   https://wg21.link/P2589R1;>P2589R1
-  No
+  16
 
 
   Permitting static constexpr variables in constexpr functions (DR)
Index: clang/test/Lexer/cxx-features.cpp
===
--- clang/test/Lexer/cxx-features.cpp
+++ clang/test/Lexer/cxx-features.cpp
@@ -43,7 +43,7 @@
 #error "wrong value for __cpp_if_consteval"
 #endif
 
-#if check(multidimensional_subscript, 0, 0, 0, 0, 0, 202110)
+#if check(multidimensional_subscript, 0, 0, 0, 0, 0, 202211)
 #error "wrong value for __cpp_multidimensional_subscript"
 #endif
 
Index: clang/test/CodeGenCXX/cxx2b-static-subscript-operator.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/cxx2b-static-subscript-operator.cpp
@@ -0,0 +1,64 @@
+// RUN: %clang_cc1 -std=c++2b %s -emit-llvm -triple x86_64-linux -o - | FileCheck %s
+// RUN: %clang_cc1 -std=c++2b %s -emit-llvm -triple x86_64-windows-msvc -o - | FileCheck %s
+
+struct Functor {
+  static int operator[](int x, int y) {
+return x + y;
+  }
+};
+
+void call_static_subscript_operator[] {
+  Functor f;
+  f[101, 102];
+  f.operator[](201, 202);
+  Functor{}[301, 302];
+}
+
+// CHECK:  define {{.*}}call_static_subscript_operator{{.*}}
+// CHECK-NEXT: entry:
+// CHECK:{{.*}} = call noundef i32 {{.*}}Functor{{.*}}(i32 noundef 101, i32 noundef 102)
+// CHECK-NEXT:   {{.*}} = call noundef i32 {{.*}}Functor{{.*}}(i32 noundef 201, i32 noundef 202)
+// CHECK-NEXT:   {{.*}} = call noundef i32 {{.*}}Functor{{.*}}(i32 noundef 301, i32 noundef 302)
+// CHECK-NEXT:   ret void
+// CHECK-NEXT: }
+
+struct FunctorConsteval {
+  consteval static int operator[](int x, int y) {
+  return x + y;
+  }
+};
+
+struct FunctorConstexpr {
+  constexpr static int operator[](int x, int y) {
+  return x + y;
+  }
+};
+
+void test_consteval_constexpr() {
+  int x = 0;
+  int y = FunctorConstexpr{}[x, 2];
+  constexpr int z1 = FunctorConsteval{}[2, 2];
+  constexpr int z2 = FunctorConstexpr{}[2, 2];
+  
+  static_assert(z1 == 4);
+  static_assert(z2 == 4);
+}
+
+template 
+struct DepFunctor {
+  static int operator[](T t) {
+return int(t);
+  }
+};
+
+void test_dep_functors() {
+  int x = DepFunctor{}[1.0f];
+  int y = DepFunctor{}[true];
+}
+
+// CHECK:  define {{.*}}test_dep_functors{{.*}}
+// CHECK-NEXT: entry:
+// CHECK:%call = call noundef i32 {{.*}}DepFunctor{{.*}}(float noundef 1.00e+00)
+// CHECK:%call1 = call noundef i32 {{.*}}DepFunctor{{.*}}(i1 noundef zeroext true)
+// CHECK:ret void
+// CHECK-NEXT: }
Index: clang/test/CXX/over/over.oper/p7.cpp
===
--- clang/test/CXX/over/over.oper/p7.cpp
+++ clang/test/CXX/over/over.oper/p7.cpp
@@ -5,14 +5,19 @@
 
 struct Functor {
   static int operator()(int a, int b);
-  // cxx11-warning@-1 {{is a C++2b extension}}
-  // precxx2b-warning@-2 {{declaring overloaded 'operator()' as 'static' is a C++2b extension}}
+  static int operator[](int a1);
+  // cxx11-warning@-2 {{is a C++2b extension}}
+  // cxx11-warning@-2 {{is a C++2b extension}}
+  // precxx2b-warning@-4 {{declaring overloaded 'operator()' as 'static' is a C++2b extension}}
+  // precxx2b-warning@-4 {{declaring overloaded 'operator[]' as 'static' is a C++2b extension}}
 };
 
 struct InvalidParsing1 {
   extern int operator()(int a, int b);  // expected-error {{storage class specified}}
+  extern int operator[](int a1);  // expected-error {{storage class specified}}
 };
 
 struct InvalidParsing2 {
   extern static int operator()(int a, int b);  // expected-error {{storage class specified}} // expected-error {{cannot combine with previous 'extern' declaration specifier}}
+  extern static int operator[](int a);  // expected-error {{storage class specified}} // expected-error {{cannot combine with previous 'extern' declaration specifier}}
 };
Index: 

[clang] 30f9eb1 - [clang] Remove unused forward declarations (NFC)

2022-11-20 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2022-11-20T14:32:17-08:00
New Revision: 30f9eb1eb81cb3cac9016da1fb79e2ff80f766d6

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

LOG: [clang] Remove unused forward declarations (NFC)

Added: 


Modified: 
clang/include/clang/Serialization/ModuleManager.h
clang/lib/AST/Interp/EvalEmitter.h
clang/lib/CodeGen/CGHLSLRuntime.h

Removed: 




diff  --git a/clang/include/clang/Serialization/ModuleManager.h 
b/clang/include/clang/Serialization/ModuleManager.h
index 1623dd4460368..5f453c3bfa965 100644
--- a/clang/include/clang/Serialization/ModuleManager.h
+++ b/clang/include/clang/Serialization/ModuleManager.h
@@ -39,7 +39,6 @@ class FileManager;
 class GlobalModuleIndex;
 class HeaderSearch;
 class InMemoryModuleCache;
-class ModuleMap;
 class PCHContainerReader;
 
 namespace serialization {

diff  --git a/clang/lib/AST/Interp/EvalEmitter.h 
b/clang/lib/AST/Interp/EvalEmitter.h
index 560ce6f6f4701..72433778f23f8 100644
--- a/clang/lib/AST/Interp/EvalEmitter.h
+++ b/clang/lib/AST/Interp/EvalEmitter.h
@@ -23,7 +23,6 @@
 #include "llvm/Support/Error.h"
 
 namespace clang {
-class FunctionDecl;
 namespace interp {
 class Context;
 class Function;

diff  --git a/clang/lib/CodeGen/CGHLSLRuntime.h 
b/clang/lib/CodeGen/CGHLSLRuntime.h
index 976f925ed1c84..5cc2c89da0f8c 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.h
+++ b/clang/lib/CodeGen/CGHLSLRuntime.h
@@ -37,7 +37,6 @@ class VarDecl;
 class ParmVarDecl;
 class HLSLBufferDecl;
 class HLSLResourceBindingAttr;
-class CallExpr;
 class Type;
 class DeclContext;
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] ad485b7 - Add version to all LLVM cmake package

2022-11-20 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2022-11-20T21:09:50Z
New Revision: ad485b71b51168ce13282ae159bd8feff48baf84

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

LOG: Add version to all LLVM cmake package

Add a version to non-LLVM cmake package so that users needing an exact
version match can use the version parameter to find_package. Also adjust
the find_package(LLVM) to use an exact version match as well.

Reviewed By: arsenm, stellaraccident

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

Added: 
clang/cmake/modules/ClangConfigVersion.cmake.in
flang/cmake/modules/FlangConfigVersion.cmake.in
lld/cmake/modules/LLDConfigVersion.cmake.in
mlir/cmake/modules/MLIRConfigVersion.cmake.in
polly/cmake/PollyConfigVersion.cmake.in

Modified: 
clang/cmake/modules/CMakeLists.txt
clang/cmake/modules/ClangConfig.cmake.in
flang/cmake/modules/CMakeLists.txt
flang/cmake/modules/FlangConfig.cmake.in
lld/cmake/modules/CMakeLists.txt
lld/cmake/modules/LLDConfig.cmake.in
mlir/cmake/modules/CMakeLists.txt
mlir/cmake/modules/MLIRConfig.cmake.in
polly/cmake/CMakeLists.txt
polly/cmake/PollyConfig.cmake.in

Removed: 




diff  --git a/clang/cmake/modules/CMakeLists.txt 
b/clang/cmake/modules/CMakeLists.txt
index 880d51f5aef71..749ef672c34f7 100644
--- a/clang/cmake/modules/CMakeLists.txt
+++ b/clang/cmake/modules/CMakeLists.txt
@@ -32,6 +32,10 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
   ${clang_cmake_builddir}/ClangConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfigVersion.cmake.in
+  ${clang_cmake_builddir}/ClangConfigVersion.cmake
+  @ONLY)
 set(CLANG_CONFIG_CMAKE_DIR)
 set(CLANG_CONFIG_LLVM_CMAKE_DIR)
 
@@ -59,6 +63,10 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfigVersion.cmake
+  @ONLY)
 set(CLANG_CONFIG_CODE)
 set(CLANG_CONFIG_CMAKE_DIR)
 
@@ -67,6 +75,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
 
   install(FILES
 ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
+${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfigVersion.cmake
 ${CMAKE_CURRENT_SOURCE_DIR}/AddClang.cmake
 DESTINATION ${CLANG_INSTALL_PACKAGE_DIR}
 COMPONENT clang-cmake-exports)

diff  --git a/clang/cmake/modules/ClangConfig.cmake.in 
b/clang/cmake/modules/ClangConfig.cmake.in
index 2a254463d6f5e..5596ad669e209 100644
--- a/clang/cmake/modules/ClangConfig.cmake.in
+++ b/clang/cmake/modules/ClangConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @CLANG_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION 
${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
+find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG
  HINTS "@CLANG_CONFIG_LLVM_CMAKE_DIR@")
 
 set(CLANG_EXPORTED_TARGETS "@CLANG_EXPORTS@")

diff  --git a/clang/cmake/modules/ClangConfigVersion.cmake.in 
b/clang/cmake/modules/ClangConfigVersion.cmake.in
new file mode 100644
index 0..e9ac4ed2da786
--- /dev/null
+++ b/clang/cmake/modules/ClangConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()

diff  --git a/flang/cmake/modules/CMakeLists.txt 
b/flang/cmake/modules/CMakeLists.txt
index 31a6c3c83e48b..bf50bcaa18d52 100644
--- a/flang/cmake/modules/CMakeLists.txt
+++ b/flang/cmake/modules/CMakeLists.txt
@@ -28,8 +28,8 @@ set(FLANG_CONFIG_INCLUDE_DIRS
   "${FLANG_BINARY_DIR}/include"
   )
 configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfig.cmake.in
-  ${flang_cmake_builddir}/FlangConfig.cmake
+  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfigVersion.cmake.in
+  ${flang_cmake_builddir}/FlangConfigVersion.cmake
   @ONLY)
 set(FLANG_CONFIG_CMAKE_DIR)
 set(FLANG_CONFIG_LLVM_CMAKE_DIR)
@@ -46,6 +46,10 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfigVersion.cmake
+  @ONLY)
 
 set(FLANG_CONFIG_CODE)
 set(FLANG_CONFIG_CMAKE_DIR)
@@ -56,6 +60,7 @@ 

[PATCH] D138274: Add version to all LLVM cmake package

2022-11-20 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGad485b71b511: Add version to all LLVM cmake package 
(authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138274/new/

https://reviews.llvm.org/D138274

Files:
  clang/cmake/modules/CMakeLists.txt
  clang/cmake/modules/ClangConfig.cmake.in
  clang/cmake/modules/ClangConfigVersion.cmake.in
  flang/cmake/modules/CMakeLists.txt
  flang/cmake/modules/FlangConfig.cmake.in
  flang/cmake/modules/FlangConfigVersion.cmake.in
  lld/cmake/modules/CMakeLists.txt
  lld/cmake/modules/LLDConfig.cmake.in
  lld/cmake/modules/LLDConfigVersion.cmake.in
  mlir/cmake/modules/CMakeLists.txt
  mlir/cmake/modules/MLIRConfig.cmake.in
  mlir/cmake/modules/MLIRConfigVersion.cmake.in
  polly/cmake/CMakeLists.txt
  polly/cmake/PollyConfig.cmake.in
  polly/cmake/PollyConfigVersion.cmake.in

Index: polly/cmake/PollyConfigVersion.cmake.in
===
--- /dev/null
+++ polly/cmake/PollyConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()
Index: polly/cmake/PollyConfig.cmake.in
===
--- polly/cmake/PollyConfig.cmake.in
+++ polly/cmake/PollyConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @POLLY_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
+find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG
  HINTS "@POLLY_CONFIG_LLVM_CMAKE_DIR@")
 
 set(Polly_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -82,6 +82,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfig.cmake.in
   ${polly_cmake_builddir}/PollyConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfigVersion.cmake.in
+  ${polly_cmake_builddir}/PollyConfigVersion.cmake
+  @ONLY)
 
 file(GENERATE
   OUTPUT ${polly_cmake_builddir}/${POLLY_EXPORTS_FILE_NAME}
@@ -138,6 +142,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfigVersion.cmake
+  @ONLY)
 file(GENERATE OUTPUT
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${POLLY_EXPORTS_FILE_NAME}
   CONTENT "${POLLY_EXPORTS}")
@@ -146,6 +154,7 @@
   install(
 FILES
 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfig.cmake"
+"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfigVersion.cmake"
 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${POLLY_EXPORTS_FILE_NAME}"
 DESTINATION "${POLLY_INSTALL_PACKAGE_DIR}")
 endif ()
Index: mlir/cmake/modules/MLIRConfigVersion.cmake.in
===
--- /dev/null
+++ mlir/cmake/modules/MLIRConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()
Index: mlir/cmake/modules/MLIRConfig.cmake.in
===
--- mlir/cmake/modules/MLIRConfig.cmake.in
+++ mlir/cmake/modules/MLIRConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @MLIR_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
+find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG
  HINTS "@MLIR_CONFIG_LLVM_CMAKE_DIR@")
 
 set(MLIR_EXPORTED_TARGETS "@MLIR_EXPORTS@")
Index: mlir/cmake/modules/CMakeLists.txt
===
--- mlir/cmake/modules/CMakeLists.txt
+++ mlir/cmake/modules/CMakeLists.txt
@@ -41,6 +41,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/MLIRConfig.cmake.in
   ${mlir_cmake_builddir}/MLIRConfig.cmake
   @ONLY)
+configure_file(
+  

[PATCH] D137213: [clang][modules] NFCI: Pragma diagnostic mappings: write/read FileID instead of SourceLocation

2022-11-20 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment.

Heads up: this commit has broken compilation in a small number of cases: some 
#includes from modularized headers now fail to be found. I'm still trying to 
figure out what exactly happened, but some behavior has definitely changed by 
this commit.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137213/new/

https://reviews.llvm.org/D137213

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138385: [clang-format][NFC] Removed unused include

2022-11-20 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks created this revision.
HazardyKnusperkeks added reviewers: owenpan, MyDeveloperDay, rymiel.
HazardyKnusperkeks added a project: clang-format.
Herald added a project: All.
HazardyKnusperkeks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138385

Files:
  clang/unittests/Format/FormatTestComments.cpp


Index: clang/unittests/Format/FormatTestComments.cpp
===
--- clang/unittests/Format/FormatTestComments.cpp
+++ clang/unittests/Format/FormatTestComments.cpp
@@ -12,7 +12,6 @@
 #include "FormatTestUtils.h"
 
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/MemoryBuffer.h"
 #include "gtest/gtest.h"
 
 #define DEBUG_TYPE "format-test"


Index: clang/unittests/Format/FormatTestComments.cpp
===
--- clang/unittests/Format/FormatTestComments.cpp
+++ clang/unittests/Format/FormatTestComments.cpp
@@ -12,7 +12,6 @@
 #include "FormatTestUtils.h"
 
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/MemoryBuffer.h"
 #include "gtest/gtest.h"
 
 #define DEBUG_TYPE "format-test"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138263: [clang-format] Supress aligning of trailing namespace comments

2022-11-20 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

In D138263#3938593 , @owenpan wrote:

> Something like the following:
>
>   diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h
>   index 87515372046d..3dc5e411df55 100644
>   --- a/clang/lib/Format/FormatToken.h
>   +++ b/clang/lib/Format/FormatToken.h
>   @@ -98,6 +98,8 @@ namespace format {
>  TYPE(MacroBlockBegin)
> \
>  TYPE(MacroBlockEnd)  
> \
>  TYPE(ModulePartitionColon)   
> \
>   +  TYPE(NamespaceLBrace)
> \
>   +  TYPE(NamespaceRBrace)
> \
>  TYPE(NamespaceMacro) 
> \
>  TYPE(NonNullAssertion)   
> \
>  TYPE(NullCoalescingEqual)
> \
>   diff --git a/clang/lib/Format/UnwrappedLineParser.cpp 
> b/clang/lib/Format/UnwrappedLineParser.cpp
>   index 18ec0844db3d..6eb1086015f0 100644
>   --- a/clang/lib/Format/UnwrappedLineParser.cpp
>   +++ b/clang/lib/Format/UnwrappedLineParser.cpp
>   @@ -920,6 +920,9 @@ FormatToken *UnwrappedLineParser::parseBlock(
>return IfLBrace;
>  }
>
>   +  if (FormatTok->is(tok::r_brace) && Tok->is(TT_NamespaceLBrace))
>   +FormatTok->setFinalizedType(TT_NamespaceRBrace);
>   +
>  const bool IsFunctionRBrace =
>  FormatTok->is(tok::r_brace) && Tok->is(TT_FunctionLBrace);
>
>   @@ -2961,6 +2964,7 @@ void UnwrappedLineParser::parseNamespace() {
>}
>  }
>  if (FormatTok->is(tok::l_brace)) {
>   +FormatTok->setFinalizedType(TT_NamespaceLBrace);
>if (ShouldBreakBeforeBrace(Style, InitialToken))
>  addUnwrappedLine();
>
>   diff --git a/clang/lib/Format/WhitespaceManager.cpp 
> b/clang/lib/Format/WhitespaceManager.cpp
>   index 1f29f7ab917c..0867a8585b50 100644
>   --- a/clang/lib/Format/WhitespaceManager.cpp
>   +++ b/clang/lib/Format/WhitespaceManager.cpp
>   @@ -990,8 +990,7 @@ void WhitespaceManager::alignTrailingComments() {
>// If this comment follows an } in column 0, it probably documents the
>// closing of a namespace and we don't want to align it.
>bool FollowsRBraceInColumn0 = i > 0 && Changes[i].NewlinesBefore == 0 
> &&
>   -  Changes[i - 1].Tok->is(tok::r_brace) &&
>   -  Changes[i - 1].StartOfTokenColumn == 0;
>   +  Changes[i - 
> 1].Tok->is(TT_NamespaceRBrace);
>bool WasAlignedWithStartOfNextLine = false;
>if (Changes[i].NewlinesBefore >= 1) { // A comment on its own line.
>  unsigned CommentColumn = SourceMgr.getSpellingColumnNumber(

Actually read this only now. Basically doing the same thing.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138263/new/

https://reviews.llvm.org/D138263

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138371: [clang-format] Fix a crash due to dereferencing null MatchingParen

2022-11-20 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks accepted this revision.
HazardyKnusperkeks added a comment.
This revision is now accepted and ready to land.

In D138371#3939682 , @rymiel wrote:

> Oops, nevermind, I misunderstood the loop

To understand this is really a tough one. Took me some minutes too, to see why 
the return is needed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138371/new/

https://reviews.llvm.org/D138371

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137020: [clang][AST] Handle variable declaration with unknown typedef in C

2022-11-20 Thread Dilshod Urazov via Phabricator via cfe-commits
urazoff updated this revision to Diff 476766.
urazoff added a comment.

- Added test for AST dump of invalid C code
- Added testcase for diagnostics
- Some minor fixes


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137020/new/

https://reviews.llvm.org/D137020

Files:
  clang/lib/Parse/ParseDecl.cpp
  clang/test/AST/ast-dump-invalid.c
  clang/test/AST/ast-dump-recovery.c
  clang/test/Driver/types.c
  clang/test/Parser/CompoundStmtScope.c
  clang/test/Parser/opencl-atomics-cl20.cl
  clang/test/Parser/recovery.c
  clang/test/SemaOpenCL/intel-subgroup-avc-ext-types.cl
  clang/test/SemaOpenCL/invalid-device-enqueue-types-cl3.0.cl
  clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl

Index: clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
===
--- clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
+++ clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
@@ -26,10 +26,5 @@
 #endif
 
 void bar(void) {
- reserve_id_t r;
-#if defined(__OPENCL_C_VERSION__)
-// expected-error@-2 {{use of undeclared identifier 'reserve_id_t'}}
-#else
-// expected-error@-4 {{unknown type name 'reserve_id_t'}}
-#endif
+ reserve_id_t r; // expected-error {{unknown type name 'reserve_id_t'}}
 }
Index: clang/test/SemaOpenCL/invalid-device-enqueue-types-cl3.0.cl
===
--- clang/test/SemaOpenCL/invalid-device-enqueue-types-cl3.0.cl
+++ clang/test/SemaOpenCL/invalid-device-enqueue-types-cl3.0.cl
@@ -5,8 +5,8 @@
   clk_event_t e;
   queue_t q;
 #ifndef __opencl_c_device_enqueue
-// expected-error@-3 {{use of undeclared identifier 'clk_event_t'}}
-// expected-error@-3 {{use of undeclared identifier 'queue_t'}}
+// expected-error@-3 {{unknown type name 'clk_event_t'}}
+// expected-error@-3 {{unknown type name 'queue_t'}}
 #else
 // expected-no-diagnostics
 #endif
Index: clang/test/SemaOpenCL/intel-subgroup-avc-ext-types.cl
===
--- clang/test/SemaOpenCL/intel-subgroup-avc-ext-types.cl
+++ clang/test/SemaOpenCL/intel-subgroup-avc-ext-types.cl
@@ -46,19 +46,19 @@
 // expected-error@-14 {{initializing '__private intel_sub_group_avc_ime_single_reference_streamin_t' with an expression of incompatible type '__private char'}}
 // expected-error@-14 {{initializing '__private intel_sub_group_avc_ime_dual_reference_streamin_t' with an expression of incompatible type 'int'}}
 #else
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_mce_payload_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_ime_payload_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_ref_payload_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_sic_payload_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_mce_result_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_ime_result_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_ref_result_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_sic_result_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_ime_result_single_reference_streamout_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_ime_result_dual_reference_streamout_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_ime_dual_reference_streamin_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_ime_single_reference_streamin_t'}}
-// expected-error@-28 {{use of undeclared identifier 'intel_sub_group_avc_ime_dual_reference_streamin_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_mce_payload_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_ime_payload_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_ref_payload_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_sic_payload_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_mce_result_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_ime_result_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_ref_result_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_sic_result_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_ime_result_single_reference_streamout_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_ime_result_dual_reference_streamout_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_ime_dual_reference_streamin_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_ime_single_reference_streamin_t'}}
+// expected-error@-28 {{unknown type name 'intel_sub_group_avc_ime_dual_reference_streamin_t'}}
 #endif
 }
 
@@ -75,13 +75,12 @@
 // expected-error@-5 {{initializing '__private 

[clang] 4f0520f - [Clang] Add papers approved in Kona by WG21 to the C++ status page

2022-11-20 Thread Corentin Jabot via cfe-commits

Author: Corentin Jabot
Date: 2022-11-20T18:51:52+01:00
New Revision: 4f0520f82e6693ef5f439d5e998765fe965f25ec

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

LOG: [Clang] Add papers approved in Kona by WG21 to the C++ status page

Approved core issues will be updated separately through an update
of the defect report list when a new core issue list is
published.

Added: 


Modified: 
clang/www/cxx_status.html

Removed: 




diff  --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index b00b3b903e053..e3b75654d515c 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -1162,7 +1162,7 @@ C++20 implementation status
 https://wg21.link/p1975r0;>P1975R0
   
 
-  Modules
+  Modules
   https://wg21.link/p1103r3;>P1103R3
   Clang 15
 
@@ -1202,6 +1202,10 @@ C++20 implementation status
 https://wg21.link/p1815r2;>P1815R2
 Partial
   
+   
+https://wg21.link/P2615R1;>P2615R1
+No
+  
 
   Coroutines
   https://wg21.link/p0912r5;>P0912R5
@@ -1510,7 +1514,27 @@ C++2b implementation status
   https://wg21.link/P2590R2;>P2590R2
   No
 
-
+
+
+  static operator[]
+  https://wg21.link/P2589R1;>P2589R1
+  No
+
+
+  Permitting static constexpr variables in constexpr functions 
(DR)
+  https://wg21.link/P2647R1;>P2647R1
+  No
+
+
+  consteval needs to propagate up (DR)
+  https://wg21.link/P2564R3;>P2564R3
+  No
+
+
+  Lifetime extension in range-based for loops
+  https://wg21.link/P2718R0;>P2718R0
+  No
+
 
 
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137205: [clang-tidy] Add performance-unnecessary-copy-on-last-use check

2022-11-20 Thread Fabian Keßler via Phabricator via cfe-commits
Febbe updated this revision to Diff 476757.
Febbe marked 3 inline comments as done and 3 inline comments as done.
Febbe added a comment.

Improved fixit suggestion.

- No duplicated replacements.

Removed replacements for macros, since they could be wrong somehow.
Made some helperfunction non-trailing


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137205/new/

https://reviews.llvm.org/D137205

Files:
  clang-tools-extra/clang-tidy/performance/CMakeLists.txt
  clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp
  clang-tools-extra/clang-tidy/performance/UnnecessaryCopyOnLastUseCheck.cpp
  clang-tools-extra/clang-tidy/performance/UnnecessaryCopyOnLastUseCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  
clang-tools-extra/docs/clang-tidy/checks/performance/unnecessary-copy-on-last-use.rst
  
clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-on-last-use.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-on-last-use.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-on-last-use.cpp
@@ -0,0 +1,269 @@
+// RUN: %check_clang_tidy %s -std=c++17 performance-unnecessary-copy-on-last-use %t
+// RUN: %check_clang_tidy %s -std=c++11 performance-unnecessary-copy-on-last-use %t
+// CHECK-FIXES: #include 
+
+struct Movable {
+  Movable() = default;
+  Movable(Movable const &) = default;
+  Movable(Movable &&) = default;
+  Movable =(Movable const &) = default;
+  Movable =(Movable &&) = default;
+  ~Movable();
+
+  void memberUse() {}
+};
+
+struct Copyable {
+  Copyable() = default;
+  Copyable(Copyable const &) = default;
+  Copyable(Copyable &&) = default;
+  Copyable =(Copyable const &) = default;
+  Copyable =(Copyable &&) = default;
+  ~Copyable() = default; 
+
+  void memberUse() {}
+};
+// static_assert(!std::is_trivially_copyable_v, "Movable must not be trivially copyable");
+
+void valueReceiver(Movable Mov);
+void constRefReceiver(Movable const );
+
+void valueTester() {
+  Movable Mov{};
+  valueReceiver(Mov);
+  valueReceiver(Mov);
+  // CHECK-MESSAGES: [[@LINE-1]]:17: warning: Parameter 'Mov' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-last-use]
+  // CHECK-FIXES: valueReceiver(std::move(Mov));
+  Mov = Movable{};
+  valueReceiver(Mov);
+  // CHECK-MESSAGES: [[@LINE-1]]:17: warning: Parameter 'Mov' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-last-use]
+  // CHECK-FIXES: valueReceiver(std::move(Mov));
+}
+
+void testUsageInBranch(bool Splitter) {
+  Movable Mov{};
+
+  valueReceiver(Mov);
+  if(Splitter){
+Mov.memberUse();
+  } else {
+Mov = Movable{};
+  }
+  valueReceiver(Mov);
+  // CHECK-MESSAGES: [[@LINE-1]]:17: warning: Parameter 'Mov' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-last-use]
+  // CHECK-FIXES: valueReceiver(std::move(Mov));
+
+  if(Splitter){
+Mov = Movable{};
+  } else {
+Mov = Movable{};
+  }
+  valueReceiver(Mov);
+  Mov.memberUse();
+}
+
+void testExplicitCopy() {
+  Movable Mov{};
+  constRefReceiver(Movable{Mov});
+  // CHECK-MESSAGES: [[@LINE-1]]:28: warning: Parameter 'Mov' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-last-use]
+  // CHECK-FIXES: constRefReceiver(Movable{std::move(Mov)});
+}
+
+Movable testReturn() {
+  Movable Mov{};
+  return Mov; // no warning, copy elision
+}
+
+Movable testReturn2(Movable && Mov, bool F) {
+  return F? Mov: Movable{}; 
+  // CHECK-MESSAGES: [[@LINE-1]]:13: warning: Parameter 'Mov' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-last-use] 
+  // CHECK-FIXES: return F? std::move(Mov): Movable{};
+}
+
+void rValReferenceTester(Movable&& Mov) {
+  valueReceiver(Mov);
+  valueReceiver(Mov);
+  // CHECK-MESSAGES: [[@LINE-1]]:17: warning: Parameter 'Mov' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-last-use]
+  // CHECK-FIXES: valueReceiver(std::move(Mov));
+  Mov = Movable{};
+  valueReceiver(Mov);
+  // CHECK-MESSAGES: [[@LINE-1]]:17: warning: Parameter 'Mov' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-last-use]
+  // CHECK-FIXES: valueReceiver(std::move(Mov));
+}
+
+void referenceTester(Movable& Mov) {
+  valueReceiver(Mov);
+  valueReceiver(Mov);
+  Mov = Movable{};
+  valueReceiver(Mov);
+}
+
+void pointerTester(Movable* Mov) {
+  valueReceiver(*Mov);
+  valueReceiver(*Mov);
+  *Mov = Movable{};
+  valueReceiver(*Mov);
+}
+
+// Replacements in expansions from macros or of their parameters are buggy, so we don't fix them.
+// Todo (future): The source location of macro parameters might be fixed in the future
+#define FUN(Mov) valueReceiver((Mov))
+void falseMacroExpansion() {
+  

[PATCH] D138376: Use None consistently (NFC)

2022-11-20 Thread Thorsten via Phabricator via cfe-commits
tschuett added a comment.

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138376/new/

https://reviews.llvm.org/D138376

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137205: [clang-tidy] Add performance-unnecessary-copy-on-last-use check

2022-11-20 Thread Fabian Keßler via Phabricator via cfe-commits
Febbe added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyOnLastUseCheck.cpp:79
+
+static auto findDeclRefBlock(CFG const *TheCFG, DeclRefExpr const *DeclRef)
+-> FindDeclRefBlockReturn {

njames93 wrote:
> We generally avoid trailing return types.
Ok, I'll make them non-trailing. 
Personally, I find trailing return types more readable, and they always work 
like expected.



Comment at: 
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyOnLastUseCheck.cpp:123
+  hasLHS(ignoringParenImpCasts(declRefExpr(equalsNode(DeclRef)),
+  Context);
+  return !Matches.empty();

njames93 wrote:
> Matching over the entire context seems pretty and a huge drain on 
> performance, would it not make sense to just match inside the function 
> declaration.
> Side note maybe a RecursiveASTVisitor would make more sense here in terms of 
> performance.
> 
> Same goes for isInLambdaCapture.
How can I reduce the Context?

Also, in which terms, the RecursiveASTVisitor would make more sense here?



Comment at: 
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyOnLastUseCheck.cpp:290
+
+if (isInLambdaCapture(Param, *Result.Context)) {
+  // Lambda captures should not be fixed.

njames93 wrote:
> What's the reason for this logic, they require a different fix -
> `x` => `x(std::move(x))` 
> And a checking langopts for c++14.
> 
> Or is this because of implicit captures?
Yes, all fixes require at least c++14.
Also, implicit captures, require a different fix. 

So this is for both.
Honestly, I was too lazy to also implement some sort of lambda capture builder, 
which handles all of this.







Comment at: 
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyOnLastUseCheck.h:30
+  UnnecessaryCopyOnLastUseCheck(StringRef Name, ClangTidyContext *Context);
+  UnnecessaryCopyOnLastUseCheck(UnnecessaryCopyOnLastUseCheck &&) = delete;
+  UnnecessaryCopyOnLastUseCheck(const UnnecessaryCopyOnLastUseCheck &) = 
delete;

njames93 wrote:
> We typically avoid defining all the special member functions for clang tidy 
> checks. The destructor typically only needs to be defined if it's definition 
> can't be inside the header file.
It can't be, because I forward declared CFG, to reduce compile time a bit.
If you prefer to include the CFG's definition in the header, I can do that.

Shall I still remove the deleted special member functions?



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-on-last-use.cpp:16
+
+struct Copyable {
+  Copyable() = default;

njames93 wrote:
> This struct appears to be unused and has exactly the same definition as 
> `Movable`.
No, `Movable` is not trivially capyable, because it does not define a default 
destructor, `Copyable` does.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137205/new/

https://reviews.llvm.org/D137205

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138376: Use None consistently (NFC)

2022-11-20 Thread Alexander Yermolovich via Phabricator via cfe-commits
ayermolo added a comment.

Is there an a RFC for this or something?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138376/new/

https://reviews.llvm.org/D138376

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D22505: [clang-format] Access Modifier Use Normal Indent

2022-11-20 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks abandoned this revision.
HazardyKnusperkeks added a comment.

Closing because of the long silence.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D22505/new/

https://reviews.llvm.org/D22505

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137205: [clang-tidy] Add performance-unnecessary-copy-on-last-use check

2022-11-20 Thread Nathan James via Phabricator via cfe-commits
njames93 added a subscriber: sammccall.
njames93 added a comment.

@sammccall I have a feeling you're gonna want to examine this checks 
feasibility in clangd.




Comment at: 
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyOnLastUseCheck.cpp:79
+
+static auto findDeclRefBlock(CFG const *TheCFG, DeclRefExpr const *DeclRef)
+-> FindDeclRefBlockReturn {

We generally avoid trailing return types.



Comment at: 
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyOnLastUseCheck.cpp:96
+
+static auto
+nextUsageInCurrentBlock(FindDeclRefBlockReturn const ,

The same rules for auto apply here, this should be explicit about what pointer 
it's returning.



Comment at: 
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyOnLastUseCheck.cpp:123
+  hasLHS(ignoringParenImpCasts(declRefExpr(equalsNode(DeclRef)),
+  Context);
+  return !Matches.empty();

Matching over the entire context seems pretty and a huge drain on performance, 
would it not make sense to just match inside the function declaration.
Side note maybe a RecursiveASTVisitor would make more sense here in terms of 
performance.

Same goes for isInLambdaCapture.



Comment at: 
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyOnLastUseCheck.cpp:290
+
+if (isInLambdaCapture(Param, *Result.Context)) {
+  // Lambda captures should not be fixed.

What's the reason for this logic, they require a different fix -
`x` => `x(std::move(x))` 
And a checking langopts for c++14.

Or is this because of implicit captures?



Comment at: 
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyOnLastUseCheck.h:30
+  UnnecessaryCopyOnLastUseCheck(StringRef Name, ClangTidyContext *Context);
+  UnnecessaryCopyOnLastUseCheck(UnnecessaryCopyOnLastUseCheck &&) = delete;
+  UnnecessaryCopyOnLastUseCheck(const UnnecessaryCopyOnLastUseCheck &) = 
delete;

We typically avoid defining all the special member functions for clang tidy 
checks. The destructor typically only needs to be defined if it's definition 
can't be inside the header file.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-on-last-use.cpp:1
+// RUN: %check_clang_tidy %s -std=c++17 
performance-unnecessary-copy-on-last-use %t
+// RUN: %check_clang_tidy %s -std=c++11 
performance-unnecessary-copy-on-last-use %t

Running this check explicitly in c++11/17 implies you expect different 
diagnostics, if so you can use the `--check-suffixes` flag to enable checking 
configurations. Search for other tests which use that if you're unsure 



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-on-last-use.cpp:16
+
+struct Copyable {
+  Copyable() = default;

This struct appears to be unused and has exactly the same definition as 
`Movable`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137205/new/

https://reviews.llvm.org/D137205

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-11-20 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks created this revision.
HazardyKnusperkeks added reviewers: owenpan, MyDeveloperDay, rymiel.
HazardyKnusperkeks added a project: clang-format.
Herald added a project: All.
HazardyKnusperkeks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

For `UT_Never` the remaining results of the `max()` function are not needed, 
introduce a fast path for `UT_Never`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138378

Files:
  clang/lib/Format/WhitespaceManager.cpp


Index: clang/lib/Format/WhitespaceManager.cpp
===
--- clang/lib/Format/WhitespaceManager.cpp
+++ clang/lib/Format/WhitespaceManager.cpp
@@ -1430,10 +1430,14 @@
   }
   // FIXME: This assert should hold if we computed the column correctly.
   // assert((int)C.StartOfTokenColumn >= C.Spaces);
-  appendIndentText(
-  ReplacementText, C.Tok->IndentLevel, std::max(0, C.Spaces),
-  std::max((int)C.StartOfTokenColumn, C.Spaces) - std::max(0, 
C.Spaces),
-  C.IsAligned);
+  unsigned Spaces = std::max(0, C.Spaces);
+  if (Style.UseTab == FormatStyle::UT_Never) {
+ReplacementText.append(Spaces, ' ');
+  } else {
+appendIndentText(ReplacementText, C.Tok->IndentLevel, Spaces,
+ std::max((int)C.StartOfTokenColumn, C.Spaces) - 
Spaces,
+ C.IsAligned);
+  }
   ReplacementText.append(C.CurrentLinePrefix);
   storeReplacement(C.OriginalWhitespaceRange, ReplacementText);
 }
@@ -1489,7 +1493,8 @@
  bool IsAligned) {
   switch (Style.UseTab) {
   case FormatStyle::UT_Never:
-Text.append(Spaces, ' ');
+assert(false);
+llvm_unreachable("Manually handled");
 break;
   case FormatStyle::UT_Always: {
 if (Style.TabWidth) {


Index: clang/lib/Format/WhitespaceManager.cpp
===
--- clang/lib/Format/WhitespaceManager.cpp
+++ clang/lib/Format/WhitespaceManager.cpp
@@ -1430,10 +1430,14 @@
   }
   // FIXME: This assert should hold if we computed the column correctly.
   // assert((int)C.StartOfTokenColumn >= C.Spaces);
-  appendIndentText(
-  ReplacementText, C.Tok->IndentLevel, std::max(0, C.Spaces),
-  std::max((int)C.StartOfTokenColumn, C.Spaces) - std::max(0, C.Spaces),
-  C.IsAligned);
+  unsigned Spaces = std::max(0, C.Spaces);
+  if (Style.UseTab == FormatStyle::UT_Never) {
+ReplacementText.append(Spaces, ' ');
+  } else {
+appendIndentText(ReplacementText, C.Tok->IndentLevel, Spaces,
+ std::max((int)C.StartOfTokenColumn, C.Spaces) - Spaces,
+ C.IsAligned);
+  }
   ReplacementText.append(C.CurrentLinePrefix);
   storeReplacement(C.OriginalWhitespaceRange, ReplacementText);
 }
@@ -1489,7 +1493,8 @@
  bool IsAligned) {
   switch (Style.UseTab) {
   case FormatStyle::UT_Never:
-Text.append(Spaces, ' ');
+assert(false);
+llvm_unreachable("Manually handled");
 break;
   case FormatStyle::UT_Always: {
 if (Style.TabWidth) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138371: [clang-format] Fix a crash due to dereferencing null MatchingParen

2022-11-20 Thread Emilia Dreamer via Phabricator via cfe-commits
rymiel added a comment.

Oops, nevermind, I misunderstood the loop


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138371/new/

https://reviews.llvm.org/D138371

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138371: [clang-format] Fix a crash due to dereferencing null MatchingParen

2022-11-20 Thread Emilia Dreamer via Phabricator via cfe-commits
rymiel added a comment.

Could the check be hoisted to the top of the loop? could that possibly catch 
more cases?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138371/new/

https://reviews.llvm.org/D138371

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138376: Use None consistently (NFC)

2022-11-20 Thread Kazu Hirata via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1fa870b1bd6c: Use None consistently (NFC) (authored by kazu).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138376/new/

https://reviews.llvm.org/D138376

Files:
  bolt/include/bolt/Core/BinaryContext.h
  bolt/include/bolt/Core/BinaryFunction.h
  bolt/include/bolt/Core/MCPlusBuilder.h
  bolt/lib/Core/BinaryContext.cpp
  bolt/lib/Core/MCPlusBuilder.cpp
  bolt/lib/Profile/BoltAddressTranslation.cpp
  bolt/lib/Profile/DataAggregator.cpp
  bolt/lib/Profile/DataReader.cpp
  bolt/lib/Rewrite/RewriteInstance.cpp
  bolt/lib/Target/X86/X86MCPlusBuilder.cpp
  bolt/lib/Utils/Utils.cpp
  clang/lib/Driver/ToolChains/HLSL.cpp
  lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/lib/CodeGen/RemoveRedundantDebugValues.cpp
  llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
  llvm/unittests/IR/MetadataTest.cpp
  mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp

Index: mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
===
--- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
+++ mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
@@ -312,12 +312,12 @@
   if (parser.parseOperand(*chunkSize) || parser.parseColonType(chunkType))
 return failure();
 } else {
-  chunkSize = llvm::NoneType::None;
+  chunkSize = llvm::None;
 }
 break;
   case ClauseScheduleKind::Auto:
   case ClauseScheduleKind::Runtime:
-chunkSize = llvm::NoneType::None;
+chunkSize = llvm::None;
   }
 
   // If there is a comma, we have one or more modifiers..
Index: llvm/unittests/IR/MetadataTest.cpp
===
--- llvm/unittests/IR/MetadataTest.cpp
+++ llvm/unittests/IR/MetadataTest.cpp
@@ -3683,9 +3683,9 @@
   DILocalVariable *VarB =
   DILocalVariable::get(Context, Scope, "B", File, 7, Type, 3, Flags, 8, nullptr);
 
-  DebugVariable DebugVariableA(VarA, NoneType(), nullptr);
-  DebugVariable DebugVariableInlineA(VarA, NoneType(), InlinedLoc);
-  DebugVariable DebugVariableB(VarB, NoneType(), nullptr);
+  DebugVariable DebugVariableA(VarA, None, nullptr);
+  DebugVariable DebugVariableInlineA(VarA, None, InlinedLoc);
+  DebugVariable DebugVariableB(VarB, None, nullptr);
   DebugVariable DebugVariableFragB(VarB, {{16, 16}}, nullptr);
 
   DebugVariableMap.insert({DebugVariableA, 2});
Index: llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
@@ -159,7 +159,7 @@
 return Instr;
   }
 }
-return NoneType();
+return None;
   };
 
   std::unique_ptr Ctx = DWARFContext::create(E);
Index: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
===
--- llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -428,8 +428,7 @@
   VariableMap;
   for (auto  : *BB) {
 if (DbgValueInst *DVI = dyn_cast()) {
-  DebugVariable Key(DVI->getVariable(),
-NoneType(),
+  DebugVariable Key(DVI->getVariable(), None,
 DVI->getDebugLoc()->getInlinedAt());
   auto VMI = VariableMap.find(Key);
   auto *DAI = dyn_cast(DVI);
@@ -490,7 +489,7 @@
   DenseSet SeenDefForAggregate;
   // Returns the DebugVariable for DVI with no fragment info.
   auto GetAggregateVariable = [](DbgValueInst *DVI) {
-return DebugVariable(DVI->getVariable(), NoneType(),
+return DebugVariable(DVI->getVariable(), None,
  DVI->getDebugLoc()->getInlinedAt());
   };
 
Index: llvm/lib/CodeGen/RemoveRedundantDebugValues.cpp
===
--- llvm/lib/CodeGen/RemoveRedundantDebugValues.cpp
+++ llvm/lib/CodeGen/RemoveRedundantDebugValues.cpp
@@ -89,7 +89,7 @@
 
   for (auto  : MBB) {
 if (MI.isDebugValue()) {
-  DebugVariable Var(MI.getDebugVariable(), NoneType(),
+  DebugVariable Var(MI.getDebugVariable(), None,
 MI.getDebugLoc()->getInlinedAt());
   auto VMI = VariableMap.find(Var);
   // Just stop tracking this variable, until we cover DBG_VALUE_LIST.
Index: llvm/include/llvm/IR/DebugInfoMetadata.h
===
--- llvm/include/llvm/IR/DebugInfoMetadata.h
+++ llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -3675,8 +3675,7 @@
 
   DebugVariable(const DILocalVariable *Var, const