[PATCH] D147908: [clang-tidy] Add support for long double in bugprone-incorrect-roundings

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL created this revision.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
PiotrZSL requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Support all floating point representations for an 0.5 floating const.
Added missing tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147908

Files:
  clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
@@ -12,74 +12,126 @@
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5) to integer leads to incorrect rounding; consider using lround (#include ) instead [bugprone-incorrect-roundings]
   x = (d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + d);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + ld);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + f);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (int)(d + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(ld + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(ld + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(ld + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + d);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + ld);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + f);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = static_cast(d + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(ld + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(ld + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(ld + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(0.5 +

[PATCH] D147908: [clang-tidy] Add support for long double in bugprone-incorrect-roundings

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL updated this revision to Diff 512082.
PiotrZSL edited the summary of this revision.
PiotrZSL added a comment.

Update dependency


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147908

Files:
  clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
@@ -12,74 +12,126 @@
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5) to integer leads to incorrect rounding; consider using lround (#include ) instead [bugprone-incorrect-roundings]
   x = (d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + d);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + ld);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + f);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (int)(d + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(ld + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(ld + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(ld + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + d);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + ld);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + f);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = static_cast(d + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(ld + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(ld + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(ld + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (d

[PATCH] D147908: [clang-tidy] Add support for long double in bugprone-incorrect-roundings

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL updated this revision to Diff 512085.
PiotrZSL added a comment.

iDependency fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147908

Files:
  clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
@@ -12,74 +12,126 @@
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5) to integer leads to incorrect rounding; consider using lround (#include ) instead [bugprone-incorrect-roundings]
   x = (d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + d);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + ld);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + f);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (int)(d + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(ld + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(ld + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(ld + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + d);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + ld);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + f);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = static_cast(d + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(ld + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(ld + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(ld + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(0.5L + d);
+  /

[PATCH] D147911: [5/N][POC][Clang] Define tuple type variant of vlseg2e32ff

2023-04-10 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
Herald added subscribers: luke, frasercrmck, luismarques, apazos, 
sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, 
MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, 
simoncook, johnrusso, rbar, asb.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D147774 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147911

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32ff_tuple.c

Index: clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32ff_tuple.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32ff_tuple.c
@@ -0,0 +1,39 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
+// REQUIRES: riscv-registered-target
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
+// RUN:   -target-feature +experimental-zvfh -disable-O0-optnone  \
+// RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
+// RUN:   FileCheck --check-prefix=CHECK-RV64 %s
+#include 
+
+// CHECK-RV64-LABEL: define dso_local { ,  } @test_vlseg2e32ff_v_tuple_i32m1
+// CHECK-RV64-SAME: (ptr noundef [[BASE:%.*]], ptr noundef [[NEW_VL:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = call { , , i64 } @llvm.riscv.vlseg2ff.nxv2i32.i64( poison,  poison, ptr [[BASE]], i64 [[VL]])
+// CHECK-RV64-NEXT:[[TMP1:%.*]] = extractvalue { , , i64 } [[TMP0]], 0
+// CHECK-RV64-NEXT:[[TMP2:%.*]] = insertvalue { ,  } poison,  [[TMP1]], 0
+// CHECK-RV64-NEXT:[[TMP3:%.*]] = extractvalue { , , i64 } [[TMP0]], 1
+// CHECK-RV64-NEXT:[[TMP4:%.*]] = insertvalue { ,  } [[TMP2]],  [[TMP3]], 1
+// CHECK-RV64-NEXT:[[TMP5:%.*]] = extractvalue { , , i64 } [[TMP0]], 2
+// CHECK-RV64-NEXT:store i64 [[TMP5]], ptr [[NEW_VL]], align 8
+// CHECK-RV64-NEXT:ret { ,  } [[TMP4]]
+//
+vint32m1x2_t test_vlseg2e32ff_v_tuple_i32m1(const int32_t *base, size_t *new_vl, size_t vl) {
+  return __riscv_vlseg2e32ff_v_tuple_i32m1(base, new_vl, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local { ,  } @test_vlseg2e32ff_v_tuple_i32m1_m
+// CHECK-RV64-SAME: ( [[MASK:%.*]], ptr noundef [[BASE:%.*]], ptr noundef [[NEW_VL:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = call { , , i64 } @llvm.riscv.vlseg2ff.mask.nxv2i32.i64( poison,  poison, ptr [[BASE]],  [[MASK]], i64 [[VL]], i64 3)
+// CHECK-RV64-NEXT:[[TMP1:%.*]] = extractvalue { , , i64 } [[TMP0]], 0
+// CHECK-RV64-NEXT:[[TMP2:%.*]] = insertvalue { ,  } poison,  [[TMP1]], 0
+// CHECK-RV64-NEXT:[[TMP3:%.*]] = extractvalue { , , i64 } [[TMP0]], 1
+// CHECK-RV64-NEXT:[[TMP4:%.*]] = insertvalue { ,  } [[TMP2]],  [[TMP3]], 1
+// CHECK-RV64-NEXT:[[TMP5:%.*]] = extractvalue { , , i64 } [[TMP0]], 2
+// CHECK-RV64-NEXT:store i64 [[TMP5]], ptr [[NEW_VL]], align 8
+// CHECK-RV64-NEXT:ret { ,  } [[TMP4]]
+//
+vint32m1x2_t test_vlseg2e32ff_v_tuple_i32m1_m(vbool32_t mask, const int32_t *base, size_t *new_vl, size_t vl) {
+  return __riscv_vlseg2e32ff_v_tuple_i32m1_m(mask, base, new_vl, vl);
+}
Index: clang/include/clang/Basic/riscv_vector.td
===
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -1824,11 +1824,77 @@
 }
   }
 }
+
+multiclass RVVUnitStridedSegLoadFFTuple {
+  foreach type = ["i"] in {
+defvar eew = !cond(!eq(type, "i") : "32");
+  foreach nf = [2] in {
+let Name = op # nf # "e" # eew # "ff_v_tuple",
+OverloadedName = op # nf # "e" # eew # "ff_tuple",
+IRName = op # nf # "ff",
+MaskedIRName = op # nf # "ff_mask",
+NF = nf,
+ManualCodegen = [{
+{
+  assert(((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
+ (!IsMasked && (PolicyAttrs & RVV_VTA))) &&
+ "FIXME: Only handling default policy (TAMA) for now");
+
+  llvm::Type *ElementVectorType = cast(ResultType)->elements()[0];
+
+  IntrinsicTypes = {ElementVectorType, Ops.back()->getType()};
+  SmallVector Operands;
+
+  Operands.append(NF, llvm::PoisonValue::get(ElementVectorType));
+
+  llvm::Value *MaskOperand = IsMasked ? Ops[0] : nullptr;
+  llvm::Value *PtrOperand = IsMasked ? Ops[1] : Ops[0];
+  unsigned NewVLOperandIdx = IsMasked ? 2 : 1;
+  llvm::Value *NewVLOperand = IsMasked ? Ops[2] : Ops[1];
+  llvm::Value *VLOperand = IsMasked ? Ops[3] : Ops[2];
+
+  Operands.push_back(

[PATCH] D147912: [6/N][POC][Clang] Define tuple type variant of vlsseg2e32

2023-04-10 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
Herald added subscribers: luke, frasercrmck, luismarques, apazos, 
sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, 
MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, 
simoncook, johnrusso, rbar, asb.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D147911 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147912

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32_tuple.c

Index: clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32_tuple.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32_tuple.c
@@ -0,0 +1,27 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
+// REQUIRES: riscv-registered-target
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
+// RUN:   -target-feature +experimental-zvfh -disable-O0-optnone  \
+// RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
+// RUN:   FileCheck --check-prefix=CHECK-RV64 %s
+#include 
+
+// CHECK-RV64-LABEL: define dso_local { ,  } @test_vlsseg2e32_v_tuple_i32m1
+// CHECK-RV64-SAME: (ptr noundef [[BASE:%.*]], i64 noundef [[BSTRIDE:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = call { ,  } @llvm.riscv.vlsseg2.nxv2i32.i64( poison,  poison, ptr [[BASE]], i64 [[BSTRIDE]], i64 [[VL]])
+// CHECK-RV64-NEXT:ret { ,  } [[TMP0]]
+//
+vint32m1x2_t test_vlsseg2e32_v_tuple_i32m1(const int32_t *base, ptrdiff_t bstride, size_t vl) {
+  return __riscv_vlsseg2e32_v_tuple_i32m1(base, bstride, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local { ,  } @test_vlsseg2e32_v_tuple_i32m1_m
+// CHECK-RV64-SAME: ( [[MASK:%.*]], ptr noundef [[BASE:%.*]], i64 noundef [[BSTRIDE:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = call { ,  } @llvm.riscv.vlsseg2.mask.nxv2i32.i64( poison,  poison, ptr [[BASE]], i64 [[BSTRIDE]],  [[MASK]], i64 [[VL]], i64 3)
+// CHECK-RV64-NEXT:ret { ,  } [[TMP0]]
+//
+vint32m1x2_t test_vlsseg2e32_v_tuple_i32m1_m(vbool32_t mask, const int32_t *base, ptrdiff_t bstride, size_t vl) {
+  return __riscv_vlsseg2e32_v_tuple_i32m1_m(mask, base, bstride, vl);
+}
Index: clang/include/clang/Basic/riscv_vector.td
===
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -1889,12 +1889,64 @@
   }
 }
 
+multiclass RVVStridedSegLoadTuple {
+  foreach type = ["i"] in {
+defvar eew = !cond(!eq(type, "i") : "32");
+  foreach nf = [2] in {
+let Name = op # nf # "e" # eew # "_v_tuple",
+OverloadedName = op # nf # "e" # eew # "_tuple",
+IRName = op # nf,
+MaskedIRName = op # nf # "_mask",
+NF = nf,
+ManualCodegen = [{
+{
+  assert(((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
+ (!IsMasked && (PolicyAttrs & RVV_VTA))) &&
+ "FIXME: Only handling default policy (TAMA) for now");
+
+  llvm::Type *ElementVectorType = cast(ResultType)->elements()[0];
+
+  IntrinsicTypes = {ElementVectorType, Ops.back()->getType()};
+  SmallVector Operands;
+
+  Operands.append(NF, llvm::PoisonValue::get(ElementVectorType));
+
+  llvm::Value *MaskOperand = IsMasked ? Ops[0] : nullptr;
+  llvm::Value *PtrOperand = IsMasked ? Ops[1] : Ops[0];
+  llvm::Value *StrideOperand = IsMasked ? Ops[2] : Ops[1];
+  llvm::Value *VLOperand = IsMasked ? Ops[3] : Ops[2];
+
+  Operands.push_back(PtrOperand);
+  Operands.push_back(StrideOperand);
+  if (MaskOperand)
+Operands.push_back(MaskOperand);
+  Operands.push_back(VLOperand);
+  if (IsMasked)
+Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
+
+  llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
+  llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
+
+  if (ReturnValue.isNull())
+return LoadValue;
+  else
+return Builder.CreateStore(LoadValue, ReturnValue.getValue());  
+}
+}] in {
+  defvar T = "(Tuple:" # nf # ")";
+  def : RVVBuiltin<"v", T # "vPCet", type>;
+  }
+}
+  }
+}
+
 // TODO: Extend for policy
 let UnMaskedPolicyScheme = NonePolicy,
 MaskedPolicyScheme = NonePolicy,
 IsTuple = true in {
 defm : RVVUnitStridedSegLoadTuple<"vlseg">;
 defm : RVVUnitStridedSegLoadFFTuple<"vlseg">;
+defm : RVVStridedSegLoadTuple<"vlsseg">;
 }
 
 l

[PATCH] D147913: [7/N][POC][Clang] Define tuple type variant of vssseg2e32

2023-04-10 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
Herald added subscribers: luke, frasercrmck, luismarques, apazos, 
sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, 
MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, 
simoncook, johnrusso, rbar, asb.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D147912 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147913

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e32_tuple.c

Index: clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e32_tuple.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e32_tuple.c
@@ -0,0 +1,36 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
+// REQUIRES: riscv-registered-target
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
+// RUN:   -target-feature +experimental-zvfh -disable-O0-optnone  \
+// RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
+// RUN:   FileCheck --check-prefix=CHECK-RV64 %s
+
+#include 
+
+// CHECK-RV64-LABEL: define dso_local void @test_vssseg2e32_v_tuple_i32m1
+// CHECK-RV64-SAME: (ptr noundef [[BASE:%.*]], i64 noundef [[BSTRIDE:%.*]],  [[V_TUPLE_COERCE0:%.*]],  [[V_TUPLE_COERCE1:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = insertvalue { ,  } undef,  [[V_TUPLE_COERCE0]], 0
+// CHECK-RV64-NEXT:[[TMP1:%.*]] = insertvalue { ,  } [[TMP0]],  [[V_TUPLE_COERCE1]], 1
+// CHECK-RV64-NEXT:[[TMP2:%.*]] = extractvalue { ,  } [[TMP1]], 0
+// CHECK-RV64-NEXT:[[TMP3:%.*]] = extractvalue { ,  } [[TMP1]], 1
+// CHECK-RV64-NEXT:call void @llvm.riscv.vssseg2.nxv2i32.i64( [[TMP2]],  [[TMP3]], ptr [[BASE]], i64 [[BSTRIDE]], i64 [[VL]])
+// CHECK-RV64-NEXT:ret void
+//
+void test_vssseg2e32_v_tuple_i32m1(int32_t *base, ptrdiff_t bstride, vint32m1x2_t v_tuple, size_t vl) {
+  return __riscv_vssseg2e32_v_tuple_i32m1(base, bstride, v_tuple, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_vssseg2e32_v_tuple_i32m1_m
+// CHECK-RV64-SAME: ( [[MASK:%.*]], ptr noundef [[BASE:%.*]], i64 noundef [[BSTRIDE:%.*]],  [[V_TUPLE_COERCE0:%.*]],  [[V_TUPLE_COERCE1:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = insertvalue { ,  } undef,  [[V_TUPLE_COERCE0]], 0
+// CHECK-RV64-NEXT:[[TMP1:%.*]] = insertvalue { ,  } [[TMP0]],  [[V_TUPLE_COERCE1]], 1
+// CHECK-RV64-NEXT:[[TMP2:%.*]] = extractvalue { ,  } [[TMP1]], 0
+// CHECK-RV64-NEXT:[[TMP3:%.*]] = extractvalue { ,  } [[TMP1]], 1
+// CHECK-RV64-NEXT:call void @llvm.riscv.vssseg2.mask.nxv2i32.i64( [[TMP2]],  [[TMP3]], ptr [[BASE]], i64 [[BSTRIDE]],  [[MASK]], i64 [[VL]])
+// CHECK-RV64-NEXT:ret void
+//
+void test_vssseg2e32_v_tuple_i32m1_m(vbool32_t mask, int32_t *base, ptrdiff_t bstride, vint32m1x2_t v_tuple, size_t vl) {
+  return __riscv_vssseg2e32_v_tuple_i32m1_m(mask, base, bstride, v_tuple, vl);
+}
Index: clang/include/clang/Basic/riscv_vector.td
===
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -1940,6 +1940,54 @@
   }
 }
 
+multiclass RVVStridedSegStoreTuple {
+  foreach type = ["i"] in {
+defvar eew = !cond(!eq(type, "i") : "32");
+  foreach nf = [2] in {
+let Name = op # nf # "e" # eew # "_v_tuple",
+OverloadedName = op # nf # "e" # eew # "_tuple",
+IRName = op # nf,
+MaskedIRName = op # nf # "_mask",
+NF = nf,
+HasMaskedOffOperand = false,
+MaskedPolicyScheme = NonePolicy,
+ManualCodegen = [{
+{
+  // Masked
+  // Builtin: (mask, ptr, stride, v_tuple, vl)
+  // Intrinsic: (val0, val1, ..., ptr, stride, mask, vl)
+  // Unmasked
+  // Builtin: (ptr, stride, v_tuple, vl)
+  // Intrinsic: (val0, val1, ..., ptr, stride, vl)
+  llvm::Value *MaskOperand = IsMasked ? Ops[0] : nullptr;
+  llvm::Value *PtrOperand = IsMasked ? Ops[1] : Ops[0];
+  llvm::Value *StrideOperand = IsMasked ? Ops[2] : Ops[1];
+  llvm::Value *VTupleOperand = IsMasked ? Ops[3] : Ops[2];
+  llvm::Value *VLOperand = IsMasked ? Ops[4] : Ops[3];
+
+  SmallVector Operands;
+  for (unsigned I = 0; I < NF; ++I) {
+llvm::Value *V = Builder.CreateExtractValue(VTupleOperand, {I});
+Operands.push_back(V);
+  }
+  Operands.push_back(PtrOperand);
+  Operands.push_back(StrideOperand);
+  if (MaskOperand)
+Operands.push_bac

[PATCH] D147914: [8/N][POC][Clang] Define tuple type variant of vloxseg2ei32 vluxseg2ei32

2023-04-10 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
Herald added subscribers: luke, frasercrmck, luismarques, apazos, 
sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, 
MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, 
simoncook, johnrusso, rbar, asb.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D147913 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147914

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei32_tuple.c

Index: clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei32_tuple.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei32_tuple.c
@@ -0,0 +1,28 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
+// REQUIRES: riscv-registered-target
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
+// RUN:   -target-feature +experimental-zvfh -disable-O0-optnone  \
+// RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
+// RUN:   FileCheck --check-prefix=CHECK-RV64 %s
+
+#include 
+
+// CHECK-RV64-LABEL: define dso_local { ,  } @test_vluxseg2ei32_v_tuple_i32m1
+// CHECK-RV64-SAME: (ptr noundef [[BASE:%.*]],  [[BINDEX:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = call { ,  } @llvm.riscv.vluxseg2.nxv2i32.nxv2i32.i64( poison,  poison, ptr [[BASE]],  [[BINDEX]], i64 [[VL]])
+// CHECK-RV64-NEXT:ret { ,  } [[TMP0]]
+//
+vint32m1x2_t test_vluxseg2ei32_v_tuple_i32m1(const int32_t *base, vuint32m1_t bindex, size_t vl) {
+  return __riscv_vluxseg2ei32_v_tuple_i32m1(base, bindex, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local { ,  } @test_vluxseg2ei32_v_tuple_i32m1_m
+// CHECK-RV64-SAME: ( [[MASK:%.*]], ptr noundef [[BASE:%.*]],  [[BINDEX:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = call { ,  } @llvm.riscv.vluxseg2.mask.nxv2i32.nxv2i32.i64( poison,  poison, ptr [[BASE]],  [[BINDEX]],  [[MASK]], i64 [[VL]], i64 3)
+// CHECK-RV64-NEXT:ret { ,  } [[TMP0]]
+//
+vint32m1x2_t test_vluxseg2ei32_v_tuple_i32m1_m(vbool32_t mask, const int32_t *base, vuint32m1_t bindex, size_t vl) {
+  return __riscv_vluxseg2ei32_v_tuple_i32m1_m(mask, base, bindex, vl);
+}
Index: clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32_tuple.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32_tuple.c
@@ -0,0 +1,28 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
+// REQUIRES: riscv-registered-target
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
+// RUN:   -target-feature +experimental-zvfh -disable-O0-optnone  \
+// RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
+// RUN:   FileCheck --check-prefix=CHECK-RV64 %s
+
+#include 
+
+// CHECK-RV64-LABEL: define dso_local { ,  } @test_vloxseg2ei32_v_tuple_i32m1
+// CHECK-RV64-SAME: (ptr noundef [[BASE:%.*]],  [[BINDEX:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = call { ,  } @llvm.riscv.vloxseg2.nxv2i32.nxv2i32.i64( poison,  poison, ptr [[BASE]],  [[BINDEX]], i64 [[VL]])
+// CHECK-RV64-NEXT:ret { ,  } [[TMP0]]
+//
+vint32m1x2_t test_vloxseg2ei32_v_tuple_i32m1(const int32_t *base, vuint32m1_t bindex, size_t vl) {
+  return __riscv_vloxseg2ei32_v_tuple_i32m1(base, bindex, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local { ,  } @test_vloxseg2ei32_v_tuple_i32m1_m
+// CHECK-RV64-SAME: ( [[MASK:%.*]], ptr noundef [[BASE:%.*]],  [[BINDEX:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = call { ,  } @llvm.riscv.vloxseg2.mask.nxv2i32.nxv2i32.i64( poison,  poison, ptr [[BASE]],  [[BINDEX]],  [[MASK]], i64 [[VL]], i64 3)
+// CHECK-RV64-NEXT:ret { ,  } [[TMP0]]
+//
+vint32m1x2_t test_vloxseg2ei32_v_tuple_i32m1_m(vbool32_t mask, const int32_t *base, vuint32m1_t bindex, size_t vl) {
+  return __riscv_vloxseg2ei32_v_tuple_i32m1_m(mask, base, bindex, vl);
+}
Index: clang/include/clang/Basic/riscv_vector.td
===
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -1988,6 +1988,60 @@
   }
 }
 
+multiclass RVVIndexedSegLoadTuple {
+  for

[PATCH] D147915: [9/N][POC][Clang] Define tuple type variant of vsoxseg2ei32 vsuxseg2ei32

2023-04-10 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
Herald added subscribers: luke, frasercrmck, luismarques, apazos, 
sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, 
MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, 
simoncook, johnrusso, rbar, asb.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D147914 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147915

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32_tuple.c

Index: clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32_tuple.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32_tuple.c
@@ -0,0 +1,36 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
+// REQUIRES: riscv-registered-target
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
+// RUN:   -target-feature +experimental-zvfh -disable-O0-optnone  \
+// RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
+// RUN:   FileCheck --check-prefix=CHECK-RV64 %s
+
+#include 
+
+// CHECK-RV64-LABEL: define dso_local void @test_vsuxseg2ei32_v_tuple_i32m1
+// CHECK-RV64-SAME: (ptr noundef [[BASE:%.*]],  [[BINDEX:%.*]],  [[V_TUPLE_COERCE0:%.*]],  [[V_TUPLE_COERCE1:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = insertvalue { ,  } undef,  [[V_TUPLE_COERCE0]], 0
+// CHECK-RV64-NEXT:[[TMP1:%.*]] = insertvalue { ,  } [[TMP0]],  [[V_TUPLE_COERCE1]], 1
+// CHECK-RV64-NEXT:[[TMP2:%.*]] = extractvalue { ,  } [[TMP1]], 0
+// CHECK-RV64-NEXT:[[TMP3:%.*]] = extractvalue { ,  } [[TMP1]], 1
+// CHECK-RV64-NEXT:call void @llvm.riscv.vsuxseg2.nxv2i32.nxv2i32.i64( [[TMP2]],  [[TMP3]], ptr [[BASE]],  [[BINDEX]], i64 [[VL]])
+// CHECK-RV64-NEXT:ret void
+//
+void test_vsuxseg2ei32_v_tuple_i32m1(int32_t *base, vuint32m1_t bindex, vint32m1x2_t v_tuple, size_t vl) {
+  return __riscv_vsuxseg2ei32_v_tuple_i32m1(base, bindex, v_tuple, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_vsuxseg2ei32_v_tuple_i32m1_m
+// CHECK-RV64-SAME: ( [[MASK:%.*]], ptr noundef [[BASE:%.*]],  [[BINDEX:%.*]],  [[V_TUPLE_COERCE0:%.*]],  [[V_TUPLE_COERCE1:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = insertvalue { ,  } undef,  [[V_TUPLE_COERCE0]], 0
+// CHECK-RV64-NEXT:[[TMP1:%.*]] = insertvalue { ,  } [[TMP0]],  [[V_TUPLE_COERCE1]], 1
+// CHECK-RV64-NEXT:[[TMP2:%.*]] = extractvalue { ,  } [[TMP1]], 0
+// CHECK-RV64-NEXT:[[TMP3:%.*]] = extractvalue { ,  } [[TMP1]], 1
+// CHECK-RV64-NEXT:call void @llvm.riscv.vsuxseg2.mask.nxv2i32.nxv2i32.i64( [[TMP2]],  [[TMP3]], ptr [[BASE]],  [[BINDEX]],  [[MASK]], i64 [[VL]])
+// CHECK-RV64-NEXT:ret void
+//
+void test_vsuxseg2ei32_v_tuple_i32m1_m(vbool32_t mask, int32_t *base, vuint32m1_t bindex, vint32m1x2_t v_tuple, size_t vl) {
+  return __riscv_vsuxseg2ei32_v_tuple_i32m1_m(mask, base, bindex, v_tuple, vl);
+}
Index: clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32_tuple.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32_tuple.c
@@ -0,0 +1,36 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
+// REQUIRES: riscv-registered-target
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
+// RUN:   -target-feature +experimental-zvfh -disable-O0-optnone  \
+// RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
+// RUN:   FileCheck --check-prefix=CHECK-RV64 %s
+
+#include 
+
+// CHECK-RV64-LABEL: define dso_local void @test_vsoxseg2ei32_v_tuple_i32m1
+// CHECK-RV64-SAME: (ptr noundef [[BASE:%.*]],  [[BINDEX:%.*]],  [[V_TUPLE_COERCE0:%.*]],  [[V_TUPLE_COERCE1:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = insertvalue { ,  } undef,  [[V_TUPLE_COERCE0]], 0
+// CHECK-RV64-NEXT:[[TMP1:%.*]] = insertvalue { ,  } [[TMP0]],  [[V_TUPLE_COERCE1]], 1
+// CHECK-RV64-NEXT:[[TMP2:%.*]] = extractvalue { ,  } [[TMP1]], 0
+// CHECK-RV64-NEXT:[[TMP3:%.*]] = extractvalue { ,  } [[TMP1]], 1
+// CHECK-RV64-NEXT:call void @llvm.riscv.vsoxseg2.nxv2i32.nxv2i32.i64( [[TMP2]],  [[TMP3]], ptr [[BASE]],  [[BINDEX]], i64 [[VL]])
+// CHECK-RV64-NEXT:ret void
+//
+void test_vsoxseg2e

[PATCH] D147916: [10/N][POC][Clang] Define vget for tuple type

2023-04-10 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
Herald added subscribers: luke, frasercrmck, luismarques, apazos, 
sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, 
MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, 
simoncook, johnrusso, rbar, asb.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D147915 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147916

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/lib/Support/RISCVVIntrinsicUtils.cpp
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vget_tuple.c


Index: 
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vget_tuple.c
===
--- /dev/null
+++ 
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vget_tuple.c
@@ -0,0 +1,20 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 2
+// REQUIRES: riscv-registered-target
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
+// RUN:   -target-feature +experimental-zvfh -disable-O0-optnone  \
+// RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
+// RUN:   FileCheck --check-prefix=CHECK-RV64 %s
+
+#include 
+
+// CHECK-RV64-LABEL: define dso_local  
@test_vget_v_i32m1x2_i32m1
+// CHECK-RV64-SAME: ( [[SRC_COERCE0:%.*]],  [[SRC_COERCE1:%.*]], i64 noundef [[INDEX:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = insertvalue { , 
 } undef,  [[SRC_COERCE0]], 0
+// CHECK-RV64-NEXT:[[TMP1:%.*]] = insertvalue { , 
 } [[TMP0]],  [[SRC_COERCE1]], 1
+// CHECK-RV64-NEXT:[[TMP2:%.*]] = extractvalue { , 
 } [[TMP1]], 0
+// CHECK-RV64-NEXT:ret  [[TMP2]]
+//
+vint32m1_t test_vget_v_i32m1x2_i32m1(vint32m1x2_t src, size_t index) {
+  return __riscv_vget_v_i32m1x2_i32m1(src, 0);
+}
Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -332,6 +332,8 @@
   }
   if (isVector())
 ShortStr += LMUL.str();
+  if (isTuple())
+ShortStr += "x" + utostr(NF);
 }
 
 void RVVType::applyBasicType() {
Index: clang/include/clang/Basic/riscv_vector.td
===
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -2714,6 +2714,16 @@
   let Name = "vget_v", MaskedPolicyScheme = NonePolicy,
   ManualCodegen = [{
   {
+if (isa(Ops[0]->getType())) { // codegen for tuple type
+  llvm::Value *VTupleOperand = Ops[0];
+  llvm::Value *IndexOperand = Ops[1];
+  assert(isa(IndexOperand));
+  unsigned Index = cast(IndexOperand)->getZExtValue();
+  unsigned MaxIndex = 
cast(VTupleOperand->getType())->getNumElements();
+  Index = std::min(Index, MaxIndex);
+
+  return Builder.CreateExtractValue(VTupleOperand, {Index});
+}
 ID = Intrinsic::vector_extract;
 auto *VecTy = cast(ResultType);
 auto *OpVecTy = cast(Ops[0]->getType());
@@ -2733,6 +2743,10 @@
   def : RVVBuiltin<"v" # dst_lmul # "v", dst_lmul # "vvKz", "csilxfd", 
dst_lmul # "v">;
   def : RVVBuiltin<"Uv" # dst_lmul # "Uv", dst_lmul # "UvUvKz", "csil", 
dst_lmul # "Uv">;
 }
+foreach nf = [2] in {
+  defvar T = "(Tuple:" # nf # ")";
+  def : RVVBuiltin;
+}
   }
 
   let Name = "vset_v", Log2LMUL = [0, 1, 2], MaskedPolicyScheme = NonePolicy,


Index: clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vget_tuple.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vget_tuple.c
@@ -0,0 +1,20 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
+// REQUIRES: riscv-registered-target
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
+// RUN:   -target-feature +experimental-zvfh -disable-O0-optnone  \
+// RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
+// RUN:   FileCheck --check-prefix=CHECK-RV64 %s
+
+#include 
+
+// CHECK-RV64-LABEL: define dso_local  @test_vget_v_i32m1x2_i32m1
+// CHECK-RV64-SAME: ( [[SRC_COERCE0:%.*]],  [[SRC_COERCE1:%.*]], i64 noundef [[INDEX:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = insertvalue { ,  } undef,  [[SRC_COERCE0]], 0
+// CHECK-RV64-NEXT:[[TMP1:%.*]] = insertvalue { ,  } [[TMP0]],  [[SRC_COERCE1]], 1
+// CHECK-RV64-NEXT:[[TMP2:%.*]] = extractvalue { ,  } [[TMP1]], 0
+// CHECK-RV64-NEXT:ret  [[TMP2]]

[PATCH] D147917: [11/11][POC][Clang] Define vset for tuple type

2023-04-10 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
Herald added subscribers: luke, frasercrmck, luismarques, apazos, 
sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, 
MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, 
simoncook, johnrusso, rbar, asb.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D147916 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147917

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vset_tuple.c


Index: 
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vset_tuple.c
===
--- /dev/null
+++ 
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vset_tuple.c
@@ -0,0 +1,20 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 2
+// REQUIRES: riscv-registered-target
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
+// RUN:   -target-feature +experimental-zvfh -disable-O0-optnone  \
+// RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
+// RUN:   FileCheck --check-prefix=CHECK-RV64 %s
+
+#include 
+
+// CHECK-RV64-LABEL: define dso_local { ,  
} @test_vget_v_i32m1x2_i32m1
+// CHECK-RV64-SAME: ( [[DEST_COERCE0:%.*]],  [[DEST_COERCE1:%.*]], i64 noundef [[INDEX:%.*]],  
[[VAL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = insertvalue { , 
 } undef,  [[DEST_COERCE0]], 0
+// CHECK-RV64-NEXT:[[TMP1:%.*]] = insertvalue { , 
 } [[TMP0]],  [[DEST_COERCE1]], 1
+// CHECK-RV64-NEXT:[[TMP2:%.*]] = insertvalue { , 
 } [[TMP1]],  [[VAL]], 0
+// CHECK-RV64-NEXT:ret { ,  } [[TMP2]]
+//
+vint32m1x2_t test_vget_v_i32m1x2_i32m1(vint32m1x2_t dest, size_t index, 
vint32m1_t val) {
+  return __riscv_vset_v_i32m1x2_i32m1(dest, 0, val);
+}
Index: clang/include/clang/Basic/riscv_vector.td
===
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -2752,6 +2752,18 @@
   let Name = "vset_v", Log2LMUL = [0, 1, 2], MaskedPolicyScheme = NonePolicy,
   ManualCodegen = [{
   {
+if (isa(ResultType)) { // codegen for tuple type
+  llvm::Value *VTupleOperand = Ops[0];
+  llvm::Value *IndexOperand = Ops[1];
+  llvm::Value *VOperand = Ops[2];
+  assert(isa(IndexOperand));
+
+  unsigned Index = cast(IndexOperand)->getZExtValue();
+  unsigned MaxIndex = 
cast(VTupleOperand->getType())->getNumElements();
+  Index = std::min(Index, MaxIndex);
+
+  return Builder.CreateInsertValue(VTupleOperand, VOperand, {Index});
+}
 ID = Intrinsic::vector_insert;
 IntrinsicTypes = {ResultType, Ops[2]->getType()};
 auto *ResVecTy = cast(ResultType);
@@ -2772,5 +2784,9 @@
   def : RVVBuiltin<"v" # dst_lmul # "v", dst_lmul # "v" # dst_lmul # 
"vKzv", "csilxfd">;
   def : RVVBuiltin<"Uv" # dst_lmul # "Uv", dst_lmul # "Uv" # dst_lmul 
#"UvKzUv", "csil">;
 }
+foreach nf = [2] in {
+  defvar T = "(Tuple:" # nf # ")";
+  def : RVVBuiltin;
+}
   }
 }


Index: clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vset_tuple.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vset_tuple.c
@@ -0,0 +1,20 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
+// REQUIRES: riscv-registered-target
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
+// RUN:   -target-feature +experimental-zvfh -disable-O0-optnone  \
+// RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
+// RUN:   FileCheck --check-prefix=CHECK-RV64 %s
+
+#include 
+
+// CHECK-RV64-LABEL: define dso_local { ,  } @test_vget_v_i32m1x2_i32m1
+// CHECK-RV64-SAME: ( [[DEST_COERCE0:%.*]],  [[DEST_COERCE1:%.*]], i64 noundef [[INDEX:%.*]],  [[VAL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = insertvalue { ,  } undef,  [[DEST_COERCE0]], 0
+// CHECK-RV64-NEXT:[[TMP1:%.*]] = insertvalue { ,  } [[TMP0]],  [[DEST_COERCE1]], 1
+// CHECK-RV64-NEXT:[[TMP2:%.*]] = insertvalue { ,  } [[TMP1]],  [[VAL]], 0
+// CHECK-RV64-NEXT:ret { ,  } [[TMP2]]
+//
+vint32m1x2_t test_vget_v_i32m1x2_i32m1(vint32m1x2_t dest, size_t index, vint32m1_t val) {
+  return __riscv_vset_v_i32m1x2_i32m1(dest, 0, val);
+}
Index: clang/include/clang/Basic/riscv_vector.td
===
--- clang/include/clang/Basic/riscv_vector.td

[PATCH] D147918: [clang-tidy] Added IgnoreVirtual option to misc-unused-parameters

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL created this revision.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
PiotrZSL requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Added option to ignore virtual methods in this check.
This allows to quickly get rid of big number of
potentialy false-positive issues without inserting
not-needed comments.

Fixes #55665.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147918

Files:
  clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
  clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
  clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
@@ -0,0 +1,20 @@
+// RUN: %check_clang_tidy %s misc-unused-parameters %t -- \
+// RUN:   -config="{CheckOptions: [{key: misc-unused-parameters.IgnoreVirtual, value: true}]}" --
+
+struct Class {
+  int f(int foo) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: parameter 'foo' is unused [misc-unused-parameters]
+  // CHECK-FIXES: {{^  }}int f(int  /*foo*/) {{{$}}
+return 5;
+  }
+
+  virtual int f2(int foo) {
+return 5;
+  }
+};
+
+struct Derived : Class {
+  int f2(int foo) {
+return 5;
+  }
+};
Index: clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
@@ -40,3 +40,8 @@
constructors - no constructor initializers). When the function body is empty,
an unused parameter is unlikely to be unnoticed by a human reader, and
there's basically no place for a bug to hide.
+
+.. option:: IgnoreVirtual
+
+   Determines whether virtual method parameters should be inspected.
+   Set to `true` to ignore them. Default is `false`.
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -220,6 +220,10 @@
   ` to avoid warning on
   declarations inside anonymous namespaces.
 
+- Improved :doc:`misc-unused-parameters
+  ` check with new `IgnoreVirtual`
+  option to optionally ignore virtual methods (default `false`).
+
 - Deprecated check-local options `HeaderFileExtensions`
   in :doc:`misc-unused-using-decls
   ` check.
@@ -302,8 +306,8 @@
   ``DISABLED_`` in the test suite name.
 
 - Improved :doc:`modernize-concat-nested-namespaces
-  ` to fix incorrect fixes when 
-  using macro between namespace declarations and false positive when using namespace 
+  ` to fix incorrect fixes when
+  using macro between namespace declarations and false positive when using namespace
   with attributes.
 
 - Fixed a false positive in :doc:`performance-no-automatic-move
Index: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
===
--- clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
+++ clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
@@ -25,6 +25,7 @@
 
 private:
   const bool StrictMode;
+  const bool IgnoreVirtual;
   class IndexerVisitor;
   std::unique_ptr Indexer;
 
Index: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
@@ -123,10 +123,12 @@
 UnusedParametersCheck::UnusedParametersCheck(StringRef Name,
  ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
-  StrictMode(Options.getLocalOrGlobal("StrictMode", false)) {}
+  StrictMode(Options.getLocalOrGlobal("StrictMode", false)),
+  IgnoreVirtual(Options.get("IgnoreVirtual", false)) {}
 
 void UnusedParametersCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "StrictMode", StrictMode);
+  Options.store(Opts, "IgnoreVirtual", IgnoreVirtual);
 }
 
 void UnusedParametersCheck::warnOnUnusedParameter(
@@ -177,7 +179,8 @@
   if (!Function->hasWrittenPrototype() || Function->isTemplateInstantiation())
 return;
   if (const auto *Method = dyn_cast(Function))
-if (Method->isLambdaStaticInvoker())
+if (Method->isLambdaStaticInvoker() ||
+(IgnoreVirtual && Method->isVirtual()))
   return;
   for (unsigned I = 0, E = Function->getNumParams(); I != E; ++I) {
 const auto *Param = Function->getParam

[PATCH] D147909: [clang] Implement CWG 2397

2023-04-10 Thread Younan Zhang via Phabricator via cfe-commits
zyounan created this revision.
Herald added a project: All.
zyounan added a comment.
zyounan added reviewers: aaron.ballman, erichkeane, rsmith.
zyounan published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Note GCC had implemented such feature since GCC 12 
.


This patch implements CWG 2397, allowing array of placeholder type
to be valid.

See also https://wg21.cmeerw.net/cwg/issue2397.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147909

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaType.cpp
  clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/cwg2397.cpp
  clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp


Index: clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
===
--- clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
+++ clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
@@ -2,6 +2,6 @@
 
 void f() {
   int b[5];
-  auto a[5] = b; // expected-error{{'a' declared as array of 'auto'}}
-  auto *c[5] = b; // expected-error{{'c' declared as array of 'auto *'}}
+  auto a[5] = b; // expected-error{{variable 'a' with type 'auto[5]' has 
incompatible initializer of type 'int[5]'}}
+  auto *c[5] = b; // expected-error{{variable 'c' with type 'auto *[5]' has 
incompatible initializer of type 'int[5]'}}
 }
Index: clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/cwg2397.cpp
===
--- /dev/null
+++ clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/cwg2397.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+
+void foo() {
+  int a[5];
+
+  auto (&b)[5] = a;
+  auto (*c)[5] = &a;
+
+  auto d[] = {0}; // expected-error{{cannot deduce actual type for variable 
'd' with type 'auto[]' from initializer list}}
+}
+
+void g() {
+  int a[5];
+  auto (*b)[5] = &a;
+  auto (&c)[5] = a;
+  auto (&&d)[5] = static_cast(a);
+  static_assert(__is_same(decltype(b), int (*)[5]), "");
+  static_assert(__is_same(decltype(c), int (&)[5]), "");
+  static_assert(__is_same(decltype(d), int (&&)[5]), "");
+}
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -5130,17 +5130,6 @@
   D.setInvalidType(true);
 }
   }
-  const AutoType *AT = T->getContainedAutoType();
-  // Allow arrays of auto if we are a generic lambda parameter.
-  // i.e. [](auto (&array)[5]) { return array[0]; }; OK
-  if (AT && D.getContext() != DeclaratorContext::LambdaExprParameter) {
-// We've already diagnosed this for decltype(auto).
-if (!AT->isDecltypeAuto())
-  S.Diag(DeclType.Loc, diag::err_illegal_decl_array_of_auto)
-  << getPrintableNameForEntity(Name) << T;
-T = QualType();
-break;
-  }
 
   // Array parameters can be marked nullable as well, although it's not
   // necessary if they're marked 'static'.
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -2314,8 +2314,6 @@
 def err_binding_cannot_appear_in_own_initializer : Error<
   "binding %0 cannot appear in the initializer of its own "
   "decomposition declaration">;
-def err_illegal_decl_array_of_auto : Error<
-  "'%0' declared as array of %1">;
 def err_new_array_of_auto : Error<
   "cannot allocate array of 'auto'">;
 def err_auto_not_allowed : Error<


Index: clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
===
--- clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
+++ clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
@@ -2,6 +2,6 @@
 
 void f() {
   int b[5];
-  auto a[5] = b; // expected-error{{'a' declared as array of 'auto'}}
-  auto *c[5] = b; // expected-error{{'c' declared as array of 'auto *'}}
+  auto a[5] = b; // expected-error{{variable 'a' with type 'auto[5]' has incompatible initializer of type 'int[5]'}}
+  auto *c[5] = b; // expected-error{{variable 'c' with type 'auto *[5]' has incompatible initializer of type 'int[5]'}}
 }
Index: clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/cwg2397.cpp
===
--- /dev/null
+++ clang/test/CXX/dcl.decl/dcl.meaning/dcl.array/cwg2397.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+
+void foo() {
+  int a[5];
+
+  auto (&b)[5] = a;
+  auto (*c)[5] = &a;
+
+  auto d[] = {0}; // expected-error{{cannot deduce actual type for variable 'd' with type 'auto[]' from initializer list}}
+}
+
+void g() {
+  int a[5];
+  auto (*b)[5] = &a;
+  auto (&c)[5] = a;
+  

[PATCH] D147894: [clang-format] SortIncludes documentation: remove contradiction in its description

2023-04-10 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay requested changes to this revision.
MyDeveloperDay added a comment.
This revision now requires changes to proceed.

Sorry I don’t get how this change helps. Removing the option values does make 
it clearer IMHO


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

https://reviews.llvm.org/D147894

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


[PATCH] D147893: [clang-tidy] avoid colon in namespace cause false positve

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL accepted this revision.
PiotrZSL added a comment.
This revision is now accepted and ready to land.

Except above llvm:errs, looks good to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147893

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


[PATCH] D144510: [clang-tidy] improve readability-identifier-naming hungarian options test

2023-04-10 Thread Douglas Chen via Phabricator via cfe-commits
dougpuob added a comment.
Herald added a subscriber: PiotrZSL.

Hi @amurzeau

I missed the review before landing. I have a suggestion regarding the 
customized prefix "cust" because it confused me when I found the Hungarian 
notation patterns in the output message. Perhaps using "my" instead of "cust" 
would improve readability.

Take some examples:

- const char *`custszNamePtr` = "Name"; --> `myszNamePtr`
- uint8_t `custu8ValueU8` = 0; --> `myu8ValueU8`
- DWORD `custdwMsDword` = 0; --> `mydwMsDword`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144510

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


[PATCH] D147920: [clang] Add test for CWG399

2023-04-10 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added a reviewer: clang-language-wg.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 : CWG399 is resolved by explicitly appealing to 
the lookup for the last component of any suitable nested-name-specifier.
Wording: Otherwise, its nested-name-specifier N shall nominate a type. If N has 
another nested-name-specifier S, Q is looked up as if its lookup context were 
that nominated by S. ([basic.lookup.qual]/6.2)

CWG399 revisits a resolution to older CWG244. Our test for CWG244 covers many 
examples from CWG399, and it was updated in 2020 presumably aware of P1787 
, so I reused CWG244 test. This approach to 
reusing was discussed in a CWG405 patch review 
.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147920

Files:
  clang/test/CXX/drs/dr2xx.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/www/cxx_dr_status.html

Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -2433,7 +2433,7 @@
 https://wg21.link/cwg399";>399
 CD6
 Destructor lookup redux
-Unknown
+Clang 11
   
   
 https://wg21.link/cwg400";>400
Index: clang/test/CXX/drs/dr3xx.cpp
===
--- clang/test/CXX/drs/dr3xx.cpp
+++ clang/test/CXX/drs/dr3xx.cpp
@@ -1435,3 +1435,83 @@
 }
   }
 }
+
+namespace dr399 { // dr399: 11
+  // NB: reuse dr244 test 
+  struct B {}; // expected-note {{type 'dr244::B' found by destructor name lookup}}
+  struct D : B {};
+
+  D D_object;
+  typedef B B_alias;
+  B* B_ptr = &D_object;
+
+  void f() {
+D_object.~B(); // expected-error {{does not match the type 'D' of the object being destroyed}}
+D_object.B::~B();
+D_object.D::~B(); // FIXME: Missing diagnostic for this.
+B_ptr->~B();
+B_ptr->~B_alias();
+B_ptr->B_alias::~B();
+B_ptr->B_alias::~B_alias();
+B_ptr->dr244::~B(); // expected-error {{refers to a member in namespace}}
+B_ptr->dr244::~B_alias(); // expected-error {{refers to a member in namespace}}
+  }
+
+  template
+  void f(T *B_ptr, U D_object) {
+D_object.~B(); // FIXME: Missing diagnostic for this.
+D_object.B::~B();
+D_object.D::~B(); // FIXME: Missing diagnostic for this.
+B_ptr->~B();
+B_ptr->~B_alias();
+B_ptr->B_alias::~B();
+B_ptr->B_alias::~B_alias();
+B_ptr->dr399::~B(); // expected-error {{does not refer to a type name}}
+B_ptr->dr399::~B_alias(); // expected-error {{does not refer to a type name}}
+  }
+  template void f(B*, D);
+
+  namespace N {
+template struct E {};
+typedef E F;
+  }
+  void g(N::F f) {
+typedef N::F G; // expected-note {{found by destructor name lookup}}
+f.~G();
+f.G::~E(); // expected-error {{ISO C++ requires the name after '::~' to be found in the same scope as the name before '::~'}}
+f.G::~F(); // expected-error {{undeclared identifier 'F' in destructor name}}
+f.G::~G();
+// This is technically ill-formed; E is looked up in 'N::' and names the
+// class template, not the injected-class-name of the class. But that's
+// probably a bug in the standard.
+f.N::F::~E(); // expected-error {{ISO C++ requires the name after '::~' to be found in the same scope as the name before '::~'}}
+// This is valid; we look up the second F in the same scope in which we
+// found the first one, that is, 'N::'.
+f.N::F::~F();
+// This is technically ill-formed; G is looked up in 'N::' and is not found.
+// Rejecting this seems correct, but most compilers accept, so we do also.
+f.N::F::~G(); // expected-error {{qualified destructor name only found in lexical scope; omit the qualifier to find this type name by unqualified lookup}}
+  }
+
+  // Bizarrely, compilers perform lookup in the scope for qualified destructor
+  // names, if the nested-name-specifier is non-dependent. Ensure we diagnose
+  // this.
+  namespace QualifiedLookupInScope {
+namespace N {
+  template  struct S { struct Inner {}; };
+}
+template  void f(typename N::S::Inner *p) {
+  typedef typename N::S::Inner T;
+  p->::dr399::QualifiedLookupInScope::N::S::Inner::~T(); // expected-error {{no type named 'T' in}}
+}
+template void f(N::S::Inner *); // expected-note {{instantiation of}}
+
+template  void g(U *p) {
+  typedef U T;
+  p->T::~T();
+  p->U::~T();
+  p->::dr399::QualifiedLookupInScope::N::S::Inner::~T(); // expected-error {{'T' does not refer to a type name}}
+}
+template void g(N::S::Inner *);
+  }
+}
Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/

[PATCH] D147920: [clang] Add test for CWG399

2023-04-10 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/CXX/drs/dr3xx.cpp:1439
+
+namespace dr399 { // dr399: 11
+  // NB: reuse dr244 test 

Despite a couple of FIXME in CWG244 test (out of dozens of examples), it claims 
full availability since Clang 11. I'd take a more conservative approach, 
declaring partial support, but I think that declaring different availability 
for the same test would bring unnecessary confusion. So I followed CWG244 
availability.

Alternative is to demote CWG244 to partial, but I'm not sure we should go back 
on our claims for CWG support that has been out for so long.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147920

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


[PATCH] D147924: [clang-tidy] Exclude template instantiations in modernize-use-override

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL created this revision.
PiotrZSL added reviewers: njames93, carlosgalvezp.
Herald added a subscriber: xazax.hun.
Herald added a project: All.
PiotrZSL requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Fixed false positive in modernize-use-override check that occurred
when warnings were generated for template classes that were valid
for some instantiations but potentially invalid for others.
Template instantiations are now excluded from the check.

Fixes #38276.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147924

Files:
  clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp
@@ -274,16 +274,16 @@
 
 template  struct DerivedFromTemplate : public TemplateBase {
   virtual void f(T t);
-  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using
-  // CHECK-FIXES: {{^}}  void f(T t) override;
+  // CHECK-MESSAGES-NOT: :[[@LINE-1]]:16: warning: prefer using
+  // CHECK-FIXES-NOT: {{^}}  void f(T t) override;
 };
 void f() { DerivedFromTemplate().f(2); }
 
 template 
 struct UnusedMemberInstantiation : public C {
   virtual ~UnusedMemberInstantiation() {}
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using
-  // CHECK-FIXES: {{^}}  ~UnusedMemberInstantiation() override {}
+  // CHECK-MESSAGES-NOT: :[[@LINE-1]]:11: warning: prefer using
+  // CHECK-FIXES-NOT: {{^}}  ~UnusedMemberInstantiation() override {}
 };
 struct IntantiateWithoutUse : public UnusedMemberInstantiation {};
 
@@ -316,3 +316,56 @@
   // CHECK-FIXES: {{^}}  void d() override try
   { e(); } catch(...) { f(); }
 };
+
+namespace PR38276 {
+  struct Base {
+virtual void foo();
+  };
+
+  struct Base2 {
+virtual void foo2();
+  };
+
+  template
+  struct Derived : T {
+virtual void foo();
+// CHECK-MESSAGES-NOT: :[[@LINE-1]]:18: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions,modernize-use-override]
+// CHECK-FIXES-NOT: {{^}}void foo() override;{{$}}
+virtual void foo2();
+// CHECK-MESSAGES-NOT: :[[@LINE-1]]:18: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions,modernize-use-override]
+// CHECK-FIXES-NOT: {{^}}void foo2() override;{{$}}
+  };
+
+  void test() {
+Derived b;
+Derived b2;
+  }
+
+  template
+  struct BaseS {
+virtual void boo();
+  };
+
+  template<>
+  struct BaseS {
+virtual void boo2();
+  };
+
+  struct BaseU {
+virtual void boo3();
+  };
+
+  template
+  struct Derived2 : BaseS, BaseU {
+virtual void boo();
+// CHECK-MESSAGES-NOT: :[[@LINE-1]]:18: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions,modernize-use-override]
+// CHECK-FIXES-NOT: {{^}}void boo() override;{{$}}
+virtual void boo2();
+// CHECK-MESSAGES-NOT: :[[@LINE-1]]:18: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions,modernize-use-override]
+// CHECK-FIXES-NOT: {{^}}void boo2() override;{{$}}
+virtual void boo3();
+// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions,modernize-use-override]
+// CHECK-FIXES: {{^}}void boo3() override;{{$}}
+  };
+
+}
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -235,6 +235,11 @@
   functions containing macros or preprocessor directives, and out-of-line special
   member functions in unions.
 
+- Fixed false positive in :doc:`modernize-use-override
+  ` check that occurred when warnings
+  were generated for template classes that were valid for some instantiations
+  but potentially invalid for others.
+
 - Fixed reading `HungarianNotation.CString.*` options in
   :doc:`readability-identifier-naming
   ` check.
Index: clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
===
--- clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
@@ -30,12 +30,16 @@
 }
 
 void UseOverrideCheck::registerMatchers(MatchFinder *Finder) {
-  if (IgnoreDestructors)
-Finder->addMatcher(
-cxxMethodDecl(isOverride(), unless(cxxDestructorDecl())).bind("met

[PATCH] D147661: [Sema] Tweak merging of availability attributes

2023-04-10 Thread Richard Sandiford via Phabricator via cfe-commits
rsandifo-arm added a comment.

> I threw together a patch to make the constructors `explicit` and the only two 
> compile failures I have are with what you're fixing in this patch. If you'd 
> like, I can commandeer this patch and subsume it with the larger refactor. 
> Alternatively, we can land this (I'd drop the test though) and I can rebase 
> on top of your changes. Either is fine by me.

Yeah, please feel free to commandeer it.  My original motivation for doing this 
was to remove the single-argument constructors rather than keep them.  However, 
I agree that making them explicit in the meantime would ensure forward 
progress, if what I'm doing in the follow-on patches turns out not to be 
acceptable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147661

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


[clang-tools-extra] 01025dd - [clang-tidy][NFC] Rename test files for simplify-boolean-expr to match check name

2023-04-10 Thread Piotr Zegar via cfe-commits

Author: Piotr Zegar
Date: 2023-04-10T09:50:59Z
New Revision: 01025ddd6264737ebf617bd754173969af34243f

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

LOG: [clang-tidy][NFC] Rename test files for simplify-boolean-expr to match 
check name

Change simplify-bool-expr -> simplify-boolean-expr

Added: 

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-case.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-chained-conditional-assignment.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-chained-conditional-return.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-cxx17.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-cxx23.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-demorgan.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-members.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr.cpp

Modified: 


Removed: 

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-case.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-chained-conditional-assignment.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-chained-conditional-return.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-cxx17.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-cxx23.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-demorgan.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-members.cpp

clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr.cpp



diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-case.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-case.cpp
similarity index 100%
rename from 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-case.cpp
rename to 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-case.cpp

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-chained-conditional-assignment.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-chained-conditional-assignment.cpp
similarity index 100%
rename from 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-chained-conditional-assignment.cpp
rename to 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-chained-conditional-assignment.cpp

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-chained-conditional-return.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-chained-conditional-return.cpp
similarity index 100%
rename from 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-chained-conditional-return.cpp
rename to 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-chained-conditional-return.cpp

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-cxx17.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-cxx17.cpp
similarity index 100%
rename from 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-cxx17.cpp
rename to 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-cxx17.cpp

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-cxx23.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-cxx23.cpp
similarity index 100%
rename from 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-cxx23.cpp
rename to 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-cxx23.cpp

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-demorgan.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-demorgan.cpp
similarity index 100%
rename from 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-demorgan.cpp
rename to 
clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-demorgan.cpp

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-members.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-members.cpp
similarity index 100%
rename from 
clang-tools-extra/test/clang-tidy/checker

[PATCH] D147925: [Clang] Check type-constraints applied to placeholder types

2023-04-10 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin created this revision.
Herald added a project: All.
cor3ntin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

(and deduced return types)

Previously, only type constraints applied to type parameter
were semantically checked.

A diagnostic would still be emitted on instantiation, but it was
too late, lacked clarity, and was inconsistent with type parameters.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147925

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/test/Parser/cxx2a-placeholder-type-constraint.cpp

Index: clang/test/Parser/cxx2a-placeholder-type-constraint.cpp
===
--- clang/test/Parser/cxx2a-placeholder-type-constraint.cpp
+++ clang/test/Parser/cxx2a-placeholder-type-constraint.cpp
@@ -47,3 +47,23 @@
 void foo3(C auto const &a){}
 void foo4(const C &a){}
 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
+
+namespace non_type {
+  template
+  concept C1 = true;
+
+  auto f() -> C1 auto {} // expected-error{{concept named in type constraint is not a type concept}}
+  auto g(C1 auto); // expected-error{{concept named in type constraint is not a type concept}}
+  C1 auto a = 0; // expected-error{{concept named in type constraint is not a type concept}}
+  C1 decltype(auto) b = 0; // expected-error{{concept named in type constraint is not a type concept}}
+}
+
+namespace arity {
+  template
+  concept C1 = true;
+
+  auto f() -> C1 auto {} // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}
+  auto g(C1 auto); // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}
+  C1 auto a = 0; // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}
+  C1 decltype(auto) b = 0; // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}
+}
Index: clang/lib/Sema/SemaTemplate.cpp
===
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -1107,19 +1107,8 @@
   return TemplateArgs;
 }
 
-bool Sema::ActOnTypeConstraint(const CXXScopeSpec &SS,
-   TemplateIdAnnotation *TypeConstr,
-   TemplateTypeParmDecl *ConstrainedParameter,
-   SourceLocation EllipsisLoc) {
-  return BuildTypeConstraint(SS, TypeConstr, ConstrainedParameter, EllipsisLoc,
- false);
-}
+bool Sema::CheckTypeConstraint(TemplateIdAnnotation *TypeConstr) {
 
-bool Sema::BuildTypeConstraint(const CXXScopeSpec &SS,
-   TemplateIdAnnotation *TypeConstr,
-   TemplateTypeParmDecl *ConstrainedParameter,
-   SourceLocation EllipsisLoc,
-   bool AllowUnexpandedPack) {
   TemplateName TN = TypeConstr->Template.get();
   ConceptDecl *CD = cast(TN.getAsTemplateDecl());
 
@@ -1137,9 +1126,32 @@
   if (!WereArgsSpecified &&
   CD->getTemplateParameters()->getMinRequiredArguments() > 1) {
 Diag(TypeConstr->TemplateNameLoc,
- diag::err_type_constraint_missing_arguments) << CD;
+ diag::err_type_constraint_missing_arguments)
+<< CD;
 return true;
   }
+  return false;
+}
+
+bool Sema::ActOnTypeConstraint(const CXXScopeSpec &SS,
+   TemplateIdAnnotation *TypeConstr,
+   TemplateTypeParmDecl *ConstrainedParameter,
+   SourceLocation EllipsisLoc) {
+  return BuildTypeConstraint(SS, TypeConstr, ConstrainedParameter, EllipsisLoc,
+ false);
+}
+
+bool Sema::BuildTypeConstraint(const CXXScopeSpec &SS,
+   TemplateIdAnnotation *TypeConstr,
+   TemplateTypeParmDecl *ConstrainedParameter,
+   SourceLocation EllipsisLoc,
+   bool AllowUnexpandedPack) {
+
+  if (CheckTypeConstraint(TypeConstr))
+return true;
+
+  TemplateName TN = TypeConstr->Template.get();
+  ConceptDecl *CD = cast(TN.getAsTemplateDecl());
 
   DeclarationNameInfo ConceptName(DeclarationName(TypeConstr->Name),
   TypeConstr->TemplateNameLoc);
Index: clang/lib/Parse/ParseDecl.cpp
===
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -3770,6 +3770,10 @@
 }
 if (!NextToken().isOneOf(tok::kw_auto, tok::kw_decltype))
 goto DoneWithDeclSpec;
+
+if (TemplateId && !isInval

[clang] 6737a15 - [clang] Mark CWG536 as N/A

2023-04-10 Thread Vlad Serebrennikov via cfe-commits

Author: Vlad Serebrennikov
Date: 2023-04-10T13:18:19+03:00
New Revision: 6737a1520900a506a884db6677a03fa729c2f197

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

LOG: [clang] Mark CWG536 as N/A

[[https://wg21.link/p1787 | P1787]]: CWG536 (long partially resolved) is 
resolved by specifying that unqualified lookup occurs for any kind of 
unqualified-id as an id-expression.
Wording: An unqualified name is a name that <...>. Unless otherwise specified, 
such a name undergoes unqualified name lookup from the point where it appears. 
([basic.lookup.unqual]/4)

Reviewed By: #clang-language-wg, aaron.ballman

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

Added: 


Modified: 
clang/test/CXX/drs/dr5xx.cpp
clang/www/cxx_dr_status.html

Removed: 




diff  --git a/clang/test/CXX/drs/dr5xx.cpp b/clang/test/CXX/drs/dr5xx.cpp
index d75b1b5bba16..1477a40fd25d 100644
--- a/clang/test/CXX/drs/dr5xx.cpp
+++ b/clang/test/CXX/drs/dr5xx.cpp
@@ -418,6 +418,7 @@ namespace dr535 { // dr535: yes
 #endif
 }
 
+// dr536: na
 // dr537: na
 // dr538: na
 

diff  --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 7498753836d6..4621e6e851cd 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -3255,7 +3255,7 @@ C++ defect report implementation 
status
 https://wg21.link/cwg536";>536
 CD6
 Problems in the description of id-expressions
-Unknown
+N/A
   
   
 https://wg21.link/cwg537";>537



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


[PATCH] D147564: [clang] Mark CWG536 as N/A

2023-04-10 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6737a1520900: [clang] Mark CWG536 as N/A (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147564

Files:
  clang/test/CXX/drs/dr5xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -3255,7 +3255,7 @@
 https://wg21.link/cwg536";>536
 CD6
 Problems in the description of id-expressions
-Unknown
+N/A
   
   
 https://wg21.link/cwg537";>537
Index: clang/test/CXX/drs/dr5xx.cpp
===
--- clang/test/CXX/drs/dr5xx.cpp
+++ clang/test/CXX/drs/dr5xx.cpp
@@ -418,6 +418,7 @@
 #endif
 }
 
+// dr536: na
 // dr537: na
 // dr538: na
 


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -3255,7 +3255,7 @@
 https://wg21.link/cwg536";>536
 CD6
 Problems in the description of id-expressions
-Unknown
+N/A
   
   
 https://wg21.link/cwg537";>537
Index: clang/test/CXX/drs/dr5xx.cpp
===
--- clang/test/CXX/drs/dr5xx.cpp
+++ clang/test/CXX/drs/dr5xx.cpp
@@ -418,6 +418,7 @@
 #endif
 }
 
+// dr536: na
 // dr537: na
 // dr538: na
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147733: Set rounding_mode to tonearest in presence of a #pragma STDC FENV_ACCESS OFF.

2023-04-10 Thread Zahira Ammarguellat via Phabricator via cfe-commits
zahiraam updated this revision to Diff 512108.
zahiraam marked an inline comment as done.

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

https://reviews.llvm.org/D147733

Files:
  clang/lib/Sema/SemaAttr.cpp
  clang/test/CodeGen/pragma-fenv_access.c


Index: clang/test/CodeGen/pragma-fenv_access.c
===
--- clang/test/CodeGen/pragma-fenv_access.c
+++ clang/test/CodeGen/pragma-fenv_access.c
@@ -224,3 +224,17 @@
 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, 
float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
 // DEFAULT: fadd float
 
+#pragma STDC FENV_ACCESS ON
+float func_19(float x, float y) {
+  return x + y;
+}
+// CHECK-LABEL: @func_19
+// STRICT:  call float @llvm.experimental.constrained.fadd.f32(float %0, float 
%1, metadata !"round.dynamic", metadata !"fpexcept.strict")
+
+#pragma STDC FENV_ACCESS OFF
+float func_20(float x, float y) {
+  return x + y;
+}
+// CHECK-LABEL: @func_20
+// STRICT: call float @llvm.experimental.constrained.fadd.f32(float %0, float 
%1, metadata !"round.tonearest", metadata !"fpexcept.strict")
+// DEFAULT: fadd float
Index: clang/lib/Sema/SemaAttr.cpp
===
--- clang/lib/Sema/SemaAttr.cpp
+++ clang/lib/Sema/SemaAttr.cpp
@@ -1336,6 +1336,7 @@
   Diag(Loc, diag::err_pragma_fenv_requires_precise);
   }
   NewFPFeatures.setAllowFEnvAccessOverride(IsEnabled);
+  NewFPFeatures.setRoundingMathOverride(IsEnabled);
   FpPragmaStack.Act(Loc, PSK_Set, StringRef(), NewFPFeatures);
   CurFPFeatures = NewFPFeatures.applyOverrides(getLangOpts());
 }


Index: clang/test/CodeGen/pragma-fenv_access.c
===
--- clang/test/CodeGen/pragma-fenv_access.c
+++ clang/test/CodeGen/pragma-fenv_access.c
@@ -224,3 +224,17 @@
 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
 // DEFAULT: fadd float
 
+#pragma STDC FENV_ACCESS ON
+float func_19(float x, float y) {
+  return x + y;
+}
+// CHECK-LABEL: @func_19
+// STRICT:  call float @llvm.experimental.constrained.fadd.f32(float %0, float %1, metadata !"round.dynamic", metadata !"fpexcept.strict")
+
+#pragma STDC FENV_ACCESS OFF
+float func_20(float x, float y) {
+  return x + y;
+}
+// CHECK-LABEL: @func_20
+// STRICT: call float @llvm.experimental.constrained.fadd.f32(float %0, float %1, metadata !"round.tonearest", metadata !"fpexcept.strict")
+// DEFAULT: fadd float
Index: clang/lib/Sema/SemaAttr.cpp
===
--- clang/lib/Sema/SemaAttr.cpp
+++ clang/lib/Sema/SemaAttr.cpp
@@ -1336,6 +1336,7 @@
   Diag(Loc, diag::err_pragma_fenv_requires_precise);
   }
   NewFPFeatures.setAllowFEnvAccessOverride(IsEnabled);
+  NewFPFeatures.setRoundingMathOverride(IsEnabled);
   FpPragmaStack.Act(Loc, PSK_Set, StringRef(), NewFPFeatures);
   CurFPFeatures = NewFPFeatures.applyOverrides(getLangOpts());
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147928: [clang] Keep multiple-include optimization for null directives

2023-04-10 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian created this revision.
IncludeGuardian added a reviewer: clang.
IncludeGuardian added a project: clang.
Herald added a project: All.
IncludeGuardian requested review of this revision.
Herald added a subscriber: cfe-commits.

The multiple-include optimization allows Clang to avoid opening a
files when they contain `#pragma once` or a proper include guard.

Both GCC and Microsoft Visual Studio allow null directives outside of
the `#ifndef`/`#endif` pair without disabling this multiple-include
optimization. GCC documents this behavior here
https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html.

> There must be no directives outside the controlling directive pair,
> but the null directive (a line containing nothing other than a
> single '#' and possibly whitespace) is permitted.

However, Clang disables the multiple-include optimization when
encountering the null directive.

In particular, this slows down preprocessing of most projects that
depend on boost as many boost libraries depend on the boost
preprocessor library, which contains null directives outside the
include guard on **every** header file.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147928

Files:
  clang/include/clang/Lex/MultipleIncludeOpt.h
  clang/lib/Lex/PPDirectives.cpp
  clang/test/Preprocessor/multiple-inclusion-opt.cpp
  clang/test/Preprocessor/multiple-inclusion-opt.h


Index: clang/test/Preprocessor/multiple-inclusion-opt.h
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.h
@@ -0,0 +1,18 @@
+# // null directive and comments before include guard
+
+#ifndef MULTIPLE_INCLUSION_OPT
+
+int foo();
+
+// The position of the define should not matter
+#define MULTIPLE_INCLUSION_OPT
+
+int bar();
+
+#endif
+
+#
+#
+/* Two null directives
+   and a multiline comment
+   after the #endif */
Index: clang/test/Preprocessor/multiple-inclusion-opt.cpp
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E -P -H %s 2>&1 | grep "multiple-inclusion-opt.h" | count 1
+
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -1177,6 +1177,12 @@
 
   switch (Result.getKind()) {
   case tok::eod:
+// Allow the null directive to appear outside of the include guard and 
still
+// keep multiple-include optimization. So if we haven't recorded any tokens
+// yet we can reset MIOpt to forget about the null directive.
+if (!ReadAnyTokensBeforeDirective) {
+  CurPPLexer->MIOpt.ResetReadToken();
+}
 return;   // null directive.
   case tok::code_completion:
 setCodeCompletionReached();
Index: clang/include/clang/Lex/MultipleIncludeOpt.h
===
--- clang/include/clang/Lex/MultipleIncludeOpt.h
+++ clang/include/clang/Lex/MultipleIncludeOpt.h
@@ -108,6 +108,12 @@
 ImmediatelyAfterTopLevelIfndef = false;
   }
 
+  /// ResetReadToken - reset whether we have read any tokens. Called when
+  /// encountering tokens outside of the include guard that have no effect if
+  /// the file in question is is included multiple times (e.g. the null
+  /// directive).
+  void ResetReadToken() { ReadAnyTokens = false; }
+
   /// ExpandedMacro - When a macro is expanded with this lexer as the current
   /// buffer, this method is called to disable the MIOpt if needed.
   void ExpandedMacro() { DidMacroExpansion = true; }


Index: clang/test/Preprocessor/multiple-inclusion-opt.h
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.h
@@ -0,0 +1,18 @@
+# // null directive and comments before include guard
+
+#ifndef MULTIPLE_INCLUSION_OPT
+
+int foo();
+
+// The position of the define should not matter
+#define MULTIPLE_INCLUSION_OPT
+
+int bar();
+
+#endif
+
+#
+#
+/* Two null directives
+   and a multiline comment
+   after the #endif */
Index: clang/test/Preprocessor/multiple-inclusion-opt.cpp
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E -P -H %s 2>&1 | grep "multiple-inclusion-opt.h" | count 1
+
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDir

[PATCH] D147929: [clang-tidy] Fix handling of UseAssignment option in cppcoreguidelines-prefer-member-initializer

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL created this revision.
PiotrZSL added reviewers: njames93, carlosgalvezp.
Herald added subscribers: shchenz, kbarton, xazax.hun, nemanjai.
Herald added a project: All.
PiotrZSL requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

>From now on check will use value from 
>cppcoreguidelines-prefer-member-initializer
and fallback to modernize-use-default-member-init.UseAssignment if not 
specified.

Fixes: #55616.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147929

Files:
  
clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/prefer-member-initializer.rst
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/prefer-member-initializer-modernize-use-default-member-init-assignment.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/prefer-member-initializer-modernize-use-default-member-init.cpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/prefer-member-initializer-modernize-use-default-member-init.cpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/prefer-member-initializer-modernize-use-default-member-init.cpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/prefer-member-initializer-modernize-use-default-member-init.cpp
@@ -1,4 +1,7 @@
 // RUN: %check_clang_tidy %s 
cppcoreguidelines-prefer-member-initializer,modernize-use-default-member-init %t
+// RUN: %check_clang_tidy %s 
cppcoreguidelines-prefer-member-initializer,modernize-use-default-member-init 
%t -- \
+// RUN: -config="{CheckOptions: [{key: 
modernize-use-default-member-init.UseAssignment, value: true}, \
+// RUN:  {key: 
cppcoreguidelines-prefer-member-initializer.UseAssignment, value: false}]}"
 
 class Simple1 {
   int n;
Index: 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/prefer-member-initializer-modernize-use-default-member-init-assignment.cpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/prefer-member-initializer-modernize-use-default-member-init-assignment.cpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/prefer-member-initializer-modernize-use-default-member-init-assignment.cpp
@@ -1,5 +1,8 @@
 // RUN: %check_clang_tidy %s 
cppcoreguidelines-prefer-member-initializer,modernize-use-default-member-init 
%t -- \
 // RUN: -config="{CheckOptions: [{key: 
modernize-use-default-member-init.UseAssignment, value: true}]}"
+// RUN: %check_clang_tidy %s 
cppcoreguidelines-prefer-member-initializer,modernize-use-default-member-init 
%t -- \
+// RUN: -config="{CheckOptions: [{key: 
modernize-use-default-member-init.UseAssignment, value: false}, \
+// RUN:  {key: 
cppcoreguidelines-prefer-member-initializer.UseAssignment, value: true}]}"
 
 class Simple1 {
   int n;
Index: 
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/prefer-member-initializer.rst
===
--- 
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/prefer-member-initializer.rst
+++ 
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/prefer-member-initializer.rst
@@ -85,9 +85,11 @@
 
 .. option:: UseAssignment
 
-   If this option is set to `true` (default is `false`), the check will 
initialize
-   members with an assignment. In this case the fix of the first example looks
-   like this:
+   If this option is set to `true` (by default `UseAssignment` from
+   `modernize-use-default-member-init
+   <../modernize/use-default-member-init.html>`_ will be used),
+   the check will initialize members with an assignment.
+   In this case the fix of the first example looks like this:
 
 .. code-block:: c++
 
Index: 
clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp
===
--- 
clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp
+++ 
clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp
@@ -129,9 +129,11 @@
 : ClangTidyCheck(Name, Context),
   IsUseDefaultMemberInitEnabled(
   Context->isCheckEnabled("modernize-use-default-member-init")),
-  UseAssignment(OptionsView("modernize-use-default-member-init",
-Context->getOptions().CheckOptions, Context)
-.get("UseAssignment", false)) {}
+  UseAssignment(
+  Options.get("UseAssignment",
+  OptionsView("modernize-use-default-member-init",
+  Context->getOptions().CheckOptions, Context)
+  .get("UseAssignment", false))) {}
 
 void PreferMemberInitializerCheck::sto

[PATCH] D147876: [clang-tidy] Support specifying checks as a list in the config file

2023-04-10 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp updated this revision to Diff 512114.
carlosgalvezp marked 2 inline comments as done.
carlosgalvezp retitled this revision from "[clang-tidy] Support introducing 
checks as a list in the config file" to "[clang-tidy] Support specifying checks 
as a list in the config file".
carlosgalvezp edited the summary of this revision.
carlosgalvezp added a comment.

Revert unrelated changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147876

Files:
  clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  
clang-tools-extra/test/clang-tidy/infrastructure/Inputs/config-file/config-file-list-bracket
  
clang-tools-extra/test/clang-tidy/infrastructure/Inputs/config-file/config-file-list-dash
  clang-tools-extra/test/clang-tidy/infrastructure/config-file.cpp

Index: clang-tools-extra/test/clang-tidy/infrastructure/config-file.cpp
===
--- clang-tools-extra/test/clang-tidy/infrastructure/config-file.cpp
+++ clang-tools-extra/test/clang-tidy/infrastructure/config-file.cpp
@@ -6,3 +6,15 @@
 // CHECK-SPACES-NEXT: hicpp-use-auto
 // CHECK-SPACES-NEXT: hicpp-use-emplace
 // CHECK-SPACES-EMPTY:
+// RUN: clang-tidy -config-file=%S/Inputs/config-file/config-file-list-dash --list-checks -- | FileCheck %s -check-prefix=CHECK-LIST-DASH
+// CHECK-LIST-DASH: Enabled checks:
+// CHECK-LIST-DASH-NEXT: hicpp-uppercase-literal-suffix
+// CHECK-LIST-DASH-NEXT: hicpp-use-auto
+// CHECK-LIST-DASH-NEXT: hicpp-use-emplace
+// CHECK-LIST-DASH-EMPTY:
+// RUN: clang-tidy -config-file=%S/Inputs/config-file/config-file-list-bracket --list-checks -- | FileCheck %s -check-prefix=CHECK-LIST-BRACKET
+// CHECK-LIST-BRACKET: Enabled checks:
+// CHECK-LIST-BRACKET-NEXT: hicpp-uppercase-literal-suffix
+// CHECK-LIST-BRACKET-NEXT: hicpp-use-auto
+// CHECK-LIST-BRACKET-NEXT: hicpp-use-emplace
+// CHECK-LIST-BRACKET-EMPTY:
Index: clang-tools-extra/test/clang-tidy/infrastructure/Inputs/config-file/config-file-list-dash
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/infrastructure/Inputs/config-file/config-file-list-dash
@@ -0,0 +1,5 @@
+Checks:
+  - "-*"
+  - "hicpp-uppercase-literal-suffix"
+  - "hicpp-use-auto"
+  - "hicpp-use-emplace"
Index: clang-tools-extra/test/clang-tidy/infrastructure/Inputs/config-file/config-file-list-bracket
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/infrastructure/Inputs/config-file/config-file-list-bracket
@@ -0,0 +1,6 @@
+Checks: [
+  "-*",
+  "hicpp-uppercase-literal-suffix",
+  "hicpp-use-auto",
+  "hicpp-use-emplace",
+]
Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -259,7 +259,9 @@
options. Example:
  CheckOptions:
some-check.SomeOption: 'some value'
-Checks   - Same as '--checks'.
+Checks   - Same as '--checks'. Additionally, the list of
+   globs can be specified as a list instead of a
+   string.
 ExtraArgs- Same as '--extra-args'.
 ExtraArgsBefore  - Same as '--extra-args-before'.
 FormatStyle  - Same as '--format-style'.
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -98,6 +98,9 @@
   `ImplementationFileExtensions`, replacing the check-local options of the
   same name.
 
+- Support specifying `Checks` as a YAML list in the `.clang-tidy` configuration
+  file.
+
 New checks
 ^^
 
Index: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
===
--- clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -52,7 +52,9 @@
  options. Example:
CheckOptions:
  some-check.SomeOption: 'some value'
-  Checks   - Same as '--checks'.
+  Checks   - Same as '--checks'. Additionally, the list of
+ globs can be specified as a list instead of a
+ string.
   ExtraArgs- Same as '--extra-args'.
   ExtraArgsBefore  - Same as '--extra-a

[PATCH] D147876: [clang-tidy] Support specifying checks as a list in the config file

2023-04-10 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp marked an inline comment as done.
carlosgalvezp added inline comments.



Comment at: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp:129-141
+// Special case for reading from YAML
+// Must support reading from both a string or a list
+Input &I = reinterpret_cast(IO);
+if (isa(I.getCurrentNode()) ||
+isa(I.getCurrentNode())) {
+  Checks.AsString = std::string();
+  yamlize(IO, *Checks.AsString, true, Ctx);

njames93 wrote:
> All this code can just be inlined into the function below and this function 
> can just be removed
Can you elaborate on how to do it? I cannot call `mapOptional("Checks"` twice, 
one for string and one for vector, since it will print an error message on 
either case.

The function `yamlize` does not exp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147876

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


[PATCH] D147918: [clang-tidy] Added IgnoreVirtual option to misc-unused-parameters

2023-04-10 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

Looks good, small comments!




Comment at: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp:183
+if (Method->isLambdaStaticInvoker() ||
+(IgnoreVirtual && Method->isVirtual()))
   return;

Since these 2 conditions are unrelated, I believe it's better to put them in 
separate ifs:

```
if (IgnoreVirtual && Method->isVirtual())
  return;

if (Method->isLambdaStaticInvoker())
  return;
```



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp:4
+
+struct Class {
+  int f(int foo) {

We typically call it `Base`. `Class` can also be confusing since it's a 
`struct` ;) 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147918

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


[PATCH] D147924: [clang-tidy] Exclude template instantiations in modernize-use-override

2023-04-10 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

I'm not sure this is really a great improvement.
If the override candidate originates in a templated base class I think we 
should still warn

  struct Foo {
virtual void foo();
  };
  
  template 
  struct DirectBase : T {
virtual void foo();
  };
  
  DirectBase Y; // This instantiation should not warn about the above 
declaration.
  
  template
  struct Bar {
virtual void bar();
  };
  
  template 
  struct TemplateBase : Bar {
virtual void bar();
  };
  
  TemplateBase Y; // This instantiation should warn about the above 
declaration.
   // Or potentially configurable to either warn or ignore 
this case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147924

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


[PATCH] D147906: [clang-tidy] Avoid float compare in bugprone-incorrect-roundings

2023-04-10 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

Looks good, small suggestions! I appreciate having this small patch prior to 
the next one fixing the actual issue.




Comment at: clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp:28
+  if ((&Node.getSemantics()) == &llvm::APFloat::IEEEsingle()) {
+static llvm::APFloat Half = getHalf(llvm::APFloat::IEEEsingle());
+return Literal == Half;

Remove `static`



Comment at: clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp:28
+  if ((&Node.getSemantics()) == &llvm::APFloat::IEEEsingle()) {
+static llvm::APFloat Half = getHalf(llvm::APFloat::IEEEsingle());
+return Literal == Half;

carlosgalvezp wrote:
> Remove `static`
I think you can just combine those lines into one to get rid of the variable.

```
return Literal == getHalf(llvm::APFloat::IEEEsingle());
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147906

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


[PATCH] D147908: [clang-tidy] Add support for long double in bugprone-incorrect-roundings

2023-04-10 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp accepted this revision.
carlosgalvezp added a comment.
This revision is now accepted and ready to land.

Nice cleanup and increased generality, thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147908

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


[PATCH] D147893: [clang-tidy] avoid colon in namespace cause false positve

2023-04-10 Thread Congcong Cai via Phabricator via cfe-commits
HerrCai0907 updated this revision to Diff 512116.
HerrCai0907 added a comment.

remove debug log


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147893

Files:
  clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
  clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.h
  
clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
@@ -214,6 +214,18 @@
 // CHECK-FIXES: namespace avoid_change_close_comment::inner {
 // CHECK-FIXES-NOT: } // namespace avoid_add_close_comment::inner
 
+namespace /*::*/ comment_colon_1 {
+void foo() {}
+} // namespace comment_colon_1
+// CHECK-FIXES: namespace /*::*/ comment_colon_1 {
+
+// CHECK-MESSAGES-DAG: :[[@LINE+1]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+namespace /*::*/ comment_colon_2 {
+namespace comment_colon_2 {
+void foo() {}
+} // namespace comment_colon_2
+} // namespace comment_colon_2
+
 int main() {
   n26::n27::n28::n29::n30::t();
 #ifdef IEXIST
Index: clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.h
===
--- clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.h
+++ clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.h
@@ -15,6 +15,20 @@
 
 namespace clang::tidy::modernize {
 
+using NamespaceName = llvm::SmallString<40>;
+
+class NS : public llvm::SmallVector {
+public:
+  std::optional
+  getCleanedNamespaceFrontRange(const SourceManager &SM,
+const LangOptions &LangOpts) const;
+  SourceRange getReplacedNamespaceFrontRange() const;
+  SourceRange getNamespaceBackRange(const SourceManager &SM,
+const LangOptions &LangOpts) const;
+  SourceRange getDefaultNamespaceBackRange() const;
+  NamespaceName getName() const;
+};
+
 class ConcatNestedNamespacesCheck : public ClangTidyCheck {
 public:
   ConcatNestedNamespacesCheck(StringRef Name, ClangTidyContext *Context)
@@ -26,12 +40,10 @@
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 
 private:
-  using NamespaceContextVec = llvm::SmallVector;
-  using NamespaceString = llvm::SmallString<40>;
+  using NamespaceContextVec = llvm::SmallVector;
 
   void reportDiagnostic(const SourceManager &Sources,
 const LangOptions &LangOpts);
-  NamespaceString concatNamespaces();
   NamespaceContextVec Namespaces;
 };
 } // namespace clang::tidy::modernize
Index: clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
===
--- clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
@@ -12,7 +12,6 @@
 #include "clang/AST/Decl.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Basic/SourceLocation.h"
-#include "llvm/ADT/STLExtras.h"
 #include 
 #include 
 
@@ -45,22 +44,23 @@
   return ChildNamespace && !unsupportedNamespace(*ChildNamespace);
 }
 
-static bool alreadyConcatenated(std::size_t NumCandidates,
-const SourceRange &ReplacementRange,
-const SourceManager &Sources,
-const LangOptions &LangOpts) {
-  // FIXME: This logic breaks when there is a comment with ':'s in the middle.
-  return getRawStringRef(ReplacementRange, Sources, LangOpts).count(':') ==
- (NumCandidates - 1) * 2;
+template 
+static void concatNamespace(NamespaceName &ConcatNameSpace, R &&Range,
+F &&Stringify) {
+  for (auto const &V : Range) {
+ConcatNameSpace.append(Stringify(V));
+if (V != Range.back())
+  ConcatNameSpace.append("::");
+  }
 }
 
-static std::optional
-getCleanedNamespaceFrontRange(const NamespaceDecl *ND, const SourceManager &SM,
-  const LangOptions &LangOpts) {
+std::optional
+NS::getCleanedNamespaceFrontRange(const SourceManager &SM,
+  const LangOptions &LangOpts) const {
   // Front from namespace tp '{'
   std::optional Tok =
   ::clang::tidy::utils::lexer::findNextTokenSkippingComments(
-  ND->getLocation(), SM, LangOpts);
+  back()->getLocation(), SM, LangOpts);
   if (!Tok)
 return std::nullopt;
   while (Tok->getKind() != tok::TokenKind::l_brace) {
@@ -69,44 +69,40 @@
 if (!Tok)
   return std::nullopt;
   }
-  return SourceRange{ND->getBeginLoc(), Tok->getEndLoc()};
+  re

[PATCH] D147876: [clang-tidy] Support specifying checks as a list in the config file

2023-04-10 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added inline comments.



Comment at: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp:129-141
+// Special case for reading from YAML
+// Must support reading from both a string or a list
+Input &I = reinterpret_cast(IO);
+if (isa(I.getCurrentNode()) ||
+isa(I.getCurrentNode())) {
+  Checks.AsString = std::string();
+  yamlize(IO, *Checks.AsString, true, Ctx);

carlosgalvezp wrote:
> njames93 wrote:
> > All this code can just be inlined into the function below and this function 
> > can just be removed
> Can you elaborate on how to do it? I cannot call `mapOptional("Checks"` 
> twice, one for string and one for vector, since it will print an error 
> message on either case.
> 
> The function `yamlize` does not exp
... The function `yamlize` does not allow one to specify the `Checks` key as 
far as I can tell either.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147876

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


[PATCH] D147928: [clang] Keep multiple-include optimization for null directives

2023-04-10 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added a comment.

Differences between the behaviors of compilers can be found here 
https://github.com/IncludeGuardian/multiple-inclusion-optimization-tests

You can see the number of boost preprocessor files failing the include guard 
optimization when running IncludeGuardian  over 
Boost Graph 
https://gist.github.com/IncludeGuardian/0837719e0d1162d5b50e4c8fed4d3c0d#file-boost_graph-yaml-L345-L749

An example boost preprocessor header can be found here 
https://github.com/boostorg/preprocessor/blob/667e87b3392db338a919cbe0213979713aca52e3/include/boost/preprocessor.hpp.
 Note the consistent use of null directives outside of the guard.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147928

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


[clang-tools-extra] 72777dc - [clang-tidy] avoid colon in namespace cause false positve

2023-04-10 Thread Congcong Cai via cfe-commits

Author: Congcong Cai
Date: 2023-04-10T13:42:33+02:00
New Revision: 72777dc000ac432a99cf5f591553127432bd0365

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

LOG: [clang-tidy] avoid colon in namespace cause false positve

Refactor the Namespaces with NamespaceDecl[][].
First level stores non nested namepsace.
Second level stores nested namespace.

Reviewed By: PiotrZSL

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

Added: 


Modified: 
clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.h

clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
index a0b004f851ee..beaa4eeaeb5e 100644
--- a/clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
@@ -12,7 +12,6 @@
 #include "clang/AST/Decl.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Basic/SourceLocation.h"
-#include "llvm/ADT/STLExtras.h"
 #include 
 #include 
 
@@ -45,22 +44,23 @@ static bool singleNamedNamespaceChild(const NamespaceDecl 
&ND) {
   return ChildNamespace && !unsupportedNamespace(*ChildNamespace);
 }
 
-static bool alreadyConcatenated(std::size_t NumCandidates,
-const SourceRange &ReplacementRange,
-const SourceManager &Sources,
-const LangOptions &LangOpts) {
-  // FIXME: This logic breaks when there is a comment with ':'s in the middle.
-  return getRawStringRef(ReplacementRange, Sources, LangOpts).count(':') ==
- (NumCandidates - 1) * 2;
+template 
+static void concatNamespace(NamespaceName &ConcatNameSpace, R &&Range,
+F &&Stringify) {
+  for (auto const &V : Range) {
+ConcatNameSpace.append(Stringify(V));
+if (V != Range.back())
+  ConcatNameSpace.append("::");
+  }
 }
 
-static std::optional
-getCleanedNamespaceFrontRange(const NamespaceDecl *ND, const SourceManager &SM,
-  const LangOptions &LangOpts) {
+std::optional
+NS::getCleanedNamespaceFrontRange(const SourceManager &SM,
+  const LangOptions &LangOpts) const {
   // Front from namespace tp '{'
   std::optional Tok =
   ::clang::tidy::utils::lexer::findNextTokenSkippingComments(
-  ND->getLocation(), SM, LangOpts);
+  back()->getLocation(), SM, LangOpts);
   if (!Tok)
 return std::nullopt;
   while (Tok->getKind() != tok::TokenKind::l_brace) {
@@ -69,44 +69,40 @@ getCleanedNamespaceFrontRange(const NamespaceDecl *ND, 
const SourceManager &SM,
 if (!Tok)
   return std::nullopt;
   }
-  return SourceRange{ND->getBeginLoc(), Tok->getEndLoc()};
+  return SourceRange{front()->getBeginLoc(), Tok->getEndLoc()};
+}
+SourceRange NS::getReplacedNamespaceFrontRange() const {
+  return SourceRange{front()->getBeginLoc(), back()->getLocation()};
 }
 
-static SourceRange getCleanedNamespaceBackRange(const NamespaceDecl *ND,
-const SourceManager &SM,
-const LangOptions &LangOpts) {
+SourceRange NS::getDefaultNamespaceBackRange() const {
+  return SourceRange{front()->getRBraceLoc(), front()->getRBraceLoc()};
+}
+SourceRange NS::getNamespaceBackRange(const SourceManager &SM,
+  const LangOptions &LangOpts) const {
   // Back from '}' to conditional '// namespace xxx'
-  const SourceRange DefaultSourceRange =
-  SourceRange{ND->getRBraceLoc(), ND->getRBraceLoc()};
-  SourceLocation Loc = ND->getRBraceLoc();
+  SourceLocation Loc = front()->getRBraceLoc();
   std::optional Tok =
   utils::lexer::findNextTokenIncludingComments(Loc, SM, LangOpts);
   if (!Tok)
-return DefaultSourceRange;
+return getDefaultNamespaceBackRange();
   if (Tok->getKind() != tok::TokenKind::comment)
-return DefaultSourceRange;
+return getDefaultNamespaceBackRange();
   SourceRange TokRange = SourceRange{Tok->getLocation(), Tok->getEndLoc()};
   StringRef TokText = getRawStringRef(TokRange, SM, LangOpts);
-  std::string CloseComment = "namespace " + ND->getNameAsString();
+  std::string CloseComment = ("namespace " + getName()).str();
   // current fix hint in readability/NamespaceCommentCheck.cpp use single line
   // comment
   if (TokText != "// " + CloseComment && TokText != "//" + CloseComment)
-return DefaultSourceRange;
-  return SourceRange{ND->getRBraceLoc(), Tok->getEndLoc()};
+ret

[PATCH] D147893: [clang-tidy] avoid colon in namespace cause false positve

2023-04-10 Thread Congcong Cai 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 rG72777dc000ac: [clang-tidy] avoid colon in namespace cause 
false positve (authored by HerrCai0907).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147893

Files:
  clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
  clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.h
  
clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
@@ -214,6 +214,18 @@
 // CHECK-FIXES: namespace avoid_change_close_comment::inner {
 // CHECK-FIXES-NOT: } // namespace avoid_add_close_comment::inner
 
+namespace /*::*/ comment_colon_1 {
+void foo() {}
+} // namespace comment_colon_1
+// CHECK-FIXES: namespace /*::*/ comment_colon_1 {
+
+// CHECK-MESSAGES-DAG: :[[@LINE+1]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+namespace /*::*/ comment_colon_2 {
+namespace comment_colon_2 {
+void foo() {}
+} // namespace comment_colon_2
+} // namespace comment_colon_2
+
 int main() {
   n26::n27::n28::n29::n30::t();
 #ifdef IEXIST
Index: clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.h
===
--- clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.h
+++ clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.h
@@ -15,6 +15,20 @@
 
 namespace clang::tidy::modernize {
 
+using NamespaceName = llvm::SmallString<40>;
+
+class NS : public llvm::SmallVector {
+public:
+  std::optional
+  getCleanedNamespaceFrontRange(const SourceManager &SM,
+const LangOptions &LangOpts) const;
+  SourceRange getReplacedNamespaceFrontRange() const;
+  SourceRange getNamespaceBackRange(const SourceManager &SM,
+const LangOptions &LangOpts) const;
+  SourceRange getDefaultNamespaceBackRange() const;
+  NamespaceName getName() const;
+};
+
 class ConcatNestedNamespacesCheck : public ClangTidyCheck {
 public:
   ConcatNestedNamespacesCheck(StringRef Name, ClangTidyContext *Context)
@@ -26,12 +40,10 @@
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 
 private:
-  using NamespaceContextVec = llvm::SmallVector;
-  using NamespaceString = llvm::SmallString<40>;
+  using NamespaceContextVec = llvm::SmallVector;
 
   void reportDiagnostic(const SourceManager &Sources,
 const LangOptions &LangOpts);
-  NamespaceString concatNamespaces();
   NamespaceContextVec Namespaces;
 };
 } // namespace clang::tidy::modernize
Index: clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
===
--- clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
@@ -12,7 +12,6 @@
 #include "clang/AST/Decl.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Basic/SourceLocation.h"
-#include "llvm/ADT/STLExtras.h"
 #include 
 #include 
 
@@ -45,22 +44,23 @@
   return ChildNamespace && !unsupportedNamespace(*ChildNamespace);
 }
 
-static bool alreadyConcatenated(std::size_t NumCandidates,
-const SourceRange &ReplacementRange,
-const SourceManager &Sources,
-const LangOptions &LangOpts) {
-  // FIXME: This logic breaks when there is a comment with ':'s in the middle.
-  return getRawStringRef(ReplacementRange, Sources, LangOpts).count(':') ==
- (NumCandidates - 1) * 2;
+template 
+static void concatNamespace(NamespaceName &ConcatNameSpace, R &&Range,
+F &&Stringify) {
+  for (auto const &V : Range) {
+ConcatNameSpace.append(Stringify(V));
+if (V != Range.back())
+  ConcatNameSpace.append("::");
+  }
 }
 
-static std::optional
-getCleanedNamespaceFrontRange(const NamespaceDecl *ND, const SourceManager &SM,
-  const LangOptions &LangOpts) {
+std::optional
+NS::getCleanedNamespaceFrontRange(const SourceManager &SM,
+  const LangOptions &LangOpts) const {
   // Front from namespace tp '{'
   std::optional Tok =
   ::clang::tidy::utils::lexer::findNextTokenSkippingComments(
-  ND->getLocation(), SM, LangOpts);
+  back()->getLocation(), SM, LangOpts);
   if (!Tok)
 return std::nullopt;
   while (Tok->getKind() != tok::Toke

[PATCH] D147929: [clang-tidy] Fix handling of UseAssignment option in cppcoreguidelines-prefer-member-initializer

2023-04-10 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp:134
+  Options.get("UseAssignment",
+  OptionsView("modernize-use-default-member-init",
+  Context->getOptions().CheckOptions, Context)

This is very strange, feels like it's done to ensure the checks are in sync but 
IMO it creates more harm than good and makes the check harder to maintain. The 
checks are independent anyway (not aliases), so I believe it makes sense to 
keep being independent also in the options.

There are similar checks (e.g. magic numbers) where the user needs to either 
only enable one of the checks, or enter the same configuration settings twice.

I would vote for just treating this like an independent argument like all other 
checks, to avoid bugs like these.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147929

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


[PATCH] D147661: [Sema] Tweak merging of availability attributes

2023-04-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman commandeered this revision.
aaron.ballman edited reviewers, added: rsandifo-arm; removed: aaron.ballman.
aaron.ballman added a comment.

In D147661#4255043 , @rsandifo-arm 
wrote:

>> I threw together a patch to make the constructors `explicit` and the only 
>> two compile failures I have are with what you're fixing in this patch. If 
>> you'd like, I can commandeer this patch and subsume it with the larger 
>> refactor. Alternatively, we can land this (I'd drop the test though) and I 
>> can rebase on top of your changes. Either is fine by me.
>
> Yeah, please feel free to commandeer it.  My original motivation for doing 
> this was to remove the single-argument constructors rather than keep them.  
> However, I agree that making them explicit in the meantime would ensure 
> forward progress, if what I'm doing in the follow-on patches turns out not to 
> be acceptable.

Okay, thanks! I think getting rid of these constructors will be a bit of a 
challenge because of how many implicit attributes are created internally, but 
at the same time, I would not be sad if they disappeared either.

I'm commandeering this revision and will cite it in the commit message when I 
land the patch so there's a paper trail explaining how we got to those changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147661

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


[PATCH] D147876: [clang-tidy] Support specifying checks as a list in the config file

2023-04-10 Thread Nathan James via Phabricator via cfe-commits
njames93 accepted this revision.
njames93 added inline comments.
This revision is now accepted and ready to land.



Comment at: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp:129-141
+// Special case for reading from YAML
+// Must support reading from both a string or a list
+Input &I = reinterpret_cast(IO);
+if (isa(I.getCurrentNode()) ||
+isa(I.getCurrentNode())) {
+  Checks.AsString = std::string();
+  yamlize(IO, *Checks.AsString, true, Ctx);

carlosgalvezp wrote:
> carlosgalvezp wrote:
> > njames93 wrote:
> > > All this code can just be inlined into the function below and this 
> > > function can just be removed
> > Can you elaborate on how to do it? I cannot call `mapOptional("Checks"` 
> > twice, one for string and one for vector, since it will print an error 
> > message on either case.
> > 
> > The function `yamlize` does not exp
> ... The function `yamlize` does not allow one to specify the `Checks` key as 
> far as I can tell either.
I think you're right, I was getting confused with a different serialisation 
library that does support that kind of logic


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147876

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


[PATCH] D147906: [clang-tidy] Avoid float compare in bugprone-incorrect-roundings

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL marked an inline comment as done.
PiotrZSL added a comment.

D147908  fixes comments from this on, it's 
just split into 2 reviews, this as fixing issue, and other as introducing 
improvment.




Comment at: clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp:28
+  if ((&Node.getSemantics()) == &llvm::APFloat::IEEEsingle()) {
+static llvm::APFloat Half = getHalf(llvm::APFloat::IEEEsingle());
+return Literal == Half;

carlosgalvezp wrote:
> carlosgalvezp wrote:
> > Remove `static`
> I think you can just combine those lines into one to get rid of the variable.
> 
> ```
> return Literal == getHalf(llvm::APFloat::IEEEsingle());
> ```
This get re-worked in D147908, that depend on this change.



Comment at: clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp:28
+  if ((&Node.getSemantics()) == &llvm::APFloat::IEEEsingle()) {
+static llvm::APFloat Half = getHalf(llvm::APFloat::IEEEsingle());
+return Literal == Half;

PiotrZSL wrote:
> carlosgalvezp wrote:
> > carlosgalvezp wrote:
> > > Remove `static`
> > I think you can just combine those lines into one to get rid of the 
> > variable.
> > 
> > ```
> > return Literal == getHalf(llvm::APFloat::IEEEsingle());
> > ```
> This get re-worked in D147908, that depend on this change.
This get reworked in D147908.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147906

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


[PATCH] D147918: [clang-tidy] Added IgnoreVirtual option to misc-unused-parameters

2023-04-10 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

Have you thought about handling CRTP overrides

  template 
  class Base {
int getThing(int x) {
  return x;
}
  };
  
  class Derived : public Base {
int getThing(int x) {
  return 0;
}
  };

I'm not saying update this to work for that, but could be a good direction in 
the future.




Comment at: clang-tools-extra/docs/ReleaseNotes.rst:225
+  ` check with new `IgnoreVirtual`
+  option to optionally ignore virtual methods (default `false`).
+

Don't really need to specify the default here, that's what the check 
documentation is for



Comment at: clang-tools-extra/docs/ReleaseNotes.rst:309-310
 - Improved :doc:`modernize-concat-nested-namespaces
-  ` to fix incorrect 
fixes when 
-  using macro between namespace declarations and false positive when using 
namespace 
+  ` to fix incorrect 
fixes when
+  using macro between namespace declarations and false positive when using 
namespace
   with attributes.

Please revert this change, it's unrelated.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp:7
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: parameter 'foo' is unused 
[misc-unused-parameters]
+  // CHECK-FIXES: {{^  }}int f(int  /*foo*/) {{{$}}
+return 5;

The Regex line start and end markers aren't necessary



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp:17
+struct Derived : Class {
+  int f2(int foo) {
+return 5;

Small nit: Insert `override` here so it's obvious to readers of the test that 
this is a virtual function


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147918

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


[PATCH] D147908: [clang-tidy] Add support for long double in bugprone-incorrect-roundings

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL updated this revision to Diff 512119.
PiotrZSL added a comment.

Remove local variables


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147908

Files:
  clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
@@ -12,74 +12,126 @@
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5) to integer leads to incorrect rounding; consider using lround (#include ) instead [bugprone-incorrect-roundings]
   x = (d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + d);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + ld);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + f);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (int)(d + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(ld + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(ld + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(ld + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + d);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + ld);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + f);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = static_cast(d + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(ld + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(ld + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(ld + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(0.5L + d)

[PATCH] D147929: [clang-tidy] Fix handling of UseAssignment option in cppcoreguidelines-prefer-member-initializer

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp:134
+  Options.get("UseAssignment",
+  OptionsView("modernize-use-default-member-init",
+  Context->getOptions().CheckOptions, Context)

carlosgalvezp wrote:
> This is very strange, feels like it's done to ensure the checks are in sync 
> but IMO it creates more harm than good and makes the check harder to 
> maintain. The checks are independent anyway (not aliases), so I believe it 
> makes sense to keep being independent also in the options.
> 
> There are similar checks (e.g. magic numbers) where the user needs to either 
> only enable one of the checks, or enter the same configuration settings twice.
> 
> I would vote for just treating this like an independent argument like all 
> other checks, to avoid bugs like these.
So remove dependency on modernize-use-default-member-init completly, or just on 
modernize-use-default-member-init options ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147929

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


[PATCH] D147924: [clang-tidy] Exclude template instantiations in modernize-use-override

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL added a comment.

Problem is that you may have specialization of Bar class wihtout bar base, and 
that specialization can be local to some compilation unit.
Like:

  template<>
  struct Bar {
  void bar(); // function wihout virtual or no function at all.
  };

And now your fix (override) won't compile.

In D147924#4255151 , @njames93 wrote:

> template
> struct Bar {
>
>   virtual void bar();
>
> };
>
> template 
> struct TemplateBase : Bar {
>
>   virtual void bar();
>
> };
>
> TemplateBase Y; // This instantiation should warn about the above 
> declaration.
>
>   // Or potentially configurable to either warn or ignore this case.
>
>   

Only configuration option possible to be done, is to check template 
instantiations or not, but this going to produce false-positives.
And probably we don't want false-positives in this check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147924

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


[clang] 636dd1e - Make explicit the single-argument constructors of AttributeCommonInfo; NFC

2023-04-10 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2023-04-10T08:29:21-04:00
New Revision: 636dd1e8a1782e22f9bdee640428ed5c50a4a4f2

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

LOG: Make explicit the single-argument constructors of AttributeCommonInfo; NFC

The single-argument constructors of this class were not marked explicit
and that led to some incorrect uses that slipped under the radar (see
changes in SemaDeclAttr.cpp). This makes the constructors explicit,
changes the benignly incorrect uses, and updates the tablegen code to
emit the correct support code to call the explicit constructors.

While this does correct a misuse, that incorrect usage could not be
observed except via a debugger and so no additional tests are added.

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

Added: 


Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttributeCommonInfo.h
clang/lib/Sema/SemaDeclAttr.cpp
clang/utils/TableGen/ClangAttrEmitter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index c8f364faecabd..79da53aba39ff 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -834,7 +834,7 @@ def Annotate : InheritableParamAttr {
 return AnnotateAttr::Create(Ctx, Annotation, nullptr, 0, CommonInfo);
   }
   static AnnotateAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef 
Annotation, \
-  const AttributeCommonInfo &CommonInfo = {SourceRange{}}) {
+  const AttributeCommonInfo &CommonInfo = 
AttributeCommonInfo{SourceRange{}}) {
 return AnnotateAttr::CreateImplicit(Ctx, Annotation, nullptr, 0, 
CommonInfo);
   }
   }];

diff  --git a/clang/include/clang/Basic/AttributeCommonInfo.h 
b/clang/include/clang/Basic/AttributeCommonInfo.h
index 81a8d21341938..f89bdbdaa0d28 100644
--- a/clang/include/clang/Basic/AttributeCommonInfo.h
+++ b/clang/include/clang/Basic/AttributeCommonInfo.h
@@ -76,11 +76,11 @@ class AttributeCommonInfo {
   static constexpr unsigned SpellingNotCalculated = 0xf;
 
 public:
-  AttributeCommonInfo(SourceRange AttrRange)
+  explicit AttributeCommonInfo(SourceRange AttrRange)
   : AttrRange(AttrRange), ScopeLoc(), AttrKind(0), SyntaxUsed(0),
 SpellingIndex(SpellingNotCalculated) {}
 
-  AttributeCommonInfo(SourceLocation AttrLoc)
+  explicit AttributeCommonInfo(SourceLocation AttrLoc)
   : AttrRange(AttrLoc), ScopeLoc(), AttrKind(0), SyntaxUsed(0),
 SpellingIndex(SpellingNotCalculated) {}
 

diff  --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 19bc03d30a21e..5e98dca657469 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -2775,7 +2775,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, 
const ParsedAttr &AL) {
 return V;
   };
   AvailabilityAttr *NewAttr = S.mergeAvailabilityAttr(
-  ND, AL.getRange(), NewII, true /*Implicit*/,
+  ND, AL, NewII, true /*Implicit*/,
   MinMacCatalystVersion(Introduced.Version),
   MinMacCatalystVersion(Deprecated.Version),
   MinMacCatalystVersion(Obsoleted.Version), IsUnavailable, Str,
@@ -2817,7 +2817,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, 
const ParsedAttr &AL) {
 return V ? *V : VersionTuple();
   };
   AvailabilityAttr *NewAttr = S.mergeAvailabilityAttr(
-  ND, AL.getRange(), NewII, true /*Implicit*/,
+  ND, AL, NewII, true /*Implicit*/,
   VersionOrEmptyVersion(NewIntroduced),
   VersionOrEmptyVersion(NewDeprecated),
   VersionOrEmptyVersion(NewObsoleted), /*IsUnavailable=*/false, 
Str,

diff  --git a/clang/utils/TableGen/ClangAttrEmitter.cpp 
b/clang/utils/TableGen/ClangAttrEmitter.cpp
index d8a651606e9bd..84cbf60ad05d2 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -2505,8 +2505,15 @@ static void emitAttributes(RecordKeeper &Records, 
raw_ostream &OS,
   return &R == P.second;
 });
 
+enum class CreateKind {
+  WithAttributeCommonInfo,
+  WithSourceRange,
+  WithNoArgs,
+};
+
 // Emit CreateImplicit factory methods.
-auto emitCreate = [&](bool Implicit, bool DelayedArgsOnly, bool emitFake) {
+auto emitCreate = [&](bool Implicit, bool DelayedArgsOnly,
+  bool emitFake, CreateKind Kind) {
   if (Header)
 OS << "  static ";
   OS << R.getName() << "Attr *";
@@ -2530,9 +2537,10 @@ static void emitAttributes(RecordKeeper &Records, 
raw_ostream &OS,
 OS << ", ";
 DelayedArgs->writeCtorParameters(OS);
   }
-  OS << ", const AttributeCommonInfo &CommonInfo";
-  if (He

[PATCH] D147661: [Sema] Tweak merging of availability attributes

2023-04-10 Thread Aaron Ballman via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG636dd1e8a178: Make explicit the single-argument constructors 
of AttributeCommonInfo; NFC (authored by aaron.ballman).

Changed prior to commit:
  https://reviews.llvm.org/D147661?vs=511425&id=512120#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147661

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttributeCommonInfo.h
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/utils/TableGen/ClangAttrEmitter.cpp

Index: clang/utils/TableGen/ClangAttrEmitter.cpp
===
--- clang/utils/TableGen/ClangAttrEmitter.cpp
+++ clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -2505,8 +2505,15 @@
   return &R == P.second;
 });
 
+enum class CreateKind {
+  WithAttributeCommonInfo,
+  WithSourceRange,
+  WithNoArgs,
+};
+
 // Emit CreateImplicit factory methods.
-auto emitCreate = [&](bool Implicit, bool DelayedArgsOnly, bool emitFake) {
+auto emitCreate = [&](bool Implicit, bool DelayedArgsOnly,
+  bool emitFake, CreateKind Kind) {
   if (Header)
 OS << "  static ";
   OS << R.getName() << "Attr *";
@@ -2530,9 +2537,10 @@
 OS << ", ";
 DelayedArgs->writeCtorParameters(OS);
   }
-  OS << ", const AttributeCommonInfo &CommonInfo";
-  if (Header && Implicit)
-OS << " = {SourceRange{}}";
+  if (Kind == CreateKind::WithAttributeCommonInfo)
+OS << ", const AttributeCommonInfo &CommonInfo";
+  else if (Kind == CreateKind::WithSourceRange)
+OS << ", SourceRange R";
   OS << ")";
   if (Header) {
 OS << ";\n";
@@ -2541,7 +2549,13 @@
 
   OS << " {\n";
   OS << "  auto *A = new (Ctx) " << R.getName();
-  OS << "Attr(Ctx, CommonInfo";
+  if (Kind == CreateKind::WithAttributeCommonInfo)
+OS << "Attr(Ctx, CommonInfo";
+  else if (Kind == CreateKind::WithSourceRange)
+OS << "Attr(Ctx, AttributeCommonInfo{R}";
+  else if (Kind == CreateKind::WithNoArgs)
+OS << "Attr(Ctx, AttributeCommonInfo{SourceLocation{}}";
+
   if (!DelayedArgsOnly) {
 for (auto const &ai : Args) {
   if (ai->isFake() && !emitFake)
@@ -2637,9 +2651,19 @@
   OS << "}\n\n";
 };
 
+auto emitBothImplicitAndNonCreates = [&](bool DelayedArgsOnly,
+ bool emitFake, CreateKind Kind) {
+  emitCreate(true, DelayedArgsOnly, emitFake, Kind);
+  emitCreate(false, DelayedArgsOnly, emitFake, Kind);
+};
+
 auto emitCreates = [&](bool DelayedArgsOnly, bool emitFake) {
-  emitCreate(true, DelayedArgsOnly, emitFake);
-  emitCreate(false, DelayedArgsOnly, emitFake);
+  emitBothImplicitAndNonCreates(DelayedArgsOnly, emitFake,
+CreateKind::WithNoArgs);
+  emitBothImplicitAndNonCreates(DelayedArgsOnly, emitFake,
+CreateKind::WithAttributeCommonInfo);
+  emitBothImplicitAndNonCreates(DelayedArgsOnly, emitFake,
+CreateKind::WithSourceRange);
   emitCreateNoCI(true, DelayedArgsOnly, emitFake);
   emitCreateNoCI(false, DelayedArgsOnly, emitFake);
 };
Index: clang/lib/Sema/SemaDeclAttr.cpp
===
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -2775,7 +2775,7 @@
 return V;
   };
   AvailabilityAttr *NewAttr = S.mergeAvailabilityAttr(
-  ND, AL.getRange(), NewII, true /*Implicit*/,
+  ND, AL, NewII, true /*Implicit*/,
   MinMacCatalystVersion(Introduced.Version),
   MinMacCatalystVersion(Deprecated.Version),
   MinMacCatalystVersion(Obsoleted.Version), IsUnavailable, Str,
@@ -2817,7 +2817,7 @@
 return V ? *V : VersionTuple();
   };
   AvailabilityAttr *NewAttr = S.mergeAvailabilityAttr(
-  ND, AL.getRange(), NewII, true /*Implicit*/,
+  ND, AL, NewII, true /*Implicit*/,
   VersionOrEmptyVersion(NewIntroduced),
   VersionOrEmptyVersion(NewDeprecated),
   VersionOrEmptyVersion(NewObsoleted), /*IsUnavailable=*/false, Str,
Index: clang/include/clang/Basic/AttributeCommonInfo.h
===
--- clang/include/clang/Basic/AttributeCommonInfo.h
+++ clang/include/clang/Basic/AttributeCommonInfo.h
@@ -76,11 +76,11 @@
   static constexpr unsigned SpellingNotCalculated = 0xf;
 
 public:
-  AttributeCommonInfo(SourceRange AttrRange)
+  explicit AttributeCommonInfo(SourceRange AttrRange)
   : AttrRange(

[PATCH] D147918: [clang-tidy] Added IgnoreVirtual option to misc-unused-parameters

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL updated this revision to Diff 512122.
PiotrZSL marked 6 inline comments as done.
PiotrZSL added a comment.

Review fixes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147918

Files:
  clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
  clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
  clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
===
--- /dev/null
+++ 
clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
@@ -0,0 +1,20 @@
+// RUN: %check_clang_tidy %s misc-unused-parameters %t -- \
+// RUN:   -config="{CheckOptions: [{key: misc-unused-parameters.IgnoreVirtual, 
value: true}]}" --
+
+struct Base {
+  int f(int foo) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: parameter 'foo' is unused 
[misc-unused-parameters]
+  // CHECK-FIXES: int f(int  /*foo*/) {
+return 5;
+  }
+
+  virtual int f2(int foo) {
+return 5;
+  }
+};
+
+struct Derived : Base {
+  int f2(int foo) override {
+return 5;
+  }
+};
Index: clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
@@ -40,3 +40,8 @@
constructors - no constructor initializers). When the function body is 
empty,
an unused parameter is unlikely to be unnoticed by a human reader, and
there's basically no place for a bug to hide.
+
+.. option:: IgnoreVirtual
+
+   Determines whether virtual method parameters should be inspected.
+   Set to `true` to ignore them. Default is `false`.
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -220,6 +220,10 @@
   ` to avoid warning on
   declarations inside anonymous namespaces.
 
+- Improved :doc:`misc-unused-parameters
+  ` check with new `IgnoreVirtual`
+  option to optionally ignore virtual methods.
+
 - Deprecated check-local options `HeaderFileExtensions`
   in :doc:`misc-unused-using-decls
   ` check.
Index: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
===
--- clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
+++ clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
@@ -25,6 +25,7 @@
 
 private:
   const bool StrictMode;
+  const bool IgnoreVirtual;
   class IndexerVisitor;
   std::unique_ptr Indexer;
 
Index: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
@@ -123,10 +123,12 @@
 UnusedParametersCheck::UnusedParametersCheck(StringRef Name,
  ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
-  StrictMode(Options.getLocalOrGlobal("StrictMode", false)) {}
+  StrictMode(Options.getLocalOrGlobal("StrictMode", false)),
+  IgnoreVirtual(Options.get("IgnoreVirtual", false)) {}
 
 void UnusedParametersCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "StrictMode", StrictMode);
+  Options.store(Opts, "IgnoreVirtual", IgnoreVirtual);
 }
 
 void UnusedParametersCheck::warnOnUnusedParameter(
@@ -176,9 +178,12 @@
   const auto *Function = Result.Nodes.getNodeAs("function");
   if (!Function->hasWrittenPrototype() || Function->isTemplateInstantiation())
 return;
-  if (const auto *Method = dyn_cast(Function))
+  if (const auto *Method = dyn_cast(Function)) {
+if (IgnoreVirtual && Method->isVirtual())
+  return;
 if (Method->isLambdaStaticInvoker())
   return;
+  }
   for (unsigned I = 0, E = Function->getNumParams(); I != E; ++I) {
 const auto *Param = Function->getParamDecl(I);
 if (Param->isUsed() || Param->isReferenced() || !Param->getDeclName() ||


Index: clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
@@ -0,0 +1,20 @@
+// RUN: %check_clang_tidy %s misc-unused-parameters %t -- \
+// RUN:   -config="{CheckOptions: [{key: misc-unused-parameters.IgnoreVirtual, value: true}]}" --
+
+struct Base {
+  int f(int foo) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: parameter 'foo' is unused [misc-unused-pa

[PATCH] D145803: [clang][DebugInfo] Emit DW_AT_type of preferred name if available

2023-04-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

The changes in this patch seem to have caused 
https://lab.llvm.org/buildbot/#/builders/clang-ppc64-aix to go down for the 
past 4 days -- can you revert and investigate?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145803

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


[PATCH] D147918: [clang-tidy] Added IgnoreVirtual option to misc-unused-parameters

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL added a comment.

CRTP not planed.
Not in scope of #55665.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147918

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


[clang-tools-extra] 3defc3b - [clang-tidy][NFC] Remove trailing spaces from ReleaseNotes.rst

2023-04-10 Thread Piotr Zegar via cfe-commits

Author: Piotr Zegar
Date: 2023-04-10T12:43:11Z
New Revision: 3defc3b707fb29e64cb90822bbce12d040057357

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

LOG: [clang-tidy][NFC] Remove trailing spaces from ReleaseNotes.rst

Cleanup some trailing whitespaces from ReleaseNotes.rst

Added: 


Modified: 
clang-tools-extra/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 35cdcf7b207f2..64f89dfb6034b 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -302,8 +302,8 @@ Changes in existing checks
   ``DISABLED_`` in the test suite name.
 
 - Improved :doc:`modernize-concat-nested-namespaces
-  ` to fix incorrect 
fixes when 
-  using macro between namespace declarations and false positive when using 
namespace 
+  ` to fix incorrect 
fixes when
+  using macro between namespace declarations and false positive when using 
namespace
   with attributes.
 
 - Fixed a false positive in :doc:`performance-no-automatic-move



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


[clang] 4624797 - Fix the buildbots after 636dd1e8a1782e22f9bdee640428ed5c50a4a4f2

2023-04-10 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2023-04-10T08:46:53-04:00
New Revision: 4624797f816123f327d2c8b80f7ec65c90750024

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

LOG: Fix the buildbots after 636dd1e8a1782e22f9bdee640428ed5c50a4a4f2

This addresses issues found by:
http://45.33.8.238/linux/103908/step_4.txt
https://lab.llvm.org/buildbot/#/builders/216/builds/19607
and others

Added: 


Modified: 
clang/unittests/AST/DeclTest.cpp

Removed: 




diff  --git a/clang/unittests/AST/DeclTest.cpp 
b/clang/unittests/AST/DeclTest.cpp
index a6535119afb53..ad89596328edb 100644
--- a/clang/unittests/AST/DeclTest.cpp
+++ b/clang/unittests/AST/DeclTest.cpp
@@ -88,10 +88,12 @@ TEST(Decl, AsmLabelAttr) {
   NamedDecl *DeclG = *(++DeclS->method_begin());
 
   // Attach asm labels to the decls: one literal, and one not.
-  DeclF->addAttr(::new (Ctx) AsmLabelAttr(Ctx, SourceLocation(), "foo",
-  /*LiteralLabel=*/true));
-  DeclG->addAttr(::new (Ctx) AsmLabelAttr(Ctx, SourceLocation(), "goo",
-  /*LiteralLabel=*/false));
+  DeclF->addAttr(::new (Ctx) AsmLabelAttr(
+  Ctx, AttributeCommonInfo{SourceLocation()}, "foo",
+  /*LiteralLabel=*/true));
+  DeclG->addAttr(::new (Ctx) AsmLabelAttr(
+  Ctx, AttributeCommonInfo{SourceLocation()}, "goo",
+  /*LiteralLabel=*/false));
 
   // Mangle the decl names.
   std::string MangleF, MangleG;



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


[PATCH] D141892: Implement modernize-use-constraints

2023-04-10 Thread Nathan James via Phabricator via cfe-commits
njames93 added a reviewer: carlosgalvezp.
njames93 added a comment.

Would you consider supporting enable_if via parameters

  template
  void doStuff(T&, std::enable_if_t = nullptr) {}




Comment at: clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:71
+
+return std::make_optional(Specialization);
+  }

nit: Don't need to explicitly call make_optional here, the implicit conversion 
will handle that for you, same goes for everywhere else.



Comment at: clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:89
+
+if (const auto *AliasedType = llvm::dyn_cast(
+Specialization.getTypePtr()->getAliasedType())) {

`dyn_cast` is brought into clangs namespace so the `llvm::` qualifier is 
unnecessary here



Comment at: 
clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:109-112
+  std::optional EnableIf;
+  EnableIf = matchEnableIfSpecializationImplTypename(TheType);
+  if (EnableIf)
+return EnableIf;

Nit



Comment at: 
clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:125-128
+  std::optional EnableIf =
+  matchEnableIfSpecializationImpl(TheType);
+  if (EnableIf)
+return std::make_optional(EnableIfData{std::move(*EnableIf), TheType});

Ditto as above



Comment at: 
clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:129-130
+return std::make_optional(EnableIfData{std::move(*EnableIf), TheType});
+  else
+return std::nullopt;
+}

Don't use else after a return.
Same goes for anywhere else that this pattern occurs



Comment at: clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:133
+
+static std::tuple, const Decl *>
+matchTrailingTemplateParam(const FunctionTemplateDecl *FunctionTemplate) {

Prefer pair over tuple when only 2 elements



Comment at: 
clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:157-160
+return std::make_tuple(
+matchEnableIfSpecialization(
+LastTemplateParam->getTypeSourceInfo()->getTypeLoc()),
+LastTemplateParam);

Prefer braced initialization rather than the factory make_tuple(or make_pair). 
Same goes below.



Comment at: clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:215
+
+static std::optional
+getTypeText(ASTContext &Context,

This can return a std::optional if you remove the call the `.str()` 
and assignment to `std::string` below.



Comment at: clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:266
+
+static Token getPreviousToken(SourceLocation &Location, const SourceManager 
&SM,
+  const LangOptions &LangOpts,

Isn't there a copy of this function in `clang::tidy::utils`?



Comment at: 
clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:296-299
+  if (llvm::dyn_cast(Expression))
+return true;
+  if (llvm::dyn_cast(Expression))
+return true;





Comment at: clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:335
+  if (EndsWithDoubleSlash)
+return std::make_optional(AddParens(ConditionText.str()));
+  else

No need to call `.str()` here if the lambda expects a `StringRef`, also removed 
`std::make_optional`.



Comment at: 
clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:459-461
+  std::optional EnableIf;
+  EnableIf = matchEnableIfSpecialization(*ReturnType);
+  if (EnableIf.has_value()) {





Comment at: 
clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:462-466
+std::vector FixIts =
+handleReturnType(Function, *ReturnType, *EnableIf, *Result.Context);
+diag(ReturnType->getBeginLoc(),
+ "use C++20 requires constraints instead of enable_if")
+<< FixIts;

Though a different approach of passing the `DiagnosticBuilder` to the 
`handleReturnType` function and just appending the fixits in place would be a 
nicer solution.
Maybe change the function name to `addReturnTypeFixes(DiagnosticBuilder&, const 
FunctionDecl *, const TypeLoc &, const EnableIfData &, ASTContext &);`

Same transformation can be made below.



Comment at: 
clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:471-474
+  const Decl *LastTemplateParam = nullptr;
+  std::tie(EnableIf, LastTemplateParam) =
+  matchTrailingTemplateParam(FunctionTemplate);
+  if (EnableIf.has_value() && LastTemplateParam) {




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141892

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.

[PATCH] D147925: [Clang] Check type-constraints applied to placeholder types

2023-04-10 Thread Erich Keane via Phabricator via cfe-commits
erichkeane accepted this revision.
erichkeane added a comment.
This revision is now accepted and ready to land.

This looks fine to me!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147925

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


[PATCH] D147722: [Concepts] Fix Function Template Concepts comparisons

2023-04-10 Thread Erich Keane via Phabricator via cfe-commits
erichkeane abandoned this revision.
erichkeane added a comment.

Superceded by https://reviews.llvm.org/D146178


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

https://reviews.llvm.org/D147722

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


[PATCH] D147935: [RISCV] Add SiFive extension support

2023-04-10 Thread Brandon Wu via Phabricator via cfe-commits
4vtomat created this revision.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, 
evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, 
jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, 
zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, 
rbar, asb, arichardson.
Herald added a project: All.
4vtomat requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: clang.

Add SiFive extension support
Depends on D147934 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147935

Files:
  clang/include/clang/Support/RISCVVIntrinsicUtils.h
  clang/utils/TableGen/RISCVVEmitter.cpp


Index: clang/utils/TableGen/RISCVVEmitter.cpp
===
--- clang/utils/TableGen/RISCVVEmitter.cpp
+++ clang/utils/TableGen/RISCVVEmitter.cpp
@@ -633,6 +633,7 @@
   RVVRequire RequireExt = StringSwitch(RequiredFeature)
   .Case("RV64", RVV_REQ_RV64)
   .Case("FullMultiply", RVV_REQ_FullMultiply)
+  .Case("Xsfvcp", RVV_REQ_xsfvcp)
   .Default(RVV_REQ_None);
   assert(RequireExt != RVV_REQ_None && "Unrecognized required feature?");
   SR.RequiredExtensions |= RequireExt;
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -462,8 +462,9 @@
   RVV_REQ_None = 0,
   RVV_REQ_RV64 = 1 << 0,
   RVV_REQ_FullMultiply = 1 << 1,
+  RVV_REQ_xsfvcp = 1 << 2,
 
-  LLVM_MARK_AS_BITMASK_ENUM(RVV_REQ_FullMultiply)
+  LLVM_MARK_AS_BITMASK_ENUM(RVV_REQ_xsfvcp)
 };
 
 // Raw RVV intrinsic info, used to expand later.


Index: clang/utils/TableGen/RISCVVEmitter.cpp
===
--- clang/utils/TableGen/RISCVVEmitter.cpp
+++ clang/utils/TableGen/RISCVVEmitter.cpp
@@ -633,6 +633,7 @@
   RVVRequire RequireExt = StringSwitch(RequiredFeature)
   .Case("RV64", RVV_REQ_RV64)
   .Case("FullMultiply", RVV_REQ_FullMultiply)
+  .Case("Xsfvcp", RVV_REQ_xsfvcp)
   .Default(RVV_REQ_None);
   assert(RequireExt != RVV_REQ_None && "Unrecognized required feature?");
   SR.RequiredExtensions |= RequireExt;
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -462,8 +462,9 @@
   RVV_REQ_None = 0,
   RVV_REQ_RV64 = 1 << 0,
   RVV_REQ_FullMultiply = 1 << 1,
+  RVV_REQ_xsfvcp = 1 << 2,
 
-  LLVM_MARK_AS_BITMASK_ENUM(RVV_REQ_FullMultiply)
+  LLVM_MARK_AS_BITMASK_ENUM(RVV_REQ_xsfvcp)
 };
 
 // Raw RVV intrinsic info, used to expand later.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147924: [clang-tidy] Exclude template instantiations in modernize-use-override

2023-04-10 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

In D147924#4255209 , @PiotrZSL wrote:

> Problem is that you may have specialization of Bar class wihtout bar base, 
> and that specialization can be local to some compilation unit.
> Like:
>
>   template<>
>   struct Bar {
>   void bar(); // function wihout virtual or no function at all.
>   };
>
> And now your fix (override) won't compile.
>
> Only configuration option possible to be done, is to check template 
> instantiations or not, but this going to produce false-positives.
> And probably we don't want false-positives in this check.

My idea was to not check any template instantiations, instead look for template 
definitions with a template dependent base class that has potential override 
candidates.

I'd argue a (likely very rare) false positive that would prevent compilation is 
better than not diagnosing and then potentially(due to a later refactor) 
getting a near miss override candidate going undiagnosed and breaking the 
codebase.
It could also be nicer to just emit a warning with no fix, or a fix added to a 
note explaining the situation. (notes fixes aren't automatically applied when 
running clang tidy(and clang) for this reason.

Given the contention that is why i suggested this should just be user 
configurable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147924

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


[PATCH] D147918: [clang-tidy] Added IgnoreVirtual option to misc-unused-parameters

2023-04-10 Thread Nathan James via Phabricator via cfe-commits
njames93 accepted this revision.
njames93 added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147918

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


[PATCH] D126818: Itanium ABI: Implement mangling for constrained friends

2023-04-10 Thread Erich Keane via Phabricator via cfe-commits
erichkeane abandoned this revision.
erichkeane added a comment.

Superceded by: https://reviews.llvm.org/D147655


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

https://reviews.llvm.org/D126818

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


[PATCH] D147655: Implement mangling rules for C++20 concepts and requires-expressions.

2023-04-10 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In D147655#4251984 , @rsmith wrote:

> In D147655#4251042 , @aaron.ballman 
> wrote:
>
>> In D147655#4250922 , @royjacobson 
>> wrote:
>>
>>> In D147655#4250056 , @rsmith 
>>> wrote:
>>>
 There has not been any stable ABI from any compiler targeting the Itanium 
 C++ ABI for constrained templates prior to this change. I don't think we 
 need to worry too much about people using unfinished compiler features 
 being broken when those features are finished.
>>>
>>> The ABI has been stable for quite some time and people have been using 
>>> concepts with it for almost 3 years now. I'm not sure we can still break 
>>> ABI this easily. But then, I also have no data to say we can't.
>>
>> We've never claimed full support for concepts, so those folks would be 
>> relying on an unstable ABI. However, if it turns out this causes significant 
>> pain in practice, perhaps we could use ABI tags to give folks the older ABI? 
>> I'd prefer to avoid that in this case given that the feature isn't yet fully 
>> supported (I don't like the idea of setting a precedent for relying on the 
>> ABI of incomplete features in general), but concepts is a sufficiently 
>> important use case that I could imagine doing it as a one-off if needed.
>
> This patch already extends `-fclang-abi-compat` to retain the old manglings 
> so that users can stay on an old (broken) ABI if they need to. I don't think 
> we need to do more than that for the concepts mangling changes.
>
 The ABI proposals haven't been accepted yet; I'm not intending to land 
 this change until the proposals have reached consensus in the Itanium C++ 
 ABI group.
>
> The corresponding (confirmed) GCC bug report that they don't implement these 
> mangling rules yet is: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100825
>
> This patch supersedes https://reviews.llvm.org/D126818 (apologies for the 
> duplicated work, @erichkeane -- I didn't find that before I started working 
> on this).

No problem!  This is a much more complete solution, and mine was held up on 
waiting for the Itanium ABI group to come to a consensus anyway (and fell by 
the wayside).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147655

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


[PATCH] D147901: [NFC][CLANG][API] Fix coverity remarks about large copies by values

2023-04-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/include/clang/ExtractAPI/API.h:138
   APIRecord(RecordKind Kind, StringRef USR, StringRef Name,
-PresumedLoc Location, AvailabilitySet Availabilities,
+PresumedLoc Location, const AvailabilitySet &Availabilities,
 LinkageInfo Linkage, const DocComment &Comment,

A lot of these changes look to be regressions, so I think Coverity is incorrect 
to flag these. The old code is passing an `AvailabilitySet` by value because 
it's doing a move operation on initialization: 
`Availabilities(std::move(Availabilities))`. Making this into a const reference 
defeats that optimization because you can't steal resources from a const object 
(so this turns a move into a copy).

You should look through the rest of the patch for similar problematic changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147901

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


[PATCH] D147708: [NFC][clang] Fix static analyzer tool remarks about large copies by values

2023-04-10 Thread Soumi Manna via Phabricator via cfe-commits
Manna closed this revision.
Manna added a comment.

I am closing this revision since it's already been pushed 
https://reviews.llvm.org/rG33cf2a39cb11


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

https://reviews.llvm.org/D147708

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


[PATCH] D147574: [NFC][clang] Fix Coverity static analyzer tool concerns about auto_causes_copy

2023-04-10 Thread Soumi Manna via Phabricator via cfe-commits
Manna closed this revision.
Manna added a comment.

I am closing this revision since it's already been pushed: 
https://reviews.llvm.org/rG59cb47015a18


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147574

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


[PATCH] D147901: [NFC][CLANG][API] Fix coverity remarks about large copies by values

2023-04-10 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added inline comments.



Comment at: clang/include/clang/ExtractAPI/API.h:138
   APIRecord(RecordKind Kind, StringRef USR, StringRef Name,
-PresumedLoc Location, AvailabilitySet Availabilities,
+PresumedLoc Location, const AvailabilitySet &Availabilities,
 LinkageInfo Linkage, const DocComment &Comment,

aaron.ballman wrote:
> A lot of these changes look to be regressions, so I think Coverity is 
> incorrect to flag these. The old code is passing an `AvailabilitySet` by 
> value because it's doing a move operation on initialization: 
> `Availabilities(std::move(Availabilities))`. Making this into a const 
> reference defeats that optimization because you can't steal resources from a 
> const object (so this turns a move into a copy).
> 
> You should look through the rest of the patch for similar problematic changes.
I've never been sure whether coverity is being particularly poor at recognising 
the std::move pattern or particularly smart at realising it can't occur for 
some reason.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147901

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


[PATCH] D144347: [clang-tidy] Add readability-forward-usage check

2023-04-10 Thread Nathan James via Phabricator via cfe-commits
njames93 requested changes to this revision.
njames93 added inline comments.



Comment at: clang-tools-extra/clang-tidy/readability/ForwardUsageCheck.cpp:45
+
+inline SourceRange getAnglesLoc(const Expr *MatchedCallee) {
+  if (const auto *DeclRefExprCallee =

Use `static` instead of `inline`. Inline should only be used for functions(or 
variables) defined in header files.
Same goes for the other `inline` functions.
Also this function should be moved outside the anonymous namespace.



Comment at: clang-tools-extra/clang-tidy/readability/ForwardUsageCheck.cpp:47
+  if (const auto *DeclRefExprCallee =
+  llvm::dyn_cast_or_null(MatchedCallee))
+return SourceRange(DeclRefExprCallee->getLAngleLoc(),

Remove the `llvm::` qualifier and the null check is redundant here as its 
guaranteed to never be called with a non-null argument.



Comment at: clang-tools-extra/clang-tidy/readability/ForwardUsageCheck.cpp:52
+  if (const auto *UnresolvedLookupExprCallee =
+  llvm::dyn_cast_or_null(MatchedCallee))
+return SourceRange(UnresolvedLookupExprCallee->getLAngleLoc(),

Ditton



Comment at: clang-tools-extra/clang-tidy/readability/ForwardUsageCheck.cpp:94-96
+  Finder->addMatcher(
+  traverse(
+  TK_IgnoreUnlessSpelledInSource,

Rather than calling traverse, the canoncial way to handle this is by overriding 
the `getCheckTraversalKind` virtual function to return 
`TK_IgnoreUnlessSpelledInSource`



Comment at: clang-tools-extra/clang-tidy/readability/ForwardUsageCheck.cpp:99
+  unless(isExpansionInSystemHeader()), argumentCountIs(1U),
+  IgnoreDependentExpresions
+  ? expr(unless(isInstantiationDependent()))

ccotter wrote:
> I think we might need more tests when `IgnoreDependentExpresions` is true. 
> When I was playing around and hardcoded IgnoreDependentExpresions to false on 
> line 99, the tests still pass.
This needs addressing before this can be landed



Comment at: clang-tools-extra/clang-tidy/readability/ForwardUsageCheck.cpp:107
+  expr(anyOf(declRefExpr(hasDeclaration(functionDecl(
+ hasName("::std::forward"))),
+ hasTemplateArgumentLoc(

It's a good idea to follow to DRY principle:
```lang=c++
auto IsNamedStdForward = hasName("::std::forward");
```
Then you can use that here and below.

A similar point can be made with the bind IDs, if you define the IDs as a 
`static constexpr char []` you can reuse them during`bind` and `getNodeAs` 
calls, helps avoid bugs if the check is ever upgraded.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144347

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


[PATCH] D147708: [NFC][clang] Fix static analyzer tool remarks about large copies by values

2023-04-10 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

Note, in the future, if in your commit message you do:

`Differential Revision: `

the review will auto-close so you don't have to manually do so.  AND it'll 
automatically link to the commit you made.  It makes it easier to find your 
reviews as well from the git-log, so please do so!


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

https://reviews.llvm.org/D147708

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


[PATCH] D107294: [clang-tidy] adds warning to suggest users replace symbols with words

2023-04-10 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

The for Pipe/BitwiseOr issue. One heuristic could be:

- If it has any kind of template dependence don't diagnost
- If its a `BinaryOperator`, its safe to diagnose.
- If its a `CxxOperatorCallExpr`, the simplest case I can think of is to check 
the spelling of the operator (`operator|` vs `operator bitor`)




Comment at: 
clang-tools-extra/clang-tidy/readability/AlternativeTokensCheck.cpp:69
+  // Only insert spaces if there aren't already spaces between operators
+  StringRef SpaceBefore = std::isspace(lookahead(SM, Loc, -1)) ? "" : " ";
+  StringRef SpaceAfter =

cor3ntin wrote:
> aaron.ballman wrote:
> > Hrmm, I feel like `std::isspace()` is not going to properly handle all the 
> > Unicode whitespace, but I don't think we handle them all anyway as I notice 
> > the lexer is using `isHorizontalWhitespace()`, `isVerticalWhitespace()`, 
> > and `isWhitespace()` from `CharInfo.h`. Maybe we should use the same 
> > utility here just to match the lexer? (I don't feel strongly, just tickled 
> > my spidey senses.)
> I just saw this comment randomly in my mail.
> I agree we should not use `isspace` - it's also probably less efficient 
> because of locale. And we don't want lexing to depend on the host locale.
> And makes it easier to extend the set of supported whitespace if we ever do 
> thatt
Is it not just wiser to always add the spaces and just let clang-format do its 
thing.



Comment at: 
clang-tools-extra/clang-tidy/readability/AlternativeTokensCheck.cpp:117-120
+  case Opcode::BO_LAnd:
+diag(Loc, "use 'and' for logical conjunctions")
+<< createReplacement(SM, Loc, "and", 2) << includeIso646(SM, Loc);
+break;

aaron.ballman wrote:
> I think these can be replaced with a helper function along these lines:
> ```
> void emitDiag(const SourceManager &SM, SourceLocation Loc, StringRef Op, 
> StringRef OpDesc, int Lookahead) {
>   diag(Loc, ("use '" + Op + "' for " + OpDesc).str()) <<
> createReplacement(SM, Loc, Op, Lookahead) << includeIso646(SM, Loc);
> }
> ```
> WDYT?
```lang=c++
diag("use '%0' for %1") << Op << OpDesc << Fixes;
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107294

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


[clang] 3442aba - [NFC][tests] Disable new gmodules-preferred-name-* tests on AIX and z/OS

2023-04-10 Thread Jake Egan via cfe-commits

Author: Jake Egan
Date: 2023-04-10T09:51:02-04:00
New Revision: 3442aba806b98ffe2d6afbbc629d8a6a3731a5f5

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

LOG: [NFC][tests] Disable new gmodules-preferred-name-* tests on AIX and z/OS

Objective-C is not supported on AIX and z/OS. Precedent here: D109060

Added: 


Modified: 
clang/test/Modules/gmodules-preferred-name-alias.cpp
clang/test/Modules/gmodules-preferred-name-typedef.cpp

Removed: 




diff  --git a/clang/test/Modules/gmodules-preferred-name-alias.cpp 
b/clang/test/Modules/gmodules-preferred-name-alias.cpp
index 687125c86e9fb..d01cefb83d151 100644
--- a/clang/test/Modules/gmodules-preferred-name-alias.cpp
+++ b/clang/test/Modules/gmodules-preferred-name-alias.cpp
@@ -1,3 +1,5 @@
+// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}
+
 // REQUIRES: asserts
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -std=c++11 -dwarf-ext-refs -fmodule-format=obj \

diff  --git a/clang/test/Modules/gmodules-preferred-name-typedef.cpp 
b/clang/test/Modules/gmodules-preferred-name-typedef.cpp
index e6a8f3ef4c68e..1d2bbd75fe866 100644
--- a/clang/test/Modules/gmodules-preferred-name-typedef.cpp
+++ b/clang/test/Modules/gmodules-preferred-name-typedef.cpp
@@ -1,3 +1,5 @@
+// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}
+
 // REQUIRES: asserts
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -std=c++11 -dwarf-ext-refs -fmodule-format=obj \



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


[PATCH] D146178: [Clang][Sema] Fix comparison of constraint expressions

2023-04-10 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/lib/Sema/SemaConcept.cpp:263
 
+  if (SubstitutedAtomicExpr.get()->isValueDependent())
+return SubstitutedAtomicExpr;

So this bit is concerning to me... we have been catching a ton of bugs in the 
MLTAL stuff by trying to constant evaluate an expression that isn't correctly 
constexpr, and this will defeat it.  We shouldn't be calling this function at 
all on non-fully-instantiated expressions.  What is the case that ends up 
coming through here, and should be be calling this at all?



Comment at: clang/lib/Sema/SemaConcept.cpp:773
+  // ConstrExpr for the inner template will properly adjust the depths.
+  if (isa(ND) && isa(OtherND))
+ForConstraintInstantiation = true;

Hmm... this seems really strange to have to do. `ForConstraintInstantiation` 
shouldn't be used here, the point of that is to make sure we 'keep looking 
upward' once we hit a spot we normally stop with.  What exactly is the issue 
that you end up running into here?  Perhaps I can spend some time debugging 
what we should really be doign.



Comment at: clang/lib/Sema/SemaTemplateInstantiate.cpp:220
+Response HandleFunctionTemplateDecl(const FunctionTemplateDecl *FTD) {
+  return Response::ChangeDecl(FTD->getLexicalDeclContext());
+}

Huh, glad this ends up being useful!  I think i suggested this at one point in 
the last version of this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146178

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


[PATCH] D147941: [Flang][Driver][OpenMP] Enable flags for filtering of offloading passes in flang

2023-04-10 Thread Sergio Afonso via Phabricator via cfe-commits
skatrak created this revision.
skatrak added reviewers: dpalermo, jsjodin, domada, agozillon, TIFitis, 
awarzynski.
Herald added subscribers: sunshaoce, guansong, yaxunl.
Herald added a reviewer: sscalpone.
Herald added projects: Flang, All.
skatrak requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, jplehr, sstefan1, jdoerfert.
Herald added a project: clang.

This patch adds support for the "--offload-device-only",
"--offload-host-only" and "--offload-host-device" options to the Flang
driver. These can be used to modify the behavior of the driver to select
which compilation passes are triggered during OpenMP offloading.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147941

Files:
  clang/include/clang/Driver/Options.td
  flang/test/Driver/driver-help-hidden.f90
  flang/test/Driver/driver-help.f90
  flang/test/Driver/omp-frontend-forwarding.f90


Index: flang/test/Driver/omp-frontend-forwarding.f90
===
--- flang/test/Driver/omp-frontend-forwarding.f90
+++ flang/test/Driver/omp-frontend-forwarding.f90
@@ -7,6 +7,38 @@
 ! CHECK-OPENMP: "{{[^"]*}}flang-new" "-fc1" {{.*}} "-fopenmp" {{.*}}.f90"
 ! CHECK-OPENMP-NOT: "{{[^"]*}}flang-new" "-fc1" {{.*}} "-fopenmp" {{.*}} 
"-fopenmp-is-device" {{.*}}.f90"
 
+! Test regular -fopenmp with offload, and pass filtering options
+! RUN: %flang -S -### %s -o %t 2>&1 \
+! RUN: -fopenmp --offload-arch=gfx90a \
+! RUN: --target=aarch64-unknown-linux-gnu \
+! RUN:   | FileCheck %s --check-prefix=CHECK-OFFLOAD-HOST-DEVICE
+
+! RUN: %flang -S -### %s -o %t 2>&1 \
+! RUN: -fopenmp --offload-arch=gfx90a --offload-host-device \
+! RUN: --target=aarch64-unknown-linux-gnu \
+! RUN:   | FileCheck %s --check-prefix=CHECK-OFFLOAD-HOST-DEVICE
+
+! CHECK-OFFLOAD-HOST-DEVICE: "{{[^"]*}}flang-new" "-fc1" "-triple" 
"aarch64-unknown-linux-gnu"
+! CHECK-OFFLOAD-HOST-DEVICE-NEXT: "{{[^"]*}}flang-new" "-fc1" "-triple" 
"amdgcn-amd-amdhsa"
+! CHECK-OFFLOAD-HOST-DEVICE: "{{[^"]*}}flang-new" "-fc1" "-triple" 
"aarch64-unknown-linux-gnu"
+
+! RUN: %flang -S -### %s -o %t 2>&1 \
+! RUN: -fopenmp --offload-arch=gfx90a --offload-host-only \
+! RUN: --target=aarch64-unknown-linux-gnu \
+! RUN:   | FileCheck %s --check-prefix=CHECK-OFFLOAD-HOST
+
+! CHECK-OFFLOAD-HOST: "{{[^"]*}}flang-new" "-fc1" "-triple" 
"aarch64-unknown-linux-gnu"
+! CHECK-OFFLOAD-HOST-NOT: "-triple" "amdgcn-amd-amdhsa"
+
+! RUN: %flang -S -### %s -o %t 2>&1 \
+! RUN: -fopenmp --offload-arch=gfx90a --offload-device-only \
+! RUN: --target=aarch64-unknown-linux-gnu \
+! RUN:   | FileCheck %s --check-prefix=CHECK-OFFLOAD-DEVICE
+
+! CHECK-OFFLOAD-DEVICE: "{{[^"]*}}flang-new" "-fc1" "-triple" 
"aarch64-unknown-linux-gnu"
+! CHECK-OFFLOAD-DEVICE-NEXT: "{{[^"]*}}flang-new" "-fc1" "-triple" 
"amdgcn-amd-amdhsa"
+! CHECK-OFFLOAD-DEVICE-NOT: "{{[^"]*}}flang-new" "-fc1" "-triple" 
"aarch64-unknown-linux-gnu"
+
 ! Test regular -fopenmp with offload for basic fopenmp-is-device flag addition 
and correct fopenmp 
 ! RUN: %flang -### -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa %s 2>&1 | 
FileCheck --check-prefixes=CHECK-OPENMP-IS-DEVICE %s
 ! CHECK-OPENMP-IS-DEVICE: "{{[^"]*}}flang-new" "-fc1" {{.*}} "-fopenmp" {{.*}} 
"-fopenmp-is-device" {{.*}}.f90"
Index: flang/test/Driver/driver-help.f90
===
--- flang/test/Driver/driver-help.f90
+++ flang/test/Driver/driver-help.f90
@@ -65,6 +65,9 @@
 ! HELP-NEXT: -mmlir  Additional arguments to forward to MLIR's 
option processing
 ! HELP-NEXT: -module-dir   Put MODULE files in 
 ! HELP-NEXT: -nocpp Disable predefined and command line 
preprocessor macros
+! HELP-NEXT: --offload-device-only   Only compile for the offloading device.
+! HELP-NEXT: --offload-host-device   Only compile for the offloading host.
+! HELP-NEXT: --offload-host-only Only compile for the offloading host.
 ! HELP-NEXT: -o   Write output to 
 ! HELP-NEXT: -pedantic  Warn on language extensions
 ! HELP-NEXT: -print-effective-triple Print the effective target triple
Index: flang/test/Driver/driver-help-hidden.f90
===
--- flang/test/Driver/driver-help-hidden.f90
+++ flang/test/Driver/driver-help-hidden.f90
@@ -69,6 +69,9 @@
 ! CHECK-NEXT: -mmlir  Additional arguments to forward to MLIR's 
option processing
 ! CHECK-NEXT: -module-dir   Put MODULE files in 
 ! CHECK-NEXT: -nocpp Disable predefined and command line 
preprocessor macros
+! CHECK-NEXT: --offload-device-only   Only compile for the offloading device.
+! CHECK-NEXT: --offload-host-device   Only compile for the offloading host.
+! CHECK-NEXT: --offload-host-only Only compile for the offloading host.
 ! CHECK-NEXT: -o  Write output to 
 ! CHECK-NEXT: -pedantic  Warn on language extensions
 ! CHECK-NEXT: -print-effectiv

[PATCH] D145803: [clang][DebugInfo] Emit DW_AT_type of preferred name if available

2023-04-10 Thread Michael Buch via Phabricator via cfe-commits
Michael137 added a comment.

Looks like `gmodules` isn't supported on AIX (based on other tests that use 
`-dwarf-ext-refs`. So I'll just disable the new tests

Thanks for notifying @aaron.ballman , email notifications got lost in the inbox


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145803

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


[PATCH] D147941: [Flang][Driver][OpenMP] Enable flags for filtering of offloading passes in flang

2023-04-10 Thread Andrzej Warzynski via Phabricator via cfe-commits
awarzynski added a comment.

Could you add tests that demonstrate what these options actually do?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147941

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


[PATCH] D145803: [clang][DebugInfo] Emit DW_AT_type of preferred name if available

2023-04-10 Thread Michael Buch via Phabricator via cfe-commits
Michael137 added a subscriber: Jake-Egan.
Michael137 added a comment.

Oh looks like @Jake-Egan already did


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145803

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


[PATCH] D147941: [Flang][Driver][OpenMP] Enable flags for filtering of offloading passes in flang

2023-04-10 Thread Sergio Afonso via Phabricator via cfe-commits
skatrak added a comment.

In D147941#4255458 , @awarzynski 
wrote:

> Could you add tests that demonstrate what these options actually do?

Thank you for the quick review! These options just modify which `flang-new 
-fc1` invocations are produced by the driver when compiling for device 
offloading. I have added tests that check that only the expected invocations 
are present, but if these tests are not what you'd expect I'd gladly make some 
more if you can explain a bit further what you had in mind.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147941

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


[PATCH] D93240: [clang-format] Add SpaceBeforeCaseColon option

2023-04-10 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

In D93240#4254439 , @sstwcw wrote:

> A goto label isn't affected by this option.  Is it intentional?

why would it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93240

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


[clang-tools-extra] 225d255 - [clang-tidy] Added IgnoreVirtual option to misc-unused-parameters

2023-04-10 Thread Piotr Zegar via cfe-commits

Author: Piotr Zegar
Date: 2023-04-10T14:41:32Z
New Revision: 225d255a583ea3d50bbba49d949ca76be6a880bf

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

LOG: [clang-tidy] Added IgnoreVirtual option to misc-unused-parameters

Added option to ignore virtual methods in this check.
This allows to quickly get rid of big number of
potentialy false-positive issues without inserting
not-needed comments.

Fixes #55665.

Reviewed By: njames93

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

Added: 

clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp

Modified: 
clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp 
b/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
index 2c69cb0df7137..3f1d2f9f58099 100644
--- a/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
@@ -123,10 +123,12 @@ UnusedParametersCheck::~UnusedParametersCheck() = default;
 UnusedParametersCheck::UnusedParametersCheck(StringRef Name,
  ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
-  StrictMode(Options.getLocalOrGlobal("StrictMode", false)) {}
+  StrictMode(Options.getLocalOrGlobal("StrictMode", false)),
+  IgnoreVirtual(Options.get("IgnoreVirtual", false)) {}
 
 void UnusedParametersCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "StrictMode", StrictMode);
+  Options.store(Opts, "IgnoreVirtual", IgnoreVirtual);
 }
 
 void UnusedParametersCheck::warnOnUnusedParameter(
@@ -176,9 +178,12 @@ void UnusedParametersCheck::check(const 
MatchFinder::MatchResult &Result) {
   const auto *Function = Result.Nodes.getNodeAs("function");
   if (!Function->hasWrittenPrototype() || Function->isTemplateInstantiation())
 return;
-  if (const auto *Method = dyn_cast(Function))
+  if (const auto *Method = dyn_cast(Function)) {
+if (IgnoreVirtual && Method->isVirtual())
+  return;
 if (Method->isLambdaStaticInvoker())
   return;
+  }
   for (unsigned I = 0, E = Function->getNumParams(); I != E; ++I) {
 const auto *Param = Function->getParamDecl(I);
 if (Param->isUsed() || Param->isReferenced() || !Param->getDeclName() ||

diff  --git a/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h 
b/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
index 684c95daaae72..90097ed415d37 100644
--- a/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
+++ b/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
@@ -25,6 +25,7 @@ class UnusedParametersCheck : public ClangTidyCheck {
 
 private:
   const bool StrictMode;
+  const bool IgnoreVirtual;
   class IndexerVisitor;
   std::unique_ptr Indexer;
 

diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 64f89dfb6034b..cb10385d8e87f 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -220,6 +220,10 @@ Changes in existing checks
   ` to avoid warning on
   declarations inside anonymous namespaces.
 
+- Improved :doc:`misc-unused-parameters
+  ` check with new `IgnoreVirtual`
+  option to optionally ignore virtual methods.
+
 - Deprecated check-local options `HeaderFileExtensions`
   in :doc:`misc-unused-using-decls
   ` check.

diff  --git 
a/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst 
b/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
index 7a454a283b7c1..87b75579d97a7 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
@@ -40,3 +40,8 @@ Options
constructors - no constructor initializers). When the function body is 
empty,
an unused parameter is unlikely to be unnoticed by a human reader, and
there's basically no place for a bug to hide.
+
+.. option:: IgnoreVirtual
+
+   Determines whether virtual method parameters should be inspected.
+   Set to `true` to ignore them. Default is `false`.

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
new file mode 100644
index 0..0ba2965c9b04c
--- /dev/null
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
@@ -0,0 +1,20 @@
+// RUN: %check_clang_tidy %s misc-unused-parameters %t -- \
+// RUN:   -config

[PATCH] D147918: [clang-tidy] Added IgnoreVirtual option to misc-unused-parameters

2023-04-10 Thread Piotr Zegar 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 rG225d255a583e: [clang-tidy] Added IgnoreVirtual option to 
misc-unused-parameters (authored by PiotrZSL).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147918

Files:
  clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
  clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
  clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
===
--- /dev/null
+++ 
clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
@@ -0,0 +1,20 @@
+// RUN: %check_clang_tidy %s misc-unused-parameters %t -- \
+// RUN:   -config="{CheckOptions: [{key: misc-unused-parameters.IgnoreVirtual, 
value: true}]}" --
+
+struct Base {
+  int f(int foo) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: parameter 'foo' is unused 
[misc-unused-parameters]
+  // CHECK-FIXES: int f(int  /*foo*/) {
+return 5;
+  }
+
+  virtual int f2(int foo) {
+return 5;
+  }
+};
+
+struct Derived : Base {
+  int f2(int foo) override {
+return 5;
+  }
+};
Index: clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
@@ -40,3 +40,8 @@
constructors - no constructor initializers). When the function body is 
empty,
an unused parameter is unlikely to be unnoticed by a human reader, and
there's basically no place for a bug to hide.
+
+.. option:: IgnoreVirtual
+
+   Determines whether virtual method parameters should be inspected.
+   Set to `true` to ignore them. Default is `false`.
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -220,6 +220,10 @@
   ` to avoid warning on
   declarations inside anonymous namespaces.
 
+- Improved :doc:`misc-unused-parameters
+  ` check with new `IgnoreVirtual`
+  option to optionally ignore virtual methods.
+
 - Deprecated check-local options `HeaderFileExtensions`
   in :doc:`misc-unused-using-decls
   ` check.
Index: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
===
--- clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
+++ clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
@@ -25,6 +25,7 @@
 
 private:
   const bool StrictMode;
+  const bool IgnoreVirtual;
   class IndexerVisitor;
   std::unique_ptr Indexer;
 
Index: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
@@ -123,10 +123,12 @@
 UnusedParametersCheck::UnusedParametersCheck(StringRef Name,
  ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
-  StrictMode(Options.getLocalOrGlobal("StrictMode", false)) {}
+  StrictMode(Options.getLocalOrGlobal("StrictMode", false)),
+  IgnoreVirtual(Options.get("IgnoreVirtual", false)) {}
 
 void UnusedParametersCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "StrictMode", StrictMode);
+  Options.store(Opts, "IgnoreVirtual", IgnoreVirtual);
 }
 
 void UnusedParametersCheck::warnOnUnusedParameter(
@@ -176,9 +178,12 @@
   const auto *Function = Result.Nodes.getNodeAs("function");
   if (!Function->hasWrittenPrototype() || Function->isTemplateInstantiation())
 return;
-  if (const auto *Method = dyn_cast(Function))
+  if (const auto *Method = dyn_cast(Function)) {
+if (IgnoreVirtual && Method->isVirtual())
+  return;
 if (Method->isLambdaStaticInvoker())
   return;
+  }
   for (unsigned I = 0, E = Function->getNumParams(); I != E; ++I) {
 const auto *Param = Function->getParamDecl(I);
 if (Param->isUsed() || Param->isReferenced() || !Param->getDeclName() ||


Index: clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-virtual.cpp
@@ -0,0 +1,20 @@
+// RUN: %check_clang_tidy %s misc-unused-parameters %t -- \
+// RUN:   -config="{CheckOptions: [{key: misc-unused-parameters.IgnoreVirtual, value: true}]}" --
+
+

[PATCH] D147906: [clang-tidy] Avoid float compare in bugprone-incorrect-roundings

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL updated this revision to Diff 512149.
PiotrZSL added a comment.

Fix review comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147906

Files:
  clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp


Index: clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
===
--- clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
+++ clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
@@ -17,13 +17,17 @@
 
 namespace clang::tidy::bugprone {
 
+static llvm::APFloat getHalf(const llvm::fltSemantics &Semantics) {
+  return llvm::APFloat(Semantics, 1U) / llvm::APFloat(Semantics, 2U);
+}
+
 namespace {
 AST_MATCHER(FloatingLiteral, floatHalf) {
-  const auto &Literal = Node.getValue();
+  const llvm::APFloat Literal = Node.getValue();
   if ((&Node.getSemantics()) == &llvm::APFloat::IEEEsingle())
-return Literal.convertToFloat() == 0.5f;
+return Literal == getHalf(llvm::APFloat::IEEEsingle());
   if ((&Node.getSemantics()) == &llvm::APFloat::IEEEdouble())
-return Literal.convertToDouble() == 0.5;
+return Literal == getHalf(llvm::APFloat::IEEEdouble());
   return false;
 }
 } // namespace


Index: clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
===
--- clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
+++ clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
@@ -17,13 +17,17 @@
 
 namespace clang::tidy::bugprone {
 
+static llvm::APFloat getHalf(const llvm::fltSemantics &Semantics) {
+  return llvm::APFloat(Semantics, 1U) / llvm::APFloat(Semantics, 2U);
+}
+
 namespace {
 AST_MATCHER(FloatingLiteral, floatHalf) {
-  const auto &Literal = Node.getValue();
+  const llvm::APFloat Literal = Node.getValue();
   if ((&Node.getSemantics()) == &llvm::APFloat::IEEEsingle())
-return Literal.convertToFloat() == 0.5f;
+return Literal == getHalf(llvm::APFloat::IEEEsingle());
   if ((&Node.getSemantics()) == &llvm::APFloat::IEEEdouble())
-return Literal.convertToDouble() == 0.5;
+return Literal == getHalf(llvm::APFloat::IEEEdouble());
   return false;
 }
 } // namespace
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147908: [clang-tidy] Add support for long double in bugprone-incorrect-roundings

2023-04-10 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL updated this revision to Diff 512150.
PiotrZSL added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147908

Files:
  clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone/incorrect-roundings.cpp
@@ -12,74 +12,126 @@
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5) to integer leads to incorrect rounding; consider using lround (#include ) instead [bugprone-incorrect-roundings]
   x = (d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + d);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + ld);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5 + f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (0.5f + f);
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
+  x = (0.5L + f);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: casting (double + 0.5)
   x = (int)(d + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(ld + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(ld + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(ld + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + d);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + ld);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + ld);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5 + f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = (int)(0.5f + f);
   // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
+  x = (int)(0.5L + f);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: casting (double + 0.5)
   x = static_cast(d + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(d + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(d + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(ld + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(ld + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(ld + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(f + 0.5);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(f + 0.5f);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(f + 0.5L);
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(0.5 + d);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
   x = static_cast(0.5f + d);
   // CHECK-MESSAGES: [[@LINE-1]]:24: warning: casting (double + 0.5)
+  x = static_cast(0.5L + d);
+  // CHECK-ME

[clang] 1cdc0e8 - [Clang] Check type-constraints applied to placeholder types

2023-04-10 Thread Corentin Jabot via cfe-commits

Author: Corentin Jabot
Date: 2023-04-10T17:33:09+02:00
New Revision: 1cdc0e83c8ce35702ddbc6b26959a5da44776a49

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

LOG: [Clang] Check type-constraints applied to placeholder types

(and deduced return types)

Previously, only type constraints applied to type parameter
were semantically checked.

A diagnostic would still be emitted on instantiation, but it was
too late, lacked clarity, and was inconsistent with type parameters.

Reviewed By: erichkeane

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

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseDecl.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/test/Parser/cxx2a-placeholder-type-constraint.cpp

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 3fc2839b93e50..c9187f225cad3 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -288,6 +288,8 @@ Bug Fixes in This Version
 - Fix the assertion hit when a template consteval function appears in a nested
   consteval/constexpr call chain.
   (`#61142 `_)
+- Clang now better diagnose placeholder types constrained with a concept that 
is
+  not a type concept.
 
 Bug Fixes to Compiler Builtins
 ^^

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index a46bc758dd6af..33d6c40f157fe 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -8107,6 +8107,8 @@ class Sema final {
 SourceLocation EqualLoc,
 ParsedType DefaultArg, bool HasTypeConstraint);
 
+  bool CheckTypeConstraint(TemplateIdAnnotation *TypeConstraint);
+
   bool ActOnTypeConstraint(const CXXScopeSpec &SS,
TemplateIdAnnotation *TypeConstraint,
TemplateTypeParmDecl *ConstrainedParameter,

diff  --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 91376cf6a34e4..450c703a27d0c 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -3770,6 +3770,10 @@ void Parser::ParseDeclarationSpecifiers(
 }
 if (!NextToken().isOneOf(tok::kw_auto, tok::kw_decltype))
 goto DoneWithDeclSpec;
+
+if (TemplateId && !isInvalid && 
Actions.CheckTypeConstraint(TemplateId))
+TemplateId = nullptr;
+
 ConsumeAnnotationToken();
 SourceLocation AutoLoc = Tok.getLocation();
 if (TryConsumeToken(tok::kw_decltype)) {

diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index e277dccb31875..d4f89cc1f0dfd 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -1107,19 +1107,8 @@ makeTemplateArgumentListInfo(Sema &S, 
TemplateIdAnnotation &TemplateId) {
   return TemplateArgs;
 }
 
-bool Sema::ActOnTypeConstraint(const CXXScopeSpec &SS,
-   TemplateIdAnnotation *TypeConstr,
-   TemplateTypeParmDecl *ConstrainedParameter,
-   SourceLocation EllipsisLoc) {
-  return BuildTypeConstraint(SS, TypeConstr, ConstrainedParameter, EllipsisLoc,
- false);
-}
+bool Sema::CheckTypeConstraint(TemplateIdAnnotation *TypeConstr) {
 
-bool Sema::BuildTypeConstraint(const CXXScopeSpec &SS,
-   TemplateIdAnnotation *TypeConstr,
-   TemplateTypeParmDecl *ConstrainedParameter,
-   SourceLocation EllipsisLoc,
-   bool AllowUnexpandedPack) {
   TemplateName TN = TypeConstr->Template.get();
   ConceptDecl *CD = cast(TN.getAsTemplateDecl());
 
@@ -1137,9 +1126,32 @@ bool Sema::BuildTypeConstraint(const CXXScopeSpec &SS,
   if (!WereArgsSpecified &&
   CD->getTemplateParameters()->getMinRequiredArguments() > 1) {
 Diag(TypeConstr->TemplateNameLoc,
- diag::err_type_constraint_missing_arguments) << CD;
+ diag::err_type_constraint_missing_arguments)
+<< CD;
 return true;
   }
+  return false;
+}
+
+bool Sema::ActOnTypeConstraint(const CXXScopeSpec &SS,
+   TemplateIdAnnotation *TypeConstr,
+   TemplateTypeParmDecl *ConstrainedParameter,
+   SourceLocation EllipsisLoc) {
+  return BuildTypeConstraint(SS, TypeConstr, ConstrainedParameter, EllipsisLoc,
+ false);
+}
+
+bool Sema::BuildTypeConstraint(const CXXScopeSpec &SS,
+   TemplateIdAnnotation *TypeConstr,
+

[PATCH] D147925: [Clang] Check type-constraints applied to placeholder types

2023-04-10 Thread Corentin Jabot 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 rG1cdc0e83c8ce: [Clang] Check type-constraints applied to 
placeholder types (authored by cor3ntin).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147925

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/test/Parser/cxx2a-placeholder-type-constraint.cpp

Index: clang/test/Parser/cxx2a-placeholder-type-constraint.cpp
===
--- clang/test/Parser/cxx2a-placeholder-type-constraint.cpp
+++ clang/test/Parser/cxx2a-placeholder-type-constraint.cpp
@@ -47,3 +47,23 @@
 void foo3(C auto const &a){}
 void foo4(const C &a){}
 // expected-error@-1{{expected 'auto' or 'decltype(auto)' after concept name}}
+
+namespace non_type {
+  template
+  concept C1 = true;
+
+  auto f() -> C1 auto {} // expected-error{{concept named in type constraint is not a type concept}}
+  auto g(C1 auto); // expected-error{{concept named in type constraint is not a type concept}}
+  C1 auto a = 0; // expected-error{{concept named in type constraint is not a type concept}}
+  C1 decltype(auto) b = 0; // expected-error{{concept named in type constraint is not a type concept}}
+}
+
+namespace arity {
+  template
+  concept C1 = true;
+
+  auto f() -> C1 auto {} // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}
+  auto g(C1 auto); // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}
+  C1 auto a = 0; // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}
+  C1 decltype(auto) b = 0; // expected-error{{'C1' requires more than 1 template argument; provide the remaining arguments explicitly to use it here}}
+}
Index: clang/lib/Sema/SemaTemplate.cpp
===
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -1107,19 +1107,8 @@
   return TemplateArgs;
 }
 
-bool Sema::ActOnTypeConstraint(const CXXScopeSpec &SS,
-   TemplateIdAnnotation *TypeConstr,
-   TemplateTypeParmDecl *ConstrainedParameter,
-   SourceLocation EllipsisLoc) {
-  return BuildTypeConstraint(SS, TypeConstr, ConstrainedParameter, EllipsisLoc,
- false);
-}
+bool Sema::CheckTypeConstraint(TemplateIdAnnotation *TypeConstr) {
 
-bool Sema::BuildTypeConstraint(const CXXScopeSpec &SS,
-   TemplateIdAnnotation *TypeConstr,
-   TemplateTypeParmDecl *ConstrainedParameter,
-   SourceLocation EllipsisLoc,
-   bool AllowUnexpandedPack) {
   TemplateName TN = TypeConstr->Template.get();
   ConceptDecl *CD = cast(TN.getAsTemplateDecl());
 
@@ -1137,9 +1126,32 @@
   if (!WereArgsSpecified &&
   CD->getTemplateParameters()->getMinRequiredArguments() > 1) {
 Diag(TypeConstr->TemplateNameLoc,
- diag::err_type_constraint_missing_arguments) << CD;
+ diag::err_type_constraint_missing_arguments)
+<< CD;
 return true;
   }
+  return false;
+}
+
+bool Sema::ActOnTypeConstraint(const CXXScopeSpec &SS,
+   TemplateIdAnnotation *TypeConstr,
+   TemplateTypeParmDecl *ConstrainedParameter,
+   SourceLocation EllipsisLoc) {
+  return BuildTypeConstraint(SS, TypeConstr, ConstrainedParameter, EllipsisLoc,
+ false);
+}
+
+bool Sema::BuildTypeConstraint(const CXXScopeSpec &SS,
+   TemplateIdAnnotation *TypeConstr,
+   TemplateTypeParmDecl *ConstrainedParameter,
+   SourceLocation EllipsisLoc,
+   bool AllowUnexpandedPack) {
+
+  if (CheckTypeConstraint(TypeConstr))
+return true;
+
+  TemplateName TN = TypeConstr->Template.get();
+  ConceptDecl *CD = cast(TN.getAsTemplateDecl());
 
   DeclarationNameInfo ConceptName(DeclarationName(TypeConstr->Name),
   TypeConstr->TemplateNameLoc);
Index: clang/lib/Parse/ParseDecl.cpp
===
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -3770,6 +3770,10 @@
 }
 if (!NextToken().isOneOf(tok::kw_auto, tok::kw_decltype))
 goto DoneWithDeclSpec;
+
+if (TemplateId && !isInvalid && Actions.CheckTypeConstraint(TemplateId))
+TemplateId = nullptr;
+
 ConsumeAnnotationTok

[PATCH] D147946: [clang-tidy] support inline namespace in c++20

2023-04-10 Thread Congcong Cai via Phabricator via cfe-commits
HerrCai0907 created this revision.
HerrCai0907 added a reviewer: PiotrZSL.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
HerrCai0907 requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Fixed https://github.com/llvm/llvm-project/issues/56022
c++20 support namespace like `namespace a::inline b {}`.
If an inline namespace is not the first, it can be concatened.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147946

Files:
  clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
  clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  
clang-tools-extra/docs/clang-tidy/checks/modernize/concat-nested-namespaces.rst
  
clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
@@ -1,14 +1,11 @@
 // RUN: cp %S/Inputs/concat-nested-namespaces/modernize-concat-nested-namespaces.h %T/modernize-concat-nested-namespaces.h
-// RUN: %check_clang_tidy -std=c++17 %s modernize-concat-nested-namespaces %t -- -header-filter=".*" -- -I %T
+// RUN: %check_clang_tidy -std=c++17 -check-suffix=NORMAL %s modernize-concat-nested-namespaces %t -- -header-filter=".*" -- -I %T
 // RUN: FileCheck -input-file=%T/modernize-concat-nested-namespaces.h %S/Inputs/concat-nested-namespaces/modernize-concat-nested-namespaces.h -check-prefix=CHECK-FIXES
 // Restore header file and re-run with c++20:
 // RUN: cp %S/Inputs/concat-nested-namespaces/modernize-concat-nested-namespaces.h %T/modernize-concat-nested-namespaces.h
-// RUN: %check_clang_tidy -std=c++20 %s modernize-concat-nested-namespaces %t -- -header-filter=".*" -- -I %T
+// RUN: %check_clang_tidy -std=c++20 -check-suffixes=NORMAL,CPP20 %s modernize-concat-nested-namespaces %t -- -header-filter=".*" -- -I %T
 // RUN: FileCheck -input-file=%T/modernize-concat-nested-namespaces.h %S/Inputs/concat-nested-namespaces/modernize-concat-nested-namespaces.h -check-prefix=CHECK-FIXES
 
-#include "modernize-concat-nested-namespaces.h"
-// CHECK-MESSAGES-DAG: modernize-concat-nested-namespaces.h:1:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
-
 namespace n1 {}
 
 namespace n2 {
@@ -20,12 +17,6 @@
 }
 } // namespace n2
 
-namespace n5 {
-inline namespace inline_ns {
-void t();
-} // namespace inline_ns
-} // namespace n5
-
 namespace n6 {
 namespace [[deprecated]] attr_ns {
 void t();
@@ -42,17 +33,17 @@
 
 namespace n9 {
 namespace n10 {
-// CHECK-MESSAGES-DAG: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
-// CHECK-FIXES: namespace n9::n10
+// CHECK-MESSAGES-NORMAL: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+// CHECK-FIXES-NORMAL: namespace n9::n10
 void t();
 } // namespace n10
 } // namespace n9
-// CHECK-FIXES: }
+// CHECK-FIXES-NORMAL: }
 
 namespace n11 {
 namespace n12 {
-// CHECK-MESSAGES-DAG: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
-// CHECK-FIXES: namespace n11::n12
+// CHECK-MESSAGES-NORMAL: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+// CHECK-FIXES-NORMAL: namespace n11::n12
 namespace n13 {
 void t();
 }
@@ -61,7 +52,7 @@
 }
 } // namespace n12
 } // namespace n11
-// CHECK-FIXES: }
+// CHECK-FIXES-NORMAL: }
 
 namespace n15 {
 namespace n16 {
@@ -75,13 +66,13 @@
 namespace n18 {
 namespace n19 {
 namespace n20 {
-// CHECK-MESSAGES-DAG: :[[@LINE-3]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
-// CHECK-FIXES: namespace n18::n19::n20
+// CHECK-MESSAGES-NORMAL: :[[@LINE-3]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+// CHECK-FIXES-NORMAL: namespace n18::n19::n20
 void t();
 } // namespace n20
 } // namespace n19
 } // namespace n18
-// CHECK-FIXES: }
+// CHECK-FIXES-NORMAL: }
 
 namespace n21 {
 void t();
@@ -98,38 +89,36 @@
 namespace {
 namespace n24 {
 namespace n25 {
-// CHECK-MESSAGES-DAG: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
-// CHECK-FIXES: namespace n24::n25
+// CHECK-MESSAGES-NORMAL: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+// CHECK-FIXES-NORMAL: namespace n24::n25
 void t();
 } // namespace n25
 } // namespace n24
-// CHECK-FIXES: }
+// CHECK-FIXES-NORMAL: }
 } // namespace
 } // namespace n23
 
 namespace n26::n27 {
 namespace n28 

[PATCH] D147941: [Flang][Driver][OpenMP] Enable flags for filtering of offloading passes in flang

2023-04-10 Thread Andrzej Warzynski via Phabricator via cfe-commits
awarzynski added a comment.

In D147941#4255461 , @skatrak wrote:

> In D147941#4255458 , @awarzynski 
> wrote:
>
>> Could you add tests that demonstrate what these options actually do?
>
> Thank you for the quick review! These options just modify which `flang-new 
> -fc1` invocations are produced by the driver when compiling for device 
> offloading. I have added tests that check that only the expected invocations 
> are present, but if these tests are not what you'd expect I'd gladly make 
> some more if you can explain a bit further what you had in mind.

Cheers!

> These can be used to modify the behavior of the driver to select which 
> compilation passes are triggered during OpenMP offloading.

In the context of LLVM, I would normally associate "pass" with something else. 
I'm not that familiar with offloading, so perhaps that's the language that 
people use? Personally, in the context of the driver I'd normally use the term 
"phase" rather than "pass".

This patch makes sense, though I'd like the following to be addressed before 
landing this:

1. Where's the logic that implements what `--offload-host-device`? It looks 
like this is already implemented elsewhere and this patch simply "unlocks" 
(rather than "implements") this option for Flang.
2. The name of "omp-frontend-forwarding.f90" is very misleading. "Forwarding" 
would mean `flang-new --offload-host-only %s` --> `flang-new -fc1 
--offload-host-only %s`, but that's not what's happening here, is it?

For 1. you could just update the summary, and for 2. I suggest renaming 
"omp-frontend-forwarding.f90" as e.g. "omp-compiler-flag-expansion.f90". WDYT?




Comment at: clang/include/clang/Driver/Options.td:2738
   HelpText<"Don't Use the new driver for offloading compilation.">;
-def offload_device_only : Flag<["--"], "offload-device-only">,
+def offload_device_only : Flag<["--"], "offload-device-only">, 
Flags<[CoreOption, FlangOption]>,
   HelpText<"Only compile for the offloading device.">;

Why is `CoreOption` needed here? Wouldn't `FlangOption` be sufficient?



Comment at: flang/test/Driver/omp-frontend-forwarding.f90:14
+! RUN: --target=aarch64-unknown-linux-gnu \
+! RUN:   | FileCheck %s --check-prefix=CHECK-OFFLOAD-HOST-DEVICE
+

[nit] You can reduce noise by using `OFFLOAD-HOST-DEVICE` instead of 
`CHECK-OFFLOAD-HOST-DEVICE`. I think that most people understand that these are 
`CHECK` prefixes anyway.



Comment at: flang/test/Driver/omp-frontend-forwarding.f90:19
+! RUN: --target=aarch64-unknown-linux-gnu \
+! RUN:   | FileCheck %s --check-prefix=CHECK-OFFLOAD-HOST-DEVICE
+

[nit] No harm in being a bit more verbose to communicate the intent a bit 
clearer :)  



Comment at: flang/test/Driver/omp-frontend-forwarding.f90:30
+
+! CHECK-OFFLOAD-HOST: "{{[^"]*}}flang-new" "-fc1" "-triple" 
"aarch64-unknown-linux-gnu"
+! CHECK-OFFLOAD-HOST-NOT: "-triple" "amdgcn-amd-amdhsa"

Shouldn't there be 2 driver invocation for the host, as in the the 
`CHECK-OFFLOAD-HOST-DEVICE` case?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147941

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


[PATCH] D147946: [clang-tidy] support nested inline namespace in c++20 for modernize-concat-nested-namespaces

2023-04-10 Thread Congcong Cai via Phabricator via cfe-commits
HerrCai0907 updated this revision to Diff 512165.
HerrCai0907 added a comment.

remove lamda


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147946

Files:
  clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
  clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  
clang-tools-extra/docs/clang-tidy/checks/modernize/concat-nested-namespaces.rst
  
clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
@@ -1,14 +1,11 @@
 // RUN: cp %S/Inputs/concat-nested-namespaces/modernize-concat-nested-namespaces.h %T/modernize-concat-nested-namespaces.h
-// RUN: %check_clang_tidy -std=c++17 %s modernize-concat-nested-namespaces %t -- -header-filter=".*" -- -I %T
+// RUN: %check_clang_tidy -std=c++17 -check-suffix=NORMAL %s modernize-concat-nested-namespaces %t -- -header-filter=".*" -- -I %T
 // RUN: FileCheck -input-file=%T/modernize-concat-nested-namespaces.h %S/Inputs/concat-nested-namespaces/modernize-concat-nested-namespaces.h -check-prefix=CHECK-FIXES
 // Restore header file and re-run with c++20:
 // RUN: cp %S/Inputs/concat-nested-namespaces/modernize-concat-nested-namespaces.h %T/modernize-concat-nested-namespaces.h
-// RUN: %check_clang_tidy -std=c++20 %s modernize-concat-nested-namespaces %t -- -header-filter=".*" -- -I %T
+// RUN: %check_clang_tidy -std=c++20 -check-suffixes=NORMAL,CPP20 %s modernize-concat-nested-namespaces %t -- -header-filter=".*" -- -I %T
 // RUN: FileCheck -input-file=%T/modernize-concat-nested-namespaces.h %S/Inputs/concat-nested-namespaces/modernize-concat-nested-namespaces.h -check-prefix=CHECK-FIXES
 
-#include "modernize-concat-nested-namespaces.h"
-// CHECK-MESSAGES-DAG: modernize-concat-nested-namespaces.h:1:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
-
 namespace n1 {}
 
 namespace n2 {
@@ -20,12 +17,6 @@
 }
 } // namespace n2
 
-namespace n5 {
-inline namespace inline_ns {
-void t();
-} // namespace inline_ns
-} // namespace n5
-
 namespace n6 {
 namespace [[deprecated]] attr_ns {
 void t();
@@ -42,17 +33,17 @@
 
 namespace n9 {
 namespace n10 {
-// CHECK-MESSAGES-DAG: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
-// CHECK-FIXES: namespace n9::n10
+// CHECK-MESSAGES-NORMAL: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+// CHECK-FIXES-NORMAL: namespace n9::n10
 void t();
 } // namespace n10
 } // namespace n9
-// CHECK-FIXES: }
+// CHECK-FIXES-NORMAL: }
 
 namespace n11 {
 namespace n12 {
-// CHECK-MESSAGES-DAG: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
-// CHECK-FIXES: namespace n11::n12
+// CHECK-MESSAGES-NORMAL: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+// CHECK-FIXES-NORMAL: namespace n11::n12
 namespace n13 {
 void t();
 }
@@ -61,7 +52,7 @@
 }
 } // namespace n12
 } // namespace n11
-// CHECK-FIXES: }
+// CHECK-FIXES-NORMAL: }
 
 namespace n15 {
 namespace n16 {
@@ -75,13 +66,13 @@
 namespace n18 {
 namespace n19 {
 namespace n20 {
-// CHECK-MESSAGES-DAG: :[[@LINE-3]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
-// CHECK-FIXES: namespace n18::n19::n20
+// CHECK-MESSAGES-NORMAL: :[[@LINE-3]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+// CHECK-FIXES-NORMAL: namespace n18::n19::n20
 void t();
 } // namespace n20
 } // namespace n19
 } // namespace n18
-// CHECK-FIXES: }
+// CHECK-FIXES-NORMAL: }
 
 namespace n21 {
 void t();
@@ -98,38 +89,36 @@
 namespace {
 namespace n24 {
 namespace n25 {
-// CHECK-MESSAGES-DAG: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
-// CHECK-FIXES: namespace n24::n25
+// CHECK-MESSAGES-NORMAL: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+// CHECK-FIXES-NORMAL: namespace n24::n25
 void t();
 } // namespace n25
 } // namespace n24
-// CHECK-FIXES: }
+// CHECK-FIXES-NORMAL: }
 } // namespace
 } // namespace n23
 
 namespace n26::n27 {
 namespace n28 {
 namespace n29::n30 {
-// CHECK-MESSAGES-DAG: :[[@LINE-3]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
-// CHECK-FIXES: namespace n26::n27::n28::n29::n30 {
+// CHECK-MESSAGES-NORMAL: :[[@LINE-3]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+// CHECK-

[PATCH] D144218: [Clang] [AVR] Fix USHRT_MAX for 16-bit int.

2023-04-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D144218#4254021 , @barannikov88 
wrote:

> There is something wrong with the `#if`s in the test, isn't it? They all look 
> no-op.

Those are verifying that the macro expands to a value that can be used by the 
preprocessor to avoid issues like the one pointed out in this comment: 
https://reviews.llvm.org/D144218#inline-1396599


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144218

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


[PATCH] D147875: [clang][Diagnostics] WIP: Show line numbers when printing code snippets

2023-04-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

GCC emits line numbers by default these days, so it seems reasonable for Clang 
to do so as well. Having a way to disable the feature is important though as 
some folks have scripts that scrap diagnostic results and changing the format 
may break those scripts in challenging ways. GCC supports 
`-fno-diagnostics-show-line-numbers` and we should do the same. GCC also 
supports `-fdiagnostics-minimum-margin-width=width` which we might want to 
consider supporting up front as well.

As for `-fcaret-diagnostics-max-lines`, I think I agree that the current 
default of `1` makes this functionality a bit less than useful, but perhaps we 
want to change that default value now? Alternatively, do we want to tie this 
option to the number of max lines? e.g., if the max lines is one, then we 
disable line numbers by default, but if the max lines is > 1, we enable line 
numbers by default?


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

https://reviews.llvm.org/D147875

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


[PATCH] D141215: [clang-repl] Introduce Value to capture expression results

2023-04-10 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added reviewers: aaron.ballman, rsmith, lhames, sgraenitz.
v.g.vassilev added a comment.

I think it is a good time to invite more reviewers to take a look at this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141215

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


[clang] 711b70d - Fix wording in a release note; NFC

2023-04-10 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2023-04-10T12:54:30-04:00
New Revision: 711b70d77e99dd4101b9dfa94d9ea0d4149997ab

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

LOG: Fix wording in a release note; NFC

This change happened due to post-commit feedback on the review.

Added: 


Modified: 
clang/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index c9187f225cad..7dff43ba3093 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -89,7 +89,7 @@ C++20 Feature Support
   an error to a warning under the ``-Wreserved-module-identifier`` warning
   group. This warning is enabled by default. This addresses `#61446
   `_ and allows easier
-  building of precompiled modules. This diagnostic may be strengthened into an
+  building of standard modules. This diagnostic may be strengthened into an
   error again in the future once there is a less fragile way to mark a module
   as being part of the implementation rather than a user module.
 



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


[PATCH] D146986: Downgrade reserved module identifier error into a warning

2023-04-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:92
+  `_ and allows easier
+  building of precompiled modules. This diagnostic may be strengthened into an
+  error again in the future once there is a less fragile way to mark a module

Mordante wrote:
> Note this is about the standard modules, which are not precompiled per se.
Thanks! I fixed this up on the Clang 17 branch in 
711b70d77e99dd4101b9dfa94d9ea0d4149997ab


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146986

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


[PATCH] D146178: [Clang][Sema] Fix comparison of constraint expressions

2023-04-10 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexander-shaposhnikov added inline comments.



Comment at: clang/lib/Sema/SemaConcept.cpp:263
 
+  if (SubstitutedAtomicExpr.get()->isValueDependent())
+return SubstitutedAtomicExpr;

erichkeane wrote:
> So this bit is concerning to me... we have been catching a ton of bugs in the 
> MLTAL stuff by trying to constant evaluate an expression that isn't correctly 
> constexpr, and this will defeat it.  We shouldn't be calling this function at 
> all on non-fully-instantiated expressions.  What is the case that ends up 
> coming through here, and should be be calling this at all?
This happens e.g. for concepts-PR54629.cpp

```
Old:
FunctionDecl 0x64d90378 
llvm-project/clang/test/SemaTemplate/concepts-PR54629.cpp:30:1, line:32:2> 
line:30:6 foo 'void ()'
|-RequiresExpr 0x64d90318  'bool'
| |-ParmVarDecl 0x64d90150  col:24 referenced t 'T &'
| `-NestedRequirement 0x64d902d8 dependent
|   `-BinaryOperator 0x64d902b8  'bool' '<'
| |-UnaryExprOrTypeTraitExpr 0x64d90260  'unsigned 
long' sizeof
| | `-ParenExpr 0x64d90240  'T' lvalue
| |   `-DeclRefExpr 0x64d90220  'T' lvalue ParmVar 
0x64d90150 't' 'T &' non_odr_use_unevaluated
| `-ImplicitCastExpr 0x64d902a0  'unsigned long' 
|   `-IntegerLiteral 0x64d90280  'int' 4
`-CompoundStmt 0x64d90f70 

while MLTAL is empty.
```
(clang::Sema::CheckOverload calls clang::Sema::IsOverload, while 
clang::Sema::IsOverload invokes clang::Sema::AreConstraintExpressionsEqual)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146178

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


[PATCH] D146178: [Clang][Sema] Fix comparison of constraint expressions

2023-04-10 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexander-shaposhnikov added inline comments.



Comment at: clang/lib/Sema/SemaConcept.cpp:773
+  // ConstrExpr for the inner template will properly adjust the depths.
+  if (isa(ND) && isa(OtherND))
+ForConstraintInstantiation = true;

erichkeane wrote:
> Hmm... this seems really strange to have to do. `ForConstraintInstantiation` 
> shouldn't be used here, the point of that is to make sure we 'keep looking 
> upward' once we hit a spot we normally stop with.  What exactly is the issue 
> that you end up running into here?  Perhaps I can spend some time debugging 
> what we should really be doign.
yeah, I agree. I haven't found a proper solution or at least a better 
workaround (but would be happy to).
This kicks in for the case 

```
template 
concept Constraint = true;


template
struct Iterator {
template 
friend class Iterator;
void operator*();
};

Iterator I2;
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146178

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


[PATCH] D146178: [Clang][Sema] Fix comparison of constraint expressions

2023-04-10 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/lib/Sema/SemaConcept.cpp:263
 
+  if (SubstitutedAtomicExpr.get()->isValueDependent())
+return SubstitutedAtomicExpr;

alexander-shaposhnikov wrote:
> erichkeane wrote:
> > So this bit is concerning to me... we have been catching a ton of bugs in 
> > the MLTAL stuff by trying to constant evaluate an expression that isn't 
> > correctly constexpr, and this will defeat it.  We shouldn't be calling this 
> > function at all on non-fully-instantiated expressions.  What is the case 
> > that ends up coming through here, and should be be calling this at all?
> This happens e.g. for concepts-PR54629.cpp
> 
> ```
> Old:
> FunctionDecl 0x64d90378 
> llvm-project/clang/test/SemaTemplate/concepts-PR54629.cpp:30:1, line:32:2> 
> line:30:6 foo 'void ()'
> |-RequiresExpr 0x64d90318  'bool'
> | |-ParmVarDecl 0x64d90150  col:24 referenced t 'T &'
> | `-NestedRequirement 0x64d902d8 dependent
> |   `-BinaryOperator 0x64d902b8  'bool' '<'
> | |-UnaryExprOrTypeTraitExpr 0x64d90260  'unsigned 
> long' sizeof
> | | `-ParenExpr 0x64d90240  'T' lvalue
> | |   `-DeclRefExpr 0x64d90220  'T' lvalue ParmVar 
> 0x64d90150 't' 'T &' non_odr_use_unevaluated
> | `-ImplicitCastExpr 0x64d902a0  'unsigned long' 
> 
> |   `-IntegerLiteral 0x64d90280  'int' 4
> `-CompoundStmt 0x64d90f70 
> 
> while MLTAL is empty.
> ```
> (clang::Sema::CheckOverload calls clang::Sema::IsOverload, while 
> clang::Sema::IsOverload invokes clang::Sema::AreConstraintExpressionsEqual)
Hmm that seems wrong for me, but I'm not sure how.  It doesn't seem right 
for `AreConstraintExpressionsEqual`to try to calculate the constraint 
satisfaction...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146178

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


[PATCH] D147834: [clang][driver] Pass `-femulated-tls` through to the linker in LTO mode

2023-04-10 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 512189.
paulkirth marked an inline comment as done.
paulkirth added a comment.

Fix formatting in CHECK lines.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147834

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/emulated-tls.cpp


Index: clang/test/Driver/emulated-tls.cpp
===
--- clang/test/Driver/emulated-tls.cpp
+++ clang/test/Driver/emulated-tls.cpp
@@ -29,6 +29,18 @@
 // RUN: %clang -### -target i686-pc-openbsd %s -femulated-tls 
-fno-emulated-tls 2>&1 \
 // RUN: | FileCheck -check-prefix=NOEMU %s
 
+// Test that when lto is used any -emualted-tls flags are passed to the linker
+// LINUX and Android have different defaults for EmulatedTLS
+// RUN: %clang -### -flto --target=riscv64-linux -fno-emulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_NOEMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux-android1 -femulated-tls 
%s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux -femulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux-android1 
-fno-emulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_NOEMUTLS
+
+
 
 // Default without -f[no-]emulated-tls, will be decided by the target triple.
 // DEFAULT-NOT: "-cc1" {{.*}}"-femulated-tls"
@@ -40,3 +52,10 @@
 
 // NOEMU: "-cc1" {{.*}}"-fno-emulated-tls"
 // NOEMU-NOT: "-cc1" {{.*}}"-femulated-tls"
+
+// LTO related checks
+// LTO_NOEMUTLS: plugin-opt=-emulated-tls=0
+// LTO_NOEMUTLS-NOT: plugin-opt=-emulated-tls=1
+
+// LTO_EMUTLS: plugin-opt=-emulated-tls=1
+// LTO_EMUTLS-NOT: plugin-opt=-emulated-tls=0
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -764,6 +764,13 @@
   D.Diag(clang::diag::warn_drv_fjmc_for_elf_only);
   }
 
+  if (Arg *A = Args.getLastArg(options::OPT_femulated_tls,
+   options::OPT_fno_emulated_tls)) {
+bool Enable = A->getOption().getID() == options::OPT_femulated_tls;
+CmdArgs.push_back(Args.MakeArgString(
+Twine(PluginOptPrefix) + "-emulated-tls=" + (Enable ? "1" : "0")));
+  }
+
   if (Args.hasFlag(options::OPT_fstack_size_section,
options::OPT_fno_stack_size_section, false))
 CmdArgs.push_back(


Index: clang/test/Driver/emulated-tls.cpp
===
--- clang/test/Driver/emulated-tls.cpp
+++ clang/test/Driver/emulated-tls.cpp
@@ -29,6 +29,18 @@
 // RUN: %clang -### -target i686-pc-openbsd %s -femulated-tls -fno-emulated-tls 2>&1 \
 // RUN: | FileCheck -check-prefix=NOEMU %s
 
+// Test that when lto is used any -emualted-tls flags are passed to the linker
+// LINUX and Android have different defaults for EmulatedTLS
+// RUN: %clang -### -flto --target=riscv64-linux -fno-emulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_NOEMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux-android1 -femulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux -femulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux-android1 -fno-emulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_NOEMUTLS
+
+
 
 // Default without -f[no-]emulated-tls, will be decided by the target triple.
 // DEFAULT-NOT: "-cc1" {{.*}}"-femulated-tls"
@@ -40,3 +52,10 @@
 
 // NOEMU: "-cc1" {{.*}}"-fno-emulated-tls"
 // NOEMU-NOT: "-cc1" {{.*}}"-femulated-tls"
+
+// LTO related checks
+// LTO_NOEMUTLS: plugin-opt=-emulated-tls=0
+// LTO_NOEMUTLS-NOT: plugin-opt=-emulated-tls=1
+
+// LTO_EMUTLS: plugin-opt=-emulated-tls=1
+// LTO_EMUTLS-NOT: plugin-opt=-emulated-tls=0
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -764,6 +764,13 @@
   D.Diag(clang::diag::warn_drv_fjmc_for_elf_only);
   }
 
+  if (Arg *A = Args.getLastArg(options::OPT_femulated_tls,
+   options::OPT_fno_emulated_tls)) {
+bool Enable = A->getOption().getID() == options::OPT_femulated_tls;
+CmdArgs.push_back(Args.MakeArgString(
+Twine(PluginOptPrefix) + "-emulated-tls=" + (Enable ? "1" : "0")));
+  }
+
   if (Args.hasFlag(options::OPT_fstack_size_section,
options::OPT_fno_stack_size_section, false))
 CmdArgs.push_back(
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailm

[PATCH] D147834: [clang][driver] Pass `-femulated-tls` through to the linker in LTO mode

2023-04-10 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth added inline comments.



Comment at: clang/test/Driver/emulated-tls.cpp:57
+// LTO related checks
+//LTO_NOEMUTLS: plugin-opt=-emulated-tls=0
+//LTO_NOEMUTLS-NOT: plugin-opt=-emulated-tls=1

vit9696 wrote:
> Maybe add a space before LTO here?
Good catch. For whatever reason I thought clang-format had fixed that, but 
obviously not. :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147834

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


[PATCH] D147175: [clang] Add __is_trivially_equality_comparable

2023-04-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D147175#4251852 , @philnik wrote:

> In D147175#4251076 , @aaron.ballman 
> wrote:
>
>> One thing I can't quite determine is whether we expect to call this type 
>> trait often or not. Are either of the uses in libc++ going to be 
>> instantiated frequently? I'm trying to figure out whether we want the 
>> current implementation of `HasNonDeletedDefaultedEqualityComparison()` or 
>> whether we should bite the bullet up front and add another bit to 
>> `CXXRecordDecl::DefinitionData` so we compute this property once as the 
>> class is being formed and don't have to loop over all of the methods and 
>> bases each time. We do this for other special member functions, as with: 
>> https://github.com/llvm/llvm-project/blob/main/clang/include/clang/AST/DeclCXX.h#L695
>
> We currently use `__is_trivially_equality_comparable` only for `std::equal` 
> (and I'm working on using it for `std::find`), and I don't think there are a 
> lot more places where we can use it. It's also only relevant for cases where 
> we have raw pointers. Would the `enable_if` be evaluated, even if the 
> arguments aren't raw pointers in the example below?
>
>   template , 
> remove_cvref_t> && __is_trivially_equality_comparable(T)>>
>   bool equal(T* first1, T* last1, U* first2);
>   
>   
>
> If not, then I don't think it makes sense to save the information, since it 
> will most likely not be evaluated more than once or twice per type.

I believe that we deduce the type of `T` before we can instantiate any of the 
deduced template parameters, so I think the `enable_if` is not evaluated unless 
`T` is known to have a raw pointer type. Based on that, I don't think we need 
to steal any bits anywhere right now -- we can use the current approach and if 
it turns up on the hot path at some point, we can address the concern then. The 
clang bits LGTM, but I'll hold off on signing off until someone from libc++ 
approves as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147175

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


[PATCH] D147875: [clang][Diagnostics] WIP: Show line numbers when printing code snippets

2023-04-10 Thread Christopher Di Bella via Phabricator via cfe-commits
cjdb added a comment.

I have no opinion on this addition. If folks find it useful in GCC, happy to 
see it added.




Comment at: clang/lib/Frontend/TextDiagnostic.cpp:1139
+return 7;
+  return 0;
+}

I'd prefer this to be an assert rather than returning a value. We should never 
be able to return from here.


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

https://reviews.llvm.org/D147875

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


[PATCH] D147836: [clang] Add test for CWG1822

2023-04-10 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik accepted this revision.
shafik added a comment.
This revision is now accepted and ready to land.

Thank you! LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147836

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


[PATCH] D147834: [clang][driver] Pass `-femulated-tls` through to the linker in LTO mode

2023-04-10 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 512190.
paulkirth added a comment.

Remove extra newlines in emulated-tls.cpp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147834

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/emulated-tls.cpp


Index: clang/test/Driver/emulated-tls.cpp
===
--- clang/test/Driver/emulated-tls.cpp
+++ clang/test/Driver/emulated-tls.cpp
@@ -29,6 +29,16 @@
 // RUN: %clang -### -target i686-pc-openbsd %s -femulated-tls 
-fno-emulated-tls 2>&1 \
 // RUN: | FileCheck -check-prefix=NOEMU %s
 
+// Test that when lto is used any -emualted-tls flags are passed to the linker
+// LINUX and Android have different defaults for EmulatedTLS
+// RUN: %clang -### -flto --target=riscv64-linux -fno-emulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_NOEMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux-android1 -femulated-tls 
%s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux -femulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux-android1 
-fno-emulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_NOEMUTLS
 
 // Default without -f[no-]emulated-tls, will be decided by the target triple.
 // DEFAULT-NOT: "-cc1" {{.*}}"-femulated-tls"
@@ -40,3 +50,10 @@
 
 // NOEMU: "-cc1" {{.*}}"-fno-emulated-tls"
 // NOEMU-NOT: "-cc1" {{.*}}"-femulated-tls"
+
+// LTO related checks
+// LTO_NOEMUTLS: plugin-opt=-emulated-tls=0
+// LTO_NOEMUTLS-NOT: plugin-opt=-emulated-tls=1
+
+// LTO_EMUTLS: plugin-opt=-emulated-tls=1
+// LTO_EMUTLS-NOT: plugin-opt=-emulated-tls=0
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -764,6 +764,13 @@
   D.Diag(clang::diag::warn_drv_fjmc_for_elf_only);
   }
 
+  if (Arg *A = Args.getLastArg(options::OPT_femulated_tls,
+   options::OPT_fno_emulated_tls)) {
+bool Enable = A->getOption().getID() == options::OPT_femulated_tls;
+CmdArgs.push_back(Args.MakeArgString(
+Twine(PluginOptPrefix) + "-emulated-tls=" + (Enable ? "1" : "0")));
+  }
+
   if (Args.hasFlag(options::OPT_fstack_size_section,
options::OPT_fno_stack_size_section, false))
 CmdArgs.push_back(


Index: clang/test/Driver/emulated-tls.cpp
===
--- clang/test/Driver/emulated-tls.cpp
+++ clang/test/Driver/emulated-tls.cpp
@@ -29,6 +29,16 @@
 // RUN: %clang -### -target i686-pc-openbsd %s -femulated-tls -fno-emulated-tls 2>&1 \
 // RUN: | FileCheck -check-prefix=NOEMU %s
 
+// Test that when lto is used any -emualted-tls flags are passed to the linker
+// LINUX and Android have different defaults for EmulatedTLS
+// RUN: %clang -### -flto --target=riscv64-linux -fno-emulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_NOEMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux-android1 -femulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux -femulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS
+// RUN: %clang -### -flto --target=riscv64-linux-android1 -fno-emulated-tls %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO_NOEMUTLS
 
 // Default without -f[no-]emulated-tls, will be decided by the target triple.
 // DEFAULT-NOT: "-cc1" {{.*}}"-femulated-tls"
@@ -40,3 +50,10 @@
 
 // NOEMU: "-cc1" {{.*}}"-fno-emulated-tls"
 // NOEMU-NOT: "-cc1" {{.*}}"-femulated-tls"
+
+// LTO related checks
+// LTO_NOEMUTLS: plugin-opt=-emulated-tls=0
+// LTO_NOEMUTLS-NOT: plugin-opt=-emulated-tls=1
+
+// LTO_EMUTLS: plugin-opt=-emulated-tls=1
+// LTO_EMUTLS-NOT: plugin-opt=-emulated-tls=0
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -764,6 +764,13 @@
   D.Diag(clang::diag::warn_drv_fjmc_for_elf_only);
   }
 
+  if (Arg *A = Args.getLastArg(options::OPT_femulated_tls,
+   options::OPT_fno_emulated_tls)) {
+bool Enable = A->getOption().getID() == options::OPT_femulated_tls;
+CmdArgs.push_back(Args.MakeArgString(
+Twine(PluginOptPrefix) + "-emulated-tls=" + (Enable ? "1" : "0")));
+  }
+
   if (Args.hasFlag(options::OPT_fstack_size_section,
options::OPT_fno_stack_size_section, false))
 CmdArgs.push_back(
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146178: [Clang][Sema] Fix comparison of constraint expressions

2023-04-10 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/lib/Sema/SemaConcept.cpp:773
+  // ConstrExpr for the inner template will properly adjust the depths.
+  if (isa(ND) && isa(OtherND))
+ForConstraintInstantiation = true;

alexander-shaposhnikov wrote:
> erichkeane wrote:
> > Hmm... this seems really strange to have to do. 
> > `ForConstraintInstantiation` shouldn't be used here, the point of that is 
> > to make sure we 'keep looking upward' once we hit a spot we normally stop 
> > with.  What exactly is the issue that you end up running into here?  
> > Perhaps I can spend some time debugging what we should really be doign.
> yeah, I agree. I haven't found a proper solution or at least a better 
> workaround (but would be happy to).
> This kicks in for the case 
> 
> ```
> template 
> concept Constraint = true;
> 
> 
> template
> struct Iterator {
> template 
> friend class Iterator;
> void operator*();
> };
> 
> Iterator I2;
> ```
> yeah, I agree. I haven't found a proper solution or at least a better 
> workaround (but would be happy to).
> This kicks in for the case 
> 
> ```
> template 
> concept Constraint = true;
> 
> 
> template
> struct Iterator {
> template 
> friend class Iterator;
> void operator*();
> };
> 
> Iterator I2;
> ```

Alright, well, I should have time later in the week to poke at this, perhaps I 
can come up with something better?  I DO remember self-friend is a little 
wacky, and I spent a bunch of time on it last time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146178

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


[PATCH] D144218: [Clang] [AVR] Fix USHRT_MAX for 16-bit int.

2023-04-10 Thread Sergei Barannikov via Phabricator via cfe-commits
barannikov88 added a comment.

In D144218#4255686 , @aaron.ballman 
wrote:

> In D144218#4254021 , @barannikov88 
> wrote:
>
>> There is something wrong with the `#if`s in the test, isn't it? They all 
>> look no-op.
>
> Those are verifying that the macro expands to a value that can be used by the 
> preprocessor to avoid issues like the one pointed out in this comment: 
> https://reviews.llvm.org/D144218#inline-1396599

Ah, I see, thanks. I should have read the comments more carefully.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144218

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


  1   2   3   >