[clang] 37458c6 - [clang][dataflow] Eliminate deprecated `DataflowAnalysis` constructor.

2023-09-04 Thread Martin Braenne via cfe-commits

Author: Martin Braenne
Date: 2023-09-04T07:00:11Z
New Revision: 37458c66bfefaa4f4cb40043cb88413e5b826e3f

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

LOG: [clang][dataflow] Eliminate deprecated `DataflowAnalysis` constructor.

Reviewed By: ymandel, xazax.hun

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

Added: 


Modified: 
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
clang/include/clang/Analysis/FlowSensitive/NoopAnalysis.h
clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp
clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp

Removed: 




diff  --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h 
b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
index db02e1b73c6aff7..abd34f40922121e 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
@@ -85,14 +85,6 @@ class DataflowAnalysis : public TypeErasedDataflowAnalysis {
 
   explicit DataflowAnalysis(ASTContext &Context) : Context(Context) {}
 
-  /// Deprecated. Use the `DataflowAnalysisOptions` constructor instead.
-  explicit DataflowAnalysis(ASTContext &Context, bool ApplyBuiltinTransfer)
-  : DataflowAnalysis(
-Context,
-{ApplyBuiltinTransfer
- ? DataflowAnalysisContext::Options{}
- : std::optional()}) {}
-
   explicit DataflowAnalysis(ASTContext &Context,
 DataflowAnalysisOptions Options)
   : TypeErasedDataflowAnalysis(Options), Context(Context) {}

diff  --git a/clang/include/clang/Analysis/FlowSensitive/NoopAnalysis.h 
b/clang/include/clang/Analysis/FlowSensitive/NoopAnalysis.h
index 016b6b3ba014540..393f68300cb80c1 100644
--- a/clang/include/clang/Analysis/FlowSensitive/NoopAnalysis.h
+++ b/clang/include/clang/Analysis/FlowSensitive/NoopAnalysis.h
@@ -27,15 +27,6 @@ class NoopAnalysis : public DataflowAnalysis {
   NoopAnalysis(ASTContext &Context)
   : DataflowAnalysis(Context) {}
 
-  /// Deprecated. Use the `DataflowAnalysisOptions` constructor instead.
-  NoopAnalysis(ASTContext &Context, bool ApplyBuiltinTransfer)
-  : DataflowAnalysis(Context,
-ApplyBuiltinTransfer) {}
-
-  /// `ApplyBuiltinTransfer` controls whether to run the built-in transfer
-  /// functions that model memory during the analysis. Their results are not
-  /// used by `NoopAnalysis`, but tests that need to inspect the environment
-  /// should enable them.
   NoopAnalysis(ASTContext &Context, DataflowAnalysisOptions Options)
   : DataflowAnalysis(Context, Options) {}
 

diff  --git a/clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp 
b/clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp
index 0edf3ca6b359b27..1cb51a9cf37c5c4 100644
--- a/clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp
@@ -113,8 +113,7 @@ class ModelAdaptorAnalysis
 : public DataflowAnalysis, NoopLattice> {
 public:
   explicit ModelAdaptorAnalysis(ASTContext &Context)
-  : DataflowAnalysis(
-Context, /*ApplyBuiltinTransfer=*/true) {}
+  : DataflowAnalysis(Context) {}
 
   static NoopLattice initialElement() { return NoopLattice(); }
 

diff  --git a/clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp 
b/clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp
index 937ab039f72f9ee..5de3dd8dccb68a9 100644
--- a/clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp
@@ -86,7 +86,9 @@ void checkDataflow(
 Code, std::move(TargetFuncMatcher),
 [](ASTContext &Context, Environment &) {
   return NoopAnalysis(
-  Context, /*ApplyBuiltinTransfer=*/false);
+  Context,
+  // Don't apply builtin transfer function.
+  DataflowAnalysisOptions{std::nullopt});
 })
 .withASTBuildArgs({"-fsyntax-only", "-std=c++17"}),
 /*VerifyResults=*/std::move(Expectations)),

diff  --git a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp 
b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
index 8100db2aec40909..0a5cf62e5ea2332 100644
--- a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
+++ b/cla

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

2023-09-04 Thread Martin Böhme 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 rG37458c66bfef: [clang][dataflow] Eliminate deprecated 
`DataflowAnalysis` constructor. (authored by mboehme).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159261

Files:
  clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
  clang/include/clang/Analysis/FlowSensitive/NoopAnalysis.h
  clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp
  clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp
  clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
  clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp

Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
===
--- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
@@ -78,7 +78,9 @@
 TEST(DataflowAnalysisTest, NoopAnalysis) {
   auto BlockStates = llvm::cantFail(
   runAnalysis("void target() {}", [](ASTContext &C) {
-return NoopAnalysis(C, false);
+return NoopAnalysis(C,
+// Don't use builtin transfer function.
+DataflowAnalysisOptions{std::nullopt});
   }));
   EXPECT_EQ(BlockStates.size(), 2u);
   EXPECT_TRUE(BlockStates[0].has_value());
@@ -130,7 +132,8 @@
   explicit NonConvergingAnalysis(ASTContext &Context)
   : DataflowAnalysis(
 Context,
-/*ApplyBuiltinTransfer=*/false) {}
+// Don't apply builtin transfer function.
+DataflowAnalysisOptions{std::nullopt}) {}
 
   static NonConvergingLattice initialElement() { return {0}; }
 
@@ -811,7 +814,7 @@
 AnalysisInputs(
 Code, ast_matchers::hasName("target"),
 [](ASTContext &Context, Environment &Env) {
-  return NoopAnalysis(Context, true);
+  return NoopAnalysis(Context);
 })
 .withASTBuildArgs({"-fsyntax-only", "-std=c++17"}),
 /*VerifyResults=*/[&Match](const llvm::StringMap<
Index: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
===
--- clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
@@ -1418,9 +1418,7 @@
   checkDataflow(
   AnalysisInputs(
   Code, cxxConstructorDecl(ofClass(hasName("B"))),
-  [](ASTContext &C, Environment &) {
-return NoopAnalysis(C, /*ApplyBuiltinTransfer=*/true);
-  })
+  [](ASTContext &C, Environment &) { return NoopAnalysis(C); })
   .withASTBuildArgs(
   {"-fsyntax-only", "-fno-delayed-template-parsing",
"-std=" + std::string(LangStandard::getLangStandardForKind(
Index: clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp
===
--- clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp
@@ -86,7 +86,9 @@
 Code, std::move(TargetFuncMatcher),
 [](ASTContext &Context, Environment &) {
   return NoopAnalysis(
-  Context, /*ApplyBuiltinTransfer=*/false);
+  Context,
+  // Don't apply builtin transfer function.
+  DataflowAnalysisOptions{std::nullopt});
 })
 .withASTBuildArgs({"-fsyntax-only", "-std=c++17"}),
 /*VerifyResults=*/std::move(Expectations)),
Index: clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp
===
--- clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp
@@ -113,8 +113,7 @@
 : public DataflowAnalysis, NoopLattice> {
 public:
   explicit ModelAdaptorAnalysis(ASTContext &Context)
-  : DataflowAnalysis(
-Context, /*ApplyBuiltinTransfer=*/true) {}
+  : DataflowAnalysis(Context) {}
 
   static NoopLattice initialElement() { return NoopLattice(); }
 
Index: clang/include/clang/Analysis/FlowSensitive/NoopAnalysis.h
===
--- clang/include/clang/Analysis/FlowSensitive/NoopAnalysis.h
+++ clang/include/clang/Analysis/FlowSensitive/NoopAnalysis.h
@@ -27,15 +27,6 @@
   NoopAnalysis(ASTContext &Context)
   : DataflowAnalysis(Contex

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

2023-09-04 Thread via cfe-commits

cor3ntin wrote:

Ouch the inability to comment outside of modified code is going to be painful.

The changed code being

```cpp
  unsigned DisplayLineNo = Loc.getPresumedLoc().getLine();
  for (const auto &I : Ranges) {
  DisplayLineNo = 
std::min(DisplayLineNo, SM.getPresumedLineNumber(I.getBegin()));
  }
```

If the range starts before `DisplayLineNo`, it still works. Am I missing 
something?

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-04 Thread via cfe-commits

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

>From d15196f5148194c5cb2f59c438d06f9fa61c8b4a Mon Sep 17 00:00:00 2001
From: "kasuga.ryotaro" 
Date: Wed, 30 Aug 2023 13:26:31 +0900
Subject: [PATCH 1/2] [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 f9badf4ede847f9..d78d823e15e62d7 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 3ccd0ad25d7e753..a5660e10fe725a5 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 -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -Wno-invalid-offsetof -DCLANG_ABI_COMPAT=6
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -Wno-invalid-offsetof -fclang-abi-compat=

[clang] b70f1f8 - Haiku: Pick up a few more codegen parametres from downstream

2023-09-04 Thread Brad Smith via cfe-commits

Author: X512
Date: 2023-09-04T03:05:51-04:00
New Revision: b70f1f836da9b66675db74d19c84bddd0f6708a8

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

LOG: Haiku: Pick up a few more codegen parametres from downstream

Pick up a few more codegen parametres from downstream. The DWARF version 
matchesthe GCC config.

DWARF version 4, Math Errno handling, ObjC ABI handling, and debug handling.

Reviewed By: nielx

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

Added: 


Modified: 
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

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Haiku.h 
b/clang/lib/Driver/ToolChains/Haiku.h
index cc7f7eb19091a97..4b5f21f7ba66bec 100644
--- a/clang/lib/Driver/ToolChains/Haiku.h
+++ b/clang/lib/Driver/ToolChains/Haiku.h
@@ -22,6 +22,8 @@ class LLVM_LIBRARY_VISIBILITY Haiku : public Generic_ELF {
   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 @@ class LLVM_LIBRARY_VISIBILITY Haiku : public Generic_ELF {
   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

diff  --git a/clang/test/CodeGen/dwarf-version.c 
b/clang/test/CodeGen/dwarf-version.c
index 850cedf4d14c76e..e63316ace69c872 100644
--- a/clang/test/CodeGen/dwarf-version.c
+++ b/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

diff  --git a/clang/test/Driver/clang-g-opts.c 
b/clang/test/Driver/clang-g-opts.c
index 4882eb6068f4360..b1cdf411925aea1 100644
--- a/clang/test/Driver/clang-g-opts.c
+++ b/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"

diff  --git a/clang/test/Driver/debug-options.c 
b/clang/test/Driver/debug-options.c
index 8ffa88d00dff376..6c472f047528d37 100644
--- a/clang/test/Driver/debug-options.c
+++ b/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

diff  --git a/clang/test/Driver/fast-math.c b/clang/test/Driver/fast-math.c
index 34b9899e9fc185e..882e

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

2023-09-04 Thread Brad Smith 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 rGb70f1f836da9: Haiku: Pick up a few more codegen parametres 
from downstream (authored by X512 , committed by 
brad).

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 { r

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

2023-09-04 Thread via cfe-commits

cor3ntin wrote:

Thanks. LGTM.
I'd like to do things properly so I'll wait for CI to be fixed before 
approving, hopefully we can figure that out today!
(Nothing to do on your end)

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-04 Thread via cfe-commits

kasuga-fj wrote:

Thank you for your quick review!

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


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

2023-09-04 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei 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");

skan wrote:
> It seems the change in X86.cpp is redundant?
It's not. We need `FeatureEVEX512` because it's independent of `FeatureAVX512`. 
We will have future AVX10-256 targets that have `FeatureAVX512` only.
Here we handle old IR that don't set `evex512` in function attributes.



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

skan wrote:
> Missing f?
No, it's intentional. Sometimes, feature attributes may not have a full set of 
AVX512 features. If user only use e.g., "avx512bw", we should make sure 
"evex512" attached too.


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][Diagnostics] Fix wrong line number display (PR #65238)

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

hazohelet wrote:

> Ouch the inability to comment outside of modified code is going to be painful.
> 
> The changed code being
> 
> ```c++
>   unsigned DisplayLineNo = Loc.getPresumedLoc().getLine();
>   for (const auto &I : Ranges) {
>   DisplayLineNo = 
> std::min(DisplayLineNo, SM.getPresumedLineNumber(I.getBegin()));
>   }
> ```
> 
> If the range starts before `DisplayLineNo`, it still works. Am I missing 
> something?

Thanks, that's my point.

When I provided an invalid source location, the diagnostics looked like the 
following. Filename, line/column number and code snippet are not printed.
```
source:7:3: error: no matching function for call to 'func'
7 |   func(3, 4, 5);
  |   ^~~~
note: candidate function not viable: expects an lvalue for 3rd argument
1 error generated.
```
When `Loc` is invalid, calling `Loc.getPresumedLoc().getLine()` should cause 
validness assertion failure in `PresumedLoc::getLine`, so invalid `Loc` seems 
to be handled elsewhere.

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] D159363: [clangd] SIGSEGV at clangd: DiagnosticConsumer Is Used After Free

2023-09-04 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment.

thanks, the fix LGTM as well.

but i wonder how this surfaces, to make sure we're taking necessary precautions 
in the future. we definitely have a dangling reference, which isn't great. but 
it's surprising that we access diags consumer during indexing.
I assume it's about the modules setup you're running clangd in. Do you have any 
stack traces that shows the execution path? my assumption is, this triggers 
when clangd ends up deserializing some symbols from a module. If these end up 
being important diagnostics, we might want to figure out how to emit 
diagnostics from these stages as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159363

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


[PATCH] D159363: [clangd] SIGSEGV at clangd: DiagnosticConsumer Is Used After Free

2023-09-04 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment.

thanks, the fix LGTM as well.

but i wonder how this surfaces, to make sure we're taking necessary precautions 
in the future. we definitely have a dangling reference, which isn't great. but 
it's surprising that we access diags consumer during indexing.
I assume it's about the modules setup you're running clangd in. Do you have any 
stack traces that shows the execution path? my assumption is, this triggers 
when clangd ends up deserializing some symbols from a module. If these end up 
being important diagnostics, we might want to figure out how to emit 
diagnostics from these stages as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159363

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


[clang] 27bba42 - [clang] Use range-based for loops (NFC)

2023-09-04 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2023-09-04T00:31:37-07:00
New Revision: 27bba42fc9e7674c6a8936c14e9614f3d7a30a85

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

LOG: [clang] Use range-based for loops (NFC)

Added: 


Modified: 
clang/lib/Parse/ParseObjc.cpp
clang/lib/Sema/SemaPseudoObject.cpp
clang/utils/TableGen/RISCVVEmitter.cpp

Removed: 




diff  --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 38448a0825617ac..c0261c462b8834e 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -65,10 +65,10 @@ Parser::ParseObjCAtDirectives(ParsedAttributes &DeclAttrs,
   case tok::objc_implementation:
 break;
   default:
-llvm::for_each(DeclAttrs, [this](const auto &Attr) {
+for (const auto &Attr : DeclAttrs) {
   if (Attr.isGNUAttribute())
 Diag(Tok.getLocation(), diag::err_objc_unexpected_attr);
-});
+}
   }
 
   Decl *SingleDecl = nullptr;

diff  --git a/clang/lib/Sema/SemaPseudoObject.cpp 
b/clang/lib/Sema/SemaPseudoObject.cpp
index 408f71044fa306f..1ac895e4eb1c86c 100644
--- a/clang/lib/Sema/SemaPseudoObject.cpp
+++ b/clang/lib/Sema/SemaPseudoObject.cpp
@@ -1451,7 +1451,8 @@ 
MSPropertyOpBuilder::getBaseMSProperty(MSPropertySubscriptExpr *E) {
 
 Expr *MSPropertyOpBuilder::rebuildAndCaptureObject(Expr *syntacticBase) {
   InstanceBase = capture(RefExpr->getBaseExpr());
-  llvm::for_each(CallArgs, [this](Expr *&Arg) { Arg = capture(Arg); });
+  for (Expr *&Arg : CallArgs)
+Arg = capture(Arg);
   syntacticBase = Rebuilder(S, [=](Expr *, unsigned Idx) -> Expr * {
 switch (Idx) {
 case 0:

diff  --git a/clang/utils/TableGen/RISCVVEmitter.cpp 
b/clang/utils/TableGen/RISCVVEmitter.cpp
index d2c3d70ac1f0121..41025926058ed07 100644
--- a/clang/utils/TableGen/RISCVVEmitter.cpp
+++ b/clang/utils/TableGen/RISCVVEmitter.cpp
@@ -264,13 +264,14 @@ void SemaSignatureTable::init(ArrayRef 
SemaRecords) {
 
   assert(!SemaRecords.empty());
 
-  llvm::for_each(SemaRecords, [&](const SemaRecord &SR) {
+  for (const SemaRecord &SR : SemaRecords) {
 InsertToSignatureSet(SR.Prototype);
 InsertToSignatureSet(SR.Suffix);
 InsertToSignatureSet(SR.OverloadedSuffix);
-  });
+  }
 
-  llvm::for_each(Signatures, [this](auto &Sig) { insert(Sig); });
+  for (auto &Sig : Signatures)
+insert(Sig);
 }
 
 void SemaSignatureTable::insert(ArrayRef Signature) {



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


[clang] 266c12a - [clang][dataflow] When dumping `ExprToVal`, dump the `Value`, not just its location.

2023-09-04 Thread Martin Braenne via cfe-commits

Author: Martin Braenne
Date: 2023-09-04T07:38:33Z
New Revision: 266c12a1bd603fa3ecbf26a6f93621f0f8488da1

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

LOG: [clang][dataflow] When dumping `ExprToVal`, dump the `Value`, not just its 
location.

This makes `ExprToVal` dumping consistent with `LocToVal` dumping.

Reviewed By: ymandel, xazax.hun

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

Added: 


Modified: 
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp

Removed: 




diff  --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp 
b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
index f15ea52d6b4699..b40fbbc991c8f8 100644
--- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -918,7 +918,7 @@ void Environment::dump(raw_ostream &OS) const {
 
   OS << "ExprToVal:\n";
   for (auto [E, V] : ExprToVal)
-OS << "  [" << E << ", " << V << "]\n";
+OS << "  [" << E << ", " << V << ": " << *V << "]\n";
 
   OS << "LocToVal:\n";
   for (auto [L, V] : LocToVal) {



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


[PATCH] D159274: [clang][dataflow] When dumping `ExprToVal`, dump the `Value`, not just its location.

2023-09-04 Thread Martin Böhme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG266c12a1bd60: [clang][dataflow] When dumping `ExprToVal`, 
dump the `Value`, not just its… (authored by mboehme).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159274

Files:
  clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp


Index: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
===
--- clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -918,7 +918,7 @@
 
   OS << "ExprToVal:\n";
   for (auto [E, V] : ExprToVal)
-OS << "  [" << E << ", " << V << "]\n";
+OS << "  [" << E << ", " << V << ": " << *V << "]\n";
 
   OS << "LocToVal:\n";
   for (auto [L, V] : LocToVal) {


Index: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
===
--- clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -918,7 +918,7 @@
 
   OS << "ExprToVal:\n";
   for (auto [E, V] : ExprToVal)
-OS << "  [" << E << ", " << V << "]\n";
+OS << "  [" << E << ", " << V << ": " << *V << "]\n";
 
   OS << "LocToVal:\n";
   for (auto [L, V] : LocToVal) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D159300: [AST] Support ConceptReference in DynTypedNode, add dump().

2023-09-04 Thread Jens Massberg via Phabricator via cfe-commits
massberg accepted this revision.
massberg added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159300

___
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-04 Thread Omair Javaid via cfe-commits

omjavaid wrote:

Hi Have you compared build performance between cl and clang-cl? If only cl.exe 
is taking a lot of time while clang-cl doesnt then may be we should make this 
change specific to cl.exe.

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-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

2023-09-04 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?= ,
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/7] [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/7] 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/7] 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 th

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

2023-09-04 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?= ,
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


[PATCH] D159414: Haiku: Fixes for header / library paths

2023-09-04 Thread Brad Smith via Phabricator via cfe-commits
brad created this revision.
brad added reviewers: nielx, korli, kallisti5.
brad added a project: clang.
Herald added a project: All.
brad requested review of this revision.
Herald added a subscriber: MaskRay.

Some fixes for the header / library paths..

- Use concat macro for all paths
- Correct the C++ header paths
- Add library path and GCC path handling


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159414

Files:
  clang/lib/Driver/ToolChains/Haiku.cpp

Index: clang/lib/Driver/ToolChains/Haiku.cpp
===
--- clang/lib/Driver/ToolChains/Haiku.cpp
+++ clang/lib/Driver/ToolChains/Haiku.cpp
@@ -21,6 +21,13 @@
 Haiku::Haiku(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
   : Generic_ELF(D, Triple, Args) {
 
+  GCCInstallation.init(Triple, Args);
+
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib"));
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/develop/lib"));
+
+  if (GCCInstallation.isValid())
+getFilePaths().push_back(GCCInstallation.getInstallPath().str());
 }
 
 void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
@@ -52,49 +59,82 @@
 return;
   }
 
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/non-packaged/develop/headers");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/app");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/device");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/drivers");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/game");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/interface");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/kernel");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/locale");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/mail");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/media");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/midi");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/midi2");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/net");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/opengl");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/storage");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/support");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/translation");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/graphics");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/input_server");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/mail_daemon");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/registrar");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/screen_saver");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/tracker");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/Deskbar");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/NetPositive");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/Tracker");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/3rdparty");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/bsd");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/glibc");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/gnu");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/posix");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers");
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/non-packaged/develop/headers"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os"));
+  addSystemInclude(DriverArgs, CC1Args, conact(D.SysRoot,
+   "/boot/system/develop/headers/os/app"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/device"));
+  addSystemInclude(DriverArgs,

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

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

tru wrote:

I suspect maybe the MSVC_VERSION check might exclude clang-cl, but we should 
make sure, because @omjavaid is correct, we shouldn't apply this to clang-cl 
unless it shows the same problems.

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-04 Thread Tobias Hieta via cfe-commits


@@ -39,6 +40,4 @@ struct C {
 
 static_assert(__builtin_offsetof(C, n) == 8,
   "long long field in ms_struct should be 8-byte aligned");
-#if !defined(TEST_FOR_ERROR) && !defined(TEST_FOR_WARNING)
-// expected-no-diagnostics
-#endif
+// expected-warning@-2 {{offset of on non-standard-layout type 'C'}}

tru wrote:

Missing EOL. Did you run `clang-format`?

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][MSExtentions] Fix invalid overload failure about the loss of `__unaligned` qualifier (PR #65248)

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

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


[clang] [clang][MSExtentions] Fix invalid overload failure about the loss of `__unaligned` qualifier (PR #65248)

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

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

Loss of `__unaligned` qualifier does not invalidate overload candidates.
This fixes a regression reported in https://reviews.llvm.org/D153690

>From eee4c3aee9350be51c9333f284810ffebd9d1663 Mon Sep 17 00:00:00 2001
From: Takuya Shimizu 
Date: Mon, 4 Sep 2023 16:23:00 +0900
Subject: [PATCH] [clang][MSExtentions] Fix invalid overload failure about the
 loss of `__unaligned` qualifier

Loss of `__unaligned` qualifier does not invalidate overload
candidates.
This fixes a regression reported in https://reviews.llvm.org/D153690
---
 clang/lib/Sema/SemaOverload.cpp|  8 +---
 clang/test/SemaCXX/MicrosoftExtensions.cpp | 11 +++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 5d0299dfa752f92..9833d0d312186b6 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -5557,9 +5557,11 @@ TryObjectArgumentInitialization(Sema &S, SourceLocation 
Loc, QualType FromType,
 
   // First check the qualifiers.
   QualType FromTypeCanon = S.Context.getCanonicalType(FromType);
-  if (ImplicitParamType.getCVRQualifiers()
-!= FromTypeCanon.getLocalCVRQualifiers() &&
-  !ImplicitParamType.isAtLeastAsQualifiedAs(FromTypeCanon)) {
+  // MSVC ignores __unaligned qualifier for overload candidates; do the same.
+  if (ImplicitParamType.getCVRQualifiers() !=
+  FromTypeCanon.getLocalCVRQualifiers() &&
+  !ImplicitParamType.isAtLeastAsQualifiedAs(
+  withoutUnaligned(S.Context, FromTypeCanon))) {
 ICS.setBad(BadConversionSequence::bad_qualifiers,
FromType, ImplicitParamType);
 return ICS;
diff --git a/clang/test/SemaCXX/MicrosoftExtensions.cpp 
b/clang/test/SemaCXX/MicrosoftExtensions.cpp
index 960030d44f0c155..71618048014cc74 100644
--- a/clang/test/SemaCXX/MicrosoftExtensions.cpp
+++ b/clang/test/SemaCXX/MicrosoftExtensions.cpp
@@ -589,6 +589,17 @@ namespace PR42089 {
   __attribute__((nothrow)) void S::Bar(){}
 }
 
+namespace UnalignedConv {
+struct S {
+  bool operator==(int) const;
+};
+
+int func() {
+  S __unaligned s;
+  return s == 42;
+}
+}
+
 #elif TEST2
 
 // Check that __unaligned is not recognized if MS extensions are not enabled

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


[clang] [clang][MSExtentions] Fix invalid overload failure about the loss of `__unaligned` qualifier (PR #65248)

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

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


[clang] [clang][MSExtentions] Fix invalid overload failure about the loss of `__unaligned` qualifier (PR #65248)

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

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


[clang] [clang][MSExtentions] Fix invalid overload failure about the loss of `__unaligned` qualifier (PR #65248)

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

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


[clang] [clang][MSExtentions] Fix invalid overload failure about the loss of `__unaligned` qualifier (PR #65248)

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

https://github.com/hazohelet review_requested 
https://github.com/llvm/llvm-project/pull/65248
___
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 `offsetof` (PR #65246)

2023-09-04 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] Fix missing diagnostic for non-standard layout type in `offsetof` (PR #65246)

2023-09-04 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


[PATCH] D159284: [clang][dataflow] Fix Record initialization with InitListExpr and inheritances

2023-09-04 Thread Kinuko Yasuda via Phabricator via cfe-commits
kinu updated this revision to Diff 555676.
kinu added a comment.

reverted wrong changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159284

Files:
  clang/lib/Analysis/FlowSensitive/Transfer.cpp
  clang/unittests/Analysis/FlowSensitive/TransferTest.cpp

Index: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
===
--- clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
@@ -1438,6 +1438,150 @@
   llvm::Succeeded());
 }
 
+TEST(TransferTest, StructModeledFieldsWithComplicatedInheritance) {
+  std::string Code = R"(
+struct Base3 {
+  int x7;
+  int x8;
+};
+struct Base2 : Base3 {
+  int x5;
+  int x6;
+};
+struct Base {
+  int x3;
+  int x4;
+};
+struct Foo : public Base, Base2 {
+  int x1;
+  int x2;
+};
+
+void target() {
+  Foo F;
+  F.x4 = F.x2;
+  F.x6 = 1;
+  F.x8 = 1;
+  // [[p]]
+}
+  )";
+  runDataflow(
+  Code,
+  [](const llvm::StringMap> &Results,
+ ASTContext &ASTCtx) {
+const Environment &Env =
+  getEnvironmentAtAnnotation(Results, "p");
+
+const ValueDecl *FooDecl = findValueDecl(ASTCtx, "F");
+const ValueDecl *X1Decl = findValueDecl(ASTCtx, "x1");
+const ValueDecl *X2Decl = findValueDecl(ASTCtx, "x2");
+const ValueDecl *X3Decl = findValueDecl(ASTCtx, "x3");
+const ValueDecl *X4Decl = findValueDecl(ASTCtx, "x4");
+const ValueDecl *X5Decl = findValueDecl(ASTCtx, "x5");
+const ValueDecl *X6Decl = findValueDecl(ASTCtx, "x6");
+const ValueDecl *X7Decl = findValueDecl(ASTCtx, "x7");
+const ValueDecl *X8Decl = findValueDecl(ASTCtx, "x8");
+ASSERT_THAT(FooDecl, NotNull());
+
+// Only "x2", "x4", "x6", and "x8" are accessed and exist in the model.
+const auto *FooLoc =
+cast(Env.getStorageLocation(*FooDecl));
+llvm::DenseSet Fields;
+for (auto [Field, _] : FooLoc->children()) {
+  Fields.insert(Field);
+}
+ASSERT_EQ(Fields.size(), 4);
+ASSERT_TRUE(Fields.contains(X2Decl));
+ASSERT_TRUE(Fields.contains(X4Decl));
+ASSERT_TRUE(Fields.contains(X6Decl));
+ASSERT_TRUE(Fields.contains(X8Decl));
+
+// "x1", "x3", "x5", "x7" are not used therefore are filtered out.
+ASSERT_FALSE(Fields.contains(X1Decl));
+ASSERT_FALSE(Fields.contains(X3Decl));
+ASSERT_FALSE(Fields.contains(X5Decl));
+ASSERT_FALSE(Fields.contains(X7Decl));
+  });
+}
+
+TEST(TransferTest, StructInitializerListWithComplicatedInheritance) {
+  std::string Code = R"(
+struct Base3 {
+  int x7;
+  int x8;
+};
+struct Base2 : Base3 {
+  int x5;
+  int x6;
+};
+struct Base {
+  int x3;
+  int x4;
+};
+struct Foo : public Base, Base2 {
+  int x1;
+  int x2;
+};
+
+void target() {
+  Foo F = {};
+  F.x4 = F.x2;
+  F.x6 = 1;
+  F.x8 = 1;
+  // [[p]]
+}
+  )";
+  runDataflow(
+  Code,
+  [](const llvm::StringMap> &Results,
+ ASTContext &ASTCtx) {
+const Environment &Env =
+  getEnvironmentAtAnnotation(Results, "p");
+
+const ValueDecl *FooDecl = findValueDecl(ASTCtx, "F");
+const ValueDecl *X1Decl = findValueDecl(ASTCtx, "x1");
+const ValueDecl *X2Decl = findValueDecl(ASTCtx, "x2");
+const ValueDecl *X3Decl = findValueDecl(ASTCtx, "x3");
+const ValueDecl *X4Decl = findValueDecl(ASTCtx, "x4");
+const ValueDecl *X5Decl = findValueDecl(ASTCtx, "x5");
+const ValueDecl *X6Decl = findValueDecl(ASTCtx, "x6");
+const ValueDecl *X7Decl = findValueDecl(ASTCtx, "x7");
+const ValueDecl *X8Decl = findValueDecl(ASTCtx, "x8");
+ASSERT_THAT(FooDecl, NotNull());
+
+// When a struct is initialized with a initializer list, all the
+// fields are considered "accessed", and therefore do exist.
+// (Without the initializer, we should only see "x2", "x4", "x6",
+// and "x8")
+const auto *FooLoc =
+cast(Env.getStorageLocation(*FooDecl));
+const auto *X1Val =
+cast(getFieldValue(FooLoc, *X1Decl, Env));
+const auto *X2Val =
+cast(getFieldValue(FooLoc, *X2Decl, Env));
+const auto *X3Val =
+cast(getFieldValue(FooLoc, *X3Decl, Env));
+const auto *X4Val =
+cast(getFieldValue(FooLoc, *X4Decl, Env));
+const auto *X5Val =
+cast(getFieldValue(FooLoc, *X5Decl, Env));
+const auto *X6Val =
+cast(getFieldValue(FooLoc, *X6Decl, Env));
+const auto *X7Val =
+cast(getFieldValue(FooLoc, *X7Decl, Env));
+const auto *X8Val =
+   

[PATCH] D153690: [clang][Sema] Remove dead diagnostic for loss of __unaligned qualifier

2023-09-04 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment.

I submitted PR to fix the crash: https://github.com/llvm/llvm-project/pull/65248


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153690

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


[PATCH] D159309: [ASTMatchers] basic matcher support for ConceptReference

2023-09-04 Thread Jens Massberg via Phabricator via cfe-commits
massberg added inline comments.



Comment at: clang/docs/LibASTMatchersReference.html:2545
   };
-dependentSizedArrayType()
+dependentSizedArrayType
   matches "T data[Size]"

Was this change to drop the () by purpose?



Comment at: clang/docs/LibASTMatchersReference.html:2559
   };
-dependentSizedExtVectorType()
+dependentSizedExtVectorType
   matches "T __attribute__((ext_vector_type(Size)))"

same as above


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159309

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


[clang] d948d91 - [clang][dataflow] Remove deprecated synonyms related to `RecordStorageLocation` and `RecordValue`

2023-09-04 Thread Martin Braenne via cfe-commits

Author: Martin Braenne
Date: 2023-09-04T08:18:43Z
New Revision: d948d9121f104f06b47361528289030a28e1e044

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

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

Reviewed By: ymandel, xazax.hun

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

Added: 


Modified: 
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
clang/include/clang/Analysis/FlowSensitive/Value.h

Removed: 




diff  --git a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h 
b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
index f5e4057f957a969..c128ee4ea85c928 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
@@ -690,15 +690,6 @@ RecordValue &refreshRecordValue(RecordStorageLocation 
&Loc, Environment &Env);
 /// See also documentation for the overload above.
 RecordValue &refreshRecordValue(const Expr &Expr, Environment &Env);
 
-/// Deprecated synonym for `refreshRecordValue()`.
-inline RecordValue &refreshStructValue(RecordStorageLocation &Loc,
-   Environment &Env) {
-  return refreshRecordValue(Loc, Env);
-}
-inline RecordValue &refreshStructValue(const Expr &Expr, Environment &Env) {
-  return refreshRecordValue(Expr, Env);
-}
-
 } // namespace dataflow
 } // namespace clang
 

diff  --git a/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h 
b/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
index 4a55adad74616ed..89d2bbfbb69f9fb 100644
--- a/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
+++ b/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
@@ -34,8 +34,6 @@ class StorageLocation {
   enum class Kind {
 Scalar,
 Record,
-// Deprecated synonym for `Record`
-Aggregate = Record,
   };
 
   StorageLocation(Kind LocKind, QualType Type) : LocKind(LocKind), Type(Type) {
@@ -155,9 +153,6 @@ class RecordStorageLocation final : public StorageLocation {
   FieldToLoc Children;
 };
 
-/// Deprecated synonym for `RecordStorageLocation`.
-using AggregateStorageLocation = RecordStorageLocation;
-
 } // namespace dataflow
 } // namespace clang
 

diff  --git a/clang/include/clang/Analysis/FlowSensitive/Value.h 
b/clang/include/clang/Analysis/FlowSensitive/Value.h
index da9fe6be9489c20..6e911af7264ced9 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Value.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Value.h
@@ -36,8 +36,6 @@ class Value {
 Integer,
 Pointer,
 Record,
-// Deprecated synonym for `Record`
-Struct = Record,
 
 // TODO: Top values should not be need to be type-specific.
 TopBool,
@@ -227,9 +225,6 @@ class RecordValue final : public Value {
   /// Returns the storage location that this `RecordValue` is associated with.
   RecordStorageLocation &getLoc() const { return Loc; }
 
-  /// Deprecated synonym for `getLoc()`.
-  RecordStorageLocation &getAggregateLoc() const { return Loc; }
-
   /// Convenience function that returns the child storage location for `Field`.
   /// See also the documentation for `RecordStorageLocation::getChild()`.
   StorageLocation *getChild(const ValueDecl &Field) const {
@@ -240,9 +235,6 @@ class RecordValue final : public Value {
   RecordStorageLocation &Loc;
 };
 
-/// Deprecated synonym for `RecordValue`.
-using StructValue = RecordValue;
-
 raw_ostream &operator<<(raw_ostream &OS, const Value &Val);
 
 } // namespace dataflow



___
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-04 Thread Martin Böhme 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 rGd948d9121f10: [clang][dataflow] Remove deprecated synonyms 
related to `RecordStorageLocation`… (authored by mboehme).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159264

Files:
  clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
  clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
  clang/include/clang/Analysis/FlowSensitive/Value.h


Index: clang/include/clang/Analysis/FlowSensitive/Value.h
===
--- clang/include/clang/Analysis/FlowSensitive/Value.h
+++ clang/include/clang/Analysis/FlowSensitive/Value.h
@@ -36,8 +36,6 @@
 Integer,
 Pointer,
 Record,
-// Deprecated synonym for `Record`
-Struct = Record,
 
 // TODO: Top values should not be need to be type-specific.
 TopBool,
@@ -227,9 +225,6 @@
   /// Returns the storage location that this `RecordValue` is associated with.
   RecordStorageLocation &getLoc() const { return Loc; }
 
-  /// Deprecated synonym for `getLoc()`.
-  RecordStorageLocation &getAggregateLoc() const { return Loc; }
-
   /// Convenience function that returns the child storage location for `Field`.
   /// See also the documentation for `RecordStorageLocation::getChild()`.
   StorageLocation *getChild(const ValueDecl &Field) const {
@@ -240,9 +235,6 @@
   RecordStorageLocation &Loc;
 };
 
-/// Deprecated synonym for `RecordValue`.
-using StructValue = RecordValue;
-
 raw_ostream &operator<<(raw_ostream &OS, const Value &Val);
 
 } // namespace dataflow
Index: clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
===
--- clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
+++ clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
@@ -34,8 +34,6 @@
   enum class Kind {
 Scalar,
 Record,
-// Deprecated synonym for `Record`
-Aggregate = Record,
   };
 
   StorageLocation(Kind LocKind, QualType Type) : LocKind(LocKind), Type(Type) {
@@ -155,9 +153,6 @@
   FieldToLoc Children;
 };
 
-/// Deprecated synonym for `RecordStorageLocation`.
-using AggregateStorageLocation = RecordStorageLocation;
-
 } // namespace dataflow
 } // namespace clang
 
Index: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
===
--- clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
+++ clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
@@ -690,15 +690,6 @@
 /// See also documentation for the overload above.
 RecordValue &refreshRecordValue(const Expr &Expr, Environment &Env);
 
-/// Deprecated synonym for `refreshRecordValue()`.
-inline RecordValue &refreshStructValue(RecordStorageLocation &Loc,
-   Environment &Env) {
-  return refreshRecordValue(Loc, Env);
-}
-inline RecordValue &refreshStructValue(const Expr &Expr, Environment &Env) {
-  return refreshRecordValue(Expr, Env);
-}
-
 } // namespace dataflow
 } // namespace clang
 


Index: clang/include/clang/Analysis/FlowSensitive/Value.h
===
--- clang/include/clang/Analysis/FlowSensitive/Value.h
+++ clang/include/clang/Analysis/FlowSensitive/Value.h
@@ -36,8 +36,6 @@
 Integer,
 Pointer,
 Record,
-// Deprecated synonym for `Record`
-Struct = Record,
 
 // TODO: Top values should not be need to be type-specific.
 TopBool,
@@ -227,9 +225,6 @@
   /// Returns the storage location that this `RecordValue` is associated with.
   RecordStorageLocation &getLoc() const { return Loc; }
 
-  /// Deprecated synonym for `getLoc()`.
-  RecordStorageLocation &getAggregateLoc() const { return Loc; }
-
   /// Convenience function that returns the child storage location for `Field`.
   /// See also the documentation for `RecordStorageLocation::getChild()`.
   StorageLocation *getChild(const ValueDecl &Field) const {
@@ -240,9 +235,6 @@
   RecordStorageLocation &Loc;
 };
 
-/// Deprecated synonym for `RecordValue`.
-using StructValue = RecordValue;
-
 raw_ostream &operator<<(raw_ostream &OS, const Value &Val);
 
 } // namespace dataflow
Index: clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
===
--- clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
+++ clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
@@ -34,8 +34,6 @@
   enum class Kind {
 Scalar,
 Record,
-// Deprecated synonym for `Record`
-Aggregate = Record,
   };
 
   StorageLocation(Kind LocKind, QualType Type) : LocKind(LocKind), Type(Type) {
@@ -155,9 +153,6 @@
   FieldToLoc Children;
 };
 
-/// Deprecated synonym for `RecordStorageLocation

[PATCH] D141757: [clangd] allow extracting to variable for lambda expressions

2023-09-04 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added inline comments.



Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp:102
+
+  if (clang::Expr *const RequiresClause =
+  LExpr->getTrailingRequiresClause();

nit: just `if (clang::Expr *const RequiresClause = 
LExpr->getTrailingRequiresClause())` is equivalent



Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp:187
+// Allow expressions, but only allow completely selected lambda
+// expressions or unselected lambda expressions that are the parent of
+// the originally selected node, not partially selected lambda

5chmidti wrote:
> nridge wrote:
> > I think it's worth adding to the comment *why* we allow unselected lambda 
> > expressions (to allow extracting from capture initializers), as it's not 
> > obvious
> I changed the previous return of `!isa(Stmt) || 
> InsertionPoint->Selected != SelectionTree::Partial;` to a simple `return 
> true;`. None of my partial selection tests fail and I can't think of a case 
> where the lambda would be partially selected.
Hmm, so what actually happens in these testcases?

```
  // lambdas: partially selected
  [][[(){}]];
  []()[[{}]];
  [ [[ ](){}]];
```


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

https://reviews.llvm.org/D141757

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


[clang] bf46b0b - [clang][dataflow] Eliminate deprecated `ControlFlowContext::build()` overload.

2023-09-04 Thread Martin Braenne via cfe-commits

Author: Martin Braenne
Date: 2023-09-04T08:30:54Z
New Revision: bf46b0b551011d958ae642f808894311513517ef

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

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

Reviewed By: ymandel, xazax.hun

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

Added: 


Modified: 
clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp

Removed: 




diff  --git a/clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h 
b/clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
index a45bb0635a2f363..768387a121b920a 100644
--- a/clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
+++ b/clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
@@ -40,12 +40,6 @@ class ControlFlowContext {
   static llvm::Expected build(const Decl &D, Stmt &S,
   ASTContext &C);
 
-  /// Builds a ControlFlowContext from an AST node. `D` is the function in 
which
-  /// `S` resides. `D` must not be null and `D->isTemplated()` must be false.
-  LLVM_DEPRECATED("Use the version that takes a const Decl & instead", "")
-  static llvm::Expected build(const Decl *D, Stmt &S,
-  ASTContext &C);
-
   /// Returns the `Decl` containing the statement used to construct the CFG, if
   /// available.
   const Decl &getDecl() const { return ContainingDecl; }

diff  --git a/clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp 
b/clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
index d5e0b443caf3015..7f9bc31bd41f2dd 100644
--- a/clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
+++ b/clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
@@ -109,15 +109,5 @@ ControlFlowContext::build(const Decl &D, Stmt &S, 
ASTContext &C) {
 std::move(BlockReachable));
 }
 
-llvm::Expected
-ControlFlowContext::build(const Decl *D, Stmt &S, ASTContext &C) {
-  if (D == nullptr)
-return llvm::createStringError(
-std::make_error_code(std::errc::invalid_argument),
-"Declaration must not be null");
-
-  return build(*D, S, C);
-}
-
 } // namespace dataflow
 } // namespace clang



___
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-04 Thread Martin Böhme 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 rGbf46b0b55101: [clang][dataflow] Eliminate deprecated 
`ControlFlowContext::build()` overload. (authored by mboehme).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159262

Files:
  clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
  clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp


Index: clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
===
--- clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
+++ clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
@@ -109,15 +109,5 @@
 std::move(BlockReachable));
 }
 
-llvm::Expected
-ControlFlowContext::build(const Decl *D, Stmt &S, ASTContext &C) {
-  if (D == nullptr)
-return llvm::createStringError(
-std::make_error_code(std::errc::invalid_argument),
-"Declaration must not be null");
-
-  return build(*D, S, C);
-}
-
 } // namespace dataflow
 } // namespace clang
Index: clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
===
--- clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
+++ clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
@@ -40,12 +40,6 @@
   static llvm::Expected build(const Decl &D, Stmt &S,
   ASTContext &C);
 
-  /// Builds a ControlFlowContext from an AST node. `D` is the function in 
which
-  /// `S` resides. `D` must not be null and `D->isTemplated()` must be false.
-  LLVM_DEPRECATED("Use the version that takes a const Decl & instead", "")
-  static llvm::Expected build(const Decl *D, Stmt &S,
-  ASTContext &C);
-
   /// Returns the `Decl` containing the statement used to construct the CFG, if
   /// available.
   const Decl &getDecl() const { return ContainingDecl; }


Index: clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
===
--- clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
+++ clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
@@ -109,15 +109,5 @@
 std::move(BlockReachable));
 }
 
-llvm::Expected
-ControlFlowContext::build(const Decl *D, Stmt &S, ASTContext &C) {
-  if (D == nullptr)
-return llvm::createStringError(
-std::make_error_code(std::errc::invalid_argument),
-"Declaration must not be null");
-
-  return build(*D, S, C);
-}
-
 } // namespace dataflow
 } // namespace clang
Index: clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
===
--- clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
+++ clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h
@@ -40,12 +40,6 @@
   static llvm::Expected build(const Decl &D, Stmt &S,
   ASTContext &C);
 
-  /// Builds a ControlFlowContext from an AST node. `D` is the function in which
-  /// `S` resides. `D` must not be null and `D->isTemplated()` must be false.
-  LLVM_DEPRECATED("Use the version that takes a const Decl & instead", "")
-  static llvm::Expected build(const Decl *D, Stmt &S,
-  ASTContext &C);
-
   /// Returns the `Decl` containing the statement used to construct the CFG, if
   /// available.
   const Decl &getDecl() const { return ContainingDecl; }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D159174: [Clang] Use stable_sort in AppendTargetMangling

2023-09-04 Thread Pavel Iliin via Phabricator via cfe-commits
ilinpv added a comment.

In D159174#4635886 , @BeMg wrote:

> I'm working on RISC-V FMV support, and we found the large set of extension 
> features is hard to maintain the priority that doesn't collision at all.

On AArch64 for FMV we are using ##target_version## attribute and 
##AppendTargetVersionMangling## with llvm::stable_sort


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159174

___
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-04 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?= ,
Carlos =?utf-8?q?G=C3=A1lvez?= ,
Carlos =?utf-8?q?G=C3=A1lvez?= 


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

No more comments from me.

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


[PATCH] D141757: [clangd] allow extracting to variable for lambda expressions

2023-09-04 Thread Nathan Ridge via Phabricator via cfe-commits
nridge requested changes to this revision.
nridge added inline comments.
This revision now requires changes to proceed.



Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp:187
+// Allow expressions, but only allow completely selected lambda
+// expressions or unselected lambda expressions that are the parent of
+// the originally selected node, not partially selected lambda

nridge wrote:
> 5chmidti wrote:
> > nridge wrote:
> > > I think it's worth adding to the comment *why* we allow unselected lambda 
> > > expressions (to allow extracting from capture initializers), as it's not 
> > > obvious
> > I changed the previous return of `!isa(Stmt) || 
> > InsertionPoint->Selected != SelectionTree::Partial;` to a simple `return 
> > true;`. None of my partial selection tests fail and I can't think of a case 
> > where the lambda would be partially selected.
> Hmm, so what actually happens in these testcases?
> 
> ```
>   // lambdas: partially selected
>   [][[(){}]];
>   []()[[{}]];
>   [ [[ ](){}]];
> ```
I checked, and in these cases we disallow the extraction 
[here](https://searchfox.org/llvm/rev/c2bee1ed26a3355d164c92f1eb70ebf88804560d/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp#426-432)
 before we get to creating an `ExtractionContext`.

If the testcases are modified as follows:

```
template  void sink(T) {}
...
void f() {
  // lambdas: partially selected
  sink([][[(){}]]);
  sink([]()[[{}]]);
  sink([ [[ ](){}]]);
}
```

now they fail, unless the check for partial selection here is restored.


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

https://reviews.llvm.org/D141757

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


[PATCH] D141757: [clangd] allow extracting to variable for lambda expressions

2023-09-04 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

(Otherwise the updates look good!)


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

https://reviews.llvm.org/D141757

___
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 `offsetof` (PR #65246)

2023-09-04 Thread via cfe-commits


@@ -39,6 +40,4 @@ struct C {
 
 static_assert(__builtin_offsetof(C, n) == 8,
   "long long field in ms_struct should be 8-byte aligned");
-#if !defined(TEST_FOR_ERROR) && !defined(TEST_FOR_WARNING)
-// expected-no-diagnostics
-#endif
+// expected-warning@-2 {{offset of on non-standard-layout type 'C'}}

kasuga-fj wrote:

Yes. I ran `git clang-format HEAD~2`, but no files were modified. Should we 
apply clang-format to the tests as well? (I think removing EOL is not good. 
I'll fix it)

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 `offsetof` (PR #65246)

2023-09-04 Thread via cfe-commits


@@ -39,6 +40,4 @@ struct C {
 
 static_assert(__builtin_offsetof(C, n) == 8,
   "long long field in ms_struct should be 8-byte aligned");
-#if !defined(TEST_FOR_ERROR) && !defined(TEST_FOR_WARNING)
-// expected-no-diagnostics
-#endif
+// expected-warning@-2 {{offset of on non-standard-layout type 'C'}}

cor3ntin wrote:

We do not run clang-format on tests - in part because tests are sensible to 
line number changes.

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


[PATCH] D159363: [clangd] SIGSEGV at clangd: DiagnosticConsumer Is Used After Free

2023-09-04 Thread Ivan Murashko via Phabricator via cfe-commits
ivanmurashko added a comment.

In D159363#4636581 , @kadircet wrote:

> thanks, the fix LGTM as well.
>
> but i wonder how this surfaces, to make sure we're taking necessary 
> precautions in the future. we definitely have a dangling reference, which 
> isn't great. but it's surprising that we access diags consumer during 
> indexing.
> I assume it's about the modules setup you're running clangd in. Do you have 
> any stack traces that shows the execution path? my assumption is, this 
> triggers when clangd ends up deserializing some symbols from a module. If 
> these end up being important diagnostics, we might want to figure out how to 
> emit diagnostics from these stages as well.

Yes, you are right. The diags consumer is triggered when it tries to read an 
implicit module that has some incompatibilities with the preamble headers.

The typical stack trace is below (that is LLVM-12 specific)

  clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&)
  clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool)
  clang::DiagnosticBuilder::~DiagnosticBuilder()
  clang::ASTReader::diagnoseOdrViolations()
  clang::ASTReader::FinishedDeserializing()
  clang::DeclContext::LoadLexicalDeclsFromExternalStorage()
  clang::DeclContext::decls_begin()
  clang::index::IndexingContext::indexDeclContext(clang::DeclContext const*)
  clang::declvisitor::Base::Visit(clang::Decl const*)
  clang::index::IndexingContext::indexDecl(clang::Decl const*)
  clang::index::IndexingContext::indexDeclContext(clang::DeclContext const*)
  clang::declvisitor::Base::Visit(clang::Decl const*)
  clang::index::IndexingContext::indexDecl(clang::Decl const*)
  clang::index::IndexingContext::indexDeclContext(clang::DeclContext const*)
  clang::declvisitor::Base::Visit(clang::Decl const*)
  clang::index::IndexingContext::indexDecl(clang::Decl const*)
  clang::index::indexTopLevelDecls(clang::ASTContext&, clang::Preprocessor&, 
llvm::ArrayRef, clang::index::IndexDataConsumer&, 
clang::index::IndexingOptions)
  clang::clangd::(anonymous namespace)::indexSymbols(clang::ASTContext&, 
std::shared_ptr, llvm::ArrayRef, 
clang::clangd::MainFileMacros const*, clang::clangd::CanonicalIncludes const&, 
bool, llvm::StringRef, bool)
  clang::clangd::indexHeaderSymbols(llvm::StringRef, clang::ASTContext&, 
std::shared_ptr, clang::clangd::CanonicalIncludes const&)
  clang::clangd::FileIndex::updatePreamble(llvm::StringRef, llvm::StringRef, 
clang::ASTContext&, std::shared_ptr, 
clang::clangd::CanonicalIncludes const&)
  void
  void
  threadFuncAsync(void*)
  start_thread


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159363

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


[PATCH] D159414: Haiku: Fixes for header / library paths

2023-09-04 Thread Brad Smith via Phabricator via cfe-commits
brad updated this revision to Diff 555689.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159414

Files:
  clang/lib/Driver/ToolChains/Haiku.cpp

Index: clang/lib/Driver/ToolChains/Haiku.cpp
===
--- clang/lib/Driver/ToolChains/Haiku.cpp
+++ clang/lib/Driver/ToolChains/Haiku.cpp
@@ -21,6 +21,13 @@
 Haiku::Haiku(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
   : Generic_ELF(D, Triple, Args) {
 
+  GCCInstallation.init(Triple, Args);
+
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib"));
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/develop/lib"));
+
+  if (GCCInstallation.isValid())
+getFilePaths().push_back(GCCInstallation.getInstallPath().str());
 }
 
 void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
@@ -52,49 +59,82 @@
 return;
   }
 
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/non-packaged/develop/headers");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/app");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/device");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/drivers");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/game");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/interface");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/kernel");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/locale");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/mail");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/media");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/midi");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/midi2");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/net");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/opengl");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/storage");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/support");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/translation");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/graphics");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/input_server");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/mail_daemon");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/registrar");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/screen_saver");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/tracker");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/Deskbar");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/NetPositive");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/Tracker");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/3rdparty");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/bsd");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/glibc");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/gnu");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/posix");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers");
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/non-packaged/develop/headers"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/app"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/device"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/drivers"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+   "/boot/system/develop/headers/os/game"));
+  addSystemInclude(DriverArgs, CC1Ar

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

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


@@ -39,6 +40,4 @@ struct C {
 
 static_assert(__builtin_offsetof(C, n) == 8,
   "long long field in ms_struct should be 8-byte aligned");
-#if !defined(TEST_FOR_ERROR) && !defined(TEST_FOR_WARNING)
-// expected-no-diagnostics
-#endif
+// expected-warning@-2 {{offset of on non-standard-layout type 'C'}}

tru wrote:

Ah I missed that it was in a test. We shouldn't run clang-format then. But the 
EOL should be fixed! Sorry for the drive-by review :)

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


[PATCH] D159206: [Clang] Propagate target-features if compatible when using mlink-builtin-bitcode

2023-09-04 Thread Juan Manuel Martinez Caamaño via Phabricator via cfe-commits
jmmartinez updated this revision to Diff 555691.
jmmartinez marked 4 inline comments as done.
jmmartinez added a comment.

- Review


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159206

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/test/CodeGen/link-builtin-bitcode.c
  clang/test/CodeGenCUDA/link-builtin-bitcode-gpu-attrs-preserved.cu

Index: clang/test/CodeGenCUDA/link-builtin-bitcode-gpu-attrs-preserved.cu
===
--- clang/test/CodeGenCUDA/link-builtin-bitcode-gpu-attrs-preserved.cu
+++ clang/test/CodeGenCUDA/link-builtin-bitcode-gpu-attrs-preserved.cu
@@ -31,7 +31,7 @@
 
 
 // CHECK: define {{.*}} i64 @do_intrin_stuff() #[[ATTR:[0-9]+]]
-// INTERNALIZE: attributes #[[ATTR]] = {{.*}} "target-cpu"="gfx{{.*}}" "target-features"="+gfx11-insts"
+// INTERNALIZE: attributes #[[ATTR]] = {{.*}} "target-cpu"="gfx{{.*}}" "target-features"="{{.*}}+gfx11-insts{{.*}}"
 // NOINTERNALIZE: attributes #[[ATTR]] = {{.*}} "target-features"="+gfx11-insts"
 
 #define __device__ __attribute__((device))
Index: clang/test/CodeGen/link-builtin-bitcode.c
===
--- clang/test/CodeGen/link-builtin-bitcode.c
+++ clang/test/CodeGen/link-builtin-bitcode.c
@@ -1,42 +1,50 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes --check-globals --include-generated-funcs --version 2
+// Build two version of the bitcode library, one with a target-cpu set and one without
 // RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx803 -DBITCODE -emit-llvm-bc -o %t-lib.bc %s
+// RUN: %clang_cc1 -triple amdgcn-- -DBITCODE -emit-llvm-bc -o %t-lib.no-cpu.bc %s
+
+// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx90a -emit-llvm-bc -o %t.bc %s
+// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx90a -emit-llvm \
+// RUN:   -mlink-builtin-bitcode %t-lib.bc -o - %t.bc | FileCheck %s --check-prefixes=CHECK,CPU
+
 // RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx90a -emit-llvm-bc -o %t.bc %s
 // RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx90a -emit-llvm \
-// RUN:   -mlink-builtin-bitcode %t-lib.bc -o - %t.bc | FileCheck %s
+// RUN:   -mlink-builtin-bitcode %t-lib.no-cpu.bc -o - %t.bc | FileCheck %s --check-prefixes=CHECK,NOCPU
 
 #ifdef BITCODE
-int foo(void) { return 42; }
+int no_attr(void) { return 42; }
+int __attribute__((target("gfx8-insts"))) attr_in_target(void) { return 42; }
+int __attribute__((target("extended-image-insts"))) attr_not_in_target(void) { return 42; }
+int __attribute__((target("no-gfx9-insts"))) attr_incompatible(void) { return 42; }
 int x = 12;
 #endif
 
-extern int foo(void);
+extern int no_attr(void);
+extern int attr_in_target(void);
+extern int attr_not_in_target(void);
+extern int attr_incompatible(void);
 extern int x;
 
-int bar() { return foo() + x; }
-//.
+int bar() { return no_attr() + attr_in_target() + attr_not_in_target() + attr_incompatible() + x; }
+
 // CHECK: @x = internal addrspace(1) global i32 12, align 4
-//.
-// CHECK: Function Attrs: noinline nounwind optnone
+
 // CHECK-LABEL: define dso_local i32 @bar
-// CHECK-SAME: () #[[ATTR0:[0-9]+]] {
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[RETVAL:%.*]] = alloca i32, align 4, addrspace(5)
-// CHECK-NEXT:[[RETVAL_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL]] to ptr
-// CHECK-NEXT:[[CALL:%.*]] = call i32 @foo()
-// CHECK-NEXT:[[TMP0:%.*]] = load i32, ptr addrspacecast (ptr addrspace(1) @x to ptr), align 4
-// CHECK-NEXT:[[ADD:%.*]] = add nsw i32 [[CALL]], [[TMP0]]
-// CHECK-NEXT:ret i32 [[ADD]]
+// CHECK-SAME: () #[[ATTR_BAR:[0-9]+]] {
 //
-//
-// CHECK: Function Attrs: convergent noinline nounwind optnone
-// CHECK-LABEL: define internal i32 @foo
-// CHECK-SAME: () #[[ATTR1:[0-9]+]] {
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[RETVAL:%.*]] = alloca i32, align 4, addrspace(5)
-// CHECK-NEXT:[[RETVAL_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL]] to ptr
-// CHECK-NEXT:ret i32 42
-//
-//.
-// CHECK: attributes #0 = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx90a" "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-fadd-rtn-insts,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" }
-// CHECK: attributes #1 = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx90a" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" }
-//.
+// CHECK-LABEL: define internal i32 @no_attr
+// CHECK-SAME: () #[[ATTR_COMPATIBLE:[0-9]+]] {
+
+// CHECK-LABEL: define internal i32 @attr_in_target
+// CHECK-S

[PATCH] D159206: [Clang] Propagate target-features if compatible when using mlink-builtin-bitcode

2023-09-04 Thread Juan Manuel Martinez Caamaño via Phabricator via cfe-commits
jmmartinez added inline comments.



Comment at: clang/lib/CodeGen/CGCall.cpp:2017
+for (StringRef Feature : llvm::split(FFeatures.getValueAsString(), ',')) {
+  bool EnabledForFunc = Feature[0] == '+';
+  StringRef Name = Feature.substr(1);

arsenm wrote:
> Do you need to guard against empty string?
I checked and I saw some tests without it. I'm adding the condition for it.



Comment at: clang/lib/CodeGen/CGCall.cpp:2018
+  bool EnabledForFunc = Feature[0] == '+';
+  StringRef Name = Feature.substr(1);
+  auto TEntry = TFeatures.find(Name);

arsenm wrote:
> consume_front
I used drop_front(1) instead, consume_front would only work with "+" and not 
drop "-".



Comment at: clang/lib/CodeGen/CGCall.cpp:2030-2031
+  bool EnabledForTarget = TEntry->second;
+  if (EnabledForTarget != EnabledForFunc)
+return;
+}

arsenm wrote:
> Early return breaks the other features
I did not understand this remark.

If the features are not compatible, we do not add a "target-features" entry in 
the new "FuncAttrs". Then, the old "target-features" entry is kept in the 
Function coming from the builtin.

If you think it would be better to set the target-features in FuncAttrs to the 
old value in any case. If that's the case I've added the following code:

if (EnabledForTarget != EnabledForFunc) {
FuncAttr.addAttribute(FFeatures);
return;
}


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159206

___
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 `offsetof` (PR #65246)

2023-09-04 Thread via cfe-commits

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

>From d15196f5148194c5cb2f59c438d06f9fa61c8b4a Mon Sep 17 00:00:00 2001
From: "kasuga.ryotaro" 
Date: Wed, 30 Aug 2023 13:26:31 +0900
Subject: [PATCH 1/3] [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 -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -Wno-invalid-offsetof -DCLANG_ABI_COMPAT=6
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -Wno-invalid-offsetof -fclang-abi-compat=6 
-

[PATCH] D158591: Add support of Windows Trace Logging macros

2023-09-04 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment.

@RIscRIpt Do you need further help on this patch? You have commit access, 
right? 
(I'm trying to make sure things don't fall through the cracks as we move to 
github)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158591

___
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 `offsetof` (PR #65246)

2023-09-04 Thread via cfe-commits

https://github.com/kasuga-fj resolved 
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


[PATCH] D154893: [Clang] Fix some triviality computations

2023-09-04 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment.

@royjacobson Are you still working on that? It seems it's only missing updates 
to a comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154893

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


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

2023-09-04 Thread via cfe-commits

kiranchandramohan wrote:

Please add a quick RFC in the mlir discourse channel.

Would it make sense to call it an internal region? Or specialize it further and 
call it canonical_loop_region?

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


[PATCH] D154716: [SemaCXX] Fix bug where unexpanded lambda captures where assumed to be expanded

2023-09-04 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment.

@MitalAshok Are you still working on this? Do you need further help on this 
patch? You have commit access, correct?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154716

___
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 `offsetof` (PR #65246)

2023-09-04 Thread via cfe-commits


@@ -39,6 +40,4 @@ struct C {
 
 static_assert(__builtin_offsetof(C, n) == 8,
   "long long field in ms_struct should be 8-byte aligned");
-#if !defined(TEST_FOR_ERROR) && !defined(TEST_FOR_WARNING)
-// expected-no-diagnostics
-#endif
+// expected-warning@-2 {{offset of on non-standard-layout type 'C'}}

cor3ntin wrote:

Nah, thanks a lot for spotting that, I didn't

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


[PATCH] D158591: Add support of Windows Trace Logging macros

2023-09-04 Thread Richard Dzenis via Phabricator via cfe-commits
RIscRIpt added a comment.

@cor3ntin, thanks for asking. No, I do not have access. Please merge. Commits 
should have correct email and name.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158591

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


[PATCH] D158591: Add support of Windows Trace Logging macros

2023-09-04 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment.

Oh! I should have asked sooner. Will do! Thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158591

___
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-04 Thread Donát Nagy via Phabricator via cfe-commits
donat.nagy added a comment.

Please add a testcase that demonstrates this issue (fails when your change in 
MemRegion.cpp isn't added) and shows that your commit fixes it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159412

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


[PATCH] D158591: Add support of Windows Trace Logging macros

2023-09-04 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment.

Hum. before I do

- I think the commit message could be more explicit as to what the patch does 
("Add support of Windows Trace Logging macros" is a bit vague)
- Do we need a release note ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158591

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


[PATCH] D159421: [NFC] Remove unneeded header includes

2023-09-04 Thread Bill Wendling via Phabricator via cfe-commits
void created this revision.
void added reviewers: erichkeane, nickdesaulniers.
Herald added a project: All.
void requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Use forward decls instead of #including the header files.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159421

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/CodeGen/CodeGenModule.h


Index: clang/lib/CodeGen/CodeGenModule.h
===
--- clang/lib/CodeGen/CodeGenModule.h
+++ clang/lib/CodeGen/CodeGenModule.h
@@ -26,6 +26,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/Module.h"
 #include "clang/Basic/NoSanitizeList.h"
+#include "clang/Basic/ProfileList.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/XRayLists.h"
 #include "clang/Lex/PreprocessorOptions.h"
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -58,6 +58,7 @@
 #include "clang/Basic/Module.h"
 #include "clang/Basic/NoSanitizeList.h"
 #include "clang/Basic/ObjCRuntime.h"
+#include "clang/Basic/ProfileList.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Specifiers.h"
Index: clang/include/clang/AST/ASTContext.h
===
--- clang/include/clang/AST/ASTContext.h
+++ clang/include/clang/AST/ASTContext.h
@@ -24,14 +24,9 @@
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/RawCommentList.h"
 #include "clang/AST/TemplateName.h"
-#include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LLVM.h"
-#include "clang/Basic/LangOptions.h"
-#include "clang/Basic/NoSanitizeList.h"
 #include "clang/Basic/PartialDiagnostic.h"
-#include "clang/Basic/ProfileList.h"
 #include "clang/Basic/SourceLocation.h"
-#include "clang/Basic/XRayLists.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/FoldingSet.h"
@@ -62,6 +57,7 @@
 class ASTRecordLayout;
 class AtomicExpr;
 class BlockExpr;
+struct BlockVarCopyInit;
 class BuiltinTemplateDecl;
 class CharUnits;
 class ConceptDecl;
@@ -70,17 +66,19 @@
 class CXXMethodDecl;
 class CXXRecordDecl;
 class DiagnosticsEngine;
-class ParentMapContext;
 class DynTypedNodeList;
 class Expr;
 enum class FloatModeKind;
 class GlobalDecl;
+class IdentifierTable;
+class LangOptions;
 class MangleContext;
 class MangleNumberingContext;
 class MemberSpecializationInfo;
 class Module;
 struct MSGuidDeclParts;
 class NestedNameSpecifier;
+class NoSanitizeList;
 class ObjCCategoryDecl;
 class ObjCCategoryImplDecl;
 class ObjCContainerDecl;
@@ -94,8 +92,10 @@
 class ObjCProtocolDecl;
 class ObjCTypeParamDecl;
 class OMPTraitInfo;
+class ParentMapContext;
 struct ParsedTargetAttr;
 class Preprocessor;
+class ProfileList;
 class StoredDeclsMap;
 class TargetAttr;
 class TargetInfo;
@@ -108,7 +108,7 @@
 class UsingShadowDecl;
 class VarTemplateDecl;
 class VTableContextBase;
-struct BlockVarCopyInit;
+class XRayFunctionFilter;
 
 namespace Builtin {
 


Index: clang/lib/CodeGen/CodeGenModule.h
===
--- clang/lib/CodeGen/CodeGenModule.h
+++ clang/lib/CodeGen/CodeGenModule.h
@@ -26,6 +26,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/Module.h"
 #include "clang/Basic/NoSanitizeList.h"
+#include "clang/Basic/ProfileList.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/XRayLists.h"
 #include "clang/Lex/PreprocessorOptions.h"
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -58,6 +58,7 @@
 #include "clang/Basic/Module.h"
 #include "clang/Basic/NoSanitizeList.h"
 #include "clang/Basic/ObjCRuntime.h"
+#include "clang/Basic/ProfileList.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Specifiers.h"
Index: clang/include/clang/AST/ASTContext.h
===
--- clang/include/clang/AST/ASTContext.h
+++ clang/include/clang/AST/ASTContext.h
@@ -24,14 +24,9 @@
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/RawCommentList.h"
 #include "clang/AST/TemplateName.h"
-#include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LLVM.h"
-#include "clang/Basic/LangOptions.h"
-#include "clang/Basic/NoSanitizeList.h"
 #include "clang/Basic/PartialDiagnostic.h"
-#include "clang/Basic/ProfileList.h"
 #include "clang/Basic/SourceLocation.h"
-#include "clang/Basic/XRayLists.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/FoldingSet.h"
@@ -62,6 +57,7 @@
 class ASTRecordLayout;
 class AtomicExpr;
 class BlockExpr;
+struct BlockVarCopyInit;
 class Builti

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

2023-09-04 Thread via cfe-commits

Author: Carlos Galvez
Date: 2023-09-04T11:45:04+02:00
New Revision: fdb6e8b7926572bcb855d59d6bc84c7be5277768

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

LOG: [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… 
(#65231)

…-delete

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

Fixes #65221

-

Co-authored-by: Carlos Gálvez 

Added: 


Modified: 
clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h 
b/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
index a04ffd53320d058..8545aa2a6396854 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
+++ b/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
@@ -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. Additionally, it recommends relocating any
+/// deleted member function from the ``private`` to the ``public`` section.
 ///
 /// For the user-facing documentation see:
 /// 
http://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-delete.html

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..d354fcc6060ce29 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,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.
+Identifies unimplemented private special member functions, and recommends using
+``= delete`` for them. Additionally, it recommends relocating any deleted
+member function 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++
 
-  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-04 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?= ,
Carlos =?utf-8?q?Gálvez?= 


https://github.com/carlosgalvezp closed 
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


[PATCH] D158413: [Lex] Introduce Preprocessor::LexAll()

2023-09-04 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

ping :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158413

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


[PATCH] D158414: [LexerTest] Use LexAll() in StringifyArgs

2023-09-04 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

ping :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158414

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


[PATCH] D158415: [Lex] Handle repl_input_end in Preprocessor::LexAll()

2023-09-04 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

ping :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158415

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


[PATCH] D159355: [clang][dataflow] Unsoundly treat "Unknown" as "Equivalent" in widening.

2023-09-04 Thread Martin Böhme via Phabricator via cfe-commits
mboehme accepted this revision.
mboehme added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp:53
+//
+// FIXME: this function is a hook that enable unsoundness in support of
+// convergence. Once we have widening support for the reference/pointer and

Did you mean "hack"?

If you did indeed mean "hook" -- I think it's not strictly speaking a 
[hook](https://en.wikipedia.org/wiki/Hooking), as there's no way to change the 
behavior here (i.e. install a different handler). Maybe just "this function 
enables unsoundness..."?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159355

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


[clang] [clang][bpf] Fix invalid RUN lines in stack protector warning test (PR #65251)

2023-09-04 Thread David Spickett via cfe-commits

https://github.com/DavidSpickett created 
https://github.com/llvm/llvm-project/pull/65251:

2 of them were missing the ":" on the end.

Adding them broke the test so I had to add a new prefix just for the warning 
runs only.

I manually checked the first RUNs and there is no warning emitted, as expected.

>From 5e23b30672dcdff137b97a193e4defd9cc177abc Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Fri, 1 Sep 2023 13:38:39 +
Subject: [PATCH] [clang][bpf] Fix invalid RUN lines in stack protector warning
 test

2 of them were missing the ":" on the end.

Adding them broke the test so I had to add a new prefix just for
the warning runs only.

I manually checked the first RUNs and there is no warning emitted,
as expected.
---
 clang/test/CodeGen/bpf-stack-protector.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/clang/test/CodeGen/bpf-stack-protector.c 
b/clang/test/CodeGen/bpf-stack-protector.c
index c17af890eac239a..f79a49e6aa686df 100644
--- a/clang/test/CodeGen/bpf-stack-protector.c
+++ b/clang/test/CodeGen/bpf-stack-protector.c
@@ -1,16 +1,16 @@
 // REQUIRES: bpf-registered-target
 
-// RUN %clang -target bpf -S -emit-llvm -o - %s -fno-stack-protector 2>&1 \
-// RUN| FileCheck -check-prefix=OFF -check-prefix=COMMON %s
+// RUN: %clang -target bpf -S -emit-llvm -o - %s -fno-stack-protector 2>&1 \
+// RUN:| FileCheck -check-prefix=OFF -check-prefix=COMMON %s
 
 // RUN: %clang -target bpf -S -emit-llvm -o - %s -fstack-protector 2>&1 \
-// RUN:| FileCheck -check-prefix=ON -check-prefix=COMMON %s
+// RUN:| FileCheck -check-prefix=ON -check-prefix=COMMON 
-check-prefix=WARNING %s
 
 // RUN: %clang -target bpf -S -emit-llvm -o - %s -fstack-protector-all 2>&1 \
-// RUN:| FileCheck -check-prefix=ALL -check-prefix=COMMON %s
+// RUN:| FileCheck -check-prefix=ALL -check-prefix=COMMON 
-check-prefix=WARNING %s
 
 // RUN: %clang -target bpf -S -emit-llvm -o - %s -fstack-protector-strong 2>&1 
\
-// RUN:| FileCheck -check-prefix=STRONG -check-prefix=COMMON %s
+// RUN:| FileCheck -check-prefix=STRONG -check-prefix=COMMON 
-check-prefix=WARNING %s
 
 typedef __SIZE_TYPE__ size_t;
 
@@ -22,7 +22,7 @@ char *strcpy(char *s1, const char *s2);
 //  ON: warning: ignoring '-fstack-protector'
 // ALL: warning: ignoring '-fstack-protector-all'
 //  STRONG: warning: ignoring '-fstack-protector-strong'
-// COMMON-SAME: option as it is not currently supported for target 'bpf'
+// WARNING-SAME: option as it is not currently supported for target 'bpf'
 
 // COMMON: define {{.*}}void @test1(ptr noundef %{{[0-9a-z]+}}) #[[A:.*]] {
 void test1(const char *msg) {

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


[clang] [clang][bpf] Fix invalid RUN lines in stack protector warning test (PR #65251)

2023-09-04 Thread David Spickett via cfe-commits

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


[clang] [clang][bpf] Fix invalid RUN lines in stack protector warning test (PR #65251)

2023-09-04 Thread David Spickett via cfe-commits

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


[PATCH] D158591: Add support of Windows Trace Logging macros

2023-09-04 Thread Richard Dzenis via Phabricator via cfe-commits
RIscRIpt added a comment.

In D158591#4636814 , @cor3ntin wrote:

> Hum. before I do
>
> - I think the commit message could be more explicit as to what the patch does 
> ("Add support of Windows Trace Logging macros" is a bit vague)
> - Do we need a release note ?

I agree that single commit message is vague. That's why I submitted two 
separate commits with detailed messages (the first one has some details in 
body).

I don't think we need release notes, because it's a bug fix.

P.S. I don't have access to PC until next week, I am okay if you adjust commit 
messages in a way you want.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158591

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


[clang] 916415b - [AArch64][SME] Make the overloaded svreinterpret_* functions streaming-compatible.

2023-09-04 Thread Sander de Smalen via cfe-commits

Author: Sander de Smalen
Date: 2023-09-04T10:15:26Z
New Revision: 916415b83732332d15125dee6d7a4b55438c8d7b

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

LOG: [AArch64][SME] Make the overloaded svreinterpret_* functions 
streaming-compatible.

Otherwise these functions are not inlined when invoked from streaming
functions.

Reviewed By: paulwalker-arm

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

Added: 

clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c

Modified: 
clang/include/clang/Basic/Attr.td
clang/utils/TableGen/SveEmitter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 2623d1741b9d3ba..4f281c5c8bdec3b 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -415,7 +415,7 @@ class TargetArch arches> : TargetSpec {
   let Arches = arches;
 }
 def TargetARM : TargetArch<["arm", "thumb", "armeb", "thumbeb"]>;
-def TargetAArch64 : TargetArch<["aarch64"]>;
+def TargetAArch64 : TargetArch<["aarch64", "aarch64_be", "aarch64_32"]>;
 def TargetAnyArm : TargetArch;
 def TargetAVR : TargetArch<["avr"]>;
 def TargetBPF : TargetArch<["bpfel", "bpfeb"]>;

diff  --git 
a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c
 
b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c
new file mode 100644
index 000..b430a0ba3cc75a3
--- /dev/null
+++ 
b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c
@@ -0,0 +1,35 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -O1 
-Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -O1 
-Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
+// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu 
-target-feature +sve -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu 
-target-feature +sve -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck 
%s -check-prefix=CPP-CHECK
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -O1 
-Werror -Wall -o /dev/null %s
+
+// Note: We need to run this test with '-O1' because oddly enough the 
svreinterpret is always inlined at -O0.
+
+#include 
+
+#ifdef SVE_OVERLOADED_FORMS
+// A simple used,unused... macro, long enough to represent any SVE builtin.
+#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
+#else
+#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
+#endif
+
+// Test that svreinterpret is inlined (because it should be 
streaming-compatible)
+__attribute__((target("sme")))
+// CHECK-LABEL: @test_svreinterpret_s16_s8_from_streaming_mode(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast  [[OP:%.*]] to 

+// CHECK-NEXT:ret  [[TMP0]]
+//
+// CPP-CHECK-LABEL: 
@_Z45test_svreinterpret_s16_s8_from_streaming_modeu10__SVInt8_t(
+// CPP-CHECK-NEXT:  entry:
+// CPP-CHECK-NEXT:[[TMP0:%.*]] = bitcast  [[OP:%.*]] to 

+// CPP-CHECK-NEXT:ret  [[TMP0]]
+//
+svint16_t test_svreinterpret_s16_s8_from_streaming_mode(svint8_t op) 
__arm_streaming {
+  return SVE_ACLE_FUNC(svreinterpret_s16,_s8,,)(op);
+}
+

diff  --git a/clang/utils/TableGen/SveEmitter.cpp 
b/clang/utils/TableGen/SveEmitter.cpp
index dbf5122fdf22317..f725c395400508f 100644
--- a/clang/utils/TableGen/SveEmitter.cpp
+++ b/clang/utils/TableGen/SveEmitter.cpp
@@ -1284,7 +1284,7 @@ void SVEEmitter::createHeader(raw_ostream &OS) {
 if (ShortForm) {
   OS << "__aio __attribute__((target(\"sve\"))) " << From.Type
  << " svreinterpret_" << From.Suffix;
-  OS << "(" << To.Type << " op) {\n";
+  OS << "(" << To.Type << " op) __arm_streaming_compatible {\n";
   OS << "  return __builtin_sve_reinterpret_" << From.Suffix << "_"
  << To.Suffix << "(op);\n";
   OS << "}\n\n";



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


[PATCH] D159188: [AArch64][SME] Make the overloaded svreinterpret_* functions streaming-compatible.

2023-09-04 Thread Sander de Smalen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG916415b83732: [AArch64][SME] Make the overloaded 
svreinterpret_* functions streaming… (authored by sdesmalen).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159188

Files:
  clang/include/clang/Basic/Attr.td
  
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c
  clang/utils/TableGen/SveEmitter.cpp


Index: clang/utils/TableGen/SveEmitter.cpp
===
--- clang/utils/TableGen/SveEmitter.cpp
+++ clang/utils/TableGen/SveEmitter.cpp
@@ -1284,7 +1284,7 @@
 if (ShortForm) {
   OS << "__aio __attribute__((target(\"sve\"))) " << From.Type
  << " svreinterpret_" << From.Suffix;
-  OS << "(" << To.Type << " op) {\n";
+  OS << "(" << To.Type << " op) __arm_streaming_compatible {\n";
   OS << "  return __builtin_sve_reinterpret_" << From.Suffix << "_"
  << To.Suffix << "(op);\n";
   OS << "}\n\n";
Index: 
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c
===
--- /dev/null
+++ 
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c
@@ -0,0 +1,35 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -O1 
-Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -O1 
-Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
+// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu 
-target-feature +sve -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu 
-target-feature +sve -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck 
%s -check-prefix=CPP-CHECK
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -O1 
-Werror -Wall -o /dev/null %s
+
+// Note: We need to run this test with '-O1' because oddly enough the 
svreinterpret is always inlined at -O0.
+
+#include 
+
+#ifdef SVE_OVERLOADED_FORMS
+// A simple used,unused... macro, long enough to represent any SVE builtin.
+#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
+#else
+#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
+#endif
+
+// Test that svreinterpret is inlined (because it should be 
streaming-compatible)
+__attribute__((target("sme")))
+// CHECK-LABEL: @test_svreinterpret_s16_s8_from_streaming_mode(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast  [[OP:%.*]] to 

+// CHECK-NEXT:ret  [[TMP0]]
+//
+// CPP-CHECK-LABEL: 
@_Z45test_svreinterpret_s16_s8_from_streaming_modeu10__SVInt8_t(
+// CPP-CHECK-NEXT:  entry:
+// CPP-CHECK-NEXT:[[TMP0:%.*]] = bitcast  [[OP:%.*]] to 

+// CPP-CHECK-NEXT:ret  [[TMP0]]
+//
+svint16_t test_svreinterpret_s16_s8_from_streaming_mode(svint8_t op) 
__arm_streaming {
+  return SVE_ACLE_FUNC(svreinterpret_s16,_s8,,)(op);
+}
+
Index: clang/include/clang/Basic/Attr.td
===
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -415,7 +415,7 @@
   let Arches = arches;
 }
 def TargetARM : TargetArch<["arm", "thumb", "armeb", "thumbeb"]>;
-def TargetAArch64 : TargetArch<["aarch64"]>;
+def TargetAArch64 : TargetArch<["aarch64", "aarch64_be", "aarch64_32"]>;
 def TargetAnyArm : TargetArch;
 def TargetAVR : TargetArch<["avr"]>;
 def TargetBPF : TargetArch<["bpfel", "bpfeb"]>;


Index: clang/utils/TableGen/SveEmitter.cpp
===
--- clang/utils/TableGen/SveEmitter.cpp
+++ clang/utils/TableGen/SveEmitter.cpp
@@ -1284,7 +1284,7 @@
 if (ShortForm) {
   OS << "__aio __attribute__((target(\"sve\"))) " << From.Type
  << " svreinterpret_" << From.Suffix;
-  OS << "(" << To.Type << " op) {\n";
+  OS << "(" << To.Type << " op) __arm_streaming_compatible {\n";
   OS << "  return __builtin_sve_reinterpret_" << From.Suffix << "_"
  << To.Suffix << "(op);\n";
   OS << "}\n\n";
Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c
@@ -0,0 +1,35 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+/

[clang] 86c31c1 - [APINotes] Remove unused OS-availability feature

2023-09-04 Thread via cfe-commits

Author: Egor Zhdan
Date: 2023-09-04T11:59:11+01:00
New Revision: 86c31c1406cfff001c0a52ebf3a31185635d6ad6

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

LOG: [APINotes] Remove unused OS-availability feature

iOS/OSX-specific availability is a legacy of compiled API Notes which
are not supported and were removed from Apple Clang in 2019 (see
https://github.com/apple/llvm-project/commit/30fc70f349277a42e02550779b464b92a2f06c1c).

Added: 


Modified: 
clang/lib/APINotes/APINotesYAMLCompiler.cpp

Removed: 




diff  --git a/clang/lib/APINotes/APINotesYAMLCompiler.cpp 
b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
index 7cfdefc2e3de828..e430956e28d0808 100644
--- a/clang/lib/APINotes/APINotesYAMLCompiler.cpp
+++ b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
@@ -28,8 +28,6 @@ using namespace api_notes;
 namespace {
 enum class APIAvailability {
   Available = 0,
-  OSX,
-  IOS,
   None,
   NonSwift,
 };
@@ -39,8 +37,6 @@ namespace llvm {
 namespace yaml {
 template <> struct ScalarEnumerationTraits {
   static void enumeration(IO &IO, APIAvailability &AA) {
-IO.enumCase(AA, "OSX", APIAvailability::OSX);
-IO.enumCase(AA, "iOS", APIAvailability::IOS);
 IO.enumCase(AA, "none", APIAvailability::None);
 IO.enumCase(AA, "nonswift", APIAvailability::NonSwift);
 IO.enumCase(AA, "available", APIAvailability::Available);



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


[clang] [APINotes] Remove unused OS-availability feature (PR #65178)

2023-09-04 Thread Egor Zhdan via cfe-commits

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


[clang] [APINotes] Upstream APINotesWriter (PR #65187)

2023-09-04 Thread Egor Zhdan via cfe-commits

https://github.com/egorzhdan updated 
https://github.com/llvm/llvm-project/pull/65187:

>From e2150c20056e44a6ecbc82c63f499b6010c37930 Mon Sep 17 00:00:00 2001
From: Egor Zhdan 
Date: Fri, 1 Sep 2023 22:07:47 +0100
Subject: [PATCH] [APINotes] Upstream APINotesWriter

This upstreams more of the Clang API Notes functionality that is currently 
implemented in the Apple fork: 
https://github.com/apple/llvm-project/tree/next/clang/lib/APINotes
---
 clang/include/clang/APINotes/APINotesWriter.h |  75 +++-
 clang/include/clang/APINotes/Types.h  |  11 ++
 clang/lib/APINotes/APINotesFormat.h   |   3 +-
 clang/lib/APINotes/APINotesWriter.cpp | 174 +-
 4 files changed, 253 insertions(+), 10 deletions(-)

diff --git a/clang/include/clang/APINotes/APINotesWriter.h 
b/clang/include/clang/APINotes/APINotesWriter.h
index eab03a2a830125..dad44623e16aeb 100644
--- a/clang/include/clang/APINotes/APINotesWriter.h
+++ b/clang/include/clang/APINotes/APINotesWriter.h
@@ -9,7 +9,9 @@
 #ifndef LLVM_CLANG_APINOTES_WRITER_H
 #define LLVM_CLANG_APINOTES_WRITER_H
 
+#include "clang/APINotes/Types.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/VersionTuple.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include 
@@ -30,8 +32,79 @@ class APINotesWriter {
   APINotesWriter &operator=(const APINotesWriter &) = delete;
 
   void writeToStream(llvm::raw_ostream &OS);
+
+  /// Add information about a specific Objective-C class or protocol or a C++
+  /// namespace.
+  ///
+  /// \param Name The name of this class/protocol/namespace.
+  /// \param Kind Whether this is a class, a protocol, or a namespace.
+  /// \param Info Information about this class/protocol/namespace.
+  ///
+  /// \returns the ID of the class, protocol, or namespace, which can be used 
to
+  /// add properties and methods to the class/protocol/namespace.
+  ContextID addObjCContext(std::optional ParentCtxID,
+   llvm::StringRef Name, ContextKind Kind,
+   const ObjCContextInfo &Info,
+   llvm::VersionTuple SwiftVersion);
+
+  /// Add information about a specific Objective-C property.
+  ///
+  /// \param CtxID The context in which this property resides.
+  /// \param Name The name of this property.
+  /// \param Info Information about this property.
+  void addObjCProperty(ContextID CtxID, llvm::StringRef Name,
+   bool IsInstanceProperty, const ObjCPropertyInfo &Info,
+   llvm::VersionTuple SwiftVersion);
+
+  /// Add information about a specific Objective-C method.
+  ///
+  /// \param CtxID The context in which this method resides.
+  /// \param Selector The selector that names this method.
+  /// \param IsInstanceMethod Whether this method is an instance method
+  /// (vs. a class method).
+  /// \param Info Information about this method.
+  void addObjCMethod(ContextID CtxID, ObjCSelectorRef Selector,
+ bool IsInstanceMethod, const ObjCMethodInfo &Info,
+ llvm::VersionTuple SwiftVersion);
+
+  /// Add information about a global variable.
+  ///
+  /// \param Name The name of this global variable.
+  /// \param Info Information about this global variable.
+  void addGlobalVariable(std::optional Ctx, llvm::StringRef Name,
+ const GlobalVariableInfo &Info,
+ llvm::VersionTuple SwiftVersion);
+
+  /// Add information about a global function.
+  ///
+  /// \param Name The name of this global function.
+  /// \param Info Information about this global function.
+  void addGlobalFunction(std::optional Ctx, llvm::StringRef Name,
+ const GlobalFunctionInfo &Info,
+ llvm::VersionTuple SwiftVersion);
+
+  /// Add information about an enumerator.
+  ///
+  /// \param Name The name of this enumerator.
+  /// \param Info Information about this enumerator.
+  void addEnumConstant(llvm::StringRef Name, const EnumConstantInfo &Info,
+   llvm::VersionTuple SwiftVersion);
+
+  /// Add information about a tag (struct/union/enum/C++ class).
+  ///
+  /// \param Name The name of this tag.
+  /// \param Info Information about this tag.
+  void addTag(std::optional Ctx, llvm::StringRef Name,
+  const TagInfo &Info, llvm::VersionTuple SwiftVersion);
+
+  /// Add information about a typedef.
+  ///
+  /// \param Name The name of this typedef.
+  /// \param Info Information about this typedef.
+  void addTypedef(std::optional Ctx, llvm::StringRef Name,
+  const TypedefInfo &Info, llvm::VersionTuple SwiftVersion);
 };
 } // namespace api_notes
 } // namespace clang
 
-#endif
+#endif // LLVM_CLANG_APINOTES_WRITER_H
diff --git a/clang/include/clang/APINotes/Types.h 
b/clang/include/clang/APINotes/Types.h
index 817d6ac1bb3fe8..79c8079191fef3 100644
--- a/clang/include/clang/APINotes/Types.h
+++ b/clang/include/clang/APINotes/Types.h
@@ -10,6 +10,7 @@
 #

[clang] [APINotes] Upstream APINotesWriter (PR #65187)

2023-09-04 Thread Egor Zhdan via cfe-commits


@@ -749,6 +750,17 @@ struct Context {
 
   Context(ContextID id, ContextKind kind) : id(id), kind(kind) {}
 };
+
+/// A temporary reference to an Objective-C selector, suitable for
+/// referencing selector data on the stack.
+///
+/// Instances of this struct do not store references to any of the
+/// data they contain; it is up to the user to ensure that the data
+/// referenced by the identifier list persists.
+struct ObjCSelectorRef {
+  unsigned NumPieces;

egorzhdan wrote:

Good point, we're not actually using `NumPieces` anywhere. Removed it.

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


[clang] [APINotes] Upstream APINotesWriter (PR #65187)

2023-09-04 Thread Egor Zhdan via cfe-commits


@@ -19,11 +19,11 @@
 
 namespace clang {
 namespace api_notes {
-class APINotesWriter::Implementation {
-  template 
-  using VersionedSmallVector =
-  llvm::SmallVector, 1>;
+template 
+using VersionedSmallVector =
+llvm::SmallVector, 1>;

egorzhdan wrote:

This is used in both `APINotesWriter` and `APINotesWriter::Implementation`.

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


[clang] [APINotes] Upstream APINotesWriter (PR #65187)

2023-09-04 Thread Egor Zhdan via cfe-commits


@@ -1200,5 +1235,128 @@ APINotesWriter::~APINotesWriter() = default;
 void APINotesWriter::writeToStream(llvm::raw_ostream &OS) {
   Implementation->writeToStream(OS);
 }
+
+ContextID APINotesWriter::addObjCContext(std::optional ParentCtxID,
+ StringRef Name, ContextKind Kind,
+ const ObjCContextInfo &Info,
+ VersionTuple SwiftVersion) {
+  IdentifierID NameID = Implementation->getIdentifier(Name);
+
+  uint32_t RawParentCtxID = ParentCtxID ? ParentCtxID->Value : -1;
+  ContextTableKey Key(RawParentCtxID, (uint8_t)Kind, NameID);

egorzhdan wrote:

Done

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


[clang] [APINotes] Upstream APINotesWriter (PR #65187)

2023-09-04 Thread Egor Zhdan via cfe-commits


@@ -1200,5 +1235,128 @@ APINotesWriter::~APINotesWriter() = default;
 void APINotesWriter::writeToStream(llvm::raw_ostream &OS) {
   Implementation->writeToStream(OS);
 }
+
+ContextID APINotesWriter::addObjCContext(std::optional ParentCtxID,
+ StringRef Name, ContextKind Kind,
+ const ObjCContextInfo &Info,
+ VersionTuple SwiftVersion) {
+  IdentifierID NameID = Implementation->getIdentifier(Name);
+
+  uint32_t RawParentCtxID = ParentCtxID ? ParentCtxID->Value : -1;
+  ContextTableKey Key(RawParentCtxID, (uint8_t)Kind, NameID);
+  auto Known = Implementation->ObjCContexts.find(Key);
+  if (Known == Implementation->ObjCContexts.end()) {
+unsigned NextID = Implementation->ObjCContexts.size() + 1;
+
+VersionedSmallVector EmptyVersionedInfo;
+Known = Implementation->ObjCContexts
+.insert(std::make_pair(
+Key, std::make_pair(NextID, EmptyVersionedInfo)))
+.first;
+
+Implementation->ObjCContextNames[NextID] = NameID;
+Implementation->ParentContexts[NextID] = RawParentCtxID;
+  }
+
+  // Add this version information.
+  auto &VersionedVec = Known->second.second;
+  bool Found = false;
+  for (auto &Versioned : VersionedVec) {
+if (Versioned.first == SwiftVersion) {
+  Versioned.second |= Info;
+  Found = true;
+  break;
+}
+  }
+
+  if (!Found)
+VersionedVec.push_back({SwiftVersion, Info});
+
+  return ContextID(Known->second.first);
+}
+
+void APINotesWriter::addObjCProperty(ContextID CtxID, StringRef Name,
+ bool IsInstanceProperty,
+ const ObjCPropertyInfo &Info,
+ VersionTuple SwiftVersion) {
+  IdentifierID NameID = Implementation->getIdentifier(Name);
+  Implementation
+  ->ObjCProperties[std::make_tuple(CtxID.Value, NameID, 
IsInstanceProperty)]
+  .push_back({SwiftVersion, Info});
+}
+
+void APINotesWriter::addObjCMethod(ContextID CtxID, ObjCSelectorRef Selector,
+   bool IsInstanceMethod,
+   const ObjCMethodInfo &Info,
+   VersionTuple SwiftVersion) {
+  SelectorID SelID = Implementation->getSelector(Selector);
+  auto Key = std::tuple{CtxID.Value, SelID,
+  IsInstanceMethod};
+  Implementation->ObjCMethods[Key].push_back({SwiftVersion, Info});
+
+  // If this method is a designated initializer, update the class to note that
+  // it has designated initializers.
+  if (Info.DesignatedInit) {
+assert(Implementation->ParentContexts.contains(CtxID.Value));
+uint32_t ParentCtxID = Implementation->ParentContexts[CtxID.Value];
+ContextTableKey CtxKey(ParentCtxID, (uint8_t)ContextKind::ObjCClass,

egorzhdan wrote:

Done

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


[clang] [APINotes] Upstream APINotesWriter (PR #65187)

2023-09-04 Thread Egor Zhdan via cfe-commits


@@ -1200,5 +1235,128 @@ APINotesWriter::~APINotesWriter() = default;
 void APINotesWriter::writeToStream(llvm::raw_ostream &OS) {
   Implementation->writeToStream(OS);
 }
+
+ContextID APINotesWriter::addObjCContext(std::optional ParentCtxID,
+ StringRef Name, ContextKind Kind,
+ const ObjCContextInfo &Info,
+ VersionTuple SwiftVersion) {
+  IdentifierID NameID = Implementation->getIdentifier(Name);
+
+  uint32_t RawParentCtxID = ParentCtxID ? ParentCtxID->Value : -1;
+  ContextTableKey Key(RawParentCtxID, (uint8_t)Kind, NameID);
+  auto Known = Implementation->ObjCContexts.find(Key);
+  if (Known == Implementation->ObjCContexts.end()) {
+unsigned NextID = Implementation->ObjCContexts.size() + 1;
+
+VersionedSmallVector EmptyVersionedInfo;
+Known = Implementation->ObjCContexts
+.insert(std::make_pair(
+Key, std::make_pair(NextID, EmptyVersionedInfo)))
+.first;

egorzhdan wrote:

Yeah, sometimes the formatting just looks weird

https://github.com/llvm/llvm-project/pull/65187
___
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 `offsetof` (PR #65246)

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

tbaederr wrote:

Okay, makes sense to me. Should probably also be backported to 17.

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


[PATCH] D159398: [AArch64][Clang] Disable outline atomics in freestanding env

2023-09-04 Thread Pavel Iliin via Phabricator via cfe-commits
ilinpv added a comment.

From what i understand in freestanding environment runtime library is not used 
and clang driver can detect this situation and set outline atomics off by 
default ( see ##clang/lib/Driver/ToolChains/Linux.cpp## 
##Linux::IsAArch64OutlineAtomicsDefault## -> ##GetRuntimeLibType## )


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159398

___
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 `offsetof` (PR #65246)

2023-09-04 Thread via cfe-commits

cor3ntin wrote:

@tbaederr We are getting rather conservative as to what gets backported. I 
think that does not meet the bar.
Maybe for 17.0.x

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] 3dcf3cb - [ASTMatchers] Bring comments & docs back in sync

2023-09-04 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2023-09-04T13:42:29+02:00
New Revision: 3dcf3cbc421cb5ee985b3b4a697c51247df8b5dc

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

LOG: [ASTMatchers] Bring comments & docs back in sync

415d9e8ca39c0b42f351cc532ccfb48b6ac97f7f edited the generated html
directly without updating the source of truth.

Added: 


Modified: 
clang/docs/LibASTMatchersReference.html
clang/include/clang/ASTMatchers/ASTMatchers.h

Removed: 




diff  --git a/clang/docs/LibASTMatchersReference.html 
b/clang/docs/LibASTMatchersReference.html
index a526751f0116f55..fcd3114bb523105 100644
--- a/clang/docs/LibASTMatchersReference.html
+++ b/clang/docs/LibASTMatchersReference.html
@@ -2537,7 +2537,8 @@ Node Matchers
 
 
 MatcherType>dependentSizedExtVectorTypeMatcherDependentSizedExtVectorType>...
-Matches 
C++ extended vector type where either the type or size is dependent.
+Matches 
C++ extended vector type where either the type or size is
+dependent.
 
 Given
   template

diff  --git a/clang/include/clang/ASTMatchers/ASTMatchers.h 
b/clang/include/clang/ASTMatchers/ASTMatchers.h
index c1ffe1a2dd3ed55..c9ab8c949a4cb6a 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -6938,7 +6938,7 @@ AST_POLYMORPHIC_MATCHER_P(hasSize,
 /// T data[Size];
 ///   };
 /// \endcode
-/// dependentSizedArrayType
+/// dependentSizedArrayType()
 ///   matches "T data[Size]"
 extern const AstTypeMatcher dependentSizedArrayType;
 
@@ -6952,7 +6952,7 @@ extern const AstTypeMatcher 
dependentSizedArrayType;
 /// typedef T __attribute__((ext_vector_type(Size))) type;
 ///   };
 /// \endcode
-/// dependentSizedExtVectorType
+/// dependentSizedExtVectorType()
 ///   matches "T __attribute__((ext_vector_type(Size)))"
 extern const AstTypeMatcher
 dependentSizedExtVectorType;



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


Re: [PATCH] D159309: [ASTMatchers] basic matcher support for ConceptReference

2023-09-04 Thread Sam McCall via cfe-commits
(by mail as phab is unusable today)

On Mon, Sep 4, 2023 at 10:16 AM Jens Massberg via Phabricator <
revi...@reviews.llvm.org> wrote:

> massberg added inline comments.
>
>
> 
> Comment at: clang/docs/LibASTMatchersReference.html:2545
>};
> -dependentSizedArrayType()
> +dependentSizedArrayType
>matches "T data[Size]"
> 
> Was this change to drop the () by purpose?
>
This file is generated, the source code is the source of truth.
Looks like 415d9e8ca39c0b42f351cc532ccfb48b6ac97f7f caused them to diverge
by editing the generated file only

I've fixed this in 3dcf3cbc421cb5ee985b3b4a697c51247df8b5dc


>
>
> 
> Comment at: clang/docs/LibASTMatchersReference.html:2559
>};
> -dependentSizedExtVectorType()
> +dependentSizedExtVectorType
>matches "T __attribute__((ext_vector_type(Size)))"
> 
> same as above
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D159309/new/
>
> https://reviews.llvm.org/D159309
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [APINotes] Upstream APINotesWriter (PR #65187)

2023-09-04 Thread Egor Zhdan via cfe-commits

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


[PATCH] D133361: [BPF] Attribute btf_decl_tag("ctx") for structs

2023-09-04 Thread Eduard Zingerman via Phabricator via cfe-commits
eddyz87 added a comment.

After retesting kernel build with LLVM=1 and libbpf patch 
 to reconstruct 
btf_decl_tag [1], statistics for BPF selftests looks as follows:

- out of 653 object files 13 have some differences with and w/o this change;
- for 2 programs there is small instruction count increase (+2 insn total);
- for 5 programs there is small instruction decrease (-6 insn total);
- 6 programs differ slightly but number of instructions is the same.

(The differences are insignificant, the rest of the comment could be skipped as 
it is probably not interesting for anyone but me).

---

Differences for first 5 programs were already described in this 
 comment. The rest of the differences 
in described below.

netns_cookie_prog.bpf.o
---

Without ctx: 46 instructions
With ctx: 46 instructions

Instruction reordering:

   :
r6 = r1
  - r2 = *(u64 *)(r6 + 0x48)
r1 = *(u32 *)(r6 + 0x10)
  - if w1 != 0xa goto +0xb 
  + if w1 != 0xa goto +0xc 
  + r2 = *(u64 *)(r6 + 0x48)
if r2 == 0x0 goto +0xa 
r1 = 0x0 ll
r3 = 0x0

The difference is introduced by "Machine code sinking" transformation. Before 
the transformation both 0x48 and 0x10 loads reside in the same basic block:

  ;; Old:
  bb.0.entry:
...
%0:gpr = CORE_LD64 345, %2:gpr, @"llvm.sk_msg_md:0:72$0:10:0"
%9:gpr32 = CORE_LD32 350, %2:gpr, @"llvm.sk_msg_md:0:16$0:2"
JNE_ri_32 killed %9:gpr32, 10, %bb.3
  
  ;; New:
  bb.0.entry:
...
%0:gpr = LDD %2:gpr, 72
%3:gpr32 = LDW32 %2:gpr, 16
JNE_ri_32 killed %3:gpr32, 10, %bb.3

Note: CORE pseudo-instructions are replaced by regular loads because 
btf_decl_tag("ctx") has priority over preserve_access_index attribute. The 
"Machine code sinking" transformation (MachineSink.cpp) can move `LDD`, `LDW` 
instructions, but can't move `CORE_LD*` because `CORE_LD*` instructions are 
marked as `MCID::UnmodeledSideEffects` in `BPFGenInstrInfo.inc` (maybe 
something to adjust):

  // called from MachineSinking::SinkInstruction
  bool MachineInstr::isSafeToMove(AAResults *AA, bool &SawStore) const {
if (... hasUnmodeledSideEffects())
  return false;
...
  }



sock_destroy_prog.bpf.o
---

Without ctx: 102 instructions
With ctx: 101 instructions

In the following code fragment:

if (ctx->protocol == IPPROTO_TCP)
bpf_map_update_elem(&tcp_conn_sockets, &key, &sock_cookie, 0);
else if (ctx->protocol == IPPROTO_UDP)
bpf_map_update_elem(&udp_conn_sockets, &keyc, &sock_cookie, 0);
else
return 1;

Version w/o btf_decl_tag("ctx") keeps two loads for `ctx->protocol` because of 
the llvm.bpf.passthrough call. Version with btf_decl_tag("ctx") eliminates 
second load via a combination of EarlyCSEPass/InstCombinePass/SimplifyCFGPass 
passes.

socket_cookie_prog.bpf.o


Without ctx: 66 instructions
With ctx: 66 instructions

For the following C code fragment:

  SEC("sockops")
  int update_cookie_sockops(struct bpf_sock_ops *ctx)
  {
struct bpf_sock *sk = ctx->sk;
struct socket_cookie *p;
  
if (ctx->family != AF_INET6)
return 1;
  
if (ctx->op != BPF_SOCK_OPS_TCP_CONNECT_CB)
return 1;
  
if (!sk)
return 1;
  ...
  }

Code with decl_tag("ctx") does reordering for ctx->sk load relative to 
ctx->family and ctx->op loads:

  //  old   new
   :  :
  r6 = r1   r6 = r1
  -   r2 = *(u64 *)(r6 + 0xb8)
  r1 = *(u32 *)(r6 + 0x14)  r1 = *(u32 *)(r6 + 0x14)
  if w1 != 0xa goto +0x13   if w1 != 0xa goto +0x14 
  r1 = *(u32 *)(r6 + 0x0)   r1 = *(u32 *)(r6 + 0x0)
  if w1 != 0x3 goto +0x11   if w1 != 0x3 goto +0x12 
+   r2 = *(u64 *)(r6 + 0xb8)
  if r2 == 0x0 goto +0x10   if r2 == 0x0 goto +0x10 
  r1 = 0x0 ll   r1 = 0x0 ll
  r3 = 0x0  r3 = 0x0

Code w/o decl_tag("ctx") uses `CORE_LD*` instructions for these loads and does 
not reorder loads due to reasons as in netns_cookie_prog.bpf.o.

test_lwt_reroute.bpf.o
--

Without ctx: 18 instructions
With ctx: 17 instructions

The difference boils down EarlyCSEPass being able to remove last load in the 
store/load pair:

  llvm
  ; Before EarlyCSEPass
store i32 %and, ptr %mark24, align 8
%mark25 = getelementptr inbounds %struct.__sk_buff, ptr %skb, i32 0, i32 2
%19 = load i32, ptr %mark25, align 8
%cmp26 = icmp eq i32 %19, 0
  ; After EarlyCSEPass
%and = and i32 %cond, 255
store i32 %and, ptr %mark, align 8
%cmp26 = icmp eq i32 %and, 0

And unable to do so when get.element.and.{s

[PATCH] D159338: [clangd][tests] Bump timeouts in TUSchedulerTests to 60 secs

2023-09-04 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

In D159338#4635010 , @hiraditya wrote:

> not sure if this is the right way to fix these tests. The problem is if a 
> device is constraiend, this will further slow down the device and create more 
> backlogs. Can we allow a way to skip these tests based on a flag/environment 
> variable?

The affected tests aren't fundamentally slower or less important than others (I 
expect many tests are very slow at the same time on such systems).
So skipping them doesn't seem appropriate.

The reason these deadlines exist in these tests is they coordinate multiple 
threads, and we want a deadlock bug (which you'd also see on healthy buildbots) 
to show up as a test failure rather than as the test running forever, which is 
harder to debug.
It's nice if it does so quickly, but if the buildbots are too slow, a longer 
deadline works fine for this purpose.

It will "further slow down the device" in the sense that running more tests 
slows down the device compared to running fewer tests, but again that's true 
for all tests, and we don't have reason to believe these ones are unreasonably 
expensive. (If so, we should understand why)

I believe @kadircet is looking into the possibility of of reducing/disabling 
test sharding of clangd tests on bots that don't have enough resources to gain 
throughput from it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159338

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


[clang] da5e11c - [AST] Support ConceptReference in DynTypedNode, add dump().

2023-09-04 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2023-09-04T13:56:15+02:00
New Revision: da5e11cd1ce0754a123ff0bf6f3ce4a41be14355

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

LOG: [AST] Support ConceptReference in DynTypedNode, add dump().

The dump() is not actually included recursively in any other nodes' dump,
as this is too verbose (similar to NNS) but useful in its own right.

It's unfortunate to not have the actual tests yet, but the DynTypedNode
tests are matcher-based and adding matchers is a larger task than
DynTypedNode support (but can't be done first).

(I've got a clangd change stacked on this that uses DynTypedNode and
dump(), and both work. I'll send a change for matchers next).

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

Added: 


Modified: 
clang/include/clang/AST/ASTConcept.h
clang/include/clang/AST/ASTFwd.h
clang/include/clang/AST/ASTNodeTraverser.h
clang/include/clang/AST/ASTTypeTraits.h
clang/include/clang/AST/TextNodeDumper.h
clang/lib/AST/ASTDumper.cpp
clang/lib/AST/ASTTypeTraits.cpp
clang/lib/AST/TextNodeDumper.cpp
clang/unittests/AST/ASTTypeTraitsTest.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ASTConcept.h 
b/clang/include/clang/AST/ASTConcept.h
index d40d3636287e7c0..5f9aa41d3e6cf50 100644
--- a/clang/include/clang/AST/ASTConcept.h
+++ b/clang/include/clang/AST/ASTConcept.h
@@ -215,6 +215,8 @@ class ConceptReference {
   }
 
   void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const;
+  void dump() const;
+  void dump(llvm::raw_ostream &) const;
 };
 
 /// Models the abbreviated syntax to constrain a template type parameter:

diff  --git a/clang/include/clang/AST/ASTFwd.h 
b/clang/include/clang/AST/ASTFwd.h
index f84b3238e32b52e..8823663386ea1bb 100644
--- a/clang/include/clang/AST/ASTFwd.h
+++ b/clang/include/clang/AST/ASTFwd.h
@@ -34,6 +34,7 @@ class Attr;
 #define ATTR(A) class A##Attr;
 #include "clang/Basic/AttrList.inc"
 class ObjCProtocolLoc;
+class ConceptReference;
 
 } // end namespace clang
 

diff  --git a/clang/include/clang/AST/ASTNodeTraverser.h 
b/clang/include/clang/AST/ASTNodeTraverser.h
index 5ffce930b440ff4..1151a756ff377b6 100644
--- a/clang/include/clang/AST/ASTNodeTraverser.h
+++ b/clang/include/clang/AST/ASTNodeTraverser.h
@@ -252,6 +252,10 @@ class ASTNodeTraverser
 });
   }
 
+  void Visit(const ConceptReference *R) {
+getNodeDelegate().AddChild([=] { getNodeDelegate().Visit(R); });
+  }
+
   void Visit(const APValue &Value, QualType Ty) {
 getNodeDelegate().AddChild([=] { getNodeDelegate().Visit(Value, Ty); });
   }
@@ -288,6 +292,8 @@ class ASTNodeTraverser
   Visit(C);
 else if (const auto *T = N.get())
   Visit(*T);
+else if (const auto *CR = N.get())
+  Visit(CR);
   }
 
   void dumpDeclContext(const DeclContext *DC) {

diff  --git a/clang/include/clang/AST/ASTTypeTraits.h 
b/clang/include/clang/AST/ASTTypeTraits.h
index 78661823ca858c2..3988a15971db5d9 100644
--- a/clang/include/clang/AST/ASTTypeTraits.h
+++ b/clang/include/clang/AST/ASTTypeTraits.h
@@ -163,6 +163,7 @@ class ASTNodeKind {
 #define ATTR(A) NKI_##A##Attr,
 #include "clang/Basic/AttrList.inc"
 NKI_ObjCProtocolLoc,
+NKI_ConceptReference,
 NKI_NumberOfKinds
   };
 
@@ -222,6 +223,7 @@ KIND_TO_KIND_ID(OMPClause)
 KIND_TO_KIND_ID(Attr)
 KIND_TO_KIND_ID(ObjCProtocolLoc)
 KIND_TO_KIND_ID(CXXBaseSpecifier)
+KIND_TO_KIND_ID(ConceptReference)
 #define DECL(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Decl)
 #include "clang/AST/DeclNodes.inc"
 #define STMT(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED)
@@ -582,6 +584,10 @@ template <>
 struct DynTypedNode::BaseConverter
 : public ValueConverter {};
 
+template <>
+struct DynTypedNode::BaseConverter
+: public PtrConverter {};
+
 // The only operation we allow on unsupported types is \c get.
 // This allows to conveniently use \c DynTypedNode when having an arbitrary
 // AST node that is not supported, but prevents misuse - a user cannot create

diff  --git a/clang/include/clang/AST/TextNodeDumper.h 
b/clang/include/clang/AST/TextNodeDumper.h
index 9871a7fd4fbd025..2f4ed082a0c7ad4 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -189,6 +189,8 @@ class TextNodeDumper
 
   void Visit(const GenericSelectionExpr::ConstAssociation &A);
 
+  void Visit(const ConceptReference *);
+
   void Visit(const concepts::Requirement *R);
 
   void Visit(const APValue &Value, QualType Ty);
@@ -204,6 +206,7 @@ class TextNodeDumper
   void dumpCleanupObject(const ExprWithCleanups::CleanupObject &C);
   void dumpTemplateSpecializationKind(TemplateSpecializationKind TSK);
   void dumpNestedNameSpecifier(const NestedNameSpecifier *NNS);
+  void dumpConceptReference(const ConceptReference *R);
 

[PATCH] D159309: [ASTMatchers] basic matcher support for ConceptReference

2023-09-04 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 555709.
sammccall added a comment.

regenerate HTML after rebasing on 415d9e8ca39c0b42f351cc532ccfb48b6ac97f7f 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159309

Files:
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchFinder.h
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/include/clang/ASTMatchers/ASTMatchersInternal.h
  clang/lib/ASTMatchers/ASTMatchFinder.cpp
  clang/lib/ASTMatchers/ASTMatchersInternal.cpp
  clang/lib/ASTMatchers/Dynamic/Registry.cpp
  clang/unittests/AST/ASTTypeTraitsTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Index: clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -770,6 +770,17 @@
   cxxCtorInitializer(forField(hasName("i");
 }
 
+TEST_P(ASTMatchersTest, Match_ConceptReference) {
+  if (!GetParam().isCXX20OrLater()) {
+return;
+  }
+  std::string Concept = "template  concept C = true;\n";
+  EXPECT_TRUE(matches(Concept + "auto X = C;", conceptReference()));
+  EXPECT_TRUE(matches(Concept + "C auto X = 0;", conceptReference()));
+  EXPECT_TRUE(matches(Concept + "template  int i;", conceptReference()));
+  EXPECT_TRUE(matches(Concept + "void foo(C auto X) {}", conceptReference()));
+}
+
 TEST_P(ASTMatchersTest, Matcher_ThisExpr) {
   if (!GetParam().isCXX()) {
 return;
Index: clang/unittests/AST/ASTTypeTraitsTest.cpp
===
--- clang/unittests/AST/ASTTypeTraitsTest.cpp
+++ clang/unittests/AST/ASTTypeTraitsTest.cpp
@@ -210,7 +210,13 @@
  ast_matchers::attr()));
 }
 
-// FIXME: add tests for ConceptReference once we add an ASTMatcher.
+TEST(DynTypedNode, ConceptReferenceSourceRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(2, 10, 2, 15);
+  EXPECT_TRUE(Verifier.match("template  concept C = true;\n"
+ "auto X = C;",
+ conceptReference()));
+}
 
 TEST(DynTypedNode, DeclDump) {
   DumpVerifier Verifier;
@@ -224,6 +230,14 @@
   EXPECT_TRUE(Verifier.match("void f() {}", stmt()));
 }
 
+TEST(DynTypedNode, ConceptReferenceDump) {
+  DumpVerifier Verifier;
+  Verifier.expectSubstring("ConceptReference");
+  EXPECT_TRUE(Verifier.match("template  concept C = true;\n"
+ "auto X = C;",
+ conceptReference()));
+}
+
 TEST(DynTypedNode, DeclPrint) {
   PrintVerifier Verifier;
   Verifier.expectString("void f() {\n}\n");
@@ -236,6 +250,14 @@
   EXPECT_TRUE(Verifier.match("void f() {}", stmt()));
 }
 
+TEST(DynTypedNode, ConceptReferencePrint) {
+  PrintVerifier Verifier;
+  Verifier.expectString("C");
+  EXPECT_TRUE(Verifier.match("template  concept C = true;\n"
+ "auto X = C;",
+ conceptReference()));
+}
+
 TEST(DynTypedNode, QualType) {
   QualType Q;
   DynTypedNode Node = DynTypedNode::create(Q);
Index: clang/lib/ASTMatchers/Dynamic/Registry.cpp
===
--- clang/lib/ASTMatchers/Dynamic/Registry.cpp
+++ clang/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -173,6 +173,7 @@
   REGISTER_MATCHER(compoundStmt);
   REGISTER_MATCHER(coawaitExpr);
   REGISTER_MATCHER(conceptDecl);
+  REGISTER_MATCHER(conceptReference);
   REGISTER_MATCHER(conditionalOperator);
   REGISTER_MATCHER(constantArrayType);
   REGISTER_MATCHER(constantExpr);
Index: clang/lib/ASTMatchers/ASTMatchersInternal.cpp
===
--- clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -768,6 +768,7 @@
 templateTypeParmDecl;
 const internal::VariadicDynCastAllOfMatcher
 templateTemplateParmDecl;
+const internal::VariadicAllOfMatcher conceptReference;
 
 const internal::VariadicAllOfMatcher lambdaCapture;
 const internal::VariadicAllOfMatcher qualType;
Index: clang/lib/ASTMatchers/ASTMatchFinder.cpp
===
--- clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace clang {
 namespace ast_matchers {
@@ -136,6 +137,8 @@
   traverse(*TALoc);
 else if (const Attr *A = DynNode.get())
   traverse(*A);
+else if (const ConceptReference *CR = DynNode.get())
+  traverse(*CR);
 // FIXME: Add other base types after adding tests.
 
 // It's OK to always overwrite the bound nodes, as if there was
@@ -275,6 +278,12 @@
 ScopedIncrement ScopedDepth(&CurrentDepth);

[clang] [clang-repl] Emit const variables only once (PR #65257)

2023-09-04 Thread Jonas Hahnfeld via cfe-commits

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


[clang] [clang-repl] Emit const variables only once (PR #65257)

2023-09-04 Thread Jonas Hahnfeld via cfe-commits

https://github.com/hahnjo created 
https://github.com/llvm/llvm-project/pull/65257:

Disable internal linkage for const variables if IncrementalExtensions are 
enabled. Otherwise the variables are emitted multiple times, with multiple 
constructions at unique memory locations, during every PTU.

>From fcea5762fab68459aef3f8e82e98fc52e04e1598 Mon Sep 17 00:00:00 2001
From: Jonas Hahnfeld 
Date: Mon, 4 Sep 2023 13:56:25 +0200
Subject: [PATCH] [clang-repl] Emit const variables only once

Disable internal linkage for const variables if IncrementalExtensions
are enabled. Otherwise the variables are emitted multiple times, with
multiple constructions at unique memory locations, during every PTU.
---
 clang/lib/AST/Decl.cpp   |  1 +
 clang/test/Interpreter/const.cpp | 29 +
 2 files changed, 30 insertions(+)
 create mode 100644 clang/test/Interpreter/const.cpp

diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 60c80f2b075336..e019e701196a38 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -651,6 +651,7 @@ LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl 
*D,
 // internal linkage
 // (There is no equivalent in C99.)
 if (Context.getLangOpts().CPlusPlus && Var->getType().isConstQualified() &&
+!Context.getLangOpts().IncrementalExtensions &&
 !Var->getType().isVolatileQualified() && !Var->isInline() &&
 !isDeclaredInModuleInterfaceOrPartition(Var) &&
 !isa(Var) &&
diff --git a/clang/test/Interpreter/const.cpp b/clang/test/Interpreter/const.cpp
new file mode 100644
index 00..a4b610f1a19d84
--- /dev/null
+++ b/clang/test/Interpreter/const.cpp
@@ -0,0 +1,29 @@
+// UNSUPPORTED: system-aix
+// RUN: cat %s | clang-repl | FileCheck %s
+// RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s
+
+extern "C" int printf(const char*, ...);
+
+struct A { int val; A(int v); ~A(); void f() const; };
+A::A(int v) : val(v) { printf("A(%d), this = %p\n", val, this); }
+A::~A() { printf("~A, this = %p, val = %d\n", this, val); }
+void A::f() const { printf("f: this = %p, val = %d\n", this, val); }
+
+const A a(1);
+// CHECK: A(1), this = [[THIS:0x[0-9a-f]+]]
+// The constructor must only be called once!
+// CHECK-NOT: A(1)
+
+a.f();
+// CHECK-NEXT: f: this = [[THIS]], val = 1
+a.f();
+// CHECK-NEXT: f: this = [[THIS]], val = 1
+
+%quit
+// There must still be no other constructor!
+// CHECK-NOT: A(1)
+
+// At the end, we expect exactly one destructor call
+// CHECK: ~A
+// CHECK-SAME: this = [[THIS]], val = 1
+// CHECK-NOT: ~A

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


[clang] [clang-repl] Emit const variables only once (PR #65257)

2023-09-04 Thread Jonas Hahnfeld via cfe-commits

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


[clang] [clang-repl] Emit const variables only once (PR #65257)

2023-09-04 Thread Jonas Hahnfeld via cfe-commits

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


[clang] [clang-repl] Emit const variables only once (PR #65257)

2023-09-04 Thread Jonas Hahnfeld via cfe-commits

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


[clang] [clang-repl] Emit const variables only once (PR #65257)

2023-09-04 Thread Vassil Vassilev via cfe-commits

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


[PATCH] D133361: [BPF] Attribute btf_decl_tag("ctx") for structs

2023-09-04 Thread Eduard Zingerman via Phabricator via cfe-commits
eddyz87 added a comment.

In D133361#4629292 , @ast wrote:

> ...
> Right. Such recursive propagation of PAI is necessary. For btf_tag we cannot 
> do it. Always propagating it won't be correct.
> New preserve_const_field_offset would need to be propagated too and we 
> actually have nested unions.
> __bpf_md_ptr is such example. btf_tag wouldn't propagate into that union, but 
> attr(preserve_const_field_offset) should.

Hi Alexei,

It just occurred to me that such an attribute would also require DWARF and BTF 
encoding in order to get reflected in vmlinux.h (which we already have for 
btf_decl_tag). Given this I think we can rename decl tag "ctx" to 
`btf_decl_tag("preserve_const_field_offset")` but we should still keep it a 
`btf_decl_tag`. I'll try to replace usage of `bpf_context_marker` intrinsic by 
metadata, if that fails will just rename the intrinsic to 
`preserve_const_field_offset`.
What do you think? (Sorry, I should have thought this through last week).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133361

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


[PATCH] D159398: [AArch64][Clang] Disable outline atomics in freestanding env

2023-09-04 Thread Vladislav Khmelevsky via Phabricator via cfe-commits
yota9 added a comment.

The problem here is that if you would remove the freestanding condition and run 
this test it would fail since "-target-feature" "+outline-atomics" would be 
passed to the clang.  And usually we don't want the compiler to use any 
external symbols in freestanding mode, this is the reason why -fno-builtin is 
implied with freestanding option. So it seems to be logical to me to disable 
outline-atomics too in this situation even if the compiler have runtime library 
available


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159398

___
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 `offsetof` (PR #65246)

2023-09-04 Thread Mikhail Goncharov via cfe-commits

metaflow wrote:

@kasuga-fj could you please re-upload change to trigger the build?

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


  1   2   3   >