[clang-tools-extra] c2bee1e - [clang-tidy][NFC] Unwind if-else-if-... in UnusedUsingDeclsCheck

2023-09-03 Thread Piotr Zegar via cfe-commits

Author: Piotr Zegar
Date: 2023-09-03T06:24:56Z
New Revision: c2bee1ed26a3355d164c92f1eb70ebf88804560d

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

LOG: [clang-tidy][NFC] Unwind if-else-if-... in UnusedUsingDeclsCheck

Break a if-else-if-else... chain. Use early return instead.

Fixes: #46375

Added: 


Modified: 
clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp 
b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
index 8aadb8fcb13441..c0255ea11e5ca6 100644
--- a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
@@ -126,10 +126,14 @@ void UnusedUsingDeclsCheck::check(const 
MatchFinder::MatchResult &Result) {
 // Also remove variants of Used.
 if (const auto *FD = dyn_cast(Used)) {
   removeFromFoundDecls(FD->getPrimaryTemplate());
-} else if (const auto *Specialization =
-   dyn_cast(Used)) {
+  return;
+}
+if (const auto *Specialization =
+dyn_cast(Used)) {
   removeFromFoundDecls(Specialization->getSpecializedTemplate());
-} else if (const auto *ECD = dyn_cast(Used)) {
+  return;
+}
+if (const auto *ECD = dyn_cast(Used)) {
   if (const auto *ET = ECD->getType()->getAs())
 removeFromFoundDecls(ET->getDecl());
 }
@@ -151,10 +155,16 @@ void UnusedUsingDeclsCheck::check(const 
MatchFinder::MatchResult &Result) {
 if (Used->getKind() == TemplateArgument::Template) {
   if (const auto *TD = Used->getAsTemplate().getAsTemplateDecl())
 removeFromFoundDecls(TD);
-} else if (Used->getKind() == TemplateArgument::Type) {
+  return;
+}
+
+if (Used->getKind() == TemplateArgument::Type) {
   if (auto *RD = Used->getAsType()->getAsCXXRecordDecl())
 removeFromFoundDecls(RD);
-} else if (Used->getKind() == TemplateArgument::Declaration) {
+  return;
+}
+
+if (Used->getKind() == TemplateArgument::Declaration) {
   RemoveNamedDecl(Used->getAsDecl());
 }
 return;



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


[PATCH] D159409: Haiku: Pick up a few more codegen parametres from downstream

2023-09-03 Thread Brad Smith via Phabricator via cfe-commits
brad updated this revision to Diff 555621.
brad added a comment.

Add a test for the debug handling.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159409

Files:
  clang/lib/Driver/ToolChains/Haiku.h
  clang/test/CodeGen/dwarf-version.c
  clang/test/Driver/clang-g-opts.c
  clang/test/Driver/debug-options.c
  clang/test/Driver/fast-math.c


Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -122,6 +122,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-openbsd -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### --target=x86_64-unknown-haiku -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-dragonfly -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -83,6 +83,11 @@
 // RUN: | FileCheck -check-prefix=G_GDB \
 // RUN: -check-prefix=G_DWARF4 %s
 
+// Haiku.
+// RUN: %clang -### -c -g %s -target x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF2 %s
+
 // Windows.
 // RUN: %clang -### -c -g %s -target x86_64-w64-windows-gnu 2>&1 \
 // RUN: | FileCheck -check-prefix=G_GDB %s
Index: clang/test/Driver/clang-g-opts.c
===
--- clang/test/Driver/clang-g-opts.c
+++ clang/test/Driver/clang-g-opts.c
@@ -9,6 +9,8 @@
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
+// RUN: %clang -### -S %s -g --target=x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 
 // 'g0' is the default. Just basic correctness check that it does nothing
 // RUN: %clang -### -S %s -g02>&1 | FileCheck 
--check-prefix=CHECK-WITHOUT-G %s
@@ -27,6 +29,8 @@
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g0 -g -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
+// RUN: %clang -### -S %s -g0 -g --target=x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g0 -g --target=i386-pc-solaris 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G %s
 
Index: clang/test/CodeGen/dwarf-version.c
===
--- clang/test/CodeGen/dwarf-version.c
+++ clang/test/CodeGen/dwarf-version.c
@@ -14,6 +14,7 @@
 // RUN: %clang -target x86_64-apple-darwin14 -g -S -emit-llvm -o - %s 
-isysroot %t | FileCheck %s --check-prefix=VER2
 
 // RUN: %clang -target powerpc-unknown-openbsd -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER2
+// RUN: %clang --target=x86_64-unknown-haiku -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER2
 // RUN: %clang -target powerpc-unknown-freebsd -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER4
 
 // Check which debug info formats we use on Windows. By default, in an MSVC
Index: clang/lib/Driver/ToolChains/Haiku.h
===
--- clang/lib/Driver/ToolChains/Haiku.h
+++ clang/lib/Driver/ToolChains/Haiku.h
@@ -22,6 +22,8 @@
   Haiku(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args);
 
+  bool IsMathErrnoDefault() const override { return false; }
+  bool IsObjCNonFragileABIDefault() const override { return true; }
   bool isPICDefault() const override { return true; }
 
   void AddClangSystemIncludeArgs(
@@ -33,6 +35,10 @@
   void addLibStdCxxIncludePaths(
   const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
+
+  unsigned GetDefaultDwarfVersion() const override { return 2; }
+
+  bool GetDefaultStandaloneDebug() const override { return true; }
 };
 
 } // end namespace toolchains


Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -122,6 +122,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-openbsd -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### --target=x8

[PATCH] D159409: Haiku: Pick up a few more codegen parametres from downstream

2023-09-03 Thread Brad Smith via Phabricator via cfe-commits
brad updated this revision to Diff 555622.
brad added a comment.

More context


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159409

Files:
  clang/lib/Driver/ToolChains/Haiku.h
  clang/test/CodeGen/dwarf-version.c
  clang/test/Driver/clang-g-opts.c
  clang/test/Driver/debug-options.c
  clang/test/Driver/fast-math.c


Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -122,6 +122,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-openbsd -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### --target=x86_64-unknown-haiku -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-dragonfly -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -83,6 +83,11 @@
 // RUN: | FileCheck -check-prefix=G_GDB \
 // RUN: -check-prefix=G_DWARF4 %s
 
+// Haiku.
+// RUN: %clang -### -c -g %s -target x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF2 %s
+
 // Windows.
 // RUN: %clang -### -c -g %s -target x86_64-w64-windows-gnu 2>&1 \
 // RUN: | FileCheck -check-prefix=G_GDB %s
Index: clang/test/Driver/clang-g-opts.c
===
--- clang/test/Driver/clang-g-opts.c
+++ clang/test/Driver/clang-g-opts.c
@@ -9,6 +9,8 @@
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
+// RUN: %clang -### -S %s -g --target=x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 
 // 'g0' is the default. Just basic correctness check that it does nothing
 // RUN: %clang -### -S %s -g02>&1 | FileCheck 
--check-prefix=CHECK-WITHOUT-G %s
@@ -27,6 +29,8 @@
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g0 -g -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
+// RUN: %clang -### -S %s -g0 -g --target=x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g0 -g --target=i386-pc-solaris 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G %s
 
Index: clang/test/CodeGen/dwarf-version.c
===
--- clang/test/CodeGen/dwarf-version.c
+++ clang/test/CodeGen/dwarf-version.c
@@ -14,6 +14,7 @@
 // RUN: %clang -target x86_64-apple-darwin14 -g -S -emit-llvm -o - %s 
-isysroot %t | FileCheck %s --check-prefix=VER2
 
 // RUN: %clang -target powerpc-unknown-openbsd -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER2
+// RUN: %clang --target=x86_64-unknown-haiku -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER2
 // RUN: %clang -target powerpc-unknown-freebsd -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER4
 
 // Check which debug info formats we use on Windows. By default, in an MSVC
Index: clang/lib/Driver/ToolChains/Haiku.h
===
--- clang/lib/Driver/ToolChains/Haiku.h
+++ clang/lib/Driver/ToolChains/Haiku.h
@@ -22,6 +22,8 @@
   Haiku(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args);
 
+  bool IsMathErrnoDefault() const override { return false; }
+  bool IsObjCNonFragileABIDefault() const override { return true; }
   bool isPICDefault() const override { return true; }
 
   void AddClangSystemIncludeArgs(
@@ -33,6 +35,10 @@
   void addLibStdCxxIncludePaths(
   const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
+
+  unsigned GetDefaultDwarfVersion() const override { return 2; }
+
+  bool GetDefaultStandaloneDebug() const override { return true; }
 };
 
 } // end namespace toolchains


Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -122,6 +122,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-openbsd -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### --target=x86_64-unknown-haiku -c 

[PATCH] D159409: Haiku: Pick up a few more codegen parametres from downstream

2023-09-03 Thread Niels Sascha Reedijk via Phabricator via cfe-commits
nielx added a comment.

Have you been able to test the changes?




Comment at: clang/lib/Driver/ToolChains/Haiku.h:39
+
+  unsigned GetDefaultDwarfVersion() const override { return 2; }
+

I propose pushing this to version 4. Haiku's GCC also defaults to version 4 now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159409

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


[PATCH] D159409: Haiku: Pick up a few more codegen parametres from downstream

2023-09-03 Thread Brad Smith via Phabricator via cfe-commits
brad added a comment.






Comment at: clang/lib/Driver/ToolChains/Haiku.h:39
+
+  unsigned GetDefaultDwarfVersion() const override { return 2; }
+

nielx wrote:
> I propose pushing this to version 4. Haiku's GCC also defaults to version 4 
> now.
I was using the version utilized by the patchset from the LLVM pacakge in 
HaikuPorts.

```
+  if (!global_options_set.x_dwarf_version)
+dwarf_version = 4;
```

It seems you're right. I think it should be bumped up as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159409

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


[PATCH] D159409: Haiku: Pick up a few more codegen parametres from downstream

2023-09-03 Thread Brad Smith via Phabricator via cfe-commits
brad updated this revision to Diff 555623.
brad added a comment.

Bump DWARF version to 4.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159409

Files:
  clang/lib/Driver/ToolChains/Haiku.h
  clang/test/CodeGen/dwarf-version.c
  clang/test/Driver/clang-g-opts.c
  clang/test/Driver/debug-options.c
  clang/test/Driver/fast-math.c


Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -122,6 +122,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-openbsd -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### --target=x86_64-unknown-haiku -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-dragonfly -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -83,6 +83,11 @@
 // RUN: | FileCheck -check-prefix=G_GDB \
 // RUN: -check-prefix=G_DWARF4 %s
 
+// Haiku.
+// RUN: %clang -### -c -g %s -target x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF4 %s
+
 // Windows.
 // RUN: %clang -### -c -g %s -target x86_64-w64-windows-gnu 2>&1 \
 // RUN: | FileCheck -check-prefix=G_GDB %s
Index: clang/test/Driver/clang-g-opts.c
===
--- clang/test/Driver/clang-g-opts.c
+++ clang/test/Driver/clang-g-opts.c
@@ -9,6 +9,8 @@
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
+// RUN: %clang -### -S %s -g --target=x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
 
 // 'g0' is the default. Just basic correctness check that it does nothing
 // RUN: %clang -### -S %s -g02>&1 | FileCheck 
--check-prefix=CHECK-WITHOUT-G %s
@@ -27,12 +29,15 @@
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g0 -g -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
+// RUN: %clang -### -S %s -g0 -g --target=x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
 // RUN: %clang -### -S %s -g0 -g --target=i386-pc-solaris 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G %s
 
 // CHECK-WITHOUT-G-NOT: -debug-info-kind
 // CHECK-WITH-G: "-debug-info-kind=constructor"
 // CHECK-WITH-G: "-dwarf-version=5"
+// CHECK-WITH-G-DWARF4: "-dwarf-version=4"
 // CHECK-WITH-G-DWARF2: "-dwarf-version=2"
 
 // CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
Index: clang/test/CodeGen/dwarf-version.c
===
--- clang/test/CodeGen/dwarf-version.c
+++ clang/test/CodeGen/dwarf-version.c
@@ -14,6 +14,7 @@
 // RUN: %clang -target x86_64-apple-darwin14 -g -S -emit-llvm -o - %s 
-isysroot %t | FileCheck %s --check-prefix=VER2
 
 // RUN: %clang -target powerpc-unknown-openbsd -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER2
+// RUN: %clang --target=x86_64-unknown-haiku -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER4
 // RUN: %clang -target powerpc-unknown-freebsd -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER4
 
 // Check which debug info formats we use on Windows. By default, in an MSVC
Index: clang/lib/Driver/ToolChains/Haiku.h
===
--- clang/lib/Driver/ToolChains/Haiku.h
+++ clang/lib/Driver/ToolChains/Haiku.h
@@ -22,6 +22,8 @@
   Haiku(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args);
 
+  bool IsMathErrnoDefault() const override { return false; }
+  bool IsObjCNonFragileABIDefault() const override { return true; }
   bool isPICDefault() const override { return true; }
 
   void AddClangSystemIncludeArgs(
@@ -33,6 +35,10 @@
   void addLibStdCxxIncludePaths(
   const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
+
+  unsigned GetDefaultDwarfVersion() const override { return 4; }
+
+  bool GetDefaultStandaloneDebug() const override { return true; }
 };
 
 } // end namespace toolchains


Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ 

[clang] Workaround for MSVC ARM64 build performance regression (PR #65215)

2023-09-03 Thread Tobias Hieta via cfe-commits

https://github.com/tru edited https://github.com/llvm/llvm-project/pull/65215
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Workaround for MSVC ARM64 build performance regression (PR #65215)

2023-09-03 Thread Tobias Hieta via cfe-commits

https://github.com/tru requested changes to this pull request.

Thanks for the PR, I think we at least need to make sure that we don't erase 
flags that have been set by the user manually.

Another option would just to say that this configuration ARM64 + MSVC of this 
version is not a valid configuration for MSVC and add it to 
ProblematicConfigurations here: 
https://github.com/llvm/llvm-project/blob/main/llvm/cmake/modules/CheckProblematicConfigurations.cmake

https://github.com/llvm/llvm-project/pull/65215
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Workaround for MSVC ARM64 build performance regression (PR #65215)

2023-09-03 Thread Tobias Hieta via cfe-commits


@@ -30,6 +30,15 @@ set(LLVM_LINK_COMPONENTS
   TransformUtils
   )
 
+# Workaround for MSVC ARM64 performance regression: disable all optimizations 
(/Od)
+# and then enable back all /O2 options except one.
+if(NOT CMAKE_BUILD_TYPE MATCHES Debug 
+AND MSVC 
+AND MSVC_VERSION VERSION_GREATER_EQUAL 1932
+AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64")
+  set_source_files_properties(CGBuiltin.cpp PROPERTIES COMPILE_FLAGS "/Od /Gw 
/Oi /Oy /Gy /Ob2 /Ot /GF")

tru wrote:

You are setting these settings for all configurations and erasing the other 
flags set for these files. I don't think that's the right solution. I would 
rather you grab the current compile_flags and then substitute the optimization 
flags only.

https://github.com/llvm/llvm-project/pull/65215
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Workaround for MSVC ARM64 build performance regression (PR #65215)

2023-09-03 Thread Tobias Hieta via cfe-commits

https://github.com/tru review_requested 
https://github.com/llvm/llvm-project/pull/65215
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Workaround for MSVC ARM64 build performance regression (PR #65215)

2023-09-03 Thread Tobias Hieta via cfe-commits


@@ -30,6 +30,15 @@ set(LLVM_LINK_COMPONENTS
   TransformUtils
   )
 
+# Workaround for MSVC ARM64 performance regression: disable all optimizations 
(/Od)

tru wrote:

I think this comment also should link to the issue on the Microsoft side so 
that we can know to remove this later.

https://github.com/llvm/llvm-project/pull/65215
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Workaround for MSVC ARM64 build performance regression (PR #65215)

2023-09-03 Thread Tobias Hieta via cfe-commits

https://github.com/tru labeled https://github.com/llvm/llvm-project/pull/65215
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Workaround for MSVC ARM64 build performance regression (PR #65215)

2023-09-03 Thread Tobias Hieta via cfe-commits

https://github.com/tru labeled https://github.com/llvm/llvm-project/pull/65215
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AST] Only dump desugared type when visibly different (PR #65214)

2023-09-03 Thread via cfe-commits

cor3ntin wrote:

> These are an artifact of how types are structured but serve little
purpose, merely showing that the type is sugared in some way. For
example, ElaboratedType's existence means struct S gets printed as
'struct S':'struct S' in the AST, which is unnecessary visual clutter.
Note that skipping the second print when the types have the same string
matches what we do for diagnostics, where the aka will be skipped.

There seems to be some words missing on the last line of the commit message / 
description.

Otherwise, the direction of the change looks reasonable to me.
We are still working through some bugs with CI, I'll take a longer look when 
that's fixed.


https://github.com/llvm/llvm-project/pull/65214
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AST] Only dump desugared type when visibly different (PR #65214)

2023-09-03 Thread via cfe-commits


@@ -315,12 +315,16 @@ std::string 
JSONNodeDumper::createPointerRepresentation(const void *Ptr) {
 
 llvm::json::Object JSONNodeDumper::createQualType(QualType QT, bool Desugar) {
   SplitQualType SQT = QT.split();
-  llvm::json::Object Ret{{"qualType", QualType::getAsString(SQT, 
PrintPolicy)}};
+  std::string SQTS = QualType::getAsString(SQT, PrintPolicy);
+  llvm::json::Object Ret{{"qualType", SQTS}};
 
   if (Desugar && !QT.isNull()) {
 SplitQualType DSQT = QT.getSplitDesugaredType();
-if (DSQT != SQT)
-  Ret["desugaredQualType"] = QualType::getAsString(DSQT, PrintPolicy);
+if (DSQT != SQT) {
+  std::string DSQTS = QualType::getAsString(DSQT, PrintPolicy);
+  if (DSQTS != SQTS)
+Ret["desugaredQualType"] = DSQTS;
+}

cor3ntin wrote:

You could make the argument that it make sense for json to have both.
Not having it slightly complicate the logic of consumer code.

I think we need to decide to either:
 - keep it
 - document the change in a ReleaseNotes entry.

https://github.com/llvm/llvm-project/pull/65214
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AST] Only dump desugared type when visibly different (PR #65214)

2023-09-03 Thread via cfe-commits


@@ -677,13 +677,18 @@ void TextNodeDumper::dumpBareType(QualType T, bool 
Desugar) {
   ColorScope Color(OS, ShowColors, TypeColor);
 
   SplitQualType T_split = T.split();
-  OS << "'" << QualType::getAsString(T_split, PrintPolicy) << "'";
+  std::string T_str = QualType::getAsString(T_split, PrintPolicy);
+  OS << "'" << T_str << "'";
 
   if (Desugar && !T.isNull()) {
-// If the type is sugared, also dump a (shallow) desugared type.
+// If the type is sugared, also dump a (shallow) desugared type when
+// visibly different.

cor3ntin wrote:

```suggestion
// If the type is sugared, also dump a (shallow) desugared type when
// it is visibly different.
```

https://github.com/llvm/llvm-project/pull/65214
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D159409: Haiku: Pick up a few more codegen parametres from downstream

2023-09-03 Thread Brad Smith via Phabricator via cfe-commits
brad updated this revision to Diff 555626.
brad marked an inline comment as not done.
brad added a comment.

Use --target= for all additions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159409

Files:
  clang/lib/Driver/ToolChains/Haiku.h
  clang/test/CodeGen/dwarf-version.c
  clang/test/Driver/clang-g-opts.c
  clang/test/Driver/debug-options.c
  clang/test/Driver/fast-math.c


Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -122,6 +122,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-openbsd -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### --target=x86_64-unknown-haiku -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-dragonfly -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -83,6 +83,11 @@
 // RUN: | FileCheck -check-prefix=G_GDB \
 // RUN: -check-prefix=G_DWARF4 %s
 
+// Haiku.
+// RUN: %clang -### -c -g %s --target=x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF4 %s
+
 // Windows.
 // RUN: %clang -### -c -g %s -target x86_64-w64-windows-gnu 2>&1 \
 // RUN: | FileCheck -check-prefix=G_GDB %s
Index: clang/test/Driver/clang-g-opts.c
===
--- clang/test/Driver/clang-g-opts.c
+++ clang/test/Driver/clang-g-opts.c
@@ -9,6 +9,8 @@
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
+// RUN: %clang -### -S %s -g --target=x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
 
 // 'g0' is the default. Just basic correctness check that it does nothing
 // RUN: %clang -### -S %s -g02>&1 | FileCheck 
--check-prefix=CHECK-WITHOUT-G %s
@@ -27,12 +29,15 @@
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g0 -g -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
+// RUN: %clang -### -S %s -g0 -g --target=x86_64-unknown-haiku 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
 // RUN: %clang -### -S %s -g0 -g --target=i386-pc-solaris 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G %s
 
 // CHECK-WITHOUT-G-NOT: -debug-info-kind
 // CHECK-WITH-G: "-debug-info-kind=constructor"
 // CHECK-WITH-G: "-dwarf-version=5"
+// CHECK-WITH-G-DWARF4: "-dwarf-version=4"
 // CHECK-WITH-G-DWARF2: "-dwarf-version=2"
 
 // CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
Index: clang/test/CodeGen/dwarf-version.c
===
--- clang/test/CodeGen/dwarf-version.c
+++ clang/test/CodeGen/dwarf-version.c
@@ -14,6 +14,7 @@
 // RUN: %clang -target x86_64-apple-darwin14 -g -S -emit-llvm -o - %s 
-isysroot %t | FileCheck %s --check-prefix=VER2
 
 // RUN: %clang -target powerpc-unknown-openbsd -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER2
+// RUN: %clang --target=x86_64-unknown-haiku -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER4
 // RUN: %clang -target powerpc-unknown-freebsd -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER4
 
 // Check which debug info formats we use on Windows. By default, in an MSVC
Index: clang/lib/Driver/ToolChains/Haiku.h
===
--- clang/lib/Driver/ToolChains/Haiku.h
+++ clang/lib/Driver/ToolChains/Haiku.h
@@ -22,6 +22,8 @@
   Haiku(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args);
 
+  bool IsMathErrnoDefault() const override { return false; }
+  bool IsObjCNonFragileABIDefault() const override { return true; }
   bool isPICDefault() const override { return true; }
 
   void AddClangSystemIncludeArgs(
@@ -33,6 +35,10 @@
   void addLibStdCxxIncludePaths(
   const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
+
+  unsigned GetDefaultDwarfVersion() const override { return 4; }
+
+  bool GetDefaultStandaloneDebug() const override { return true; }
 };
 
 } // end namespace toolchains


Index: clang/test/Driver/fast-math.c
==

[clang] 65b40f2 - RegAlloc: Rename MLRegalloc* files to use consistent captalization

2023-09-03 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2023-09-03T09:00:27-04:00
New Revision: 65b40f273f09a53f61a13ac6f4bb65ec4ac63d6e

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

LOG: RegAlloc: Rename MLRegalloc* files to use consistent captalization

The other regalloc related files use RegAlloc, not Regalloc.

Added: 
llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp
llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
llvm/lib/CodeGen/MLRegAllocPriorityAdvisor.cpp
llvm/test/CodeGen/MLRegAlloc/Inputs/input.ll
llvm/test/CodeGen/MLRegAlloc/Inputs/interactive_main.py
llvm/test/CodeGen/MLRegAlloc/Inputs/reference-log-noml.txt
llvm/test/CodeGen/MLRegAlloc/Inputs/reference-prio-log-noml.txt
llvm/test/CodeGen/MLRegAlloc/Inputs/two-large-fcts.ll
llvm/test/CodeGen/MLRegAlloc/bb-profile-dump.ll
llvm/test/CodeGen/MLRegAlloc/default-eviction-advisor.ll
llvm/test/CodeGen/MLRegAlloc/default-priority-advisor.ll
llvm/test/CodeGen/MLRegAlloc/dev-mode-extra-features-logging.ll
llvm/test/CodeGen/MLRegAlloc/dev-mode-log-2-fcts.ll
llvm/test/CodeGen/MLRegAlloc/dev-mode-logging.ll
llvm/test/CodeGen/MLRegAlloc/dev-mode-prio-logging.ll
llvm/test/CodeGen/MLRegAlloc/dev-rel-equivalence.ll
llvm/test/CodeGen/MLRegAlloc/empty-log.ll
llvm/test/CodeGen/MLRegAlloc/interactive-mode.ll
llvm/test/CodeGen/MLRegAlloc/lit.local.cfg
llvm/test/CodeGen/MLRegAlloc/rel-codepath.ll
llvm/unittests/CodeGen/MLRegAllocDevelopmentFeatures.cpp

Modified: 
.github/CODEOWNERS
clang/docs/tools/clang-formatted-files.txt
llvm/lib/Analysis/models/interactive_host.py
llvm/lib/CodeGen/CMakeLists.txt
llvm/unittests/CodeGen/CMakeLists.txt
llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn
llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn

Removed: 
llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
llvm/lib/CodeGen/MLRegallocEvictAdvisor.h
llvm/lib/CodeGen/MLRegallocPriorityAdvisor.cpp
llvm/test/CodeGen/MLRegalloc/Inputs/input.ll
llvm/test/CodeGen/MLRegalloc/Inputs/interactive_main.py
llvm/test/CodeGen/MLRegalloc/Inputs/reference-log-noml.txt
llvm/test/CodeGen/MLRegalloc/Inputs/reference-prio-log-noml.txt
llvm/test/CodeGen/MLRegalloc/Inputs/two-large-fcts.ll
llvm/test/CodeGen/MLRegalloc/bb-profile-dump.ll
llvm/test/CodeGen/MLRegalloc/default-eviction-advisor.ll
llvm/test/CodeGen/MLRegalloc/default-priority-advisor.ll
llvm/test/CodeGen/MLRegalloc/dev-mode-extra-features-logging.ll
llvm/test/CodeGen/MLRegalloc/dev-mode-log-2-fcts.ll
llvm/test/CodeGen/MLRegalloc/dev-mode-logging.ll
llvm/test/CodeGen/MLRegalloc/dev-mode-prio-logging.ll
llvm/test/CodeGen/MLRegalloc/dev-rel-equivalence.ll
llvm/test/CodeGen/MLRegalloc/empty-log.ll
llvm/test/CodeGen/MLRegalloc/interactive-mode.ll
llvm/test/CodeGen/MLRegalloc/lit.local.cfg
llvm/test/CodeGen/MLRegalloc/rel-codepath.ll
llvm/unittests/CodeGen/MLRegallocDevelopmentFeatures.cpp



diff  --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index aa80b55eb32334e..2e56b4a476442f3 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -541,5 +541,5 @@ utils/bazel/llvm-project-overlay/libc/** 
@llvm/pr-subscribers-libc
 /llvm/test/Transforms/inline/ML/ @llvm/pr-subscribers-mlgo
 /llvm/lib/CodeGen/ML* @llvm/pr-subscribers-mlgo
 /llvm/unittests/CodeGen/ML* @llvm/pr-subscribers-mlgo
-/llvm/test/CodeGen/MLRegalloc/ @llvm/pr-subscribers-mlgo
+/llvm/test/CodeGen/MLRegAlloc/ @llvm/pr-subscribers-mlgo
 

diff  --git a/clang/docs/tools/clang-formatted-files.txt 
b/clang/docs/tools/clang-formatted-files.txt
index 648b2401c32d18f..16f84727117e28d 100644
--- a/clang/docs/tools/clang-formatted-files.txt
+++ b/clang/docs/tools/clang-formatted-files.txt
@@ -5800,7 +5800,7 @@ llvm/lib/CodeGen/MIRPrintingPass.cpp
 llvm/lib/CodeGen/MIRSampleProfile.cpp
 llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
 llvm/lib/CodeGen/MIRYamlMapping.cpp
-llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
+llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp
 llvm/lib/CodeGen/MultiHazardRecognizer.cpp
 llvm/lib/CodeGen/NonRelocatableStringpool.cpp
 llvm/lib/CodeGen/ParallelCG.cpp

diff  --git a/llvm/lib/Analysis/models/interactive_host.py 
b/llvm/lib/Analysis/models/interactive_host.py
index 759c791614a1da0..f2c2b640e7f4f2a 100644
--- a/llvm/lib/Analysis/models/interactive_host.py
+++ b/llvm/lib/Analysis/models/interactive_host.py
@@ -8,7 +8,7 @@
 
 Examples:
 test/Transforms/Inline/ML/interactive-mode.ll
-test/CodeGen/MLRegalloc/interactive-mode.ll
+test/CodeGen/MLRegAlloc/interactive-mode.ll
 """
 
 import ctypes

diff  --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index 31dbe5c84636a45..389c70d04f17ba3 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -12

[PATCH] D159383: [Headers] Remove musl-related comment about NULL

2023-09-03 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

As far as the change goes, this is fine (it keeps the status quo we previously 
had), but I still wonder if we should be trying to detect that the user is 
working with musl and do an include_next so our stddef.h header never gets 
involved in musl's standard library headers except as a pass-through. If 
@dalias thinks that would be beneficial to musl, it may be worth doing in a 
follow-up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159383

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


[PATCH] D158486: [clang-tidy] Ignore used special-members in modernize-use-equals-delete

2023-09-03 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.

LGTM, thanks for fixing!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158486

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


[PATCH] D159383: [Headers] Remove musl-related comment about NULL

2023-09-03 Thread Rich Felker via Phabricator via cfe-commits
dalias added a comment.

musl targets **already** have the libc header path before the compiler header 
path in a BSD-like configuration (the BSDs also have this order on GCC and I 
would assume on clang as well), so if the compiler-provided `stddef.h` is 
getting seen at all, there's either a bug in clang's path logic or (more 
likely) user error, like trying to use musl with a non-musl target tuple, no 
"system headers" path, and simple `-I` to point at the musl headers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159383

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


[clang-tools-extra] [clang-tidy] readability-identifier-naming - fix StructCase and UnionCase in C (PR #65202)

2023-09-03 Thread Carlos Galvez via cfe-commits

https://github.com/carlosgalvezp approved this pull request.

LGTM!

https://github.com/llvm/llvm-project/pull/65202
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] fa8e740 - [clang-tidy] readability-identifier-naming - fix StructCase and UnionCase in C (#65202)

2023-09-03 Thread via cfe-commits

Author: Piotr Zegar
Date: 2023-09-03T18:40:18+02:00
New Revision: fa8e74073762300d07b02adec42c629daf82c44b

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

LOG: [clang-tidy] readability-identifier-naming - fix StructCase and UnionCase 
in C (#65202)

In C struct are visible as RecordDecl, not as CXXRecordDecl, this type
of declaration were not supported in this check before. Changing check
to support it. Added tests.

Fixes: #55422

Added: 


Modified: 
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/docs/ReleaseNotes.rst

clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/hungarian-notation1/.clang-tidy

clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-c-language.c

clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation.cpp

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index ad20b777202a854..7539b3899682e13 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -1151,13 +1151,15 @@ StyleKind IdentifierNamingCheck::findStyleKind(
 return SK_Invalid;
   }
 
-  if (const auto *Decl = dyn_cast(D)) {
+  if (const auto *Decl = dyn_cast(D)) {
 if (Decl->isAnonymousStructOrUnion())
   return SK_Invalid;
 
 if (const auto *Definition = Decl->getDefinition()) {
-  if (Definition->isAbstract() && NamingStyles[SK_AbstractClass])
-return SK_AbstractClass;
+  if (const auto *CxxRecordDecl = dyn_cast(Definition)) {
+if (CxxRecordDecl->isAbstract() && NamingStyles[SK_AbstractClass])
+  return SK_AbstractClass;
+  }
 
   if (Definition->isStruct() && NamingStyles[SK_Struct])
 return SK_Struct;

diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 69f7268bc3779dc..740c1c87e054ecb 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -256,9 +256,11 @@ Changes in existing checks
   ``length()`` method as an alternative to ``size()``.
 
 - Improved :doc:`readability-identifier-naming
-  ` check to emit proper
-  warnings when a type forward declaration precedes its definition and
-  added support for ``Leading_upper_snake_case`` naming convention.
+  ` check to issue accurate
+  warnings when a type's forward declaration precedes its definition.
+  Additionally, it now provides appropriate warnings for ``struct`` and
+  ``union`` in C, while also incorporating support for the
+  ``Leading_upper_snake_case`` naming convention.
 
 - Improved :doc:`readability-implicit-bool-conversion
   ` check to take

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/hungarian-notation1/.clang-tidy
 
b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/hungarian-notation1/.clang-tidy
index fb68fa542e16033..ff41479e2e96dbd 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/hungarian-notation1/.clang-tidy
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/hungarian-notation1/.clang-tidy
@@ -1,6 +1,8 @@
 Checks: readability-identifier-naming
 CheckOptions:
   readability-identifier-naming.AbstractClassCase: CamelCase
+  readability-identifier-naming.StructCase: CamelCase
+  readability-identifier-naming.UnionCase: camelBack
   readability-identifier-naming.ClassCase: CamelCase
   readability-identifier-naming.ClassConstantCase: CamelCase
   readability-identifier-naming.ClassMemberCase: CamelCase

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-c-language.c
 
b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-c-language.c
index abd7e1b8f275d89..dd82c11a3077638 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-c-language.c
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-c-language.c
@@ -63,9 +63,14 @@ struct MyStruct { int StructCase; };
 // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: invalid case style for public 
member 'StructCase' [readability-identifier-naming]
 // CHECK-FIXES: {{^}}struct MyStruct { int iStructCase; };
 
+struct shouldBeCamelCaseStruct { int iField; };
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for struct 
'shouldBeCamelCaseStruct' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}

[clang-tools-extra] [clang-tidy] readability-identifier-naming - fix StructCase and UnionCase in C (PR #65202)

2023-09-03 Thread Piotr Zegar via cfe-commits

https://github.com/PiotrZSL closed 
https://github.com/llvm/llvm-project/pull/65202
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Add flags to dump IR to a file before and after LLVM passes (PR #65179)

2023-09-03 Thread Nuri Amari via cfe-commits

https://github.com/NuriAmari updated 
https://github.com/llvm/llvm-project/pull/65179:

>From 5d395c85b84e5a554df4b092014d38123e666c6c Mon Sep 17 00:00:00 2001
From: Nuri Amari 
Date: Tue, 29 Aug 2023 10:10:57 -0700
Subject: [PATCH 1/2] Add flags to dump IR to a file before and after LLVM
 passes

Summary:

LLVM offers -print-after and -print-before flags that allow you
to print IR to stderr before and after any pass you want. This can
be useful for debugging LLVM optimization issue, but is far too
noisy for large builds.

This patch adds analogous options -dump-after and -dump-before that
dump the IR to appropriately named files. In addition, it also
introduces flags -dump-after-all, -dump-before-all and -ir-dump-directory
to control where the files are written to.

Test Plan:

Included LIT tests:
```
ninja check-llvm
```
---
 llvm/include/llvm/IR/PrintPasses.h|  21 +++
 .../llvm/Passes/StandardInstrumentations.h|  57 ++
 llvm/lib/IR/PrintPasses.cpp   |  54 ++
 llvm/lib/Passes/PassBuilder.cpp   |   3 +-
 llvm/lib/Passes/StandardInstrumentations.cpp  | 178 ++
 .../Other/dump-before-after-file-contents |  76 
 llvm/test/Other/dump-before-after-filenames   |  71 +++
 .../Other/dump-before-after-multiple-modules  |  36 
 llvm/test/Other/lit.local.cfg |   1 +
 9 files changed, 496 insertions(+), 1 deletion(-)
 create mode 100644 llvm/test/Other/dump-before-after-file-contents
 create mode 100644 llvm/test/Other/dump-before-after-filenames
 create mode 100644 llvm/test/Other/dump-before-after-multiple-modules
 create mode 100644 llvm/test/Other/lit.local.cfg

diff --git a/llvm/include/llvm/IR/PrintPasses.h 
b/llvm/include/llvm/IR/PrintPasses.h
index 95b97e76c867cb2..b2a9017521c6a91 100644
--- a/llvm/include/llvm/IR/PrintPasses.h
+++ b/llvm/include/llvm/IR/PrintPasses.h
@@ -48,6 +48,27 @@ bool shouldPrintAfterAll();
 std::vector printBeforePasses();
 std::vector printAfterPasses();
 
+// Returns true if dumping IR to a file before/after some pass is enabled
+// wether all passes or a specific pass.
+bool shouldDumpBeforeSomePass();
+bool shouldDumpAfterSomePass();
+
+// Returns true if we should dump IR to a file before/after a specific pass. 
The
+// argument should be the pass ID, e.g. "instcombine"
+bool shouldDumpBeforePass(StringRef PassID);
+bool shouldDumpAfterPass(StringRef PassID);
+
+// Returns true if we should dump IR to a file before/after all passes.
+bool shouldDumpBeforeAll();
+bool shouldDumpAfterAll();
+
+// The list of passes to dump IR to a file before/after, if we only want
+// to print before/after specific passes.
+std::vector dumpBeforePasses();
+std::vector dumpAfterPasses();
+
+StringRef irInstrumentationDumpDirectory();
+
 // Returns true if we should always print the entire module.
 bool forcePrintModuleIR();
 
diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h 
b/llvm/include/llvm/Passes/StandardInstrumentations.h
index 331130c6b22d990..4068a68aa956fd1 100644
--- a/llvm/include/llvm/Passes/StandardInstrumentations.h
+++ b/llvm/include/llvm/Passes/StandardInstrumentations.h
@@ -69,6 +69,62 @@ class PrintIRInstrumentation {
   unsigned CurrentPassNumber = 0;
 };
 
+class DumpIRInstrumentation {
+public:
+  void registerCallbacks(PassInstrumentationCallbacks &PIC);
+
+private:
+  void dumpBeforePass(StringRef PassID, Any IR);
+  void dumpAfterPass(StringRef PassID, Any IR);
+
+  bool shouldDumpBeforePass(StringRef PassID);
+  bool shouldDumpAfterPass(StringRef PassID);
+
+  PassInstrumentationCallbacks *PIC;
+
+  // The module currently being processed in the pipeline.
+  Module const *CurrentModule = nullptr;
+
+  void pushPass(StringRef PassID, Any IR);
+  void popPass(StringRef PassID);
+
+  SmallString<16> InstrumentationDumpDirectory;
+  StringRef fetchInstrumentationDumpDirectory();
+
+  SmallString<16> fetchCurrentInstrumentationDumpFile(StringRef Suffix);
+
+  // A table to store how many times a given pass has run at the current 
"nested
+  // level"
+  using PassRunsFrequencyTableT = DenseMap;
+  // A stack each frame of which (aside from the very first) represents a pass
+  // being run on some unit of IR. The larger, the stack grows, the smaller the
+  // unit of IR. For example, we would first push a module pass, then for each
+  // function pass in that module pass, we would push a frame and so on. This
+  // information is used to craft the output path for this logging.
+  //
+  // Each frame contains a map to track how many times a given subpass runs. 
For
+  // example, to keep track of how many times a function pass Foo runs within a
+  // module pass Bar. The first frame of the stack represents the module being
+  // processed rather than any particular pass. This is to create a frequency
+  // table to track module level pass run counts without having to special case
+  // that logic.
+  //
+  // When a change in the module being processed is detecte

[clang-tools-extra] Add flags to dump IR to a file before and after LLVM passes (PR #65179)

2023-09-03 Thread Nuri Amari via cfe-commits

https://github.com/NuriAmari updated 
https://github.com/llvm/llvm-project/pull/65179:

>From 5d395c85b84e5a554df4b092014d38123e666c6c Mon Sep 17 00:00:00 2001
From: Nuri Amari 
Date: Tue, 29 Aug 2023 10:10:57 -0700
Subject: [PATCH 1/2] Add flags to dump IR to a file before and after LLVM
 passes

Summary:

LLVM offers -print-after and -print-before flags that allow you
to print IR to stderr before and after any pass you want. This can
be useful for debugging LLVM optimization issue, but is far too
noisy for large builds.

This patch adds analogous options -dump-after and -dump-before that
dump the IR to appropriately named files. In addition, it also
introduces flags -dump-after-all, -dump-before-all and -ir-dump-directory
to control where the files are written to.

Test Plan:

Included LIT tests:
```
ninja check-llvm
```
---
 llvm/include/llvm/IR/PrintPasses.h|  21 +++
 .../llvm/Passes/StandardInstrumentations.h|  57 ++
 llvm/lib/IR/PrintPasses.cpp   |  54 ++
 llvm/lib/Passes/PassBuilder.cpp   |   3 +-
 llvm/lib/Passes/StandardInstrumentations.cpp  | 178 ++
 .../Other/dump-before-after-file-contents |  76 
 llvm/test/Other/dump-before-after-filenames   |  71 +++
 .../Other/dump-before-after-multiple-modules  |  36 
 llvm/test/Other/lit.local.cfg |   1 +
 9 files changed, 496 insertions(+), 1 deletion(-)
 create mode 100644 llvm/test/Other/dump-before-after-file-contents
 create mode 100644 llvm/test/Other/dump-before-after-filenames
 create mode 100644 llvm/test/Other/dump-before-after-multiple-modules
 create mode 100644 llvm/test/Other/lit.local.cfg

diff --git a/llvm/include/llvm/IR/PrintPasses.h 
b/llvm/include/llvm/IR/PrintPasses.h
index 95b97e76c867cb2..b2a9017521c6a91 100644
--- a/llvm/include/llvm/IR/PrintPasses.h
+++ b/llvm/include/llvm/IR/PrintPasses.h
@@ -48,6 +48,27 @@ bool shouldPrintAfterAll();
 std::vector printBeforePasses();
 std::vector printAfterPasses();
 
+// Returns true if dumping IR to a file before/after some pass is enabled
+// wether all passes or a specific pass.
+bool shouldDumpBeforeSomePass();
+bool shouldDumpAfterSomePass();
+
+// Returns true if we should dump IR to a file before/after a specific pass. 
The
+// argument should be the pass ID, e.g. "instcombine"
+bool shouldDumpBeforePass(StringRef PassID);
+bool shouldDumpAfterPass(StringRef PassID);
+
+// Returns true if we should dump IR to a file before/after all passes.
+bool shouldDumpBeforeAll();
+bool shouldDumpAfterAll();
+
+// The list of passes to dump IR to a file before/after, if we only want
+// to print before/after specific passes.
+std::vector dumpBeforePasses();
+std::vector dumpAfterPasses();
+
+StringRef irInstrumentationDumpDirectory();
+
 // Returns true if we should always print the entire module.
 bool forcePrintModuleIR();
 
diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h 
b/llvm/include/llvm/Passes/StandardInstrumentations.h
index 331130c6b22d990..4068a68aa956fd1 100644
--- a/llvm/include/llvm/Passes/StandardInstrumentations.h
+++ b/llvm/include/llvm/Passes/StandardInstrumentations.h
@@ -69,6 +69,62 @@ class PrintIRInstrumentation {
   unsigned CurrentPassNumber = 0;
 };
 
+class DumpIRInstrumentation {
+public:
+  void registerCallbacks(PassInstrumentationCallbacks &PIC);
+
+private:
+  void dumpBeforePass(StringRef PassID, Any IR);
+  void dumpAfterPass(StringRef PassID, Any IR);
+
+  bool shouldDumpBeforePass(StringRef PassID);
+  bool shouldDumpAfterPass(StringRef PassID);
+
+  PassInstrumentationCallbacks *PIC;
+
+  // The module currently being processed in the pipeline.
+  Module const *CurrentModule = nullptr;
+
+  void pushPass(StringRef PassID, Any IR);
+  void popPass(StringRef PassID);
+
+  SmallString<16> InstrumentationDumpDirectory;
+  StringRef fetchInstrumentationDumpDirectory();
+
+  SmallString<16> fetchCurrentInstrumentationDumpFile(StringRef Suffix);
+
+  // A table to store how many times a given pass has run at the current 
"nested
+  // level"
+  using PassRunsFrequencyTableT = DenseMap;
+  // A stack each frame of which (aside from the very first) represents a pass
+  // being run on some unit of IR. The larger, the stack grows, the smaller the
+  // unit of IR. For example, we would first push a module pass, then for each
+  // function pass in that module pass, we would push a frame and so on. This
+  // information is used to craft the output path for this logging.
+  //
+  // Each frame contains a map to track how many times a given subpass runs. 
For
+  // example, to keep track of how many times a function pass Foo runs within a
+  // module pass Bar. The first frame of the stack represents the module being
+  // processed rather than any particular pass. This is to create a frequency
+  // table to track module level pass run counts without having to special case
+  // that logic.
+  //
+  // When a change in the module being processed is detecte

[clang-tools-extra] 208fa9a - [clang-tidy] Ignore used special-members in modernize-use-equals-delete

2023-09-03 Thread Piotr Zegar via cfe-commits

Author: Piotr Zegar
Date: 2023-09-03T17:05:31Z
New Revision: 208fa9acc0ffe5a460bcd504229c24a8d3f87180

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

LOG: [clang-tidy] Ignore used special-members in modernize-use-equals-delete

Special members marked as used, or with out-of-line
definition should not raise an warning now.

Fixes: #33759

Reviewed By: carlosgalvezp

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

Added: 


Modified: 
clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-delete.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
index b82c01ee7708cce..059a0af60d3ee84 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
@@ -15,32 +15,53 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::modernize {
 
+namespace {
+AST_MATCHER(FunctionDecl, hasAnyDefinition) {
+  if (Node.hasBody() || Node.isPure() || Node.isDefaulted() || 
Node.isDeleted())
+return true;
+
+  if (const FunctionDecl *Definition = Node.getDefinition())
+if (Definition->hasBody() || Definition->isPure() ||
+Definition->isDefaulted() || Definition->isDeleted())
+  return true;
+
+  return false;
+}
+
+AST_MATCHER(Decl, isUsed) { return Node.isUsed(); }
+
+AST_MATCHER(CXXMethodDecl, isSpecialFunction) {
+  if (const auto *Constructor = dyn_cast(&Node))
+return Constructor->isDefaultConstructor() ||
+   Constructor->isCopyOrMoveConstructor();
+
+  return isa(Node) || Node.isCopyAssignmentOperator() ||
+ Node.isMoveAssignmentOperator();
+}
+} // namespace
+
 static const char SpecialFunction[] = "SpecialFunction";
 static const char DeletedNotPublic[] = "DeletedNotPublic";
 
+UseEqualsDeleteCheck::UseEqualsDeleteCheck(StringRef Name,
+   ClangTidyContext *Context)
+: ClangTidyCheck(Name, Context),
+  IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
+
 void UseEqualsDeleteCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "IgnoreMacros", IgnoreMacros);
 }
 
 void UseEqualsDeleteCheck::registerMatchers(MatchFinder *Finder) {
-  auto PrivateSpecialFn = cxxMethodDecl(
-  isPrivate(),
-  anyOf(cxxConstructorDecl(anyOf(isDefaultConstructor(),
- isCopyConstructor(), 
isMoveConstructor())),
-cxxMethodDecl(
-anyOf(isCopyAssignmentOperator(), isMoveAssignmentOperator())),
-cxxDestructorDecl()));
+  auto PrivateSpecialFn = cxxMethodDecl(isPrivate(), isSpecialFunction());
 
   Finder->addMatcher(
   cxxMethodDecl(
-  PrivateSpecialFn,
-  unless(anyOf(hasAnyBody(stmt()), isDefaulted(), isDeleted(),
-   ast_matchers::isTemplateInstantiation(),
-   // Ensure that all methods except private special member
-   // functions are defined.
-   hasParent(cxxRecordDecl(hasMethod(unless(
-   anyOf(PrivateSpecialFn, hasAnyBody(stmt()), 
isPure(),
- isDefaulted(), isDeleted()
+  PrivateSpecialFn, unless(hasAnyDefinition()), unless(isUsed()),
+  // Ensure that all methods except private special member functions 
are
+  // defined.
+  unless(ofClass(hasMethod(cxxMethodDecl(unless(PrivateSpecialFn),
+ 
unless(hasAnyDefinition()))
   .bind(SpecialFunction),
   this);
 
@@ -55,7 +76,7 @@ void UseEqualsDeleteCheck::check(const 
MatchFinder::MatchResult &Result) {
 SourceLocation EndLoc = Lexer::getLocForEndOfToken(
 Func->getEndLoc(), 0, *Result.SourceManager, getLangOpts());
 
-if (Func->getLocation().isMacroID() && IgnoreMacros)
+if (IgnoreMacros && Func->getLocation().isMacroID())
   return;
 // FIXME: Improve FixItHint to make the method public.
 diag(Func->getLocation(),
@@ -66,7 +87,7 @@ void UseEqualsDeleteCheck::check(const 
MatchFinder::MatchResult &Result) {
 // Ignore this warning in macros, since it's extremely noisy in code using
 // DISALLOW_COPY_AND_ASSIGN-style macros and there's no easy way to
 // automatically fix the warning when macros are in play.
-if (Func->getLocation().isMacroID() && IgnoreMacros)
+if (IgnoreMacros && Func->getLocation().isMacroID())
   return;
 // FIXME: Ad

[PATCH] D158486: [clang-tidy] Ignore used special-members in modernize-use-equals-delete

2023-09-03 Thread Piotr Zegar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG208fa9acc0ff: [clang-tidy] Ignore used special-members in 
modernize-use-equals-delete (authored by PiotrZSL).

Changed prior to commit:
  https://reviews.llvm.org/D158486?vs=552217&id=555635#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158486

Files:
  clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
  clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-delete.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-delete.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-delete.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-delete.cpp
@@ -191,3 +191,31 @@
 private:
   MACRO(C);
 };
+
+namespace PR33759 {
+
+  class Number {
+private:
+  Number();
+  ~Number();
+
+public:
+  static Number& getNumber() {
+static Number number;
+return number;
+  }
+
+  int getIntValue() { return (int)someFloat; }
+  float getFloatValue() { return someFloat; }
+private:
+  float someFloat;
+  };
+
+  class Number2 {
+private:
+  Number2();
+  ~Number2();
+public:
+  static Number& getNumber();
+  };
+}
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -234,6 +234,10 @@
   ` to support for-loops with
   iterators initialized by free functions like ``begin``, ``end``, or ``size``.
 
+- Improved :doc:`modernize-use-equals-delete
+  ` check to ignore
+  false-positives when special member function is actually used or implicit.
+
 - Improved :doc:`modernize-use-std-print
   ` check to accurately generate
   fixes for reordering arguments.
Index: clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
===
--- clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
+++ clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
@@ -34,15 +34,16 @@
 /// http://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-delete.html
 class UseEqualsDeleteCheck : public ClangTidyCheck {
 public:
-  UseEqualsDeleteCheck(StringRef Name, ClangTidyContext *Context)
-  : ClangTidyCheck(Name, Context),
-IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
+  UseEqualsDeleteCheck(StringRef Name, ClangTidyContext *Context);
   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
 return LangOpts.CPlusPlus;
   }
   void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+  std::optional getCheckTraversalKind() const override {
+return TK_IgnoreUnlessSpelledInSource;
+  }
 
 private:
   const bool IgnoreMacros;
Index: clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
===
--- clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
@@ -15,32 +15,53 @@
 
 namespace clang::tidy::modernize {
 
+namespace {
+AST_MATCHER(FunctionDecl, hasAnyDefinition) {
+  if (Node.hasBody() || Node.isPure() || Node.isDefaulted() || Node.isDeleted())
+return true;
+
+  if (const FunctionDecl *Definition = Node.getDefinition())
+if (Definition->hasBody() || Definition->isPure() ||
+Definition->isDefaulted() || Definition->isDeleted())
+  return true;
+
+  return false;
+}
+
+AST_MATCHER(Decl, isUsed) { return Node.isUsed(); }
+
+AST_MATCHER(CXXMethodDecl, isSpecialFunction) {
+  if (const auto *Constructor = dyn_cast(&Node))
+return Constructor->isDefaultConstructor() ||
+   Constructor->isCopyOrMoveConstructor();
+
+  return isa(Node) || Node.isCopyAssignmentOperator() ||
+ Node.isMoveAssignmentOperator();
+}
+} // namespace
+
 static const char SpecialFunction[] = "SpecialFunction";
 static const char DeletedNotPublic[] = "DeletedNotPublic";
 
+UseEqualsDeleteCheck::UseEqualsDeleteCheck(StringRef Name,
+   ClangTidyContext *Context)
+: ClangTidyCheck(Name, Context),
+  IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
+
 void UseEqualsDeleteCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "IgnoreMacros", IgnoreMacros);
 }
 
 void UseEqualsDeleteCheck::registerMatchers(MatchFinder *Finder) {
-  auto PrivateSpecialFn = cxxMethodDecl

[clang-tools-extra] Add flags to dump IR to a file before and after LLVM passes (PR #65179)

2023-09-03 Thread Nuri Amari via cfe-commits

https://github.com/NuriAmari updated 
https://github.com/llvm/llvm-project/pull/65179:

>From 5d395c85b84e5a554df4b092014d38123e666c6c Mon Sep 17 00:00:00 2001
From: Nuri Amari 
Date: Tue, 29 Aug 2023 10:10:57 -0700
Subject: [PATCH 1/3] Add flags to dump IR to a file before and after LLVM
 passes

Summary:

LLVM offers -print-after and -print-before flags that allow you
to print IR to stderr before and after any pass you want. This can
be useful for debugging LLVM optimization issue, but is far too
noisy for large builds.

This patch adds analogous options -dump-after and -dump-before that
dump the IR to appropriately named files. In addition, it also
introduces flags -dump-after-all, -dump-before-all and -ir-dump-directory
to control where the files are written to.

Test Plan:

Included LIT tests:
```
ninja check-llvm
```
---
 llvm/include/llvm/IR/PrintPasses.h|  21 +++
 .../llvm/Passes/StandardInstrumentations.h|  57 ++
 llvm/lib/IR/PrintPasses.cpp   |  54 ++
 llvm/lib/Passes/PassBuilder.cpp   |   3 +-
 llvm/lib/Passes/StandardInstrumentations.cpp  | 178 ++
 .../Other/dump-before-after-file-contents |  76 
 llvm/test/Other/dump-before-after-filenames   |  71 +++
 .../Other/dump-before-after-multiple-modules  |  36 
 llvm/test/Other/lit.local.cfg |   1 +
 9 files changed, 496 insertions(+), 1 deletion(-)
 create mode 100644 llvm/test/Other/dump-before-after-file-contents
 create mode 100644 llvm/test/Other/dump-before-after-filenames
 create mode 100644 llvm/test/Other/dump-before-after-multiple-modules
 create mode 100644 llvm/test/Other/lit.local.cfg

diff --git a/llvm/include/llvm/IR/PrintPasses.h 
b/llvm/include/llvm/IR/PrintPasses.h
index 95b97e76c867cb2..b2a9017521c6a91 100644
--- a/llvm/include/llvm/IR/PrintPasses.h
+++ b/llvm/include/llvm/IR/PrintPasses.h
@@ -48,6 +48,27 @@ bool shouldPrintAfterAll();
 std::vector printBeforePasses();
 std::vector printAfterPasses();
 
+// Returns true if dumping IR to a file before/after some pass is enabled
+// wether all passes or a specific pass.
+bool shouldDumpBeforeSomePass();
+bool shouldDumpAfterSomePass();
+
+// Returns true if we should dump IR to a file before/after a specific pass. 
The
+// argument should be the pass ID, e.g. "instcombine"
+bool shouldDumpBeforePass(StringRef PassID);
+bool shouldDumpAfterPass(StringRef PassID);
+
+// Returns true if we should dump IR to a file before/after all passes.
+bool shouldDumpBeforeAll();
+bool shouldDumpAfterAll();
+
+// The list of passes to dump IR to a file before/after, if we only want
+// to print before/after specific passes.
+std::vector dumpBeforePasses();
+std::vector dumpAfterPasses();
+
+StringRef irInstrumentationDumpDirectory();
+
 // Returns true if we should always print the entire module.
 bool forcePrintModuleIR();
 
diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h 
b/llvm/include/llvm/Passes/StandardInstrumentations.h
index 331130c6b22d990..4068a68aa956fd1 100644
--- a/llvm/include/llvm/Passes/StandardInstrumentations.h
+++ b/llvm/include/llvm/Passes/StandardInstrumentations.h
@@ -69,6 +69,62 @@ class PrintIRInstrumentation {
   unsigned CurrentPassNumber = 0;
 };
 
+class DumpIRInstrumentation {
+public:
+  void registerCallbacks(PassInstrumentationCallbacks &PIC);
+
+private:
+  void dumpBeforePass(StringRef PassID, Any IR);
+  void dumpAfterPass(StringRef PassID, Any IR);
+
+  bool shouldDumpBeforePass(StringRef PassID);
+  bool shouldDumpAfterPass(StringRef PassID);
+
+  PassInstrumentationCallbacks *PIC;
+
+  // The module currently being processed in the pipeline.
+  Module const *CurrentModule = nullptr;
+
+  void pushPass(StringRef PassID, Any IR);
+  void popPass(StringRef PassID);
+
+  SmallString<16> InstrumentationDumpDirectory;
+  StringRef fetchInstrumentationDumpDirectory();
+
+  SmallString<16> fetchCurrentInstrumentationDumpFile(StringRef Suffix);
+
+  // A table to store how many times a given pass has run at the current 
"nested
+  // level"
+  using PassRunsFrequencyTableT = DenseMap;
+  // A stack each frame of which (aside from the very first) represents a pass
+  // being run on some unit of IR. The larger, the stack grows, the smaller the
+  // unit of IR. For example, we would first push a module pass, then for each
+  // function pass in that module pass, we would push a frame and so on. This
+  // information is used to craft the output path for this logging.
+  //
+  // Each frame contains a map to track how many times a given subpass runs. 
For
+  // example, to keep track of how many times a function pass Foo runs within a
+  // module pass Bar. The first frame of the stack represents the module being
+  // processed rather than any particular pass. This is to create a frequency
+  // table to track module level pass run counts without having to special case
+  // that logic.
+  //
+  // When a change in the module being processed is detecte

[clang] Add flags to dump IR to a file before and after LLVM passes (PR #65179)

2023-09-03 Thread Nuri Amari via cfe-commits

https://github.com/NuriAmari updated 
https://github.com/llvm/llvm-project/pull/65179:

>From 5d395c85b84e5a554df4b092014d38123e666c6c Mon Sep 17 00:00:00 2001
From: Nuri Amari 
Date: Tue, 29 Aug 2023 10:10:57 -0700
Subject: [PATCH 1/3] Add flags to dump IR to a file before and after LLVM
 passes

Summary:

LLVM offers -print-after and -print-before flags that allow you
to print IR to stderr before and after any pass you want. This can
be useful for debugging LLVM optimization issue, but is far too
noisy for large builds.

This patch adds analogous options -dump-after and -dump-before that
dump the IR to appropriately named files. In addition, it also
introduces flags -dump-after-all, -dump-before-all and -ir-dump-directory
to control where the files are written to.

Test Plan:

Included LIT tests:
```
ninja check-llvm
```
---
 llvm/include/llvm/IR/PrintPasses.h|  21 +++
 .../llvm/Passes/StandardInstrumentations.h|  57 ++
 llvm/lib/IR/PrintPasses.cpp   |  54 ++
 llvm/lib/Passes/PassBuilder.cpp   |   3 +-
 llvm/lib/Passes/StandardInstrumentations.cpp  | 178 ++
 .../Other/dump-before-after-file-contents |  76 
 llvm/test/Other/dump-before-after-filenames   |  71 +++
 .../Other/dump-before-after-multiple-modules  |  36 
 llvm/test/Other/lit.local.cfg |   1 +
 9 files changed, 496 insertions(+), 1 deletion(-)
 create mode 100644 llvm/test/Other/dump-before-after-file-contents
 create mode 100644 llvm/test/Other/dump-before-after-filenames
 create mode 100644 llvm/test/Other/dump-before-after-multiple-modules
 create mode 100644 llvm/test/Other/lit.local.cfg

diff --git a/llvm/include/llvm/IR/PrintPasses.h 
b/llvm/include/llvm/IR/PrintPasses.h
index 95b97e76c867cb2..b2a9017521c6a91 100644
--- a/llvm/include/llvm/IR/PrintPasses.h
+++ b/llvm/include/llvm/IR/PrintPasses.h
@@ -48,6 +48,27 @@ bool shouldPrintAfterAll();
 std::vector printBeforePasses();
 std::vector printAfterPasses();
 
+// Returns true if dumping IR to a file before/after some pass is enabled
+// wether all passes or a specific pass.
+bool shouldDumpBeforeSomePass();
+bool shouldDumpAfterSomePass();
+
+// Returns true if we should dump IR to a file before/after a specific pass. 
The
+// argument should be the pass ID, e.g. "instcombine"
+bool shouldDumpBeforePass(StringRef PassID);
+bool shouldDumpAfterPass(StringRef PassID);
+
+// Returns true if we should dump IR to a file before/after all passes.
+bool shouldDumpBeforeAll();
+bool shouldDumpAfterAll();
+
+// The list of passes to dump IR to a file before/after, if we only want
+// to print before/after specific passes.
+std::vector dumpBeforePasses();
+std::vector dumpAfterPasses();
+
+StringRef irInstrumentationDumpDirectory();
+
 // Returns true if we should always print the entire module.
 bool forcePrintModuleIR();
 
diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h 
b/llvm/include/llvm/Passes/StandardInstrumentations.h
index 331130c6b22d990..4068a68aa956fd1 100644
--- a/llvm/include/llvm/Passes/StandardInstrumentations.h
+++ b/llvm/include/llvm/Passes/StandardInstrumentations.h
@@ -69,6 +69,62 @@ class PrintIRInstrumentation {
   unsigned CurrentPassNumber = 0;
 };
 
+class DumpIRInstrumentation {
+public:
+  void registerCallbacks(PassInstrumentationCallbacks &PIC);
+
+private:
+  void dumpBeforePass(StringRef PassID, Any IR);
+  void dumpAfterPass(StringRef PassID, Any IR);
+
+  bool shouldDumpBeforePass(StringRef PassID);
+  bool shouldDumpAfterPass(StringRef PassID);
+
+  PassInstrumentationCallbacks *PIC;
+
+  // The module currently being processed in the pipeline.
+  Module const *CurrentModule = nullptr;
+
+  void pushPass(StringRef PassID, Any IR);
+  void popPass(StringRef PassID);
+
+  SmallString<16> InstrumentationDumpDirectory;
+  StringRef fetchInstrumentationDumpDirectory();
+
+  SmallString<16> fetchCurrentInstrumentationDumpFile(StringRef Suffix);
+
+  // A table to store how many times a given pass has run at the current 
"nested
+  // level"
+  using PassRunsFrequencyTableT = DenseMap;
+  // A stack each frame of which (aside from the very first) represents a pass
+  // being run on some unit of IR. The larger, the stack grows, the smaller the
+  // unit of IR. For example, we would first push a module pass, then for each
+  // function pass in that module pass, we would push a frame and so on. This
+  // information is used to craft the output path for this logging.
+  //
+  // Each frame contains a map to track how many times a given subpass runs. 
For
+  // example, to keep track of how many times a function pass Foo runs within a
+  // module pass Bar. The first frame of the stack represents the module being
+  // processed rather than any particular pass. This is to create a frequency
+  // table to track module level pass run counts without having to special case
+  // that logic.
+  //
+  // When a change in the module being processed is detecte

[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits

https://github.com/carlosgalvezp created 
https://github.com/llvm/llvm-project/pull/65231:

…-delete

So the purpose of the check is more clear. Update examples code to show 
compliant code.

>From 0ffc7aab2f385babd81b57e8116b0433d85cfaf2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:24:55 +
Subject: [PATCH] [clang-tidy][NFC][doc] Improve documentation for
 modernize-use-equals-delete

So the purpose of the check is more clear. Update examples code to
show compliant code.
---
 .../checks/modernize/use-equals-delete.rst| 26 ++-
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index c3de904e253802..47de4185667a3e 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -3,22 +3,34 @@
 modernize-use-equals-delete
 ===
 
+Prior to C++11, the only way to "delete" a given function was to make it
+``private`` and without definition, to generate a compiler error (calling
+private function) or a linker error (undefined reference).
+
+After C++11, the more idiomatic way to achieve this is by marking the functions
+as ``= delete``, and keeping them in the ``public`` section.
+
 This check marks unimplemented private special member functions with ``= 
delete``.
+Additionally, it warns about ``delete``'d functions still kept in the 
``private``
+section, that should be moved to the ``public`` one instead.
+
 To avoid false-positives, this check only applies in a translation unit that 
has
-all other member functions implemented.
+all other member functions implemented. The check will generate partial fixes
+by adding ``= delete``, but the user must manually move it to the ``public``
+section.
 
 .. code-block:: c++
 
-  struct A {
-  private:
+  // Example: bad
+  class A {
+   private:
 A(const A&);
 A& operator=(const A&);
   };
 
-  // becomes
-
-  struct A {
-  private:
+  // Example: good
+  class A {
+   public:
 A(const A&) = delete;
 A& operator=(const A&) = delete;
   };

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


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits

https://github.com/carlosgalvezp review_requested 
https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits

https://github.com/carlosgalvezp review_requested 
https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits

https://github.com/carlosgalvezp review_requested 
https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits

https://github.com/carlosgalvezp updated 
https://github.com/llvm/llvm-project/pull/65231:

>From 9c5fec5e31f31b59262646625b7d34f23d57d6cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:24:55 +
Subject: [PATCH] [clang-tidy][NFC][doc] Improve documentation for
 modernize-use-equals-delete

So the purpose of the check is more clear. Update examples code to
show compliant code.

Fixes #65221
---
 .../checks/modernize/use-equals-delete.rst| 26 ++-
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index c3de904e253802..47de4185667a3e 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -3,22 +3,34 @@
 modernize-use-equals-delete
 ===
 
+Prior to C++11, the only way to "delete" a given function was to make it
+``private`` and without definition, to generate a compiler error (calling
+private function) or a linker error (undefined reference).
+
+After C++11, the more idiomatic way to achieve this is by marking the functions
+as ``= delete``, and keeping them in the ``public`` section.
+
 This check marks unimplemented private special member functions with ``= 
delete``.
+Additionally, it warns about ``delete``'d functions still kept in the 
``private``
+section, that should be moved to the ``public`` one instead.
+
 To avoid false-positives, this check only applies in a translation unit that 
has
-all other member functions implemented.
+all other member functions implemented. The check will generate partial fixes
+by adding ``= delete``, but the user must manually move it to the ``public``
+section.
 
 .. code-block:: c++
 
-  struct A {
-  private:
+  // Example: bad
+  class A {
+   private:
 A(const A&);
 A& operator=(const A&);
   };
 
-  // becomes
-
-  struct A {
-  private:
+  // Example: good
+  class A {
+   public:
 A(const A&) = delete;
 A& operator=(const A&) = delete;
   };

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


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits

https://github.com/carlosgalvezp edited 
https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Piotr Zegar via cfe-commits


@@ -3,22 +3,34 @@
 modernize-use-equals-delete
 ===
 
+Prior to C++11, the only way to "delete" a given function was to make it
+``private`` and without definition, to generate a compiler error (calling
+private function) or a linker error (undefined reference).
+
+After C++11, the more idiomatic way to achieve this is by marking the functions
+as ``= delete``, and keeping them in the ``public`` section.
+
 This check marks unimplemented private special member functions with ``= 
delete``.

PiotrZSL wrote:

This is duplication. Saying twice about function marked as delete.

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= 


https://github.com/carlosgalvezp updated 
https://github.com/llvm/llvm-project/pull/65231:

>From 9c5fec5e31f31b59262646625b7d34f23d57d6cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:24:55 +
Subject: [PATCH 1/2] [clang-tidy][NFC][doc] Improve documentation for
 modernize-use-equals-delete

So the purpose of the check is more clear. Update examples code to
show compliant code.

Fixes #65221
---
 .../checks/modernize/use-equals-delete.rst| 26 ++-
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index c3de904e2538021..47de4185667a3ea 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -3,22 +3,34 @@
 modernize-use-equals-delete
 ===
 
+Prior to C++11, the only way to "delete" a given function was to make it
+``private`` and without definition, to generate a compiler error (calling
+private function) or a linker error (undefined reference).
+
+After C++11, the more idiomatic way to achieve this is by marking the functions
+as ``= delete``, and keeping them in the ``public`` section.
+
 This check marks unimplemented private special member functions with ``= 
delete``.
+Additionally, it warns about ``delete``'d functions still kept in the 
``private``
+section, that should be moved to the ``public`` one instead.
+
 To avoid false-positives, this check only applies in a translation unit that 
has
-all other member functions implemented.
+all other member functions implemented. The check will generate partial fixes
+by adding ``= delete``, but the user must manually move it to the ``public``
+section.
 
 .. code-block:: c++
 
-  struct A {
-  private:
+  // Example: bad
+  class A {
+   private:
 A(const A&);
 A& operator=(const A&);
   };
 
-  // becomes
-
-  struct A {
-  private:
+  // Example: good
+  class A {
+   public:
 A(const A&) = delete;
 A& operator=(const A&) = delete;
   };

>From aba8f0d712fd78db75a0387dde968e18d87b5fb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:39:48 +
Subject: [PATCH 2/2] Remove duplication

---
 .../clang-tidy/checks/modernize/use-equals-delete.rst| 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index 47de4185667a3ea..a1fab68b0951b9d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -10,14 +10,11 @@ private function) or a linker error (undefined reference).
 After C++11, the more idiomatic way to achieve this is by marking the functions
 as ``= delete``, and keeping them in the ``public`` section.
 
-This check marks unimplemented private special member functions with ``= 
delete``.
-Additionally, it warns about ``delete``'d functions still kept in the 
``private``
-section, that should be moved to the ``public`` one instead.
-
+This check warns only on unimplemented private **special member functions**.
 To avoid false-positives, this check only applies in a translation unit that 
has
 all other member functions implemented. The check will generate partial fixes
-by adding ``= delete``, but the user must manually move it to the ``public``
-section.
+by adding ``= delete``, but the move the ``public`` section needs to be done
+manually.
 
 .. code-block:: c++
 

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


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= 


https://github.com/carlosgalvezp resolved 
https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Piotr Zegar via cfe-commits
Carlos =?utf-8?q?G=C3=A1lvez?= 



@@ -3,22 +3,34 @@
 modernize-use-equals-delete
 ===
 
+Prior to C++11, the only way to "delete" a given function was to make it

PiotrZSL wrote:

Begining of the description should say what check does, not a why.

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Piotr Zegar via cfe-commits
Carlos =?utf-8?q?Gálvez?= 


https://github.com/PiotrZSL commented:

Maybe:

```
Identifies unimplemented private special member functions, recommends using '= 
delete' for them, and suggests relocating such deleted functions from the 
private to the public section.

Before the introduction of C++11, the primary method to effectively "erase" a 
particular function involved declaring it as private without providing a 
definition. This approach would result in either a compiler error (when 
attempting to call a private function) or a linker error (due to an undefined 
reference).

However, subsequent to the advent of C++11, a more conventional approach 
emerged for achieving this purpose. It involves flagging functions as "= 
delete" and retaining them within the public section of the code.

To prevent false positives, this check is only applicable within a translation 
unit where all other member functions have been implemented. The check will 
generate partial fixes by introducing "= delete," but the user is responsible 
for manually relocating it to the public section.
```

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 


https://github.com/carlosgalvezp updated 
https://github.com/llvm/llvm-project/pull/65231:

>From 9c5fec5e31f31b59262646625b7d34f23d57d6cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:24:55 +
Subject: [PATCH 1/3] [clang-tidy][NFC][doc] Improve documentation for
 modernize-use-equals-delete

So the purpose of the check is more clear. Update examples code to
show compliant code.

Fixes #65221
---
 .../checks/modernize/use-equals-delete.rst| 26 ++-
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index c3de904e2538021..47de4185667a3ea 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -3,22 +3,34 @@
 modernize-use-equals-delete
 ===
 
+Prior to C++11, the only way to "delete" a given function was to make it
+``private`` and without definition, to generate a compiler error (calling
+private function) or a linker error (undefined reference).
+
+After C++11, the more idiomatic way to achieve this is by marking the functions
+as ``= delete``, and keeping them in the ``public`` section.
+
 This check marks unimplemented private special member functions with ``= 
delete``.
+Additionally, it warns about ``delete``'d functions still kept in the 
``private``
+section, that should be moved to the ``public`` one instead.
+
 To avoid false-positives, this check only applies in a translation unit that 
has
-all other member functions implemented.
+all other member functions implemented. The check will generate partial fixes
+by adding ``= delete``, but the user must manually move it to the ``public``
+section.
 
 .. code-block:: c++
 
-  struct A {
-  private:
+  // Example: bad
+  class A {
+   private:
 A(const A&);
 A& operator=(const A&);
   };
 
-  // becomes
-
-  struct A {
-  private:
+  // Example: good
+  class A {
+   public:
 A(const A&) = delete;
 A& operator=(const A&) = delete;
   };

>From aba8f0d712fd78db75a0387dde968e18d87b5fb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:39:48 +
Subject: [PATCH 2/3] Remove duplication

---
 .../clang-tidy/checks/modernize/use-equals-delete.rst| 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index 47de4185667a3ea..a1fab68b0951b9d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -10,14 +10,11 @@ private function) or a linker error (undefined reference).
 After C++11, the more idiomatic way to achieve this is by marking the functions
 as ``= delete``, and keeping them in the ``public`` section.
 
-This check marks unimplemented private special member functions with ``= 
delete``.
-Additionally, it warns about ``delete``'d functions still kept in the 
``private``
-section, that should be moved to the ``public`` one instead.
-
+This check warns only on unimplemented private **special member functions**.
 To avoid false-positives, this check only applies in a translation unit that 
has
 all other member functions implemented. The check will generate partial fixes
-by adding ``= delete``, but the user must manually move it to the ``public``
-section.
+by adding ``= delete``, but the move the ``public`` section needs to be done
+manually.
 
 .. code-block:: c++
 

>From 63ad78a7e313761c627fb68245e56ccac41e86e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:49:49 +
Subject: [PATCH 3/3] Apply suggestions

---
 .../checks/modernize/use-equals-delete.rst| 34 +++
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index a1fab68b0951b9d..45039858fffdd3b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -3,20 +3,26 @@
 modernize-use-equals-delete
 ===
 
-Prior to C++11, the only way to "delete" a given function was to make it
-``private`` and without definition, to generate a compiler error (calling
-private function) or a linker error (undefined reference).
-
-After C++11, the more idiomatic way to achieve this is by marking the functions
-as ``= delete``, and keeping them in the ``public`` section.
-
-This check warns only on unimplemen

[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 


https://github.com/carlosgalvezp updated 
https://github.com/llvm/llvm-project/pull/65231:

>From 9c5fec5e31f31b59262646625b7d34f23d57d6cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:24:55 +
Subject: [PATCH 1/4] [clang-tidy][NFC][doc] Improve documentation for
 modernize-use-equals-delete

So the purpose of the check is more clear. Update examples code to
show compliant code.

Fixes #65221
---
 .../checks/modernize/use-equals-delete.rst| 26 ++-
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index c3de904e2538021..47de4185667a3ea 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -3,22 +3,34 @@
 modernize-use-equals-delete
 ===
 
+Prior to C++11, the only way to "delete" a given function was to make it
+``private`` and without definition, to generate a compiler error (calling
+private function) or a linker error (undefined reference).
+
+After C++11, the more idiomatic way to achieve this is by marking the functions
+as ``= delete``, and keeping them in the ``public`` section.
+
 This check marks unimplemented private special member functions with ``= 
delete``.
+Additionally, it warns about ``delete``'d functions still kept in the 
``private``
+section, that should be moved to the ``public`` one instead.
+
 To avoid false-positives, this check only applies in a translation unit that 
has
-all other member functions implemented.
+all other member functions implemented. The check will generate partial fixes
+by adding ``= delete``, but the user must manually move it to the ``public``
+section.
 
 .. code-block:: c++
 
-  struct A {
-  private:
+  // Example: bad
+  class A {
+   private:
 A(const A&);
 A& operator=(const A&);
   };
 
-  // becomes
-
-  struct A {
-  private:
+  // Example: good
+  class A {
+   public:
 A(const A&) = delete;
 A& operator=(const A&) = delete;
   };

>From aba8f0d712fd78db75a0387dde968e18d87b5fb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:39:48 +
Subject: [PATCH 2/4] Remove duplication

---
 .../clang-tidy/checks/modernize/use-equals-delete.rst| 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index 47de4185667a3ea..a1fab68b0951b9d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -10,14 +10,11 @@ private function) or a linker error (undefined reference).
 After C++11, the more idiomatic way to achieve this is by marking the functions
 as ``= delete``, and keeping them in the ``public`` section.
 
-This check marks unimplemented private special member functions with ``= 
delete``.
-Additionally, it warns about ``delete``'d functions still kept in the 
``private``
-section, that should be moved to the ``public`` one instead.
-
+This check warns only on unimplemented private **special member functions**.
 To avoid false-positives, this check only applies in a translation unit that 
has
 all other member functions implemented. The check will generate partial fixes
-by adding ``= delete``, but the user must manually move it to the ``public``
-section.
+by adding ``= delete``, but the move the ``public`` section needs to be done
+manually.
 
 .. code-block:: c++
 

>From 63ad78a7e313761c627fb68245e56ccac41e86e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:49:49 +
Subject: [PATCH 3/4] Apply suggestions

---
 .../checks/modernize/use-equals-delete.rst| 34 +++
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index a1fab68b0951b9d..45039858fffdd3b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -3,20 +3,26 @@
 modernize-use-equals-delete
 ===
 
-Prior to C++11, the only way to "delete" a given function was to make it
-``private`` and without definition, to generate a compiler error (calling
-private function) or a linker error (undefined reference).
-
-After C++11, the more idiomatic way to achieve this is by marking the functions
-as ``= delete``, and keeping them in the ``public`` section.
-
-This ch

[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 


https://github.com/carlosgalvezp updated 
https://github.com/llvm/llvm-project/pull/65231:

>From 9c5fec5e31f31b59262646625b7d34f23d57d6cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:24:55 +
Subject: [PATCH 1/5] [clang-tidy][NFC][doc] Improve documentation for
 modernize-use-equals-delete

So the purpose of the check is more clear. Update examples code to
show compliant code.

Fixes #65221
---
 .../checks/modernize/use-equals-delete.rst| 26 ++-
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index c3de904e2538021..47de4185667a3ea 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -3,22 +3,34 @@
 modernize-use-equals-delete
 ===
 
+Prior to C++11, the only way to "delete" a given function was to make it
+``private`` and without definition, to generate a compiler error (calling
+private function) or a linker error (undefined reference).
+
+After C++11, the more idiomatic way to achieve this is by marking the functions
+as ``= delete``, and keeping them in the ``public`` section.
+
 This check marks unimplemented private special member functions with ``= 
delete``.
+Additionally, it warns about ``delete``'d functions still kept in the 
``private``
+section, that should be moved to the ``public`` one instead.
+
 To avoid false-positives, this check only applies in a translation unit that 
has
-all other member functions implemented.
+all other member functions implemented. The check will generate partial fixes
+by adding ``= delete``, but the user must manually move it to the ``public``
+section.
 
 .. code-block:: c++
 
-  struct A {
-  private:
+  // Example: bad
+  class A {
+   private:
 A(const A&);
 A& operator=(const A&);
   };
 
-  // becomes
-
-  struct A {
-  private:
+  // Example: good
+  class A {
+   public:
 A(const A&) = delete;
 A& operator=(const A&) = delete;
   };

>From aba8f0d712fd78db75a0387dde968e18d87b5fb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:39:48 +
Subject: [PATCH 2/5] Remove duplication

---
 .../clang-tidy/checks/modernize/use-equals-delete.rst| 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index 47de4185667a3ea..a1fab68b0951b9d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -10,14 +10,11 @@ private function) or a linker error (undefined reference).
 After C++11, the more idiomatic way to achieve this is by marking the functions
 as ``= delete``, and keeping them in the ``public`` section.
 
-This check marks unimplemented private special member functions with ``= 
delete``.
-Additionally, it warns about ``delete``'d functions still kept in the 
``private``
-section, that should be moved to the ``public`` one instead.
-
+This check warns only on unimplemented private **special member functions**.
 To avoid false-positives, this check only applies in a translation unit that 
has
 all other member functions implemented. The check will generate partial fixes
-by adding ``= delete``, but the user must manually move it to the ``public``
-section.
+by adding ``= delete``, but the move the ``public`` section needs to be done
+manually.
 
 .. code-block:: c++
 

>From 63ad78a7e313761c627fb68245e56ccac41e86e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:49:49 +
Subject: [PATCH 3/5] Apply suggestions

---
 .../checks/modernize/use-equals-delete.rst| 34 +++
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index a1fab68b0951b9d..45039858fffdd3b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -3,20 +3,26 @@
 modernize-use-equals-delete
 ===
 
-Prior to C++11, the only way to "delete" a given function was to make it
-``private`` and without definition, to generate a compiler error (calling
-private function) or a linker error (undefined reference).
-
-After C++11, the more idiomatic way to achieve this is by marking the functions
-as ``= delete``, and keeping them in the ``

[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Piotr Zegar via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 



@@ -3,22 +3,37 @@
 modernize-use-equals-delete
 ===
 
-This check marks unimplemented private special member functions with ``= 
delete``.
-To avoid false-positives, this check only applies in a translation unit that 
has
-all other member functions implemented.
-
-.. code-block:: c++
-
-  struct A {
-  private:
+Identifies unimplemented private special member functions, and recommends using
+``= delete`` for them, as well as relocating them from the ``private`` to the
+``public`` section.
+
+Before the introduction of C++11, the primary method to effectively "erase" a
+particular function involved declaring it as ``private`` without providing a
+definition. This approach would result in either a compiler error (when
+attempting to call a private function) or a linker error (due to an undefined
+reference).
+
+However, subsequent to the advent of C++11, a more conventional approach 
emerged
+for achieving this purpose. It involves flagging functions as ``= delete`` and
+keeping them in the ``public`` section of the class.
+
+To prevent false positives, this check is only active within a translation
+unit where all other member functions have been implemented. The check will
+generate partial fixes by introducing ``= delete``, but the user is responsible
+for manually relocating functions to the ``public`` section.
+
+.. code-block:: c
+
+  // Example: bad
+  class A {
+   private:
 A(const A&);
 A& operator=(const A&);
   };
 
-  // becomes
-
-  struct A {
-  private:
+  // Example: good
+  class A {
+   public:
 A(const A&) = delete;
 A& operator=(const A&) = delete;
   };

PiotrZSL wrote:

This check got option `IgnoreMacros`  (local or global), would be good to 
document it. It's a basic one, but is...

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 



@@ -3,22 +3,37 @@
 modernize-use-equals-delete
 ===
 
-This check marks unimplemented private special member functions with ``= 
delete``.
-To avoid false-positives, this check only applies in a translation unit that 
has
-all other member functions implemented.
-
-.. code-block:: c++
-
-  struct A {
-  private:
+Identifies unimplemented private special member functions, and recommends using
+``= delete`` for them, as well as relocating them from the ``private`` to the
+``public`` section.
+
+Before the introduction of C++11, the primary method to effectively "erase" a
+particular function involved declaring it as ``private`` without providing a
+definition. This approach would result in either a compiler error (when
+attempting to call a private function) or a linker error (due to an undefined
+reference).
+
+However, subsequent to the advent of C++11, a more conventional approach 
emerged
+for achieving this purpose. It involves flagging functions as ``= delete`` and
+keeping them in the ``public`` section of the class.
+
+To prevent false positives, this check is only active within a translation
+unit where all other member functions have been implemented. The check will
+generate partial fixes by introducing ``= delete``, but the user is responsible
+for manually relocating functions to the ``public`` section.
+
+.. code-block:: c
+
+  // Example: bad
+  class A {
+   private:
 A(const A&);
 A& operator=(const A&);
   };
 
-  // becomes
-
-  struct A {
-  private:
+  // Example: good
+  class A {
+   public:
 A(const A&) = delete;
 A& operator=(const A&) = delete;
   };

carlosgalvezp wrote:

It's already documented on line 42, is there anything else you would like to 
add?

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Piotr Zegar via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 


PiotrZSL wrote:

Other interesting thing is that currently this check is limited just to 
LangOpts.CPlusPlus, when it should be to LangOpts.CPlusPlus11. And in such case 
documentation could mention that requires C++11 or later.

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Piotr Zegar via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 



@@ -3,22 +3,37 @@
 modernize-use-equals-delete
 ===
 
-This check marks unimplemented private special member functions with ``= 
delete``.
-To avoid false-positives, this check only applies in a translation unit that 
has
-all other member functions implemented.
-
-.. code-block:: c++
-
-  struct A {
-  private:
+Identifies unimplemented private special member functions, and recommends using
+``= delete`` for them, as well as relocating them from the ``private`` to the
+``public`` section.
+
+Before the introduction of C++11, the primary method to effectively "erase" a
+particular function involved declaring it as ``private`` without providing a
+definition. This approach would result in either a compiler error (when
+attempting to call a private function) or a linker error (due to an undefined
+reference).
+
+However, subsequent to the advent of C++11, a more conventional approach 
emerged
+for achieving this purpose. It involves flagging functions as ``= delete`` and
+keeping them in the ``public`` section of the class.
+
+To prevent false positives, this check is only active within a translation
+unit where all other member functions have been implemented. The check will
+generate partial fixes by introducing ``= delete``, but the user is responsible
+for manually relocating functions to the ``public`` section.
+
+.. code-block:: c
+
+  // Example: bad
+  class A {
+   private:
 A(const A&);
 A& operator=(const A&);
   };
 
-  // becomes
-
-  struct A {
-  private:
+  // Example: good
+  class A {
+   public:
 A(const A&) = delete;
 A& operator=(const A&) = delete;
   };

PiotrZSL wrote:

Ach, didnt see it, had to click button to load rest of diff, then it's fine...

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Piotr Zegar via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 


https://github.com/PiotrZSL resolved 
https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Piotr Zegar via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 


https://github.com/PiotrZSL resolved 
https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 


carlosgalvezp wrote:

Yep, we could certainly change it to C++11 or later, but I think it's out of 
the scope for this NFC patch. Regarding documentation, I haven't seen that we 
document this detail in other checks, it seems like an implementation detail 
that could cause maintenance effort if documented.

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Piotr Zegar via cfe-commits
Carlos =?utf-8?q?G=C3=A1lvez?= ,
Carlos =?utf-8?q?G=C3=A1lvez?= ,
Carlos =?utf-8?q?G=C3=A1lvez?= ,
Carlos =?utf-8?q?G=C3=A1lvez?= 


https://github.com/PiotrZSL approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Piotr Zegar via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 


PiotrZSL wrote:

Do we want to sync comment above check class in code with first sentence in 
documentation ?

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?G=C3=A1lvez?= ,
Carlos =?utf-8?q?G=C3=A1lvez?= ,
Carlos =?utf-8?q?G=C3=A1lvez?= ,
Carlos =?utf-8?q?G=C3=A1lvez?= 


carlosgalvezp wrote:

Yes good point, will fix!

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 


https://github.com/carlosgalvezp updated 
https://github.com/llvm/llvm-project/pull/65231:

>From 9c5fec5e31f31b59262646625b7d34f23d57d6cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:24:55 +
Subject: [PATCH 1/6] [clang-tidy][NFC][doc] Improve documentation for
 modernize-use-equals-delete

So the purpose of the check is more clear. Update examples code to
show compliant code.

Fixes #65221
---
 .../checks/modernize/use-equals-delete.rst| 26 ++-
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index c3de904e253802..47de4185667a3e 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -3,22 +3,34 @@
 modernize-use-equals-delete
 ===
 
+Prior to C++11, the only way to "delete" a given function was to make it
+``private`` and without definition, to generate a compiler error (calling
+private function) or a linker error (undefined reference).
+
+After C++11, the more idiomatic way to achieve this is by marking the functions
+as ``= delete``, and keeping them in the ``public`` section.
+
 This check marks unimplemented private special member functions with ``= 
delete``.
+Additionally, it warns about ``delete``'d functions still kept in the 
``private``
+section, that should be moved to the ``public`` one instead.
+
 To avoid false-positives, this check only applies in a translation unit that 
has
-all other member functions implemented.
+all other member functions implemented. The check will generate partial fixes
+by adding ``= delete``, but the user must manually move it to the ``public``
+section.
 
 .. code-block:: c++
 
-  struct A {
-  private:
+  // Example: bad
+  class A {
+   private:
 A(const A&);
 A& operator=(const A&);
   };
 
-  // becomes
-
-  struct A {
-  private:
+  // Example: good
+  class A {
+   public:
 A(const A&) = delete;
 A& operator=(const A&) = delete;
   };

>From aba8f0d712fd78db75a0387dde968e18d87b5fb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:39:48 +
Subject: [PATCH 2/6] Remove duplication

---
 .../clang-tidy/checks/modernize/use-equals-delete.rst| 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index 47de4185667a3e..a1fab68b0951b9 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -10,14 +10,11 @@ private function) or a linker error (undefined reference).
 After C++11, the more idiomatic way to achieve this is by marking the functions
 as ``= delete``, and keeping them in the ``public`` section.
 
-This check marks unimplemented private special member functions with ``= 
delete``.
-Additionally, it warns about ``delete``'d functions still kept in the 
``private``
-section, that should be moved to the ``public`` one instead.
-
+This check warns only on unimplemented private **special member functions**.
 To avoid false-positives, this check only applies in a translation unit that 
has
 all other member functions implemented. The check will generate partial fixes
-by adding ``= delete``, but the user must manually move it to the ``public``
-section.
+by adding ``= delete``, but the move the ``public`` section needs to be done
+manually.
 
 .. code-block:: c++
 

>From 63ad78a7e313761c627fb68245e56ccac41e86e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= 
Date: Sun, 3 Sep 2023 18:49:49 +
Subject: [PATCH 3/6] Apply suggestions

---
 .../checks/modernize/use-equals-delete.rst| 34 +++
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index a1fab68b0951b9..45039858fffdd3 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -3,20 +3,26 @@
 modernize-use-equals-delete
 ===
 
-Prior to C++11, the only way to "delete" a given function was to make it
-``private`` and without definition, to generate a compiler error (calling
-private function) or a linker error (undefined reference).
-
-After C++11, the more idiomatic way to achieve this is by marking the functions
-as ``= delete``, and 

[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread Piotr Zegar via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 



@@ -13,22 +13,9 @@
 
 namespace clang::tidy::modernize {
 
-/// Mark unimplemented private special member functions with '= delete'.
-/// \code
-///   struct A {
-///   private:
-/// A(const A&);
-/// A& operator=(const A&);
-///   };
-/// \endcode
-/// Is converted to:
-/// \code
-///   struct A {
-///   private:
-/// A(const A&) = delete;
-/// A& operator=(const A&) = delete;
-///   };
-/// \endcode
+/// Identifies unimplemented private special member functions, and recommends
+/// using ``= delete`` for them, as well as relocating them from the 
``private``
+/// to the ``public`` section.

PiotrZSL wrote:

looks like check currently does not limit private -> public to only special 
member functions, in such case we could write:
`as well as relocating deleted functions from the ``private`` to the ``public`` 
section.`

https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-03 Thread via cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?= 


https://github.com/philnik777 labeled 
https://github.com/llvm/llvm-project/pull/65231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Workaround for MSVC ARM64 build performance regression (PR #65215)

2023-09-03 Thread Alexander Smarus via cfe-commits


@@ -30,6 +30,15 @@ set(LLVM_LINK_COMPONENTS
   TransformUtils
   )
 
+# Workaround for MSVC ARM64 performance regression: disable all optimizations 
(/Od)
+# and then enable back all /O2 options except one.
+if(NOT CMAKE_BUILD_TYPE MATCHES Debug 
+AND MSVC 
+AND MSVC_VERSION VERSION_GREATER_EQUAL 1932
+AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64")
+  set_source_files_properties(CGBuiltin.cpp PROPERTIES COMPILE_FLAGS "/Od /Gw 
/Oi /Oy /Gy /Ob2 /Ot /GF")

lxbndr wrote:

Thanks for the review! I think I have to elaborate a little (and I apologize 
for not making this clear enough in the PR description). We're not going to 
just throw a bunch of optimization flags, of course.

The flag I actually intend to alter is `/O2`. According to the 
[reference](https://learn.microsoft.com/en-us/cpp/build/reference/o1-o2-minimize-size-maximize-speed?view=msvc-170),
 `/O2` is the equivalent of `/Og /Oi /Ot /Oy /Ob2 /GF /Gy` (I even see this in 
the compiler frontend invocation). I want to suppress the `/Og` and leave 
others in effect. This is done by adding `/Od` first (which cancels all `/O2` 
flags), and then adding "O2-minus-Og" flags back. Probably, the `/Gw` flag is 
the only unnecessary flag here, as it is not part of the `/O...` set (and it is 
not affected by `/Od` either).

It is also worth to mention that `set_source_files_properties` does not 
override flag set. It appends specified flags to other configured flags. That's 
why I had to use `/Od` to cancel already existing `/O2`.

I fully understand the intention to not break existing configuration. And I 
think I see how this can be improved. Instead of assuming all non-debug builds 
have optimizations enabled, we should seek for `/O2`/`/O1` flags directly, and 
adjust resulting flag set according to each case. @tru WDYT? Does this sound 
better?

https://github.com/llvm/llvm-project/pull/65215
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Workaround for MSVC ARM64 build performance regression (PR #65215)

2023-09-03 Thread Alexander Smarus via cfe-commits


@@ -30,6 +30,15 @@ set(LLVM_LINK_COMPONENTS
   TransformUtils
   )
 
+# Workaround for MSVC ARM64 performance regression: disable all optimizations 
(/Od)

lxbndr wrote:

I was not sure if the link is acceptable to mention there. Will do, thanks!

https://github.com/llvm/llvm-project/pull/65215
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AST] Only dump desugared type when visibly different (PR #65214)

2023-09-03 Thread Jessica Clarke via cfe-commits


@@ -315,12 +315,16 @@ std::string 
JSONNodeDumper::createPointerRepresentation(const void *Ptr) {
 
 llvm::json::Object JSONNodeDumper::createQualType(QualType QT, bool Desugar) {
   SplitQualType SQT = QT.split();
-  llvm::json::Object Ret{{"qualType", QualType::getAsString(SQT, 
PrintPolicy)}};
+  std::string SQTS = QualType::getAsString(SQT, PrintPolicy);
+  llvm::json::Object Ret{{"qualType", SQTS}};
 
   if (Desugar && !QT.isNull()) {
 SplitQualType DSQT = QT.getSplitDesugaredType();
-if (DSQT != SQT)
-  Ret["desugaredQualType"] = QualType::getAsString(DSQT, PrintPolicy);
+if (DSQT != SQT) {
+  std::string DSQTS = QualType::getAsString(DSQT, PrintPolicy);
+  if (DSQTS != SQTS)
+Ret["desugaredQualType"] = DSQTS;
+}

jrtc27 wrote:

What's the issue for consumer code? It already needs to handle non-sugar types. 
And it's not like the type in the JSON is a structured representation of the 
QualType, it's just a textual dump, so you'd have to go and re-parse it to do 
anything with it.

https://github.com/llvm/llvm-project/pull/65214
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AST] Only dump desugared type when visibly different (PR #65214)

2023-09-03 Thread Jessica Clarke via cfe-commits

jrtc27 wrote:

> > These are an artifact of how types are structured but serve little
> > purpose, merely showing that the type is sugared in some way. For
> > example, ElaboratedType's existence means struct S gets printed as
> > 'struct S':'struct S' in the AST, which is unnecessary visual clutter.
> > Note that skipping the second print when the types have the same string
> > matches what we do for diagnostics, where the aka will be skipped.
> 
> There seems to be some words missing on the last line of the commit message / 
> description.

I don't think so? What's there is what I intended to write.

https://github.com/llvm/llvm-project/pull/65214
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AST] Only dump desugared type when visibly different (PR #65214)

2023-09-03 Thread Jessica Clarke via cfe-commits


@@ -677,13 +677,18 @@ void TextNodeDumper::dumpBareType(QualType T, bool 
Desugar) {
   ColorScope Color(OS, ShowColors, TypeColor);
 
   SplitQualType T_split = T.split();
-  OS << "'" << QualType::getAsString(T_split, PrintPolicy) << "'";
+  std::string T_str = QualType::getAsString(T_split, PrintPolicy);
+  OS << "'" << T_str << "'";
 
   if (Desugar && !T.isNull()) {
-// If the type is sugared, also dump a (shallow) desugared type.
+// If the type is sugared, also dump a (shallow) desugared type when
+// visibly different.

jrtc27 wrote:

What's wrong with what's there? It's grammatically correct AFAIK.

https://github.com/llvm/llvm-project/pull/65214
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141714: Fix ast print of variables with attributes

2023-09-03 Thread Giuliano Belinassi via Phabricator via cfe-commits
giulianobelinassi updated this revision to Diff 555642.
giulianobelinassi added a comment.

Apply @erichkeane suggestions


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141714

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/CMakeLists.txt
  clang/lib/AST/DeclPrinter.cpp
  clang/test/AST/ast-print-attr-knr.c
  clang/test/AST/ast-print-attr.c
  clang/test/AST/ast-print-method-decl.cpp
  clang/test/AST/ast-print-pragmas.cpp
  clang/test/Analysis/blocks.mm
  clang/test/OpenMP/assumes_codegen.cpp
  clang/test/OpenMP/assumes_print.cpp
  clang/test/OpenMP/assumes_template_print.cpp
  clang/test/OpenMP/declare_simd_ast_print.cpp
  clang/test/Sema/attr-print.c
  clang/test/SemaCXX/attr-print.cpp
  clang/test/SemaCXX/cxx11-attr-print.cpp
  clang/utils/TableGen/ClangAttrEmitter.cpp
  clang/utils/TableGen/TableGen.cpp
  clang/utils/TableGen/TableGenBackends.h

Index: clang/utils/TableGen/TableGenBackends.h
===
--- clang/utils/TableGen/TableGenBackends.h
+++ clang/utils/TableGen/TableGenBackends.h
@@ -39,6 +39,8 @@
 void EmitClangAttrClass(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
 void EmitClangAttrImpl(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
 void EmitClangAttrList(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitClangAttrPrintList(const std::string &FieldName,
+llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
 void EmitClangAttrSubjectMatchRuleList(llvm::RecordKeeper &Records,
llvm::raw_ostream &OS);
 void EmitClangAttrPCHRead(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
Index: clang/utils/TableGen/TableGen.cpp
===
--- clang/utils/TableGen/TableGen.cpp
+++ clang/utils/TableGen/TableGen.cpp
@@ -31,6 +31,8 @@
   GenClangAttrSubjectMatchRulesParserStringSwitches,
   GenClangAttrImpl,
   GenClangAttrList,
+  GenClangAttrCanPrintLeftList,
+  GenClangAttrMustPrintLeftList,
   GenClangAttrDocTable,
   GenClangAttrSubjectMatchRuleList,
   GenClangAttrPCHRead,
@@ -127,6 +129,14 @@
"Generate clang attribute implementations"),
 clEnumValN(GenClangAttrList, "gen-clang-attr-list",
"Generate a clang attribute list"),
+clEnumValN(GenClangAttrCanPrintLeftList,
+   "gen-clang-attr-can-print-left-list",
+   "Generate list of attributes that can be printed on left "
+   "side of a decl"),
+clEnumValN(GenClangAttrMustPrintLeftList,
+   "gen-clang-attr-must-print-left-list",
+   "Generate list of attributes that must be printed on left "
+   "side of a decl"),
 clEnumValN(GenClangAttrDocTable, "gen-clang-attr-doc-table",
"Generate a table of attribute documentation"),
 clEnumValN(GenClangAttrSubjectMatchRuleList,
@@ -315,6 +325,12 @@
   case GenClangAttrList:
 EmitClangAttrList(Records, OS);
 break;
+  case GenClangAttrCanPrintLeftList:
+EmitClangAttrPrintList("CanPrintOnLeft", Records, OS);
+break;
+  case GenClangAttrMustPrintLeftList:
+EmitClangAttrPrintList("PrintOnLeft", Records, OS);
+break;
   case GenClangAttrDocTable:
 EmitClangAttrDocTable(Records, OS);
 break;
Index: clang/utils/TableGen/ClangAttrEmitter.cpp
===
--- clang/utils/TableGen/ClangAttrEmitter.cpp
+++ clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -3207,6 +3207,27 @@
   OS << "#undef PRAGMA_SPELLING_ATTR\n";
 }
 
+// Emits the enumeration list for attributes.
+void EmitClangAttrPrintList(const std::string &FieldName, RecordKeeper &Records,
+raw_ostream &OS) {
+  emitSourceFileHeader(
+  "List of attributes that can be print on the left side of a decl", OS);
+
+  AttrClassHierarchy Hierarchy(Records);
+
+  std::vector Attrs = Records.getAllDerivedDefinitions("Attr");
+  std::vector PragmaAttrs;
+  for (auto *Attr : Attrs) {
+if (!Attr->getValueAsBit("ASTNode"))
+  continue;
+
+if (!Attr->getValueAsBit(FieldName))
+  continue;
+
+OS << "case attr::" << Attr->getName() << ":\n";
+  }
+}
+
 // Emits the enumeration list for attributes.
 void EmitClangAttrSubjectMatchRuleList(RecordKeeper &Records, raw_ostream &OS) {
   emitSourceFileHeader(
Index: clang/test/SemaCXX/cxx11-attr-print.cpp
===
--- clang/test/SemaCXX/cxx11-attr-print.cpp
+++ clang/test/SemaCXX/cxx11-attr-print.cpp
@@ -3,8 +3,7 @@
 // CHECK: int x __attribute__((aligned(4)));
 int x __attribute__((aligned(4)));
 
-// FIXME: Print this at a valid location for a __declspec attr.
-// CHECK: int y __declspec(align(4));
+// CHECK: __declspec(align(4)) int y;
 __dec

[PATCH] D159263: [clang-tidy] misc-include-cleaner: avoid duplicated fixes

2023-09-03 Thread Ding Fei via Phabricator via cfe-commits
danix800 added a comment.

Ping @kadircet~, could you please take a look at this revision?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159263

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


[clang] [clang][Diagnostics] Fix wrong line number display (PR #65238)

2023-09-03 Thread Takuya Shimizu via cfe-commits

https://github.com/hazohelet review_requested 
https://github.com/llvm/llvm-project/pull/65238
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostics] Fix wrong line number display (PR #65238)

2023-09-03 Thread Takuya Shimizu via cfe-commits

https://github.com/hazohelet labeled 
https://github.com/llvm/llvm-project/pull/65238
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostics] Fix wrong line number display (PR #65238)

2023-09-03 Thread Takuya Shimizu via cfe-commits

https://github.com/hazohelet review_requested 
https://github.com/llvm/llvm-project/pull/65238
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostics] Fix wrong line number display (PR #65238)

2023-09-03 Thread Takuya Shimizu via cfe-commits

https://github.com/hazohelet created 
https://github.com/llvm/llvm-project/pull/65238:

When the caret location is lower than the lowest source range, clang is 
printing wrong line numbers. The first line number should consider caret 
location line even when there are source ranges provided.

Current wrong line example: https://godbolt.org/z/aj4qEjzs4

>From 2bc13f3b013a4bda4364e9c29bc792ca6a0c7cf1 Mon Sep 17 00:00:00 2001
From: Takuya Shimizu 
Date: Mon, 4 Sep 2023 10:46:17 +0900
Subject: [PATCH] [clang][Diagnostics] Fix wrong line number display

When the caret location is lower than the lowest source range, clang is 
printing wrong line numbers.
The first line number should consider caret location line even when there are 
source ranges provided.

Current wrong line example: https://godbolt.org/z/aj4qEjzs4
---
 clang/lib/Frontend/TextDiagnostic.cpp |  3 +--
 clang/test/Misc/diag-style.cpp| 17 +
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Frontend/TextDiagnostic.cpp 
b/clang/lib/Frontend/TextDiagnostic.cpp
index 3a3cc246d3afc2..1b58261b22a265 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -1160,8 +1160,7 @@ void TextDiagnostic::emitSnippetAndCaret(
   // Find the set of lines to include.
   const unsigned MaxLines = DiagOpts->SnippetLineLimit;
   std::pair Lines = {CaretLineNo, CaretLineNo};
-  unsigned DisplayLineNo =
-  Ranges.empty() ? Loc.getPresumedLoc().getLine() : ~0u;
+  unsigned DisplayLineNo = Loc.getPresumedLoc().getLine();
   for (const auto &I : Ranges) {
 if (auto OptionalRange = findLinesForRange(I, FID, SM))
   Lines = maybeAddRange(Lines, *OptionalRange, MaxLines);
diff --git a/clang/test/Misc/diag-style.cpp b/clang/test/Misc/diag-style.cpp
index 3b24df974730a8..967b51a07b6a65 100644
--- a/clang/test/Misc/diag-style.cpp
+++ b/clang/test/Misc/diag-style.cpp
@@ -24,3 +24,20 @@ void f(int x) {
 // CHECK-NEXT: {{^}}  |
 // CHECK-NEXT: {{^}}  |
 // CHECK-NEXT: {{^}}   12 |
+
+#line 10
+int func(
+  int a, int b,
+  int&
+  r);
+
+void test() {
+  func(3, 4, 5);
+}
+// CHECK: 10:5: note: candidate function not viable
+// CHECK-NEXT: {{^}}   10 |
+// CHECK-NEXT: {{^}}  |
+// CHECK-NEXT: {{^}}   11 |
+// CHECK-NEXT: {{^}}   12 |
+// CHECK-NEXT: {{^}}  |
+// CHECK-NEXT: {{^}}   13 |

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


[clang] [clang][Diagnostics] Fix wrong line number display (PR #65238)

2023-09-03 Thread Takuya Shimizu via cfe-commits

https://github.com/hazohelet review_requested 
https://github.com/llvm/llvm-project/pull/65238
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostics] Fix wrong line number display (PR #65238)

2023-09-03 Thread Takuya Shimizu via cfe-commits

https://github.com/hazohelet review_requested 
https://github.com/llvm/llvm-project/pull/65238
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostics] Fix wrong line number display (PR #65238)

2023-09-03 Thread Takuya Shimizu via cfe-commits

https://github.com/hazohelet review_requested 
https://github.com/llvm/llvm-project/pull/65238
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107115: [CMake][Fuchsia] Use standalone unwinder in Fuchsia toolchain

2023-09-03 Thread Petr Hosek via Phabricator via cfe-commits
phosek abandoned this revision.
phosek added a comment.
Herald added subscribers: ekilmer, abrachet.
Herald added a project: All.

Superseded by D127887 .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107115

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


[PATCH] D159412: [analyzer]FieldRegion in getStaticSize should return size of pointee type

2023-09-03 Thread Qizhi Hu via Phabricator via cfe-commits
jcsxky created this revision.
jcsxky added reviewers: steakhal, balazske, aaron.ballman, NoQ.
jcsxky added projects: clang, clang-c.
Herald added subscribers: manas, ASDenysPetrov, martong, dkrupp, donat.nagy, 
Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: All.
jcsxky requested review of this revision.
Herald added a subscriber: cfe-commits.

In `getStaticSize`, case of FieldRegionKind should return size of pointee type 
of the member. In the following example:

  struct B {
int x;
int y;
int z;
  };
  
  class A{
  public:
void foo(){
m++;
}
  private:
B *m;
  };

`getDynamicElementCount` of `m` region, if `getDynamicExtent` return the 
pointer size, `getDynamicElementCount` returns 0 in 64bit architecture(since 
pointer size is 8 while size of pointee type is 12). Use pointee type instead, 
it will return 1.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159412

Files:
  clang/lib/StaticAnalyzer/Core/MemRegion.cpp


Index: clang/lib/StaticAnalyzer/Core/MemRegion.cpp
===
--- clang/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ clang/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -800,6 +800,12 @@
   return UnknownVal();
 
 QualType Ty = cast(SR)->getDesugaredValueType(Ctx);
+if (Ty->isPointerType()) {
+  QualType PointeeTy = Ty->getPointeeType();
+  if(!PointeeTy->isIncompleteType() && PointeeTy->isObjectType()){
+Ty = PointeeTy;
+  }
+}
 const DefinedOrUnknownSVal Size = getElementExtent(Ty, SVB);
 
 // We currently don't model flexible array members (FAMs), which are:


Index: clang/lib/StaticAnalyzer/Core/MemRegion.cpp
===
--- clang/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ clang/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -800,6 +800,12 @@
   return UnknownVal();
 
 QualType Ty = cast(SR)->getDesugaredValueType(Ctx);
+if (Ty->isPointerType()) {
+  QualType PointeeTy = Ty->getPointeeType();
+  if(!PointeeTy->isIncompleteType() && PointeeTy->isObjectType()){
+Ty = PointeeTy;
+  }
+}
 const DefinedOrUnknownSVal Size = getElementExtent(Ty, SVB);
 
 // We currently don't model flexible array members (FAMs), which are:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [mlir][OpenMP] Added omp.region operation (PR #65243)

2023-09-03 Thread via cfe-commits

https://github.com/shraiysh updated 
https://github.com/llvm/llvm-project/pull/65243:

>From ff635ce0ce910f0cde248a4babb3c27333ddc108 Mon Sep 17 00:00:00 2001
From: Shraiysh Vaishay 
Date: Sun, 3 Sep 2023 22:40:10 -0500
Subject: [PATCH] [mlir][OpenMP] Added omp.region operation

This patch adds omp.region operation. This is equivalent to a code block 
surrounded by an OpenMP construct in C/C++/Fortran. This is a part of the 
effort to implement the canonical loop operation in OpenMP dialect.
---
 mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | 34 
 mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp  | 15 ++
 mlir/test/Dialect/OpenMP/region.mlir  | 53 +++
 3 files changed, 102 insertions(+)
 create mode 100644 mlir/test/Dialect/OpenMP/region.mlir

diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td 
b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
index b1e1fe00b8594a..cf5b246178f5d7 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
@@ -1787,4 +1787,38 @@ def ClauseRequiresAttr :
   EnumAttr {
 }
 
+
+def RegionOp : OpenMP_Op<"region"> {
+  let summary = "Encapsulates a region in an OpenMP construct.";
+  let description = [{
+Encapsulates a region surrounded by an OpenMP Construct. The intended use
+of this operation is that within an OpenMP operation's region, there would
+be a single `omp.region` operation and a terminator operation as shown
+below.
+
+```
+// Example with `omp.task`
+omp.task {
+  omp.region {
+call @foo : () -> ()
+  }
+  omp.terminator
+}
+```
+
+This operation is especially more useful in operations that use `omp.yield`
+as a terminator. For example, in the proposed canonical loop operation,
+this operation would help fix the arguments of the yield operation and it
+is not affected by branches in the region assosciated with the canonical
+loop. In cases where the yielded value has to be a compile time constant,
+this provides a mechanism to avoid complex static analysis for the constant
+value.
+  }];
+  let regions = (region AnyRegion:$block);
+  let assemblyFormat = [{
+$block attr-dict
+  }];
+  let hasVerifier = 1;
+}
+
 #endif // OPENMP_OPS
diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp 
b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
index 2ba5f1aca9cf6b..2a2fcdb788cb99 100644
--- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
+++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
@@ -1524,6 +1524,21 @@ LogicalResult CancellationPointOp::verify() {
   return success();
 }
 
+//===--===//
+// RegionOp
+//===--===//
+
+LogicalResult RegionOp::verify() {
+  Operation *parentOp = (*this)->getParentOp();
+  if (!parentOp)
+return emitOpError() << "`omp.region` must have a parent";
+
+  if (!isa(parentOp->getDialect()))
+return emitOpError()
+   << "`omp.region` must be used under an OpenMP Dialect operation.";
+  return success();
+}
+
 #define GET_ATTRDEF_CLASSES
 #include "mlir/Dialect/OpenMP/OpenMPOpsAttributes.cpp.inc"
 
diff --git a/mlir/test/Dialect/OpenMP/region.mlir 
b/mlir/test/Dialect/OpenMP/region.mlir
new file mode 100644
index 00..4e0ddbc07e9ec9
--- /dev/null
+++ b/mlir/test/Dialect/OpenMP/region.mlir
@@ -0,0 +1,53 @@
+// RUN: mlir-opt %s | mlir-opt | FileCheck %s
+
+// CHECK-LABEL: @basic_omp_region
+// CHECK-NEXT: omp.parallel {
+// CHECK-NEXT:   omp.region {
+// CHECK-NEXT: "test.foo"() : () -> ()
+// CHECK-NEXT: omp.terminator
+// CHECK-NEXT:   }
+// CHECK-NEXT:   omp.terminator
+// CHECK-NEXT: }
+// CHECK-NEXT: return
+func.func @basic_omp_region() {
+  omp.parallel {
+omp.region {
+  "test.foo"() : () -> ()
+  omp.terminator
+}
+omp.terminator
+  }
+  return
+}
+
+// CHECK-LABEL: @omp_region_with_branch
+// CHECK-NEXT: omp.task {
+// CHECK-NEXT:   omp.region {
+// CHECK-NEXT: %[[c:.*]] = "test.foo"() : () -> i1
+// CHECK-NEXT: cf.cond_br %[[c]], ^[[bb1:.*]](%[[c]] : i1), 
^[[bb2:.*]](%[[c]] : i1)
+// CHECK-NEXT:   ^[[bb1]](%[[arg:.*]]: i1):
+// CHECK-NEXT: "test.bar"() : () -> ()
+// CHECK-NEXT: omp.terminator
+// CHECK-NEXT:   ^[[bb2]](%[[arg2:.*]]: i1):
+// CHECK-NEXT: "test.baz"() : () -> ()
+// CHECK-NEXT: omp.terminator
+// CHECK-NEXT:   }
+// CHECK-NEXT:   omp.terminator
+// CHECK-NEXT: }
+// CHECK-NEXT: return
+func.func @omp_region_with_branch(%a: i32) {
+  omp.task {
+omp.region {
+  %c = "test.foo"() : () -> i1
+  cf.cond_br %c, ^bb1(%c: i1), ^bb2(%c: i1)
+^bb1(%arg: i1):
+  "test.bar"() : () -> ()
+  omp.terminator
+^bb2(%arg2: i1):
+  "test.baz"() : () -> ()
+  omp.terminator
+}
+omp.terminator
+  }
+  return
+}

___
cfe-commits mailing list
cfe-commits@lists.ll

[clang] Add flags to dump IR to a file before and after LLVM passes (PR #65179)

2023-09-03 Thread Min-Yih Hsu via cfe-commits


@@ -830,6 +831,182 @@ void PrintIRInstrumentation::registerCallbacks(
   }
 }
 
+void DumpIRInstrumentation::registerCallbacks(
+PassInstrumentationCallbacks &PIC) {
+
+  if (!(shouldDumpBeforeSomePass() || shouldDumpAfterSomePass()))
+return;
+
+  this->PIC = &PIC;
+
+  PIC.registerBeforeNonSkippedPassCallback(
+  [this](StringRef P, Any IR) { this->pushPass(P, IR); });
+
+  if (shouldDumpBeforeSomePass())
+PIC.registerBeforeNonSkippedPassCallback(
+[this](StringRef P, Any IR) { this->dumpBeforePass(P, IR); });
+
+  if (shouldDumpAfterSomePass()) {
+PIC.registerAfterPassCallback(
+[this](StringRef P, Any IR, const PreservedAnalyses &) {
+  this->dumpAfterPass(P, IR);
+});
+  }
+
+  // It is important the the "popPass" callback fires after the dumpAfterPass
+  // callback
+  PIC.registerAfterPassCallback(
+  [this](StringRef P, Any IR, const PreservedAnalyses &) {
+this->popPass(P);
+  });
+}
+
+void DumpIRInstrumentation::dumpBeforePass(StringRef PassID, Any IR) {
+  if (isIgnored(PassID))

mshockwave wrote:

somehow I thought the brace on line 870 marks the end of this function, my bad. 
It's all good now

https://github.com/llvm/llvm-project/pull/65179
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] Add flags to dump IR to a file before and after LLVM passes (PR #65179)

2023-09-03 Thread Min-Yih Hsu via cfe-commits


@@ -830,6 +831,182 @@ void PrintIRInstrumentation::registerCallbacks(
   }
 }
 
+void DumpIRInstrumentation::registerCallbacks(
+PassInstrumentationCallbacks &PIC) {
+
+  if (!(shouldDumpBeforeSomePass() || shouldDumpAfterSomePass()))
+return;
+
+  this->PIC = &PIC;
+
+  PIC.registerBeforeNonSkippedPassCallback(
+  [this](StringRef P, Any IR) { this->pushPass(P, IR); });
+
+  if (shouldDumpBeforeSomePass())
+PIC.registerBeforeNonSkippedPassCallback(
+[this](StringRef P, Any IR) { this->dumpBeforePass(P, IR); });
+
+  if (shouldDumpAfterSomePass()) {
+PIC.registerAfterPassCallback(
+[this](StringRef P, Any IR, const PreservedAnalyses &) {
+  this->dumpAfterPass(P, IR);
+});
+  }
+
+  // It is important the the "popPass" callback fires after the dumpAfterPass
+  // callback
+  PIC.registerAfterPassCallback(
+  [this](StringRef P, Any IR, const PreservedAnalyses &) {
+this->popPass(P);
+  });
+}
+
+void DumpIRInstrumentation::dumpBeforePass(StringRef PassID, Any IR) {
+  if (isIgnored(PassID))

mshockwave wrote:

somehow I thought the brace on line 870 marks the end of this function, my bad. 
It's all good now

https://github.com/llvm/llvm-project/pull/65179
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] f585b7d - [NFC] Add an overload for getP1689ModuleDependencyFile without output parameters

2023-09-03 Thread Chuanqi Xu via cfe-commits

Author: Chuanqi Xu
Date: 2023-09-04T13:22:17+08:00
New Revision: f585b7db07f8b3c69141f3975a94c70f6899f733

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

LOG: [NFC] Add an overload for getP1689ModuleDependencyFile without output 
parameters

See the comment of https://reviews.llvm.org/D153114. The current
signature will make the user to misunderstant that it will write files
to the filesystem, while it is not true. This patch adds an overload to
erase the concern. And the overload will be used in the support for
modules in clangd.

Added: 


Modified: 
clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h

Removed: 




diff  --git 
a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h 
b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
index f2cd781f57d654..cb9476d1550df3 100644
--- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
+++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
@@ -106,6 +106,15 @@ class DependencyScanningTool {
   getP1689ModuleDependencyFile(const clang::tooling::CompileCommand &Command,
StringRef CWD, std::string &MakeformatOutput,
std::string &MakeformatOutputPath);
+  llvm::Expected
+  getP1689ModuleDependencyFile(const clang::tooling::CompileCommand &Command,
+   StringRef CWD) {
+std::string MakeformatOutput;
+std::string MakeformatOutputPath;
+
+return getP1689ModuleDependencyFile(Command, CWD, MakeformatOutput,
+MakeformatOutputPath);
+  }
 
   /// Given a Clang driver command-line for a translation unit, gather the
   /// modular dependencies and return the information needed for explicit 
build.



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


[clang] 00e54d0 - [clang][auto-init] Remove -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang

2023-09-03 Thread Kees Cook via cfe-commits

Author: Kees Cook
Date: 2023-09-03T22:24:37-07:00
New Revision: 00e54d04ae2802d498741097d4b83e898bc99c5b

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

LOG: [clang][auto-init] Remove 
-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang

This was deprecated in Clang 16 and scheduled for removal in Clang 18.
Time to remove it.

Reviewed By: nickdesaulniers, MaskRay

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

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/test/Driver/clang_f_opts.c

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 30fc9c43543d522..c6d2c3466a09622 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -127,6 +127,9 @@ Modified Compiler Flags
 Removed Compiler Flags
 -
 
+* ``-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang`` 
has been removed.
+  It has not been needed to enable ``-ftrivial-auto-var-init=zero`` since 
Clang 16.
+
 Attribute Changes in Clang
 --
 - On X86, a warning is now emitted if a function with 
``__attribute__((no_caller_saved_registers))``

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index fa6b69c1c7236dd..e6d8aed6aefc8d9 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -272,12 +272,6 @@ def : Flag<["-"], "fno-slp-vectorize-aggressive">, 
Group, Group;
 def mno_mpx : Flag<["-"], "mno-mpx">, 
Group;
 
-// Retired with clang-16.0, to provide a deprecation period; it should
-// be removed in Clang 18 or later.
-def enable_trivial_var_init_zero : Flag<["-"], 
"enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">,
-  Flags<[NoArgumentUnused]>, Visibility<[ClangOption, CC1Option, CLOption]>,
-  Group;
-
 // Group that ignores all gcc optimizations that won't be implemented
 def clang_ignored_gcc_optimization_f_Group : OptionGroup<
   "">, Group, 
Flags<[Ignored]>;

diff  --git a/clang/test/Driver/clang_f_opts.c 
b/clang/test/Driver/clang_f_opts.c
index 1704da892687d22..7a3616a2e9f0a48 100644
--- a/clang/test/Driver/clang_f_opts.c
+++ b/clang/test/Driver/clang_f_opts.c
@@ -563,12 +563,9 @@
 // RUN: %clang -### -S -ftrivial-auto-var-init=uninitialized %s 2>&1 | 
FileCheck -check-prefix=CHECK-TRIVIAL-UNINIT %s
 // RUN: %clang -### -S -ftrivial-auto-var-init=pattern %s 2>&1 | FileCheck 
-check-prefix=CHECK-TRIVIAL-PATTERN %s
 // RUN: %clang -### -S -ftrivial-auto-var-init=zero %s 2>&1 | FileCheck 
-check-prefix=CHECK-TRIVIAL-ZERO %s
-// RUN: %clang -### -S 
-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang \
-// RUN:   -ftrivial-auto-var-init=zero %s 2>&1 | FileCheck 
-check-prefix=CHECK-TRIVIAL-ZERO-ENABLE-DEPRECATED %s
 // CHECK-TRIVIAL-UNINIT-NOT: hasn't been enabled
 // CHECK-TRIVIAL-PATTERN-NOT: hasn't been enabled
 // CHECK-TRIVIAL-ZERO-NOT: hasn't been enabled
-// CHECK-TRIVIAL-ZERO-ENABLE-DEPRECATED: has been deprecated
 
 // RUN: %clang -### -S -ftrivial-auto-var-init=pattern 
-ftrivial-auto-var-init-stop-after=1 %s 2>&1 | FileCheck 
-check-prefix=CHECK-TRIVIAL-PATTERN-STOP-AFTER %s
 // RUN: %clang -### -S -ftrivial-auto-var-init=zero 
-ftrivial-auto-var-init-stop-after=1 %s 2>&1 | FileCheck 
-check-prefix=CHECK-TRIVIAL-ZERO-STOP-AFTER %s



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


[PATCH] D159373: [clang][auto-init] Remove -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang

2023-09-03 Thread Kees Cook 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 rG00e54d04ae28: [clang][auto-init] Remove 
-enable-trivial-auto-var-init-zero-knowing-it-will-be… (authored by kees).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159373

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Driver/Options.td
  clang/test/Driver/clang_f_opts.c


Index: clang/test/Driver/clang_f_opts.c
===
--- clang/test/Driver/clang_f_opts.c
+++ clang/test/Driver/clang_f_opts.c
@@ -563,12 +563,9 @@
 // RUN: %clang -### -S -ftrivial-auto-var-init=uninitialized %s 2>&1 | 
FileCheck -check-prefix=CHECK-TRIVIAL-UNINIT %s
 // RUN: %clang -### -S -ftrivial-auto-var-init=pattern %s 2>&1 | FileCheck 
-check-prefix=CHECK-TRIVIAL-PATTERN %s
 // RUN: %clang -### -S -ftrivial-auto-var-init=zero %s 2>&1 | FileCheck 
-check-prefix=CHECK-TRIVIAL-ZERO %s
-// RUN: %clang -### -S 
-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang \
-// RUN:   -ftrivial-auto-var-init=zero %s 2>&1 | FileCheck 
-check-prefix=CHECK-TRIVIAL-ZERO-ENABLE-DEPRECATED %s
 // CHECK-TRIVIAL-UNINIT-NOT: hasn't been enabled
 // CHECK-TRIVIAL-PATTERN-NOT: hasn't been enabled
 // CHECK-TRIVIAL-ZERO-NOT: hasn't been enabled
-// CHECK-TRIVIAL-ZERO-ENABLE-DEPRECATED: has been deprecated
 
 // RUN: %clang -### -S -ftrivial-auto-var-init=pattern 
-ftrivial-auto-var-init-stop-after=1 %s 2>&1 | FileCheck 
-check-prefix=CHECK-TRIVIAL-PATTERN-STOP-AFTER %s
 // RUN: %clang -### -S -ftrivial-auto-var-init=zero 
-ftrivial-auto-var-init-stop-after=1 %s 2>&1 | FileCheck 
-check-prefix=CHECK-TRIVIAL-ZERO-STOP-AFTER %s
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -272,12 +272,6 @@
 def mmpx : Flag<["-"], "mmpx">, Group;
 def mno_mpx : Flag<["-"], "mno-mpx">, 
Group;
 
-// Retired with clang-16.0, to provide a deprecation period; it should
-// be removed in Clang 18 or later.
-def enable_trivial_var_init_zero : Flag<["-"], 
"enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">,
-  Flags<[NoArgumentUnused]>, Visibility<[ClangOption, CC1Option, CLOption]>,
-  Group;
-
 // Group that ignores all gcc optimizations that won't be implemented
 def clang_ignored_gcc_optimization_f_Group : OptionGroup<
   "">, Group, 
Flags<[Ignored]>;
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -127,6 +127,9 @@
 Removed Compiler Flags
 -
 
+* ``-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang`` 
has been removed.
+  It has not been needed to enable ``-ftrivial-auto-var-init=zero`` since 
Clang 16.
+
 Attribute Changes in Clang
 --
 - On X86, a warning is now emitted if a function with 
``__attribute__((no_caller_saved_registers))``


Index: clang/test/Driver/clang_f_opts.c
===
--- clang/test/Driver/clang_f_opts.c
+++ clang/test/Driver/clang_f_opts.c
@@ -563,12 +563,9 @@
 // RUN: %clang -### -S -ftrivial-auto-var-init=uninitialized %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-UNINIT %s
 // RUN: %clang -### -S -ftrivial-auto-var-init=pattern %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-PATTERN %s
 // RUN: %clang -### -S -ftrivial-auto-var-init=zero %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-ZERO %s
-// RUN: %clang -### -S -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang \
-// RUN:   -ftrivial-auto-var-init=zero %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-ZERO-ENABLE-DEPRECATED %s
 // CHECK-TRIVIAL-UNINIT-NOT: hasn't been enabled
 // CHECK-TRIVIAL-PATTERN-NOT: hasn't been enabled
 // CHECK-TRIVIAL-ZERO-NOT: hasn't been enabled
-// CHECK-TRIVIAL-ZERO-ENABLE-DEPRECATED: has been deprecated
 
 // RUN: %clang -### -S -ftrivial-auto-var-init=pattern -ftrivial-auto-var-init-stop-after=1 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-PATTERN-STOP-AFTER %s
 // RUN: %clang -### -S -ftrivial-auto-var-init=zero -ftrivial-auto-var-init-stop-after=1 %s 2>&1 | FileCheck -check-prefix=CHECK-TRIVIAL-ZERO-STOP-AFTER %s
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -272,12 +272,6 @@
 def mmpx : Flag<["-"], "mmpx">, Group;
 def mno_mpx : Flag<["-"], "mno-mpx">, Group;
 
-// Retired with clang-16.0, to provide a deprecation period; it should
-// be removed in Clang 18 or later.
-def enable_trivial_var_init_zero : Flag<["-"], "enable-trivial-auto-var-init-zero-kno

[PATCH] D159250: [X86][RFC] Add new option `-m[no-]evex512` to disable ZMM and 64-bit mask instructions for AVX512 features

2023-09-03 Thread Kan Shengchen via Phabricator via cfe-commits
skan added inline comments.



Comment at: llvm/lib/Target/X86/X86Subtarget.cpp:275
+  size_t posEVEX512 = FS.rfind("+evex512");
+  size_t posAVX512F = FS.rfind("+avx512");
+

Missing f?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159250

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


[PATCH] D159250: [X86][RFC] Add new option `-m[no-]evex512` to disable ZMM and 64-bit mask instructions for AVX512 features

2023-09-03 Thread Kan Shengchen via Phabricator via cfe-commits
skan added inline comments.



Comment at: llvm/lib/Target/X86/X86Subtarget.cpp:271
 
+  // Attach EVEX512 feature when we have AVX512 features and EVEX512 is not 
set.
+  size_t posNoEVEX512 = FS.rfind("-evex512");

It seems the change in X86.cpp is redundant?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159250

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


[clang] [Clang] Fix missing diagnostic for non-standard layout type in (PR #65246)

2023-09-03 Thread via cfe-commits

https://github.com/kasuga-fj created 
https://github.com/llvm/llvm-project/pull/65246:

`offsetof`

Fixes #64619

Clang warns diagnostic for non-standard layout types in `offsetof` only if they 
are in evaluated context. With this patch, you'll also get
  diagnostic if you use `offsetof` on non-standard layout types in any
  other contexts

>From d15196f5148194c5cb2f59c438d06f9fa61c8b4a Mon Sep 17 00:00:00 2001
From: "kasuga.ryotaro" 
Date: Wed, 30 Aug 2023 13:26:31 +0900
Subject: [PATCH] [Clang] Fix missing diagnostic for non-standard layout type
 in `offsetof`

Fixes #64619

Clang warns diagnostic for non-standard layout types in `offsetof` only
if they are in evaluated context. With this patch, you'll also get
  diagnostic if you use `offsetof` on non-standard layout types in any
  other contexts
---
 clang/lib/Sema/SemaExpr.cpp |  9 -
 clang/test/SemaCXX/class-layout.cpp | 30 ++---
 clang/test/SemaCXX/ms_struct.cpp|  5 ++---
 clang/test/SemaCXX/offsetof.cpp | 10 +-
 4 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index f9badf4ede847f..d78d823e15e62d 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -16750,12 +16750,11 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation 
BuiltinLoc,
 LangOpts.CPlusPlus11? diag::ext_offsetof_non_standardlayout_type
 : diag::ext_offsetof_non_pod_type;
 
-  if (!IsSafe && !DidWarnAboutNonPOD &&
-  DiagRuntimeBehavior(BuiltinLoc, nullptr,
-  PDiag(DiagID)
-  << SourceRange(Components[0].LocStart, OC.LocEnd)
-  << CurrentType))
+  if (!IsSafe && !DidWarnAboutNonPOD) {
+Diag(BuiltinLoc, DiagID)
+<< SourceRange(Components[0].LocStart, OC.LocEnd) << CurrentType;
 DidWarnAboutNonPOD = true;
+  }
 }
 
 // Look for the field.
diff --git a/clang/test/SemaCXX/class-layout.cpp 
b/clang/test/SemaCXX/class-layout.cpp
index 3ccd0ad25d7e75..a5660e10fe725a 100644
--- a/clang/test/SemaCXX/class-layout.cpp
+++ b/clang/test/SemaCXX/class-layout.cpp
@@ -1,18 +1,18 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++98 -Wno-inaccessible-base -Wno-c++11-extensions
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base
-// RUN: %clang_cc1 -triple x86_64-apple-darwin%s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -DCLANG_ABI_COMPAT=15
-// RUN: %clang_cc1 -triple x86_64-scei-ps4%s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -DCLANG_ABI_COMPAT=6
-// RUN: %clang_cc1 -triple x86_64-sie-ps5 %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -DCLANG_ABI_COMPAT=6
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -fclang-abi-compat=6 -DCLANG_ABI_COMPAT=6
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -fclang-abi-compat=14 -DCLANG_ABI_COMPAT=14
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -fclang-abi-compat=15 -DCLANG_ABI_COMPAT=15
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -fclang-abi-compat=16 -DCLANG_ABI_COMPAT=16
-// RUN: %clang_cc1 -triple powerpc-ibm-aix7.3.0.0 %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -DCLANG_ABI_COMPAT=15
-// RUN: %clang_cc1 -triple powerpc-ibm-aix7.3.0.0 %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -fclang-abi-compat=15 -DCLANG_ABI_COMPAT=15
-// RUN: %clang_cc1 -triple powerpc64-ibm-aix7.3.0.0 %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -DCLANG_ABI_COMPAT=15
-// RUN: %clang_cc1 -triple powerpc64-ibm-aix7.3.0.0 %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -fclang-abi-compat=15 -DCLANG_ABI_COMPAT=15
-// RUN: %clang_cc1 -triple s390x-none-zos %s -fsyntax-only -verify -std=c++11 
-Wno-inaccessible-base
-// RUN: %clang_cc1 -triple s390x-none-zos %s -fsyntax-only -verify -std=c++11 
-Wno-inaccessible-base -fclang-abi-compat=15 -DCLANG_ABI_COMPAT=15
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++98 -Wno-inaccessible-base -Wno-invalid-offsetof -Wno-c++11-extensions
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -Wno-invalid-offsetof
+// RUN: %clang_cc1 -triple x86_64-apple-darwin%s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -Wno-invalid-offsetof -DCLANG_ABI_COMPAT=15
+// RUN: %clang_cc1 -triple x86_64-scei-ps4%s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -Wno-invalid-offsetof -DCLANG_ABI_COMPAT=6
+// RUN: %clang_cc1 -triple x86_64-sie-ps5 %s -fsyn

[clang] [Clang] Fix missing diagnostic for non-standard layout type in (PR #65246)

2023-09-03 Thread via cfe-commits

https://github.com/kasuga-fj review_requested 
https://github.com/llvm/llvm-project/pull/65246
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Fix missing diagnostic for non-standard layout type in (PR #65246)

2023-09-03 Thread via cfe-commits

https://github.com/kasuga-fj edited 
https://github.com/llvm/llvm-project/pull/65246
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostics] Fix wrong line number display (PR #65238)

2023-09-03 Thread via cfe-commits

https://github.com/cor3ntin labeled 
https://github.com/llvm/llvm-project/pull/65238
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Fix missing diagnostic for non-standard layout type in (PR #65246)

2023-09-03 Thread via cfe-commits

https://github.com/cor3ntin labeled 
https://github.com/llvm/llvm-project/pull/65246
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Fix missing diagnostic for non-standard layout type in (PR #65246)

2023-09-03 Thread via cfe-commits

https://github.com/cor3ntin labeled 
https://github.com/llvm/llvm-project/pull/65246
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Workaround for MSVC ARM64 build performance regression (PR #65215)

2023-09-03 Thread Tobias Hieta via cfe-commits


@@ -30,6 +30,15 @@ set(LLVM_LINK_COMPONENTS
   TransformUtils
   )
 
+# Workaround for MSVC ARM64 performance regression: disable all optimizations 
(/Od)
+# and then enable back all /O2 options except one.
+if(NOT CMAKE_BUILD_TYPE MATCHES Debug 
+AND MSVC 
+AND MSVC_VERSION VERSION_GREATER_EQUAL 1932
+AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64")
+  set_source_files_properties(CGBuiltin.cpp PROPERTIES COMPILE_FLAGS "/Od /Gw 
/Oi /Oy /Gy /Ob2 /Ot /GF")

tru wrote:

Yeah I think this is what we want. We don't want to assume what the current 
flags are. Does it only happen in Release and RelWithDebInfo configurations? In 
that case you can maybe use generator expressions to only happen for those 
configurations?

Btw I noticed that COMPILE_FLAGS is deprecated and COMPILE_OPTIONS should be 
used instead, so maybe look into that as well?

https://github.com/llvm/llvm-project/pull/65215
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Fix missing diagnostic for non-standard layout type in (PR #65246)

2023-09-03 Thread via cfe-commits

cor3ntin wrote:

Thanks for working on this. 

This generally looks good to me.
Can you add an entry in clang/docs/ReleaseNotes.rst? 
Thanks!

https://github.com/llvm/llvm-project/pull/65246
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Diagnostics] Fix wrong line number display (PR #65238)

2023-09-03 Thread via cfe-commits

cor3ntin wrote:

This looks good. My only question is, can `Loc` ever be invalid there, and what 
happens if it is?

https://github.com/llvm/llvm-project/pull/65238
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D159261: [clang][dataflow] Eliminate deprecated `DataflowAnalysis` constructor.

2023-09-03 Thread Martin Böhme via Phabricator via cfe-commits
mboehme added a comment.

Failing pre-merge checks look unrelated


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159261

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


[clang] [clang][Diagnostics] Fix wrong line number display (PR #65238)

2023-09-03 Thread Timm Baeder via cfe-commits

tbaederr wrote:

In 8554a55d041f2c7de329adda538cadf7eeb6e8a8, this was added to fix a range with 
a lower begin source location than `Loc` is, so I think this change would break 
that?

https://github.com/llvm/llvm-project/pull/65238
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D159409: Haiku: Pick up a few more codegen parametres from downstream

2023-09-03 Thread Niels Sascha Reedijk via Phabricator via cfe-commits
nielx accepted this revision.
nielx added a comment.
This revision is now accepted and ready to land.

Patch looks good to me and in line with previous work that was done on LLVM to 
run it on Haiku.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159409

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


[PATCH] D159262: [clang][dataflow] Eliminate deprecated `ControlFlowContext::build()` overload.

2023-09-03 Thread Martin Böhme via Phabricator via cfe-commits
mboehme added a comment.

Failing pre-merge checks look unrelated


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159262

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


[PATCH] D159264: [clang][dataflow] Remove deprecated synonyms related to `RecordStorageLocation` and `RecordValue`

2023-09-03 Thread Martin Böhme via Phabricator via cfe-commits
mboehme added a comment.

Failing pre-merge checks look unrelated


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159264

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


[PATCH] D158626: [AArch64] Add missing vrnd intrinsics

2023-09-03 Thread Dave Green via Phabricator via cfe-commits
dmgreen added inline comments.



Comment at: llvm/lib/Target/AArch64/AArch64InstrFormats.td:6309
+
+  def : Pat<(v1f64 (OpNode (v1f64 FPR64:$Rn))),
+   (!cast(NAME # Dr) FPR64:$Rn)>;

I think the instructions in this multiclass are the vector variants. Can the 
pattern be moved to the FRIntNNT/SingleOperandFPNo16 class?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158626

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


[clang] [clang][Diagnostics] Fix wrong line number display (PR #65238)

2023-09-03 Thread Takuya Shimizu via cfe-commits

hazohelet wrote:

When the `Loc` is higher than the lowest begin source location, `DisplayLineNo` 
still points to the lowest begin location line because we have
```c++
  DisplayLineNo =
std::min(DisplayLineNo, SM.getPresumedLineNumber(I.getBegin()));
```
in L1169, correct?
This does not break the test added in the commit at least locally.

I don't think we need to ignore `Loc.getPresumedLoc().getLine()` when `Ranges` 
is not empty.

https://github.com/llvm/llvm-project/pull/65238
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits