[clang] [RISCV] full support for riscv_rvv_vector_bits attribute (PR #100110)

2024-08-06 Thread Craig Topper via cfe-commits


@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -triple riscv64-none-linux-gnu %s -emit-llvm -o - \
 // RUN:  -target-feature +f -target-feature +d -target-feature +zfh \
 // RUN:  -target-feature +zve64d -target-feature +zvfh -mvscale-min=1 \
-// RUN:   -mvscale-max=1 | FileCheck %s --check-prefix=CHECK-64
+// RUN:   -mvscale-max=1 | FileCheck %s --check-prefix=CHECK-64 

topperc wrote:

Stray change?

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


[clang] [Sema] Preserve ContainsUnexpandedParameterPack in TransformLambdaExpr (PR #86265)

2024-08-06 Thread via cfe-commits

cor3ntin wrote:

r3 is in 2 weeks and we have to be more conservatives in our backports, so it 
really depends on how long it took you and @ilya-biryukov to address these 
issues and the complexity of the patches.

In particular, I would be surprised if the attribute case impacts many people.

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


[clang] b7730a2 - [test] Avoid writing to a potentially write-protected dir (#102073)

2024-08-06 Thread via cfe-commits

Author: Karl-Johan Karlsson
Date: 2024-08-06T09:57:31+02:00
New Revision: b7730a23efb222944b732bbdb3a7b965b7bffd98

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

LOG: [test] Avoid writing to a potentially write-protected dir (#102073)

The test length-errors.hlsl don't check the output written to the
current directory. The current directory may be write protected e.g. in
a sandboxed environment.

This patch simply remove the -emit-llvm option as this testcase don't
care about the outputed llvm IR.

Co-authored-by: Chris B 

Added: 


Modified: 
clang/test/SemaHLSL/BuiltIns/length-errors.hlsl

Removed: 




diff  --git a/clang/test/SemaHLSL/BuiltIns/length-errors.hlsl 
b/clang/test/SemaHLSL/BuiltIns/length-errors.hlsl
index fe0046a2ab5a1..281faada6f5e9 100644
--- a/clang/test/SemaHLSL/BuiltIns/length-errors.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/length-errors.hlsl
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -finclude-default-header -triple 
dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm 
-disable-llvm-passes -verify -verify-ignore-unexpected
+// RUN: %clang_cc1 -finclude-default-header -triple 
dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes 
-verify -verify-ignore-unexpected
+
 
 void test_too_few_arg()
 {



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


[clang] [test] Avoid writing to a potentially write-protected dir (PR #102073)

2024-08-06 Thread Karl-Johan Karlsson via cfe-commits

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


[libunwind] [RISCV] Allow libunwind to build for rv32e (PR #98855)

2024-08-06 Thread Sam Elliott via cfe-commits

lenary wrote:

@ArcaneNibble your contributions now definitely meet the threshold for commit 
access - please request it following the instructions in the Developer Policy: 
https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access (also take a 
read of the rest of the policy to understand how the processes are expected to 
work once you have it)

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


[clang] [DebugInfo][RemoveDIs] Use iterator-inserters in clang (PR #102006)

2024-08-06 Thread Orlando Cazalet-Hyams via cfe-commits

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

LGTM with nit + pls appease the the formatter

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


[clang] [DebugInfo][RemoveDIs] Use iterator-inserters in clang (PR #102006)

2024-08-06 Thread Orlando Cazalet-Hyams via cfe-commits

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


[clang] [DebugInfo][RemoveDIs] Use iterator-inserters in clang (PR #102006)

2024-08-06 Thread Orlando Cazalet-Hyams via cfe-commits


@@ -295,18 +295,25 @@ void EHScopeStack::Cleanup::anchor() {}
 static void createStoreInstBefore(llvm::Value *value, Address addr,
   llvm::Instruction *beforeInst,
   CodeGenFunction &CGF) {
-  auto store = new llvm::StoreInst(value, addr.emitRawPointer(CGF), 
beforeInst);
+  auto store = new llvm::StoreInst(value, addr.emitRawPointer(CGF),
+   beforeInst->getIterator());

OCHyams wrote:

Is it worth updating the `beforeInst` parameter to a iterator instead of 
`->getIterator()`-ing here? That would match the `createLoadInstBefore` 
overload you've added in this patch too.

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


[clang] [PS4/PS5][Driver] Allow -static in PlayStation drivers (PR #102020)

2024-08-06 Thread Edd Dawson via cfe-commits

https://github.com/playstation-edd updated 
https://github.com/llvm/llvm-project/pull/102020

>From aa97906cdf1ac08e0b5d607914c28dcb2bbc2545 Mon Sep 17 00:00:00 2001
From: Edd Dawson 
Date: Mon, 5 Aug 2024 17:42:55 +0100
Subject: [PATCH 1/2] [PS4/PS5][Driver] Allow -static in PlayStation drivers

On PlayStation, allow users to supply -static to the linker, via the
driver.

An initial step. Later changes will have the PS5 driver supply
additional options to the linker, if and when -static is passed.

SIE tracker: TOOLCHAIN-16704
---
 clang/lib/Driver/ToolChains/PS4CPU.cpp | 9 +
 clang/test/Driver/ps4-linker.c | 7 +++
 clang/test/Driver/ps4-pic.c| 9 -
 clang/test/Driver/ps5-linker.c | 7 +++
 clang/test/Driver/ps5-pic.c| 9 -
 5 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp 
b/clang/lib/Driver/ToolChains/PS4CPU.cpp
index a9e612c44da06..3da9a280fd129 100644
--- a/clang/lib/Driver/ToolChains/PS4CPU.cpp
+++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp
@@ -141,6 +141,9 @@ void tools::PS4cpu::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
   if (Args.hasArg(options::OPT_pie))
 CmdArgs.push_back("-pie");
 
+
+  if (Args.hasArg(options::OPT_static))
+CmdArgs.push_back("--static");
   if (Args.hasArg(options::OPT_rdynamic))
 CmdArgs.push_back("-export-dynamic");
   if (Args.hasArg(options::OPT_shared))
@@ -238,6 +241,8 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
   if (Args.hasArg(options::OPT_pie))
 CmdArgs.push_back("-pie");
 
+  if (Args.hasArg(options::OPT_static))
+CmdArgs.push_back("--static");
   if (Args.hasArg(options::OPT_rdynamic))
 CmdArgs.push_back("-export-dynamic");
   if (Args.hasArg(options::OPT_shared))
@@ -316,10 +321,6 @@ toolchains::PS4PS5Base::PS4PS5Base(const Driver &D, const 
llvm::Triple &Triple,
const ArgList &Args, StringRef Platform,
const char *EnvVar)
 : Generic_ELF(D, Triple, Args) {
-  if (Args.hasArg(clang::driver::options::OPT_static))
-D.Diag(clang::diag::err_drv_unsupported_opt_for_target)
-<< "-static" << Platform;
-
   // Determine where to find the PS4/PS5 libraries.
   // If -isysroot was passed, use that as the SDK base path.
   // If not, we use the EnvVar if it exists; otherwise use the driver's
diff --git a/clang/test/Driver/ps4-linker.c b/clang/test/Driver/ps4-linker.c
index 2a095d660bf36..47a515158fe81 100644
--- a/clang/test/Driver/ps4-linker.c
+++ b/clang/test/Driver/ps4-linker.c
@@ -1,3 +1,10 @@
+// Test that -static is forwarded to the linker
+
+// RUN: %clang --target=x86_64-scei-ps4 -static %s -### 2>&1 | FileCheck 
--check-prefixes=CHECK-STATIC %s
+
+// CHECK-STATIC: {{ld(\.exe)?}}"
+// CHECK-STATIC-SAME: "--static"
+
 // Test the driver's control over the JustMyCode behavior with linker flags.
 
 // RUN: %clang --target=x86_64-scei-ps4 -fjmc %s -### 2>&1 | FileCheck 
--check-prefixes=CHECK-LTO,CHECK-LIB %s
diff --git a/clang/test/Driver/ps4-pic.c b/clang/test/Driver/ps4-pic.c
index 0551a79cc1258..3072f379d13c6 100644
--- a/clang/test/Driver/ps4-pic.c
+++ b/clang/test/Driver/ps4-pic.c
@@ -23,8 +23,6 @@
 // CHECK-DIAG-PIE: option '-fno-PIE' was ignored by the PS4 toolchain, using 
'-fPIC'
 // CHECK-DIAG-pic: option '-fno-pic' was ignored by the PS4 toolchain, using 
'-fPIC'
 // CHECK-DIAG-pie: option '-fno-pie' was ignored by the PS4 toolchain, using 
'-fPIC'
-//
-// CHECK-STATIC-ERR: unsupported option '-static' for target 'PS4'
 
 // RUN: %clang -c %s -target x86_64-scei-ps4 -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
@@ -79,9 +77,10 @@
 // RUN: not %clang -c %s --target=x86_64-scei-ps4 -mdynamic-no-pic -fPIC -### 
2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC2
 //
-// -static not supported at all.
-// RUN: not %clang -c %s --target=x86_64-scei-ps4 -static -### 2>&1 \
-// RUN:   | FileCheck %s --check-prefix=CHECK-STATIC-ERR
+// The -static argument *doesn't* override PIC: -static only affects
+// linking, and -fPIC only affects code generation.
+// RUN: %clang -c %s -target x86_64-scei-ps4 -static -fPIC -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
 //
 // -fno-PIC etc. is obeyed if -mcmodel=kernel is also present.
 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIC -### 
2>&1 \
diff --git a/clang/test/Driver/ps5-linker.c b/clang/test/Driver/ps5-linker.c
index cf39d5bae97ac..01c0e20f970ed 100644
--- a/clang/test/Driver/ps5-linker.c
+++ b/clang/test/Driver/ps5-linker.c
@@ -1,3 +1,10 @@
+// Test that -static is forwarded to the linker
+
+// RUN: %clang --target=x86_64-scei-ps5 -static %s -### 2>&1 | FileCheck 
--check-prefixes=CHECK-STATIC %s
+
+// CHECK-STATIC: {{ld(\.exe)?}}"
+// CHECK-STATIC-SAME: "--static"
+
 // Test the driver's control over the JustMyCode behavior with linker flags.
 
 // RUN: %clan

[clang] [RISCV] full support for riscv_rvv_vector_bits attribute (PR #100110)

2024-08-06 Thread Vladislav Belov via cfe-commits

https://github.com/vbe-sc updated 
https://github.com/llvm/llvm-project/pull/100110

>From 2dba8f9f90369f79f97fc5efb1272b75d61d36b2 Mon Sep 17 00:00:00 2001
From: vb-sc 
Date: Wed, 31 Jul 2024 13:37:34 +0300
Subject: [PATCH] [RISCV] full support for riscv_rvv_vector_bits attribute

---
 clang/include/clang/AST/Type.h|   4 +
 clang/lib/AST/ASTContext.cpp  |  33 +++-
 clang/lib/AST/ItaniumMangle.cpp   |  26 ++-
 clang/lib/AST/JSONNodeDumper.cpp  |   3 +
 clang/lib/AST/TextNodeDumper.cpp  |   3 +
 clang/lib/AST/TypePrinter.cpp |   6 +
 clang/lib/CodeGen/Targets/RISCV.cpp   |  22 ++-
 clang/lib/Sema/SemaExpr.cpp   |  13 +-
 clang/lib/Sema/SemaType.cpp   |  18 +-
 .../attr-riscv-rvv-vector-bits-less-8-call.c  | 178 ++
 .../attr-riscv-rvv-vector-bits-less-8-cast.c  | 123 
 .../attr-rvv-vector-bits-bitcast-less-8.c | 106 +++
 .../RISCV/attr-rvv-vector-bits-globals.c  |  36 ++--
 .../RISCV/attr-rvv-vector-bits-types.c|  78 
 .../riscv-mangle-rvv-fixed-vectors.cpp|  18 +-
 clang/test/Sema/attr-riscv-rvv-vector-bits.c  |  18 +-
 16 files changed, 586 insertions(+), 99 deletions(-)
 create mode 100644 
clang/test/CodeGen/RISCV/attr-riscv-rvv-vector-bits-less-8-call.c
 create mode 100644 
clang/test/CodeGen/RISCV/attr-riscv-rvv-vector-bits-less-8-cast.c
 create mode 100644 
clang/test/CodeGen/RISCV/attr-rvv-vector-bits-bitcast-less-8.c

diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 25defea58c2dc..a9a87ac5837f1 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -3981,6 +3981,10 @@ enum class VectorKind {
 
   /// is RISC-V RVV fixed-length mask vector
   RVVFixedLengthMask,
+
+  RVVFixedLengthMask_1,
+  RVVFixedLengthMask_2,
+  RVVFixedLengthMask_4
 };
 
 /// Represents a GCC generic vector type. This type is created using
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 7af9ea7105bb0..1b7aed3b9dba8 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1983,7 +1983,10 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) 
const {
   // Adjust the alignment for fixed-length SVE predicates.
   Align = 16;
 else if (VT->getVectorKind() == VectorKind::RVVFixedLengthData ||
- VT->getVectorKind() == VectorKind::RVVFixedLengthMask)
+ VT->getVectorKind() == VectorKind::RVVFixedLengthMask ||
+ VT->getVectorKind() == VectorKind::RVVFixedLengthMask_1 ||
+ VT->getVectorKind() == VectorKind::RVVFixedLengthMask_2 ||
+ VT->getVectorKind() == VectorKind::RVVFixedLengthMask_4)
   // Adjust the alignment for fixed-length RVV vectors.
   Align = std::min(64, Width);
 break;
@@ -9896,7 +9899,13 @@ bool ASTContext::areCompatibleVectorTypes(QualType 
FirstVec,
   First->getVectorKind() != VectorKind::RVVFixedLengthData &&
   Second->getVectorKind() != VectorKind::RVVFixedLengthData &&
   First->getVectorKind() != VectorKind::RVVFixedLengthMask &&
-  Second->getVectorKind() != VectorKind::RVVFixedLengthMask)
+  Second->getVectorKind() != VectorKind::RVVFixedLengthMask &&
+  First->getVectorKind() != VectorKind::RVVFixedLengthMask_1 &&
+  Second->getVectorKind() != VectorKind::RVVFixedLengthMask_1 &&
+  First->getVectorKind() != VectorKind::RVVFixedLengthMask_2 &&
+  Second->getVectorKind() != VectorKind::RVVFixedLengthMask_2 &&
+  First->getVectorKind() != VectorKind::RVVFixedLengthMask_4 &&
+  Second->getVectorKind() != VectorKind::RVVFixedLengthMask_4)
 return true;
 
   return false;
@@ -10014,7 +10023,25 @@ bool ASTContext::areCompatibleRVVTypes(QualType 
FirstType,
   BuiltinVectorTypeInfo Info = getBuiltinVectorTypeInfo(BT);
   return FirstType->isRVVVLSBuiltinType() &&
  Info.ElementType == BoolTy &&
- getTypeSize(SecondType) == getRVVTypeSize(*this, BT);
+ getTypeSize(SecondType) == ((getRVVTypeSize(*this, BT)));
+}
+if (VT->getVectorKind() == VectorKind::RVVFixedLengthMask_1) {
+  BuiltinVectorTypeInfo Info = getBuiltinVectorTypeInfo(BT);
+  return FirstType->isRVVVLSBuiltinType() &&
+ Info.ElementType == BoolTy &&
+ getTypeSize(SecondType) == ((getRVVTypeSize(*this, BT) * 8));
+}
+if (VT->getVectorKind() == VectorKind::RVVFixedLengthMask_2) {
+  BuiltinVectorTypeInfo Info = getBuiltinVectorTypeInfo(BT);
+  return FirstType->isRVVVLSBuiltinType() &&
+ Info.ElementType == BoolTy &&
+ getTypeSize(SecondType) == ((getRVVTypeSize(*this, BT)) * 4);
+}
+if (VT->getVectorKind() == VectorKind::RVVFixedLengthMask_4) {
+  BuiltinVectorTypeInfo Info = getBuiltinVectorTypeInfo(BT);
+ 

[clang] [RISCV] full support for riscv_rvv_vector_bits attribute (PR #100110)

2024-08-06 Thread Vladislav Belov via cfe-commits


@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -triple riscv64-none-linux-gnu %s -emit-llvm -o - \
 // RUN:  -target-feature +f -target-feature +d -target-feature +zfh \
 // RUN:  -target-feature +zve64d -target-feature +zvfh -mvscale-min=1 \
-// RUN:   -mvscale-max=1 | FileCheck %s --check-prefix=CHECK-64
+// RUN:   -mvscale-max=1 | FileCheck %s --check-prefix=CHECK-64 

vbe-sc wrote:

Done

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


[clang] [PS4/PS5][Driver] Allow -static in PlayStation drivers (PR #102020)

2024-08-06 Thread Edd Dawson via cfe-commits

https://github.com/playstation-edd updated 
https://github.com/llvm/llvm-project/pull/102020

>From aa97906cdf1ac08e0b5d607914c28dcb2bbc2545 Mon Sep 17 00:00:00 2001
From: Edd Dawson 
Date: Mon, 5 Aug 2024 17:42:55 +0100
Subject: [PATCH 1/3] [PS4/PS5][Driver] Allow -static in PlayStation drivers

On PlayStation, allow users to supply -static to the linker, via the
driver.

An initial step. Later changes will have the PS5 driver supply
additional options to the linker, if and when -static is passed.

SIE tracker: TOOLCHAIN-16704
---
 clang/lib/Driver/ToolChains/PS4CPU.cpp | 9 +
 clang/test/Driver/ps4-linker.c | 7 +++
 clang/test/Driver/ps4-pic.c| 9 -
 clang/test/Driver/ps5-linker.c | 7 +++
 clang/test/Driver/ps5-pic.c| 9 -
 5 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp 
b/clang/lib/Driver/ToolChains/PS4CPU.cpp
index a9e612c44da06..3da9a280fd129 100644
--- a/clang/lib/Driver/ToolChains/PS4CPU.cpp
+++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp
@@ -141,6 +141,9 @@ void tools::PS4cpu::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
   if (Args.hasArg(options::OPT_pie))
 CmdArgs.push_back("-pie");
 
+
+  if (Args.hasArg(options::OPT_static))
+CmdArgs.push_back("--static");
   if (Args.hasArg(options::OPT_rdynamic))
 CmdArgs.push_back("-export-dynamic");
   if (Args.hasArg(options::OPT_shared))
@@ -238,6 +241,8 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
   if (Args.hasArg(options::OPT_pie))
 CmdArgs.push_back("-pie");
 
+  if (Args.hasArg(options::OPT_static))
+CmdArgs.push_back("--static");
   if (Args.hasArg(options::OPT_rdynamic))
 CmdArgs.push_back("-export-dynamic");
   if (Args.hasArg(options::OPT_shared))
@@ -316,10 +321,6 @@ toolchains::PS4PS5Base::PS4PS5Base(const Driver &D, const 
llvm::Triple &Triple,
const ArgList &Args, StringRef Platform,
const char *EnvVar)
 : Generic_ELF(D, Triple, Args) {
-  if (Args.hasArg(clang::driver::options::OPT_static))
-D.Diag(clang::diag::err_drv_unsupported_opt_for_target)
-<< "-static" << Platform;
-
   // Determine where to find the PS4/PS5 libraries.
   // If -isysroot was passed, use that as the SDK base path.
   // If not, we use the EnvVar if it exists; otherwise use the driver's
diff --git a/clang/test/Driver/ps4-linker.c b/clang/test/Driver/ps4-linker.c
index 2a095d660bf36..47a515158fe81 100644
--- a/clang/test/Driver/ps4-linker.c
+++ b/clang/test/Driver/ps4-linker.c
@@ -1,3 +1,10 @@
+// Test that -static is forwarded to the linker
+
+// RUN: %clang --target=x86_64-scei-ps4 -static %s -### 2>&1 | FileCheck 
--check-prefixes=CHECK-STATIC %s
+
+// CHECK-STATIC: {{ld(\.exe)?}}"
+// CHECK-STATIC-SAME: "--static"
+
 // Test the driver's control over the JustMyCode behavior with linker flags.
 
 // RUN: %clang --target=x86_64-scei-ps4 -fjmc %s -### 2>&1 | FileCheck 
--check-prefixes=CHECK-LTO,CHECK-LIB %s
diff --git a/clang/test/Driver/ps4-pic.c b/clang/test/Driver/ps4-pic.c
index 0551a79cc1258..3072f379d13c6 100644
--- a/clang/test/Driver/ps4-pic.c
+++ b/clang/test/Driver/ps4-pic.c
@@ -23,8 +23,6 @@
 // CHECK-DIAG-PIE: option '-fno-PIE' was ignored by the PS4 toolchain, using 
'-fPIC'
 // CHECK-DIAG-pic: option '-fno-pic' was ignored by the PS4 toolchain, using 
'-fPIC'
 // CHECK-DIAG-pie: option '-fno-pie' was ignored by the PS4 toolchain, using 
'-fPIC'
-//
-// CHECK-STATIC-ERR: unsupported option '-static' for target 'PS4'
 
 // RUN: %clang -c %s -target x86_64-scei-ps4 -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
@@ -79,9 +77,10 @@
 // RUN: not %clang -c %s --target=x86_64-scei-ps4 -mdynamic-no-pic -fPIC -### 
2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC2
 //
-// -static not supported at all.
-// RUN: not %clang -c %s --target=x86_64-scei-ps4 -static -### 2>&1 \
-// RUN:   | FileCheck %s --check-prefix=CHECK-STATIC-ERR
+// The -static argument *doesn't* override PIC: -static only affects
+// linking, and -fPIC only affects code generation.
+// RUN: %clang -c %s -target x86_64-scei-ps4 -static -fPIC -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
 //
 // -fno-PIC etc. is obeyed if -mcmodel=kernel is also present.
 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIC -### 
2>&1 \
diff --git a/clang/test/Driver/ps5-linker.c b/clang/test/Driver/ps5-linker.c
index cf39d5bae97ac..01c0e20f970ed 100644
--- a/clang/test/Driver/ps5-linker.c
+++ b/clang/test/Driver/ps5-linker.c
@@ -1,3 +1,10 @@
+// Test that -static is forwarded to the linker
+
+// RUN: %clang --target=x86_64-scei-ps5 -static %s -### 2>&1 | FileCheck 
--check-prefixes=CHECK-STATIC %s
+
+// CHECK-STATIC: {{ld(\.exe)?}}"
+// CHECK-STATIC-SAME: "--static"
+
 // Test the driver's control over the JustMyCode behavior with linker flags.
 
 // RUN: %clan

[clang] [Clang] Do not emit intrinsic math functions on GPU targets (PR #98209)

2024-08-06 Thread Matt Arsenault via cfe-commits

arsenm wrote:

> Interesting, the important bit is that this is done before the LTO link so we 
> know which functions to pull in. Unfortunately I don't think there's a good 
> location that actually states which math calls are supported, but I could 
> probably make a script that goes through each one. Unless @arsenm knows some 
> secret backend location.

The problem is still that there are still multiple half baked mechanisms for 
telling what calls. RuntimeLibcalls is theoretically the set of what calls what 
the backend can emit. It's now been moved, but I thought it still doesn't 
handle the renamed cases in an IR observable way? It's also still unfortunate 
that we have this parallel mechanism to TargetLibraryInfo, which is almost the 
same thing.

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


[clang] [PS4/PS5][Driver] Allow -static in PlayStation drivers (PR #102020)

2024-08-06 Thread Edd Dawson via cfe-commits


@@ -141,6 +141,9 @@ void tools::PS4cpu::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
   if (Args.hasArg(options::OPT_pie))
 CmdArgs.push_back("-pie");
 
+

playstation-edd wrote:

Oops - thanks. Removed.

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


[clang] [PS4/PS5][Driver] Allow -static in PlayStation drivers (PR #102020)

2024-08-06 Thread Edd Dawson via cfe-commits


@@ -141,6 +141,9 @@ void tools::PS4cpu::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
   if (Args.hasArg(options::OPT_pie))
 CmdArgs.push_back("-pie");
 
+
+  if (Args.hasArg(options::OPT_static))
+CmdArgs.push_back("--static");

playstation-edd wrote:

> The linker option is almost always spelled as `-static`.

I have changed this.
FWIW, I took my cue from the `--help` of ld.lld, assuming it would be a 
suitable authority.

> Gnu.cpp:437 
> ([ae623d1](https://github.com/llvm/llvm-project/commit/ae623d16d50c9f12de7ae7ac1aa11c9d6857e081))
>  demonstrates how these options work on Linux

Over coming changes we'll evolve to something more like that, but not exactly. 
The users of `-static` on PlayStation are a small, distinct group, internal to 
SIE. Over the last decade or so `-static` has - for better or worse - evolved 
into something very particular, here. Once all the functionality that should be 
in the PS driver is actually here, there's perhaps a chance that it can be 
rationalized.

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


[clang] [Clang] Implement C++26’s P2893R3 ‘Variadic friends’ (PR #101448)

2024-08-06 Thread via cfe-commits

cor3ntin wrote:

> Is there ever a situation that would cause us to have to instantiate a 
> FriendPackDecl in the TemplateDeclInstantiator? We do that for 
> UsingPackDecls, but those are sufficiently different enough from the former 
> that I’m not sure about it. I at least haven’t been able to come up w/ any 
> cases that would cause us to try and instantiate one.

That would be needed for the 

```cpp
template 
struct S {
  friend class S::Nested...;
};
```

case, I think?


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


[clang] [llvm] [AArch64] Add updated FEAT_SVE_B16B16 and begin replacement of 'b16b16' flag (PR #101480)

2024-08-06 Thread via cfe-commits

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


[clang] [llvm] [AArch64] Add updated FEAT_SVE_B16B16 and begin replacement of 'b16b16' flag (PR #101480)

2024-08-06 Thread via cfe-commits

https://github.com/CarolineConcatto commented:

Thank you Spencer for the patch.
I believe we missed the  multi vector instructions targeting BF16.
 

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


[clang] [llvm] [AArch64] Add updated FEAT_SVE_B16B16 and begin replacement of 'b16b16' flag (PR #101480)

2024-08-06 Thread via cfe-commits


@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -verify -verify-ignore-unexpected=error,note -emit-llvm 
-o - %s

CarolineConcatto wrote:

Can we group this file with the streaming on.
The same we do for the codegen?
They have both the same reported error.

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


[clang] [llvm] [AArch64] Add updated FEAT_SVE_B16B16 and begin replacement of 'b16b16' flag (PR #101480)

2024-08-06 Thread via cfe-commits


@@ -2172,7 +2172,7 @@ let SVETargetGuard = InvalidMode, SMETargetGuard = "sme2" 
in {
   def SVFCLAMP_X4 : SInst<"svclamp[_single_{d}_x4]",  "44dd",   "hfd",  
MergeNone, "aarch64_sve_fclamp_single_x4",  [IsStreaming], []>;
 }
 
-let SVETargetGuard = InvalidMode, SMETargetGuard = "sme2,b16b16"in {
+let SVETargetGuard = InvalidMode, SMETargetGuard = "sme2,sve-b16b16"in {

CarolineConcatto wrote:

It is missing the multi vector targeting Z. For some reason they are not under 
b16b16.
But they were added in this commit f7392f40f3f6d5d4f.
I can see them being changes in LLVM in this patch
// SME2 Z-targeting non-widening BFloat16 instructions
let Predicates = [HasSME2, HasSVEB16B16] in {

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


[clang] [C++20] [Modules] Don't set modules owner ship information for builtin declarations (PR #102115)

2024-08-06 Thread Chuanqi Xu via cfe-commits

https://github.com/ChuanqiXu9 created 
https://github.com/llvm/llvm-project/pull/102115

Close https://github.com/llvm/llvm-project/issues/101939

As the issue said, the builtin declarations shouldn't be in any modules.

>From 3dabd3815c78697046ba436e62a2ea39cf2361b3 Mon Sep 17 00:00:00 2001
From: Chuanqi Xu 
Date: Tue, 6 Aug 2024 17:07:01 +0800
Subject: [PATCH] [C++20] [Modules] Don't set modules owner ship information
 for builtin declarations

Close https://github.com/llvm/llvm-project/issues/101939

As the issue said, the builtin declarations shouldn't be in any modules.
---
 clang/lib/Sema/SemaDecl.cpp  | 6 ++
 clang/test/Modules/pr101939.cppm | 6 ++
 2 files changed, 12 insertions(+)
 create mode 100644 clang/test/Modules/pr101939.cppm

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1f4bfa247b544..a82c66ced817e 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2376,6 +2376,12 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, 
unsigned ID,
   FunctionDecl *New = CreateBuiltin(II, R, ID, Loc);
   RegisterLocallyScopedExternCDecl(New, S);
 
+  // Builtin functions shouldn't be owned by any module.
+  if (New->hasOwningModule()) {
+New->setLocalOwningModule(nullptr);
+New->setModuleOwnershipKind(Decl::ModuleOwnershipKind::Unowned);
+  }
+
   // TUScope is the translation-unit scope to insert this function into.
   // FIXME: This is hideous. We need to teach PushOnScopeChains to
   // relate Scopes to DeclContexts, and probably eliminate CurContext
diff --git a/clang/test/Modules/pr101939.cppm b/clang/test/Modules/pr101939.cppm
new file mode 100644
index 0..35c243ed0f1bf
--- /dev/null
+++ b/clang/test/Modules/pr101939.cppm
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -std=c++20 %s -ast-dump | FileCheck %s
+
+export module mod;
+export auto a = __builtin_expect(true, true);
+
+// CHECK-NOT: FunctionDecl{{.*}} in mod {{.*}} __builtin_expect

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


[clang] [C++20] [Modules] Don't set modules owner ship information for builtin declarations (PR #102115)

2024-08-06 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-modules

Author: Chuanqi Xu (ChuanqiXu9)


Changes

Close https://github.com/llvm/llvm-project/issues/101939

As the issue said, the builtin declarations shouldn't be in any modules.

---
Full diff: https://github.com/llvm/llvm-project/pull/102115.diff


2 Files Affected:

- (modified) clang/lib/Sema/SemaDecl.cpp (+6) 
- (added) clang/test/Modules/pr101939.cppm (+6) 


``diff
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1f4bfa247b544..a82c66ced817e 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2376,6 +2376,12 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, 
unsigned ID,
   FunctionDecl *New = CreateBuiltin(II, R, ID, Loc);
   RegisterLocallyScopedExternCDecl(New, S);
 
+  // Builtin functions shouldn't be owned by any module.
+  if (New->hasOwningModule()) {
+New->setLocalOwningModule(nullptr);
+New->setModuleOwnershipKind(Decl::ModuleOwnershipKind::Unowned);
+  }
+
   // TUScope is the translation-unit scope to insert this function into.
   // FIXME: This is hideous. We need to teach PushOnScopeChains to
   // relate Scopes to DeclContexts, and probably eliminate CurContext
diff --git a/clang/test/Modules/pr101939.cppm b/clang/test/Modules/pr101939.cppm
new file mode 100644
index 0..35c243ed0f1bf
--- /dev/null
+++ b/clang/test/Modules/pr101939.cppm
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -std=c++20 %s -ast-dump | FileCheck %s
+
+export module mod;
+export auto a = __builtin_expect(true, true);
+
+// CHECK-NOT: FunctionDecl{{.*}} in mod {{.*}} __builtin_expect

``




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


[clang] [Clang][Sema] Backport P2741R3 (static_assert with user-generated message) to C++11 (PR #102044)

2024-08-06 Thread via cfe-commits

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

That seems reasonable to me.
We need a changelog entry for that change tough

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


[clang] [C++20] [Modules] Don't set modules owner ship information for builtin declarations (PR #102115)

2024-08-06 Thread via cfe-commits


@@ -2376,6 +2376,12 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, 
unsigned ID,
   FunctionDecl *New = CreateBuiltin(II, R, ID, Loc);
   RegisterLocallyScopedExternCDecl(New, S);
 
+  // Builtin functions shouldn't be owned by any module.
+  if (New->hasOwningModule()) {
+New->setLocalOwningModule(nullptr);

cor3ntin wrote:

When is the owning module set?
It would be cleaner to check whether a function is a builtin and never set a 
module rather than adding it and removing it later, i think

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


[clang] [Sema] Preserve ContainsUnexpandedParameterPack in TransformLambdaExpr (PR #86265)

2024-08-06 Thread Ilya Biryukov via cfe-commits

ilya-biryukov wrote:

> r3 is in 2 weeks and we have to be more conservatives in our backports, so it 
> really depends on how long it took you and @ilya-biryukov to address these 
> issues and the complexity of the patches.
> 
> In particular, I would be surprised if the attribute case impacts many people.

To be clear, I don't have a real-world use-case for attributes. The only reason 
I have added it in my patch is because there was a test in Clang that started 
failing with my approach (because it started looking at thing structurally even 
on the parsing path, as discussed earlier).
I suspect we could live with that for a long time, although fixing that 
eventually is a good idea. (And is still in my TODO list, just slipped a little)

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


[clang] [RISCV] full support for riscv_rvv_vector_bits attribute (PR #100110)

2024-08-06 Thread Vladislav Belov via cfe-commits

https://github.com/vbe-sc updated 
https://github.com/llvm/llvm-project/pull/100110

>From 2dba8f9f90369f79f97fc5efb1272b75d61d36b2 Mon Sep 17 00:00:00 2001
From: vb-sc 
Date: Wed, 31 Jul 2024 13:37:34 +0300
Subject: [PATCH] [RISCV] full support for riscv_rvv_vector_bits attribute

---
 clang/include/clang/AST/Type.h|   4 +
 clang/lib/AST/ASTContext.cpp  |  33 +++-
 clang/lib/AST/ItaniumMangle.cpp   |  26 ++-
 clang/lib/AST/JSONNodeDumper.cpp  |   3 +
 clang/lib/AST/TextNodeDumper.cpp  |   3 +
 clang/lib/AST/TypePrinter.cpp |   6 +
 clang/lib/CodeGen/Targets/RISCV.cpp   |  22 ++-
 clang/lib/Sema/SemaExpr.cpp   |  13 +-
 clang/lib/Sema/SemaType.cpp   |  18 +-
 .../attr-riscv-rvv-vector-bits-less-8-call.c  | 178 ++
 .../attr-riscv-rvv-vector-bits-less-8-cast.c  | 123 
 .../attr-rvv-vector-bits-bitcast-less-8.c | 106 +++
 .../RISCV/attr-rvv-vector-bits-globals.c  |  36 ++--
 .../RISCV/attr-rvv-vector-bits-types.c|  78 
 .../riscv-mangle-rvv-fixed-vectors.cpp|  18 +-
 clang/test/Sema/attr-riscv-rvv-vector-bits.c  |  18 +-
 16 files changed, 586 insertions(+), 99 deletions(-)
 create mode 100644 
clang/test/CodeGen/RISCV/attr-riscv-rvv-vector-bits-less-8-call.c
 create mode 100644 
clang/test/CodeGen/RISCV/attr-riscv-rvv-vector-bits-less-8-cast.c
 create mode 100644 
clang/test/CodeGen/RISCV/attr-rvv-vector-bits-bitcast-less-8.c

diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 25defea58c2dc..a9a87ac5837f1 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -3981,6 +3981,10 @@ enum class VectorKind {
 
   /// is RISC-V RVV fixed-length mask vector
   RVVFixedLengthMask,
+
+  RVVFixedLengthMask_1,
+  RVVFixedLengthMask_2,
+  RVVFixedLengthMask_4
 };
 
 /// Represents a GCC generic vector type. This type is created using
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 7af9ea7105bb0..1b7aed3b9dba8 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1983,7 +1983,10 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) 
const {
   // Adjust the alignment for fixed-length SVE predicates.
   Align = 16;
 else if (VT->getVectorKind() == VectorKind::RVVFixedLengthData ||
- VT->getVectorKind() == VectorKind::RVVFixedLengthMask)
+ VT->getVectorKind() == VectorKind::RVVFixedLengthMask ||
+ VT->getVectorKind() == VectorKind::RVVFixedLengthMask_1 ||
+ VT->getVectorKind() == VectorKind::RVVFixedLengthMask_2 ||
+ VT->getVectorKind() == VectorKind::RVVFixedLengthMask_4)
   // Adjust the alignment for fixed-length RVV vectors.
   Align = std::min(64, Width);
 break;
@@ -9896,7 +9899,13 @@ bool ASTContext::areCompatibleVectorTypes(QualType 
FirstVec,
   First->getVectorKind() != VectorKind::RVVFixedLengthData &&
   Second->getVectorKind() != VectorKind::RVVFixedLengthData &&
   First->getVectorKind() != VectorKind::RVVFixedLengthMask &&
-  Second->getVectorKind() != VectorKind::RVVFixedLengthMask)
+  Second->getVectorKind() != VectorKind::RVVFixedLengthMask &&
+  First->getVectorKind() != VectorKind::RVVFixedLengthMask_1 &&
+  Second->getVectorKind() != VectorKind::RVVFixedLengthMask_1 &&
+  First->getVectorKind() != VectorKind::RVVFixedLengthMask_2 &&
+  Second->getVectorKind() != VectorKind::RVVFixedLengthMask_2 &&
+  First->getVectorKind() != VectorKind::RVVFixedLengthMask_4 &&
+  Second->getVectorKind() != VectorKind::RVVFixedLengthMask_4)
 return true;
 
   return false;
@@ -10014,7 +10023,25 @@ bool ASTContext::areCompatibleRVVTypes(QualType 
FirstType,
   BuiltinVectorTypeInfo Info = getBuiltinVectorTypeInfo(BT);
   return FirstType->isRVVVLSBuiltinType() &&
  Info.ElementType == BoolTy &&
- getTypeSize(SecondType) == getRVVTypeSize(*this, BT);
+ getTypeSize(SecondType) == ((getRVVTypeSize(*this, BT)));
+}
+if (VT->getVectorKind() == VectorKind::RVVFixedLengthMask_1) {
+  BuiltinVectorTypeInfo Info = getBuiltinVectorTypeInfo(BT);
+  return FirstType->isRVVVLSBuiltinType() &&
+ Info.ElementType == BoolTy &&
+ getTypeSize(SecondType) == ((getRVVTypeSize(*this, BT) * 8));
+}
+if (VT->getVectorKind() == VectorKind::RVVFixedLengthMask_2) {
+  BuiltinVectorTypeInfo Info = getBuiltinVectorTypeInfo(BT);
+  return FirstType->isRVVVLSBuiltinType() &&
+ Info.ElementType == BoolTy &&
+ getTypeSize(SecondType) == ((getRVVTypeSize(*this, BT)) * 4);
+}
+if (VT->getVectorKind() == VectorKind::RVVFixedLengthMask_4) {
+  BuiltinVectorTypeInfo Info = getBuiltinVectorTypeInfo(BT);
+ 

[clang] 3027688 - [RISCV] Support bf16 vmv.v.v and vmerge.vvm intrinsics with `zvfbfmin` (#101611)

2024-08-06 Thread via cfe-commits

Author: Brandon Wu
Date: 2024-08-06T17:59:53+08:00
New Revision: 3027688a77b5511447b3f060aaecbf30e4b9e63e

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

LOG: [RISCV] Support bf16 vmv.v.v and vmerge.vvm intrinsics with `zvfbfmin` 
(#101611)

These two intrinsics are supported for f16 with `zvfhmin`, also support
them in bf16 to make it aligned to f16.

This resolve:
https://github.com/riscv-non-isa/rvv-intrinsic-doc/issues/349

Added: 


Modified: 
clang/include/clang/Basic/riscv_vector.td

clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vmerge.c

clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vmv.c

clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vmerge.c

clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vmv.c

clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vmerge.c

clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vmv.c

clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vmerge.c

clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vmv.c
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Removed: 




diff  --git a/clang/include/clang/Basic/riscv_vector.td 
b/clang/include/clang/Basic/riscv_vector.td
index 0cab4b8067f0d..b838917e39cfe 100644
--- a/clang/include/clang/Basic/riscv_vector.td
+++ b/clang/include/clang/Basic/riscv_vector.td
@@ -1378,6 +1378,9 @@ let HasMasked = false,
 let RequiredFeatures = ["Zvfhmin"] in
   defm vmv_v : RVVOutBuiltinSet<"vmv_v_v", "x",
 [["v", "v", "vv"]]>;
+let RequiredFeatures = ["Zvfbfmin"] in
+  defm vmv_v : RVVOutBuiltinSet<"vmv_v_v", "y",
+[["v", "v", "vv"]]>;
   let SupportOverloading = false in
 defm vmv_v : RVVOutBuiltinSet<"vmv_v_x", "csil",
[["x", "v", "ve"],
@@ -1890,6 +1893,9 @@ let HasMasked = false,
   let RequiredFeatures = ["Zvfhmin"] in
 defm vmerge : RVVOutOp1BuiltinSet<"vmerge", "x",
   [["vvm", "v", "vvvm"]]>;
+  let RequiredFeatures = ["Zvfbfmin"] in
+defm vmerge : RVVOutOp1BuiltinSet<"vmerge", "y",
+  [["vvm", "v", "vvvm"]]>;
   defm vfmerge : RVVOutOp1BuiltinSet<"vfmerge", "xfd",
  [["vfm", "v", "vvem"]]>;
 }

diff  --git 
a/clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vmerge.c
 
b/clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vmerge.c
index fb41a07cccec0..d2eb01c70950e 100644
--- 
a/clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vmerge.c
+++ 
b/clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vmerge.c
@@ -1,7 +1,7 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 2
 // REQUIRES: riscv-registered-target
 // RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
-// RUN:   -target-feature +zvfhmin -disable-O0-optnone  \
+// RUN:   -target-feature +zvfhmin -target-feature +zvfbfmin 
-disable-O0-optnone  \
 // RUN:   -emit-llvm %s -o - | opt -S -passes=mem2reg | \
 // RUN:   FileCheck --check-prefix=CHECK-RV64 %s
 
@@ -1037,3 +1037,62 @@ vfloat64m8_t test_vmerge_vvm_f64m8(vfloat64m8_t op1, 
vfloat64m8_t op2, vbool8_t
   return __riscv_vmerge_vvm_f64m8(op1, op2, mask, vl);
 }
 
+// CHECK-RV64-LABEL: define dso_local  
@test_vmerge_vvm_bf16mf4
+// CHECK-RV64-SAME: ( [[OP1:%.*]],  
[[OP2:%.*]],  [[MASK:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] 
{
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = call  
@llvm.riscv.vmerge.nxv1bf16.nxv1bf16.i64( poison,  [[OP1]],  [[OP2]],  
[[MASK]], i64 [[VL]])
+// CHECK-RV64-NEXT:ret  [[TMP0]]
+//
+vbfloat16mf4_t test_vmerge_vvm_bf16mf4(vbfloat16mf4_t op1, vbfloat16mf4_t op2, 
vbool64_t mask, size_t vl) {
+  return __riscv_vmerge_vvm_bf16mf4(op1, op2, mask, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local  
@test_vmerge_vvm_bf16mf2
+// CHECK-RV64-SAME: ( [[OP1:%.*]],  
[[OP2:%.*]],  [[MASK:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] 
{
+// CHECK-RV64-NEXT:  entry:
+// CHECK-RV64-NEXT:[[TMP0:%.*]] = call  
@llvm.riscv.vmerge.nxv2bf16.nxv2bf16.i64( poison,  [[OP1]],  [[OP2]],  
[[MASK]], i64 [[VL]])
+// CHECK-RV64-NEXT:ret  [[TMP0]]
+//
+vbfloat16mf2_t test_vmerge_vvm_bf16mf2(vbfloat16mf2_t op1, vbfloat16mf2_t op2, 
vbool32_t mask, size_t vl) {
+  return __riscv_vmerge_vvm_bf16mf2(op1, op2, mask, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local  
@test_vmerge_vvm_bf16m1
+// CHECK

[clang] [llvm] [RISCV] Support bf16 vmv.v.v and vmerge.vvm intrinsics with `zvfbfmin` (PR #101611)

2024-08-06 Thread Brandon Wu via cfe-commits

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


[clang] [llvm] [RISCV] Support `vrgather` and `vcompress` for `zvfhmin` and `zvfbfmin` (PR #101633)

2024-08-06 Thread Brandon Wu via cfe-commits

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


[clang] 40c2aaf - [RISCV][sema] Correct the requirement of `vf[n|w]cvt.x[|u].f` intrinsics (#101811)

2024-08-06 Thread via cfe-commits

Author: Brandon Wu
Date: 2024-08-06T18:00:38+08:00
New Revision: 40c2aaf54e9a7b5c560bb68796d444180ad67b5d

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

LOG: [RISCV][sema] Correct the requirement of `vf[n|w]cvt.x[|u].f` intrinsics 
(#101811)

Fix https://github.com/llvm/llvm-project/issues/101526

`vf[n|w]cvt.x[|u].f` for f16 needs `zvfh` instead of `zvfhmin`, current
approach
is not able to detect this. Ultimately we need to add `zvfh` to
RequiredFeatures
to check other intrinsics instead, the type check should be done in
checkRVVTypeSupport.

Added: 


Modified: 
clang/include/clang/Basic/riscv_vector.td
clang/include/clang/Basic/riscv_vector_common.td
clang/include/clang/Support/RISCVVIntrinsicUtils.h
clang/lib/Sema/SemaRISCV.cpp
clang/utils/TableGen/RISCVVEmitter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/riscv_vector.td 
b/clang/include/clang/Basic/riscv_vector.td
index 06ce0affced89..dda2dcb9f4ff6 100644
--- a/clang/include/clang/Basic/riscv_vector.td
+++ b/clang/include/clang/Basic/riscv_vector.td
@@ -1918,8 +1918,18 @@ def vfcvt_rtz_x_f_v : 
RVVConvToSignedBuiltin<"vfcvt_rtz_x">;
 let Log2LMUL = [-3, -2, -1, 0, 1, 2] in {
   def vfwcvt_rtz_xu_f_v : RVVConvToWidenUnsignedBuiltin<"vfwcvt_rtz_xu">;
   def vfwcvt_rtz_x_f_v : RVVConvToWidenSignedBuiltin<"vfwcvt_rtz_x">;
-  def vfwcvt_f_xu_v : RVVConvBuiltin<"Fw", "FwUv", "csi", "vfwcvt_f">;
-  def vfwcvt_f_x_v : RVVConvBuiltin<"Fw", "Fwv", "csi", "vfwcvt_f">;
+  def vfwcvt_f_xu_v : RVVConvBuiltin<"Fw", "FwUv", "si", "vfwcvt_f">;
+  def vfwcvt_f_x_v : RVVConvBuiltin<"Fw", "Fwv", "si", "vfwcvt_f">;
+  let RequiredFeatures = ["Zvfh"] in {
+let Name = "vfwcvt_f_xu_v",
+IRName = "vfwcvt_f_xu_v",
+MaskedIRName = "vfwcvt_f_xu_v_mask" in
+  def : RVVConvBuiltin<"Fw", "FwUv", "c", "vfwcvt_f">;
+let Name = "vfwcvt_f_x_v",
+IRName = "vfwcvt_f_x_v",
+MaskedIRName = "vfwcvt_f_x_v_mask" in
+  def : RVVConvBuiltin<"Fw", "Fwv", "c", "vfwcvt_f">;
+  }
   def vfwcvt_f_f_v : RVVConvBuiltin<"w", "wv", "f", "vfwcvt_f">;
   let RequiredFeatures = ["Zvfhmin"] in
 def vfwcvt_f_f_v_fp16 : RVVConvBuiltin<"w", "wv", "x", "vfwcvt_f"> {
@@ -1933,6 +1943,16 @@ let Log2LMUL = [-3, -2, -1, 0, 1, 2] in {
 let Log2LMUL = [-3, -2, -1, 0, 1, 2] in {
   def vfncvt_rtz_xu_f_w : RVVConvToNarrowingUnsignedBuiltin<"vfncvt_rtz_xu">;
   def vfncvt_rtz_x_f_w : RVVConvToNarrowingSignedBuiltin<"vfncvt_rtz_x">;
+  let RequiredFeatures = ["Zvfh"] in {
+let Name = "vfncvt_rtz_xu_f_w",
+IRName = "vfncvt_rtz_xu_f_w",
+MaskedIRName = "vfncvt_rtz_xu_f_w_mask" in
+  def : RVVConvBuiltin<"Uv", "UvFw", "c", "vfncvt_rtz_xu">;
+let Name = "vfncvt_rtz_x_f_w",
+IRName = "vfncvt_rtz_x_f_w",
+MaskedIRName = "vfncvt_rtz_x_f_w_mask" in
+  def : RVVConvBuiltin<"Iv", "IvFw", "c", "vfncvt_rtz_x">;
+  }
   def vfncvt_rod_f_f_w : RVVConvBuiltin<"v", "vw", "xf", "vfncvt_rod_f">;
 }
 
@@ -2011,10 +2031,18 @@ let ManualCodegen = [{
 let Log2LMUL = [-3, -2, -1, 0, 1, 2] in {
   let OverloadedName = "vfncvt_x" in
 defm :
-  RVVConvBuiltinSet<"vfncvt_x_f_w", "csi", [["Iv", "IvFwu"]]>;
+  RVVConvBuiltinSet<"vfncvt_x_f_w", "si", [["Iv", "IvFwu"]]>;
   let OverloadedName = "vfncvt_xu" in
 defm :
-  RVVConvBuiltinSet<"vfncvt_xu_f_w", "csi", [["Uv", "UvFwu"]]>;
+  RVVConvBuiltinSet<"vfncvt_xu_f_w", "si", [["Uv", "UvFwu"]]>;
+  let RequiredFeatures = ["Zvfh"] in {
+let OverloadedName = "vfncvt_x" in
+  defm :
+RVVConvBuiltinSet<"vfncvt_x_f_w", "c", [["Iv", "IvFwu"]]>;
+let OverloadedName = "vfncvt_xu" in
+  defm :
+RVVConvBuiltinSet<"vfncvt_xu_f_w", "c", [["Uv", "UvFwu"]]>;
+  }
   let OverloadedName = "vfncvt_f" in {
 defm :
   RVVConvBuiltinSet<"vfncvt_f_x_w", "xf", [["v", "vIwu"]]>;
@@ -2061,10 +2089,18 @@ let ManualCodegen = [{
   let Log2LMUL = [-3, -2, -1, 0, 1, 2] in {
 let OverloadedName = "vfncvt_x" in
   defm :
-RVVConvBuiltinSet<"vfncvt_x_f_w", "csi", [["Iv", "IvFw"]]>;
+RVVConvBuiltinSet<"vfncvt_x_f_w", "si", [["Iv", "IvFw"]]>;
 let OverloadedName = "vfncvt_xu" in
   defm :
-RVVConvBuiltinSet<"vfncvt_xu_f_w", "csi", [["Uv", "UvFw"]]>;
+RVVConvBuiltinSet<"vfncvt_xu_f_w", "si", [["Uv", "UvFw"]]>;
+let RequiredFeatures = ["Zvfh"] in {
+  let OverloadedName = "vfncvt_x" in
+defm :
+  RVVConvBuiltinSet<"vfncvt_x_f_w", "c", [["Iv", "IvFw"]]>;
+  let OverloadedName = "vfncvt_xu" in
+defm :
+  RVVConvBuiltinSet<"vfncvt_xu_f_w", "c", [["Uv", "UvFw"]]>;
+}
 let OverloadedName = "vfncvt_f" in {
   defm :
 RVVConvBuiltin

[clang] [RISCV][sema] Correct the requirement of `vf[n|w]cvt.x[|u].f` intrinsics (PR #101811)

2024-08-06 Thread Brandon Wu via cfe-commits

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


[clang] [clang][driver][clang-cl] Support `--precompile` and `-fmodule-*` options in Clang-CL (PR #98761)

2024-08-06 Thread Sharadh Rajaraman via cfe-commits

https://github.com/sharadhr updated 
https://github.com/llvm/llvm-project/pull/98761

>From 2f499e793050cd0256d658f19e5a4da73c941962 Mon Sep 17 00:00:00 2001
From: Sharadh Rajaraman 
Date: Tue, 6 Aug 2024 11:00:54 +0100
Subject: [PATCH 1/7] Allow `--precompile` and `-fprebuilt-module-path` to be
 passed directly into CL driver without `/clang:` prefix

---
 clang/include/clang/Driver/Options.td | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 4ab8638175dd3..ca7cfef8453a0 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3085,7 +3085,7 @@ def fmodules_user_build_path : Separate<["-"], 
"fmodules-user-build-path">, Grou
   HelpText<"Specify the module user build path">,
   MarshallingInfoString>;
 def fprebuilt_module_path : Joined<["-"], "fprebuilt-module-path=">, 
Group,
-  Flags<[]>, Visibility<[ClangOption, CC1Option]>,
+  Flags<[]>, Visibility<[ClangOption, CLOption, CC1Option]>,
   MetaVarName<"">,
   HelpText<"Specify the prebuilt module path">;
 defm prebuilt_implicit_modules : BoolFOption<"prebuilt-implicit-modules",
@@ -5874,6 +5874,7 @@ def _output : Separate<["--"], "output">, Alias;
 def _param : Separate<["--"], "param">, Group;
 def _param_EQ : Joined<["--"], "param=">, Alias<_param>;
 def _precompile : Flag<["--"], "precompile">, Flags<[NoXarchOption]>,
+  Visibility<[ClangOption, CLOption]>,
   Group, HelpText<"Only precompile the input">;
 def _prefix_EQ : Joined<["--"], "prefix=">, Alias;
 def _prefix : Separate<["--"], "prefix">, Alias;

>From 9bf377f4d9c1939a0577571d32e2b57eff2e9d6b Mon Sep 17 00:00:00 2001
From: Sharadh Rajaraman 
Date: Tue, 6 Aug 2024 11:00:55 +0100
Subject: [PATCH 2/7] Support more `fmodule-*` options from CL driver

---
 clang/include/clang/Driver/Options.td | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index ca7cfef8453a0..bfe369a6284fe 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3094,11 +3094,11 @@ defm prebuilt_implicit_modules : 
BoolFOption<"prebuilt-implicit-modules",
   NegFlag, BothFlags<[], [ClangOption, CC1Option]>>;
 
 def fmodule_output_EQ : Joined<["-"], "fmodule-output=">,
-  Flags<[NoXarchOption]>, Visibility<[ClangOption, CC1Option]>,
+  Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, CC1Option]>,
   MarshallingInfoString>,
   HelpText<"Save intermediate module file results when compiling a standard 
C++ module unit.">;
 def fmodule_output : Flag<["-"], "fmodule-output">, Flags<[NoXarchOption]>,
-  Visibility<[ClangOption, CC1Option]>,
+  Visibility<[ClangOption, CLOption, CC1Option]>,
   HelpText<"Save intermediate module file results when compiling a standard 
C++ module unit.">;
 
 defm skip_odr_check_in_gmf : BoolOption<"f", "skip-odr-check-in-gmf",
@@ -3278,8 +3278,10 @@ def fretain_comments_from_system_headers : Flag<["-"], 
"fretain-comments-from-sy
   Visibility<[ClangOption, CC1Option]>,
   MarshallingInfoFlag>;
 def fmodule_header : Flag <["-"], "fmodule-header">, Group,
+  Visibility<[ClangOption, CLOption]>,
   HelpText<"Build a C++20 Header Unit from a header">;
 def fmodule_header_EQ : Joined<["-"], "fmodule-header=">, Group,
+  Visibility<[ClangOption, CLOption]>,
   MetaVarName<"">,
   HelpText<"Build a C++20 Header Unit from a header that should be found in 
the user (fmodule-header=user) or system (fmodule-header=system) search path.">;
 

>From d0491d3addff528017b97f2896e8ea886608d9da Mon Sep 17 00:00:00 2001
From: Sharadh Rajaraman 
Date: Tue, 6 Aug 2024 11:00:55 +0100
Subject: [PATCH 3/7] `clang-cl` C++20 modules compile test

---
 clang/test/Driver/cl-cxx20-modules.cppm | 65 +
 1 file changed, 65 insertions(+)
 create mode 100644 clang/test/Driver/cl-cxx20-modules.cppm

diff --git a/clang/test/Driver/cl-cxx20-modules.cppm 
b/clang/test/Driver/cl-cxx20-modules.cppm
new file mode 100644
index 0..84807324b4cbc
--- /dev/null
+++ b/clang/test/Driver/cl-cxx20-modules.cppm
@@ -0,0 +1,65 @@
+// REQUIRES: system-windows
+
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cl /std:c++20 --precompile "%/t/Hello.cppm" "/Fo%/t/Hello.pcm"
+// RUN: %clang_cl /std:c++20 %/t/use.cpp -fmodule-file=Hello=%/t/Hello.pcm 
%/t/Hello.pcm /Fo%/t/SimpleHelloWorld.exe 2>&1
+
+// RUN: %/t/SimpleHelloWorld.exe
+// CHECK: Simple Hello World!
+
+//--- Hello.cppm
+module;
+#include 
+export module Hello;
+export void hello() {
+  std::cout << "Simple Hello World!\n";
+}
+
+//--- use.cpp
+import Hello;
+int main() {
+  hello();
+  return 0;
+}
+
+//--- M.cppm
+export module M;
+export import :interface_part;
+import :impl_part;
+export void Hello();
+
+//--- interface_part.cpp
+export module M:interface_part;
+export void World();
+
+//--- impl_part.cppm
+module;
+#includ

[clang] [clang][driver][clang-cl] Support `--precompile` and `-fmodule-*` options in Clang-CL (PR #98761)

2024-08-06 Thread Sharadh Rajaraman via cfe-commits

sharadhr wrote:

I've done a git rebase with `--reset-author`. Hopefully this is correct.

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


[clang] [clang][Interp] Fix getField() for integral pointers (PR #102120)

2024-08-06 Thread Timm Baeder via cfe-commits

https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/102120

Instead of just adding the Record::Field offset, instead get the FieldDecl 
offset in the RecordLayout.

Unfortunately, the offset we pass to the ops here is not made to easily go back 
to a FieldDecl, so we have to iterate over the parent Record.

>From 7e0b5f788c7de6bc0f86b37e424246b567df3e18 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= 
Date: Tue, 6 Aug 2024 11:05:37 +0200
Subject: [PATCH] [clang][Interp] Fix getField() for integral pointers

Instead of just adding the Record::Field offset, instead get the
FieldDecl offset in the RecordLayout.

Unfortunately, the offset we pass to the ops here is not made to easily
go back to a FieldDecl, so we have to iterate over the parent Record.
---
 clang/lib/AST/Interp/Compiler.cpp |  4 
 clang/lib/AST/Interp/Interp.h | 11 +++
 clang/lib/AST/Interp/Pointer.cpp  | 27 +++
 clang/lib/AST/Interp/Pointer.h|  8 ++--
 clang/test/AST/Interp/c.c |  7 +--
 5 files changed, 49 insertions(+), 8 deletions(-)

diff --git a/clang/lib/AST/Interp/Compiler.cpp 
b/clang/lib/AST/Interp/Compiler.cpp
index e5280491dfd73..02cbe38f5fb1f 100644
--- a/clang/lib/AST/Interp/Compiler.cpp
+++ b/clang/lib/AST/Interp/Compiler.cpp
@@ -335,6 +335,10 @@ bool Compiler::VisitCastExpr(const CastExpr *CE) {
 if (!PointeeType.isNull()) {
   if (std::optional T = classify(PointeeType))
 Desc = P.createDescriptor(SubExpr, *T);
+  else
+Desc = P.createDescriptor(SubExpr, PointeeType.getTypePtr(),
+  std::nullopt, true, false,
+  /*IsMutable=*/false, nullptr);
 }
 return this->emitNull(classifyPrim(CE->getType()), Desc, CE);
   }
diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index 04f88efdc0acf..2eed0d3d1f16b 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -1504,6 +1504,12 @@ inline bool GetPtrField(InterpState &S, CodePtr OpPC, 
uint32_t Off) {
 
   if (Ptr.isBlockPointer() && Off > Ptr.block()->getSize())
 return false;
+
+  if (Ptr.isIntegralPointer()) {
+S.Stk.push(Ptr.asIntPointer().atOffset(S.getCtx(), Off));
+return true;
+  }
+
   S.Stk.push(Ptr.atField(Off));
   return true;
 }
@@ -1527,6 +1533,11 @@ inline bool GetPtrFieldPop(InterpState &S, CodePtr OpPC, 
uint32_t Off) {
   if (Ptr.isBlockPointer() && Off > Ptr.block()->getSize())
 return false;
 
+  if (Ptr.isIntegralPointer()) {
+S.Stk.push(Ptr.asIntPointer().atOffset(S.getCtx(), Off));
+return true;
+  }
+
   S.Stk.push(Ptr.atField(Off));
   return true;
 }
diff --git a/clang/lib/AST/Interp/Pointer.cpp b/clang/lib/AST/Interp/Pointer.cpp
index 2b1f8b460510c..ba9683a059e18 100644
--- a/clang/lib/AST/Interp/Pointer.cpp
+++ b/clang/lib/AST/Interp/Pointer.cpp
@@ -597,3 +597,30 @@ std::optional Pointer::toRValue(const Context 
&Ctx,
 return std::nullopt;
   return Result;
 }
+
+IntPointer IntPointer::atOffset(const ASTContext &ASTCtx,
+unsigned Offset) const {
+  if (!this->Desc)
+return *this;
+  const Record *R = this->Desc->ElemRecord;
+  if (!R)
+return *this;
+
+  const Record::Field *F = nullptr;
+  for (auto &It : R->fields()) {
+if (It.Offset == Offset) {
+  F = &It;
+  break;
+}
+  }
+  if (!F)
+return *this;
+
+  const FieldDecl *FD = F->Decl;
+  const ASTRecordLayout &Layout = ASTCtx.getASTRecordLayout(FD->getParent());
+  unsigned FieldIndex = FD->getFieldIndex();
+  uint64_t FieldOffset =
+  ASTCtx.toCharUnitsFromBits(Layout.getFieldOffset(FieldIndex))
+  .getQuantity();
+  return IntPointer{this->Desc, FieldOffset};
+}
diff --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/Interp/Pointer.h
index 6f6983458ab60..b7b4f82f16f66 100644
--- a/clang/lib/AST/Interp/Pointer.h
+++ b/clang/lib/AST/Interp/Pointer.h
@@ -44,6 +44,8 @@ struct BlockPointer {
 struct IntPointer {
   const Descriptor *Desc;
   uint64_t Value;
+
+  IntPointer atOffset(const ASTContext &ASTCtx, unsigned Offset) const;
 };
 
 enum class Storage { Block, Int, Fn };
@@ -88,6 +90,9 @@ class Pointer {
 PointeeStorage.Int.Value = 0;
 PointeeStorage.Int.Desc = nullptr;
   }
+  Pointer(IntPointer &&IntPtr) : StorageKind(Storage::Int) {
+PointeeStorage.Int = std::move(IntPtr);
+  }
   Pointer(Block *B);
   Pointer(Block *B, uint64_t BaseAndOffset);
   Pointer(const Pointer &P);
@@ -161,9 +166,8 @@ class Pointer {
 
   /// Creates a pointer to a field.
   [[nodiscard]] Pointer atField(unsigned Off) const {
+assert(isBlockPointer());
 unsigned Field = Offset + Off;
-if (isIntegralPointer())
-  return Pointer(asIntPointer().Value + Field, asIntPointer().Desc);
 return Pointer(asBlockPointer().Pointee, Field, Field);
   }
 
diff --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c
index 9ec305d59c68c..13a5e082a125f 1006

[clang] [clang][Interp] Fix getField() for integral pointers (PR #102120)

2024-08-06 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)


Changes

Instead of just adding the Record::Field offset, instead get the FieldDecl 
offset in the RecordLayout.

Unfortunately, the offset we pass to the ops here is not made to easily go back 
to a FieldDecl, so we have to iterate over the parent Record.

---
Full diff: https://github.com/llvm/llvm-project/pull/102120.diff


5 Files Affected:

- (modified) clang/lib/AST/Interp/Compiler.cpp (+4) 
- (modified) clang/lib/AST/Interp/Interp.h (+11) 
- (modified) clang/lib/AST/Interp/Pointer.cpp (+27) 
- (modified) clang/lib/AST/Interp/Pointer.h (+6-2) 
- (modified) clang/test/AST/Interp/c.c (+1-6) 


``diff
diff --git a/clang/lib/AST/Interp/Compiler.cpp 
b/clang/lib/AST/Interp/Compiler.cpp
index e5280491dfd73..02cbe38f5fb1f 100644
--- a/clang/lib/AST/Interp/Compiler.cpp
+++ b/clang/lib/AST/Interp/Compiler.cpp
@@ -335,6 +335,10 @@ bool Compiler::VisitCastExpr(const CastExpr *CE) {
 if (!PointeeType.isNull()) {
   if (std::optional T = classify(PointeeType))
 Desc = P.createDescriptor(SubExpr, *T);
+  else
+Desc = P.createDescriptor(SubExpr, PointeeType.getTypePtr(),
+  std::nullopt, true, false,
+  /*IsMutable=*/false, nullptr);
 }
 return this->emitNull(classifyPrim(CE->getType()), Desc, CE);
   }
diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index 04f88efdc0acf..2eed0d3d1f16b 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -1504,6 +1504,12 @@ inline bool GetPtrField(InterpState &S, CodePtr OpPC, 
uint32_t Off) {
 
   if (Ptr.isBlockPointer() && Off > Ptr.block()->getSize())
 return false;
+
+  if (Ptr.isIntegralPointer()) {
+S.Stk.push(Ptr.asIntPointer().atOffset(S.getCtx(), Off));
+return true;
+  }
+
   S.Stk.push(Ptr.atField(Off));
   return true;
 }
@@ -1527,6 +1533,11 @@ inline bool GetPtrFieldPop(InterpState &S, CodePtr OpPC, 
uint32_t Off) {
   if (Ptr.isBlockPointer() && Off > Ptr.block()->getSize())
 return false;
 
+  if (Ptr.isIntegralPointer()) {
+S.Stk.push(Ptr.asIntPointer().atOffset(S.getCtx(), Off));
+return true;
+  }
+
   S.Stk.push(Ptr.atField(Off));
   return true;
 }
diff --git a/clang/lib/AST/Interp/Pointer.cpp b/clang/lib/AST/Interp/Pointer.cpp
index 2b1f8b460510c..ba9683a059e18 100644
--- a/clang/lib/AST/Interp/Pointer.cpp
+++ b/clang/lib/AST/Interp/Pointer.cpp
@@ -597,3 +597,30 @@ std::optional Pointer::toRValue(const Context 
&Ctx,
 return std::nullopt;
   return Result;
 }
+
+IntPointer IntPointer::atOffset(const ASTContext &ASTCtx,
+unsigned Offset) const {
+  if (!this->Desc)
+return *this;
+  const Record *R = this->Desc->ElemRecord;
+  if (!R)
+return *this;
+
+  const Record::Field *F = nullptr;
+  for (auto &It : R->fields()) {
+if (It.Offset == Offset) {
+  F = &It;
+  break;
+}
+  }
+  if (!F)
+return *this;
+
+  const FieldDecl *FD = F->Decl;
+  const ASTRecordLayout &Layout = ASTCtx.getASTRecordLayout(FD->getParent());
+  unsigned FieldIndex = FD->getFieldIndex();
+  uint64_t FieldOffset =
+  ASTCtx.toCharUnitsFromBits(Layout.getFieldOffset(FieldIndex))
+  .getQuantity();
+  return IntPointer{this->Desc, FieldOffset};
+}
diff --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/Interp/Pointer.h
index 6f6983458ab60..b7b4f82f16f66 100644
--- a/clang/lib/AST/Interp/Pointer.h
+++ b/clang/lib/AST/Interp/Pointer.h
@@ -44,6 +44,8 @@ struct BlockPointer {
 struct IntPointer {
   const Descriptor *Desc;
   uint64_t Value;
+
+  IntPointer atOffset(const ASTContext &ASTCtx, unsigned Offset) const;
 };
 
 enum class Storage { Block, Int, Fn };
@@ -88,6 +90,9 @@ class Pointer {
 PointeeStorage.Int.Value = 0;
 PointeeStorage.Int.Desc = nullptr;
   }
+  Pointer(IntPointer &&IntPtr) : StorageKind(Storage::Int) {
+PointeeStorage.Int = std::move(IntPtr);
+  }
   Pointer(Block *B);
   Pointer(Block *B, uint64_t BaseAndOffset);
   Pointer(const Pointer &P);
@@ -161,9 +166,8 @@ class Pointer {
 
   /// Creates a pointer to a field.
   [[nodiscard]] Pointer atField(unsigned Off) const {
+assert(isBlockPointer());
 unsigned Field = Offset + Off;
-if (isIntegralPointer())
-  return Pointer(asIntPointer().Value + Field, asIntPointer().Desc);
 return Pointer(asBlockPointer().Pointee, Field, Field);
   }
 
diff --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c
index 9ec305d59c68c..13a5e082a125f 100644
--- a/clang/test/AST/Interp/c.c
+++ b/clang/test/AST/Interp/c.c
@@ -101,8 +101,6 @@ int somefunc(int i) {
  // all-warning {{overflow in expression; result 
is 131'073 with type 'int'}}
 }
 
-/// FIXME: The following test is incorrect in the new interpreter.
-/// The null pointer returns 16 from its getIntegerRepresentation().
 #pragma clang diagnostic ignored "-Wpointer-to-int-cast"

[clang] [Clang][Sema] Backport P2741R3 (static_assert with user-generated message) to C++11 (PR #102044)

2024-08-06 Thread Mital Ashok via cfe-commits

https://github.com/MitalAshok updated 
https://github.com/llvm/llvm-project/pull/102044

>From 90441c251c1ec5a3b8be923ca9678c8d3d586bee Mon Sep 17 00:00:00 2001
From: Mital Ashok 
Date: Mon, 5 Aug 2024 20:29:12 +0100
Subject: [PATCH 1/3] [Clang][Sema] Backport P2741R3 (static_assert with
 user-generated message) to C++11

---
 clang/docs/LanguageExtensions.rst |  2 ++
 .../clang/Basic/DiagnosticParseKinds.td   |  6 
 clang/lib/Frontend/InitPreprocessor.cpp   |  6 ++--
 clang/lib/Parse/ParseDeclCXX.cpp  | 10 +--
 clang/test/Lexer/cxx-features.cpp |  2 +-
 clang/test/SemaCXX/static-assert-ext.cpp  | 28 +++
 6 files changed, 46 insertions(+), 8 deletions(-)
 create mode 100644 clang/test/SemaCXX/static-assert-ext.cpp

diff --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index be07f81cc41b0..5953ca5259da2 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -1483,6 +1483,7 @@ Generic lambda expressions   
__cpp_generic_lambdasC+
 variable templates   __cpp_variable_templates 
C++14 C++03
 Binary literals  __cpp_binary_literals
C++14 C++03
 Relaxed constexpr__cpp_constexpr  
C++14 C++11
+Static assert with no message__cpp_static_assert>=201411L 
C++17 C++11
 Pack expansion in generalized lambda-capture __cpp_init_captures  
C++17 C++03
 ``if constexpr`` __cpp_if_constexpr   
C++17 C++11
 fold expressions __cpp_fold_expressions   
C++17 C++03
@@ -1503,6 +1504,7 @@ Conditional ``explicit`` 
__cpp_conditional_explicit   C+
 ``static operator()``__cpp_static_call_operator   
C++23 C++03
 Attributes on Lambda-Expressions  
C++23 C++11
 Attributes on Structured Bindings__cpp_structured_bindings
C++26 C++03
+Static assert with user-generated message__cpp_static_assert>=202306L 
C++26 C++11
 Pack Indexing__cpp_pack_indexing  
C++26 C++03
 ``= delete ("should have a reason");``   __cpp_deleted_function   
C++26 C++03
   
- -
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index f8d50d12bb935..eaad99451eb7f 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -470,6 +470,12 @@ def warn_c17_compat_static_assert_no_message : Warning<
   "'_Static_assert' with no message is incompatible with C standards before "
   "C23">,
   DefaultIgnore, InGroup;
+def ext_cxx_static_assert_user_generated_message : ExtWarn<
+  "'static_assert' with a user-generated message is a C++26 extension">,
+  InGroup;
+def warn_cxx20_compat_static_assert_user_generated_message : Warning<
+  "'static_assert' with a user-generated message is incompatible with "
+  "C++ standards before C++26">, DefaultIgnore, InGroup;
 def err_function_definition_not_allowed : Error<
   "function definition is not allowed here">;
 def err_expected_end_of_enumerator : Error<
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp 
b/clang/lib/Frontend/InitPreprocessor.cpp
index 8e62461d8a181..038fad5272be7 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
 LangOpts.CPlusPlus23   ? "202211L"
 : LangOpts.CPlusPlus17 ? "201603L"
: "200907");
-Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-   : LangOpts.CPlusPlus17
-   ? "201411L"
-   : "200410");
+// C++17 / C++26 static_assert backported
+Builder.defineMacro("__cpp_static_assert", "202306L");
 Builder.defineMacro("__cpp_decltype", "200707L");
 Builder.defineMacro("__cpp_attributes", "200809L");
 Builder.defineMacro("__cpp_rvalue_references", "200610L");
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index aac89d910bbc8..87ba660c35b55 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -1073,7 +1073,7 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation 
&DeclEnd) {
 }
 
 bool ParseAsExpression = false;
-if (

[clang] [Clang] Backport P2741R3 (static_assert with user-generated message) to C++11 (PR #102044)

2024-08-06 Thread Mital Ashok via cfe-commits

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


[clang] [Clang] Backport P2741R3 (static_assert with user-generated message) to C++11 (PR #102044)

2024-08-06 Thread Mital Ashok via cfe-commits


@@ -105,6 +105,11 @@ C2y Feature Support
 C23 Feature Support
 ^^^
 
+Non-comprehensive list of changes in this release
+-

MitalAshok wrote:

https://github.com/llvm/llvm-project/commit/10c6d6349e51bb245b9deec4aafca9885971135b#r145075257

Looks like this was removed by accident. We should probably wait for a separate 
NFC patch to add this so there's no chance of it getting reverted again

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


[clang] [Clang][Sema][OpenMP] Allow `num_teams` to accept multiple expressions (PR #99732)

2024-08-06 Thread Alexey Bataev via cfe-commits


@@ -13034,13 +13034,36 @@ StmtResult 
SemaOpenMP::ActOnOpenMPTargetUpdateDirective(
   Clauses, AStmt);
 }
 
+/// This checks whether a \p ClauseType clause \p C has at most \p Max
+/// expression. If not, a diag of number \p Diag will be emitted.
+template 
+static bool checkNumExprsInClause(SemaBase &SemaRef,
+  ArrayRef Clauses,
+  unsigned MaxNum, unsigned Diag) {
+  auto ClauseItr = llvm::find_if(Clauses, llvm::IsaPred);
+  if (ClauseItr != Clauses.end()) {

alexey-bataev wrote:

if (ClauseItr == Clauses.end())
  return true;

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


[clang] [Clang] Backport P2741R3 (static_assert with user-generated message) to C++11 (PR #102044)

2024-08-06 Thread Mital Ashok via cfe-commits


@@ -134,7 +134,7 @@ void test() {
 }
 
 namespace cwg2798 { // cwg2798: 17
-#if __cpp_static_assert >= 202306
+#if __cplusplus > 202302L

MitalAshok wrote:

I guess this is one of the potentially-breaking changes that comes with 
changing the feature test macro. I think this is incorrect code and should have 
been `__cpp_static_assert >= 202306L && __cpp_constexpr >= 201907L`.

For DR testing, I don't think we check extensions, which is why I changed this 
to check `__cplusplus`. @Endilll is that right?

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


[clang] [llvm] [clang] Generate nuw GEPs for struct member accesses (PR #99538)

2024-08-06 Thread Nikita Popov via cfe-commits


@@ -1902,16 +1902,18 @@ class IRBuilderBase {
   }
 
   Value *CreateConstGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1,
-const Twine &Name = "") {
+const Twine &Name = "",
+GEPNoWrapFlags NWFlags = GEPNoWrapFlags::none()) {
 Value *Idxs[] = {
   ConstantInt::get(Type::getInt32Ty(Context), Idx0),
   ConstantInt::get(Type::getInt32Ty(Context), Idx1)
 };
 
-if (auto *V = Folder.FoldGEP(Ty, Ptr, Idxs, GEPNoWrapFlags::none()))
+if (auto *V =
+Folder.FoldGEP(Ty, Ptr, Idxs, /*IsInBounds=*/NWFlags.isInBounds()))

nikic wrote:

It looks like this one still passes `NWFlags.isInBounds()` instead of the full 
`NWFlags`?

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


[clang] [Clang] Implement C++26’s P2893R3 ‘Variadic friends’ (PR #101448)

2024-08-06 Thread via cfe-commits

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


[clang] [libclang/python] Fix some type errors, add type annotations (PR #98745)

2024-08-06 Thread Vlad Serebrennikov via cfe-commits


@@ -64,48 +64,80 @@
 
 from ctypes import *
 
-import collections.abc
 import os
+import sys
 from enum import Enum
 
+from typing import (
+Any,
+Callable,
+Generic,
+Optional,
+Type as TType,
+TypeVar,
+TYPE_CHECKING,
+Union as TUnion,
+)
+
+if TYPE_CHECKING:
+from ctypes import _Pointer
+from typing_extensions import Protocol, TypeAlias

Endilll wrote:

IIRC `typing_extensions` are not in the Python standard library, and we didn't 
use them before. Which make them a novel dependency. At the very least this 
should be mentioned in the release notes. Otherwise I'm not sure how 
`cindex.py` appears on users' systems, or whether we maintain an official 
package with a list of dependencies.

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


[clang] #101784 part 1: introduce ctyped in an independent manner (PR #101941)

2024-08-06 Thread Vlad Serebrennikov via cfe-commits

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


[clang] #101784 part 1: introduce ctyped in an independent manner (PR #101941)

2024-08-06 Thread Vlad Serebrennikov via cfe-commits

https://github.com/Endilll commented:

Thank you for splitting that large PR into something smaller. That said, 1.6k 
lines of changes is no small change either.
This PR needs more high-level explanation of what you try to achieve and how. 
At the moment I'm not sold we want to go in this direction.

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


[clang] #101784 part 1: introduce ctyped in an independent manner (PR #101941)

2024-08-06 Thread Vlad Serebrennikov via cfe-commits




Endilll wrote:

I don't see value in annotating exported C functions themselves (`binder.py`), 
because they are wrapped by `cindex.py`. From maintenance perspective I'd 
rather leave `# type: ignore` at the call sites of those functions, than accept 
a whole new pile of stubs. Users of `cindex.py` won't notice either way, 
because I don't think they need to interact with C functions directly.

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


[clang] #101784 part 1: introduce ctyped in an independent manner (PR #101941)

2024-08-06 Thread Vlad Serebrennikov via cfe-commits




Endilll wrote:

This file seems to implement a whole abstraction layer for annotations. I'd 
like to understand what the benefits are, because I see a non-trivial amount of 
complexity here.

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


[clang] [libclang/python] Fix some type errors, add type annotations (PR #98745)

2024-08-06 Thread Jannick Kremer via cfe-commits


@@ -64,48 +64,80 @@
 
 from ctypes import *
 
-import collections.abc
 import os
+import sys
 from enum import Enum
 
+from typing import (
+Any,
+Callable,
+Generic,
+Optional,
+Type as TType,
+TypeVar,
+TYPE_CHECKING,
+Union as TUnion,
+)
+
+if TYPE_CHECKING:
+from ctypes import _Pointer
+from typing_extensions import Protocol, TypeAlias

DeinAlptraum wrote:

Yes that's right, that's why I put this inside the `if TYPE_CHECKING` guard: 
this line will only be executed on a type checker run, so it does not affect 
normal usage at all. The CI would fail otherwise, and in fact, did, before I 
moved this inside that block.
Does this still need a release note in that case?

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


[clang] [Clang] Backport P2741R3 (static_assert with user-generated message) to C++11 (PR #102044)

2024-08-06 Thread Nikolas Klauser via cfe-commits


@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
 LangOpts.CPlusPlus23   ? "202211L"
 : LangOpts.CPlusPlus17 ? "201603L"
: "200907");
-Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-   : LangOpts.CPlusPlus17
-   ? "201411L"
-   : "200410");
+// C++17 / C++26 static_assert backported
+Builder.defineMacro("__cpp_static_assert", "202306L");

philnik777 wrote:

AFAICT this is non-conforming. C++20 requires `__cpp_static_assert` to be 
`201411L`. Personally I think that's a defect in the standard, but that's not 
my decision to make. Also note that other feature test macros reflect the 
standards wording as well and not whether the feature has been backported.

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


[clang] [libclang/python] Fix some type errors, add type annotations (PR #98745)

2024-08-06 Thread Vlad Serebrennikov via cfe-commits


@@ -64,48 +64,80 @@
 
 from ctypes import *
 
-import collections.abc
 import os
+import sys
 from enum import Enum
 
+from typing import (
+Any,
+Callable,
+Generic,
+Optional,
+Type as TType,
+TypeVar,
+TYPE_CHECKING,
+Union as TUnion,
+)
+
+if TYPE_CHECKING:
+from ctypes import _Pointer
+from typing_extensions import Protocol, TypeAlias

Endilll wrote:

Sure, this is not going to affect normal usage. But I still wonder how it's 
handled in the ecosystem when `TYPE_CHECKING` mode brings additional 
dependencies. If `typing_extensions` are generally assumed to be available in 
this mode, then I'm fine with it.

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


[clang] [Clang] Backport P2741R3 (static_assert with user-generated message) to C++11 (PR #102044)

2024-08-06 Thread Mital Ashok via cfe-commits


@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
 LangOpts.CPlusPlus23   ? "202211L"
 : LangOpts.CPlusPlus17 ? "201603L"
: "200907");
-Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-   : LangOpts.CPlusPlus17
-   ? "201411L"
-   : "200410");
+// C++17 / C++26 static_assert backported
+Builder.defineMacro("__cpp_static_assert", "202306L");

MitalAshok wrote:

I see that other features that have been backported only define the feature 
test macro if it didn't exist in the older versions. This sounds reasonable, 
I'll revert this change.

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


[clang] [Clang] Backport P2741R3 (static_assert with user-generated message) to C++11 (PR #102044)

2024-08-06 Thread Vlad Serebrennikov via cfe-commits


@@ -134,7 +134,7 @@ void test() {
 }
 
 namespace cwg2798 { // cwg2798: 17
-#if __cpp_static_assert >= 202306
+#if __cplusplus > 202302L

Endilll wrote:

Yeah, checking for `__cplusplus` makes more sense in DR test suite.
But I wonder if we can leverage feature test macros for a future conformance 
testing outside of DRs.

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


[clang] [Clang] Backport P2741R3 (static_assert with user-generated message) to C++11 (PR #102044)

2024-08-06 Thread Mital Ashok via cfe-commits

https://github.com/MitalAshok updated 
https://github.com/llvm/llvm-project/pull/102044

>From 90441c251c1ec5a3b8be923ca9678c8d3d586bee Mon Sep 17 00:00:00 2001
From: Mital Ashok 
Date: Mon, 5 Aug 2024 20:29:12 +0100
Subject: [PATCH 1/4] [Clang][Sema] Backport P2741R3 (static_assert with
 user-generated message) to C++11

---
 clang/docs/LanguageExtensions.rst |  2 ++
 .../clang/Basic/DiagnosticParseKinds.td   |  6 
 clang/lib/Frontend/InitPreprocessor.cpp   |  6 ++--
 clang/lib/Parse/ParseDeclCXX.cpp  | 10 +--
 clang/test/Lexer/cxx-features.cpp |  2 +-
 clang/test/SemaCXX/static-assert-ext.cpp  | 28 +++
 6 files changed, 46 insertions(+), 8 deletions(-)
 create mode 100644 clang/test/SemaCXX/static-assert-ext.cpp

diff --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index be07f81cc41b0..5953ca5259da2 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -1483,6 +1483,7 @@ Generic lambda expressions   
__cpp_generic_lambdasC+
 variable templates   __cpp_variable_templates 
C++14 C++03
 Binary literals  __cpp_binary_literals
C++14 C++03
 Relaxed constexpr__cpp_constexpr  
C++14 C++11
+Static assert with no message__cpp_static_assert>=201411L 
C++17 C++11
 Pack expansion in generalized lambda-capture __cpp_init_captures  
C++17 C++03
 ``if constexpr`` __cpp_if_constexpr   
C++17 C++11
 fold expressions __cpp_fold_expressions   
C++17 C++03
@@ -1503,6 +1504,7 @@ Conditional ``explicit`` 
__cpp_conditional_explicit   C+
 ``static operator()``__cpp_static_call_operator   
C++23 C++03
 Attributes on Lambda-Expressions  
C++23 C++11
 Attributes on Structured Bindings__cpp_structured_bindings
C++26 C++03
+Static assert with user-generated message__cpp_static_assert>=202306L 
C++26 C++11
 Pack Indexing__cpp_pack_indexing  
C++26 C++03
 ``= delete ("should have a reason");``   __cpp_deleted_function   
C++26 C++03
   
- -
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index f8d50d12bb935..eaad99451eb7f 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -470,6 +470,12 @@ def warn_c17_compat_static_assert_no_message : Warning<
   "'_Static_assert' with no message is incompatible with C standards before "
   "C23">,
   DefaultIgnore, InGroup;
+def ext_cxx_static_assert_user_generated_message : ExtWarn<
+  "'static_assert' with a user-generated message is a C++26 extension">,
+  InGroup;
+def warn_cxx20_compat_static_assert_user_generated_message : Warning<
+  "'static_assert' with a user-generated message is incompatible with "
+  "C++ standards before C++26">, DefaultIgnore, InGroup;
 def err_function_definition_not_allowed : Error<
   "function definition is not allowed here">;
 def err_expected_end_of_enumerator : Error<
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp 
b/clang/lib/Frontend/InitPreprocessor.cpp
index 8e62461d8a181..038fad5272be7 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
 LangOpts.CPlusPlus23   ? "202211L"
 : LangOpts.CPlusPlus17 ? "201603L"
: "200907");
-Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-   : LangOpts.CPlusPlus17
-   ? "201411L"
-   : "200410");
+// C++17 / C++26 static_assert backported
+Builder.defineMacro("__cpp_static_assert", "202306L");
 Builder.defineMacro("__cpp_decltype", "200707L");
 Builder.defineMacro("__cpp_attributes", "200809L");
 Builder.defineMacro("__cpp_rvalue_references", "200610L");
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index aac89d910bbc8..87ba660c35b55 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -1073,7 +1073,7 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation 
&DeclEnd) {
 }
 
 bool ParseAsExpression = false;
-if (

[clang] [SystemZ][z/OS] Implement z/OS XPLINK ABI (PR #101024)

2024-08-06 Thread Ulrich Weigand via cfe-commits

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


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


[clang] [SystemZ][z/OS] Implement z/OS XPLINK ABI (PR #101024)

2024-08-06 Thread Ulrich Weigand via cfe-commits


@@ -532,9 +532,371 @@ bool SystemZTargetCodeGenInfo::isVectorTypeBased(const 
Type *Ty,
   return false;
 }
 
+//===--===//
+// z/OS XPLINK ABI Implementation
+//===--===//
+
+namespace {
+
+class ZOSXPLinkABIInfo : public ABIInfo {
+  const unsigned GPRBits = 64;
+  bool HasVector;
+
+public:
+  ZOSXPLinkABIInfo(CodeGenTypes &CGT, bool HV) : ABIInfo(CGT), HasVector(HV) {}
+
+  bool isPromotableIntegerType(QualType Ty) const;
+  bool isVectorArgumentType(QualType Ty) const;
+  bool isFPArgumentType(QualType Ty) const;
+  QualType getSingleElementType(QualType Ty) const;
+  QualType getFPTypeOfComplexLikeType(QualType Ty) const;
+
+  ABIArgInfo classifyReturnType(QualType RetTy) const;
+  ABIArgInfo classifyArgumentType(QualType ArgTy, bool IsNamedArg) const;
+
+  void computeInfo(CGFunctionInfo &FI) const override {
+if (!getCXXABI().classifyReturnType(FI))
+  FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+
+unsigned NumRequiredArgs = FI.getNumRequiredArgs();
+unsigned ArgNo = 0;
+
+for (auto &I : FI.arguments()) {
+  bool IsNamedArg = ArgNo < NumRequiredArgs;
+  I.info = classifyArgumentType(I.type, IsNamedArg);
+  ++ArgNo;
+}
+  }
+
+  RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
+   AggValueSlot Slot) const override;
+};
+
+class ZOSXPLinkTargetCodeGenInfo : public TargetCodeGenInfo {
+public:
+  ZOSXPLinkTargetCodeGenInfo(CodeGenTypes &CGT, bool HasVector)
+  : TargetCodeGenInfo(std::make_unique(CGT, HasVector)) {
+SwiftInfo =
+std::make_unique(CGT, /*SwiftErrorInRegister=*/false);
+  }
+};
+
+} // namespace
+
+// Return true if the ABI requires Ty to be passed sign- or zero-
+// extended to 64 bits.
+bool ZOSXPLinkABIInfo::isPromotableIntegerType(QualType Ty) const {
+  // Treat an enum type as its underlying type.
+  if (const EnumType *EnumTy = Ty->getAs())
+Ty = EnumTy->getDecl()->getIntegerType();
+
+  // Promotable integer types are required to be promoted by the ABI.
+  if (getContext().isPromotableIntegerType(Ty))
+return true;
+
+  if (const auto *EIT = Ty->getAs())
+if (EIT->getNumBits() < 64)
+  return true;
+
+  // In addition to the usual promotable integer types, we also need to
+  // extend all 32-bit types, since the ABI requires promotion to 64 bits.
+  if (const BuiltinType *BT = Ty->getAs())
+switch (BT->getKind()) {
+case BuiltinType::Int:
+case BuiltinType::UInt:
+  return true;
+default:
+  break;
+}
+
+  return false;
+}
+
+bool ZOSXPLinkABIInfo::isVectorArgumentType(QualType Ty) const {
+  return (HasVector && Ty->isVectorType() &&
+  getContext().getTypeSize(Ty) <= 128);
+}
+
+bool ZOSXPLinkABIInfo::isFPArgumentType(QualType Ty) const {
+  if (const BuiltinType *BT = Ty->getAs())
+switch (BT->getKind()) {
+case BuiltinType::Float:
+case BuiltinType::Double:
+case BuiltinType::LongDouble:
+  return true;
+default:
+  return false;
+}
+
+  return false;
+}
+
+QualType ZOSXPLinkABIInfo::getSingleElementType(QualType Ty) const {
+  // Unions just containing a floating point type, e.g. union { float f1, f2; 
};
+  // are treated as a single floating point number. Check if the union only
+  // consists of a single type (handling embedded unions recursively), and
+  // return that type.
+  if (const RecordType *RT = Ty->getAsUnionType()) {
+QualType Found;
+// Check the fields.
+const RecordDecl *RD = RT->getDecl();
+for (const auto *FD : RD->fields()) {
+  if (Found.isNull())
+Found = getSingleElementType(FD->getType());
+  else if (Found != getSingleElementType(FD->getType()))
+return Ty;
+}
+return Found.isNull() ? Ty : Found;
+  }
+
+  const RecordType *RT = Ty->getAs();
+
+  if (RT && RT->isStructureOrClassType()) {
+const RecordDecl *RD = RT->getDecl();
+QualType Found;
+
+// If this is a C++ record, check the bases first.
+if (const CXXRecordDecl *CXXRD = dyn_cast(RD))
+  if (CXXRD->hasDefinition())
+for (const auto &I : CXXRD->bases()) {
+  QualType Base = I.getType();
+
+  // Empty bases don't affect things either way.
+  if (isEmptyRecord(getContext(), Base, true))
+continue;
+
+  if (!Found.isNull())
+return Ty;
+  Found = getSingleElementType(Base);
+}
+
+// Check the fields.
+for (const auto *FD : RD->fields()) {
+  QualType FT = FD->getType();
+
+  // Ignore empty fields.
+  if (isEmptyField(getContext(), FD, true))
+continue;
+
+  if (!Found.isNull())
+return Ty;
+
+  // Treat single element arrays as the element.
+  while (const ConstantArrayType *AT =
+ getContext().getAsConstantArrayType(FT)) {
+if (AT->getZEx

[clang] [SystemZ][z/OS] Implement z/OS XPLINK ABI (PR #101024)

2024-08-06 Thread Ulrich Weigand via cfe-commits


@@ -532,9 +532,371 @@ bool SystemZTargetCodeGenInfo::isVectorTypeBased(const 
Type *Ty,
   return false;
 }
 
+//===--===//
+// z/OS XPLINK ABI Implementation
+//===--===//
+
+namespace {
+
+class ZOSXPLinkABIInfo : public ABIInfo {
+  const unsigned GPRBits = 64;
+  bool HasVector;
+
+public:
+  ZOSXPLinkABIInfo(CodeGenTypes &CGT, bool HV) : ABIInfo(CGT), HasVector(HV) {}
+
+  bool isPromotableIntegerType(QualType Ty) const;
+  bool isVectorArgumentType(QualType Ty) const;
+  bool isFPArgumentType(QualType Ty) const;
+  QualType getSingleElementType(QualType Ty) const;
+  QualType getFPTypeOfComplexLikeType(QualType Ty) const;
+
+  ABIArgInfo classifyReturnType(QualType RetTy) const;
+  ABIArgInfo classifyArgumentType(QualType ArgTy, bool IsNamedArg) const;
+
+  void computeInfo(CGFunctionInfo &FI) const override {
+if (!getCXXABI().classifyReturnType(FI))
+  FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+
+unsigned NumRequiredArgs = FI.getNumRequiredArgs();
+unsigned ArgNo = 0;
+
+for (auto &I : FI.arguments()) {
+  bool IsNamedArg = ArgNo < NumRequiredArgs;
+  I.info = classifyArgumentType(I.type, IsNamedArg);
+  ++ArgNo;
+}
+  }
+
+  RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
+   AggValueSlot Slot) const override;
+};
+
+class ZOSXPLinkTargetCodeGenInfo : public TargetCodeGenInfo {
+public:
+  ZOSXPLinkTargetCodeGenInfo(CodeGenTypes &CGT, bool HasVector)
+  : TargetCodeGenInfo(std::make_unique(CGT, HasVector)) {
+SwiftInfo =
+std::make_unique(CGT, /*SwiftErrorInRegister=*/false);
+  }
+};
+
+} // namespace
+
+// Return true if the ABI requires Ty to be passed sign- or zero-
+// extended to 64 bits.
+bool ZOSXPLinkABIInfo::isPromotableIntegerType(QualType Ty) const {
+  // Treat an enum type as its underlying type.
+  if (const EnumType *EnumTy = Ty->getAs())
+Ty = EnumTy->getDecl()->getIntegerType();
+
+  // Promotable integer types are required to be promoted by the ABI.
+  if (getContext().isPromotableIntegerType(Ty))
+return true;
+
+  if (const auto *EIT = Ty->getAs())
+if (EIT->getNumBits() < 64)
+  return true;
+
+  // In addition to the usual promotable integer types, we also need to
+  // extend all 32-bit types, since the ABI requires promotion to 64 bits.
+  if (const BuiltinType *BT = Ty->getAs())
+switch (BT->getKind()) {
+case BuiltinType::Int:
+case BuiltinType::UInt:
+  return true;
+default:
+  break;
+}
+
+  return false;
+}
+
+bool ZOSXPLinkABIInfo::isVectorArgumentType(QualType Ty) const {
+  return (HasVector && Ty->isVectorType() &&
+  getContext().getTypeSize(Ty) <= 128);
+}
+
+bool ZOSXPLinkABIInfo::isFPArgumentType(QualType Ty) const {
+  if (const BuiltinType *BT = Ty->getAs())
+switch (BT->getKind()) {
+case BuiltinType::Float:
+case BuiltinType::Double:
+case BuiltinType::LongDouble:
+  return true;
+default:
+  return false;
+}
+
+  return false;
+}
+
+QualType ZOSXPLinkABIInfo::getSingleElementType(QualType Ty) const {
+  // Unions just containing a floating point type, e.g. union { float f1, f2; 
};
+  // are treated as a single floating point number. Check if the union only
+  // consists of a single type (handling embedded unions recursively), and
+  // return that type.
+  if (const RecordType *RT = Ty->getAsUnionType()) {
+QualType Found;
+// Check the fields.
+const RecordDecl *RD = RT->getDecl();
+for (const auto *FD : RD->fields()) {
+  if (Found.isNull())
+Found = getSingleElementType(FD->getType());
+  else if (Found != getSingleElementType(FD->getType()))
+return Ty;
+}
+return Found.isNull() ? Ty : Found;
+  }
+
+  const RecordType *RT = Ty->getAs();
+
+  if (RT && RT->isStructureOrClassType()) {
+const RecordDecl *RD = RT->getDecl();
+QualType Found;
+
+// If this is a C++ record, check the bases first.
+if (const CXXRecordDecl *CXXRD = dyn_cast(RD))
+  if (CXXRD->hasDefinition())
+for (const auto &I : CXXRD->bases()) {
+  QualType Base = I.getType();
+
+  // Empty bases don't affect things either way.
+  if (isEmptyRecord(getContext(), Base, true))
+continue;
+
+  if (!Found.isNull())
+return Ty;
+  Found = getSingleElementType(Base);
+}
+
+// Check the fields.
+for (const auto *FD : RD->fields()) {
+  QualType FT = FD->getType();
+
+  // Ignore empty fields.
+  if (isEmptyField(getContext(), FD, true))
+continue;
+
+  if (!Found.isNull())
+return Ty;
+
+  // Treat single element arrays as the element.
+  while (const ConstantArrayType *AT =
+ getContext().getAsConstantArrayType(FT)) {
+if (AT->getZEx

[clang] [libclang/python] Fix some type errors, add type annotations (PR #98745)

2024-08-06 Thread Jannick Kremer via cfe-commits


@@ -64,48 +64,80 @@
 
 from ctypes import *
 
-import collections.abc
 import os
+import sys
 from enum import Enum
 
+from typing import (
+Any,
+Callable,
+Generic,
+Optional,
+Type as TType,
+TypeVar,
+TYPE_CHECKING,
+Union as TUnion,
+)
+
+if TYPE_CHECKING:
+from ctypes import _Pointer
+from typing_extensions import Protocol, TypeAlias

DeinAlptraum wrote:

There is no strict requirement for `typing_extensions` to be available, though 
all type checkers I've seen are either written in Python and depend on 
`typing_extensions` themselves  (the default checker `mypy`, Google's `pytype`, 
Facebook's `pyre`), or don't use Python at all (Microsoft's `pyright`) in which 
case the installed modules don't matter
Aside from that, as `TYPE_CHECKING` mode doesn't actually include any 
execution, the module not being installed would never lead to an error. At 
most, the type checker would complain that it can't resolve the import.

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


[clang] 59e1366 - [clang][Interp] Fix getField() for integral pointers (#102120)

2024-08-06 Thread via cfe-commits

Author: Timm Baeder
Date: 2024-08-06T13:37:11+02:00
New Revision: 59e13666dd2e81e58253488a29635fb2992ed741

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

LOG: [clang][Interp] Fix getField() for integral pointers (#102120)

Instead of just adding the Record::Field offset, instead get the
FieldDecl offset in the RecordLayout.

Unfortunately, the offset we pass to the ops here is not made to easily
go back to a FieldDecl, so we have to iterate over the parent Record.

Added: 


Modified: 
clang/lib/AST/Interp/Compiler.cpp
clang/lib/AST/Interp/Interp.h
clang/lib/AST/Interp/Pointer.cpp
clang/lib/AST/Interp/Pointer.h
clang/test/AST/Interp/c.c

Removed: 




diff  --git a/clang/lib/AST/Interp/Compiler.cpp 
b/clang/lib/AST/Interp/Compiler.cpp
index e5280491dfd73..02cbe38f5fb1f 100644
--- a/clang/lib/AST/Interp/Compiler.cpp
+++ b/clang/lib/AST/Interp/Compiler.cpp
@@ -335,6 +335,10 @@ bool Compiler::VisitCastExpr(const CastExpr *CE) {
 if (!PointeeType.isNull()) {
   if (std::optional T = classify(PointeeType))
 Desc = P.createDescriptor(SubExpr, *T);
+  else
+Desc = P.createDescriptor(SubExpr, PointeeType.getTypePtr(),
+  std::nullopt, true, false,
+  /*IsMutable=*/false, nullptr);
 }
 return this->emitNull(classifyPrim(CE->getType()), Desc, CE);
   }

diff  --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index 04f88efdc0acf..2eed0d3d1f16b 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -1504,6 +1504,12 @@ inline bool GetPtrField(InterpState &S, CodePtr OpPC, 
uint32_t Off) {
 
   if (Ptr.isBlockPointer() && Off > Ptr.block()->getSize())
 return false;
+
+  if (Ptr.isIntegralPointer()) {
+S.Stk.push(Ptr.asIntPointer().atOffset(S.getCtx(), Off));
+return true;
+  }
+
   S.Stk.push(Ptr.atField(Off));
   return true;
 }
@@ -1527,6 +1533,11 @@ inline bool GetPtrFieldPop(InterpState &S, CodePtr OpPC, 
uint32_t Off) {
   if (Ptr.isBlockPointer() && Off > Ptr.block()->getSize())
 return false;
 
+  if (Ptr.isIntegralPointer()) {
+S.Stk.push(Ptr.asIntPointer().atOffset(S.getCtx(), Off));
+return true;
+  }
+
   S.Stk.push(Ptr.atField(Off));
   return true;
 }

diff  --git a/clang/lib/AST/Interp/Pointer.cpp 
b/clang/lib/AST/Interp/Pointer.cpp
index 2b1f8b460510c..ba9683a059e18 100644
--- a/clang/lib/AST/Interp/Pointer.cpp
+++ b/clang/lib/AST/Interp/Pointer.cpp
@@ -597,3 +597,30 @@ std::optional Pointer::toRValue(const Context 
&Ctx,
 return std::nullopt;
   return Result;
 }
+
+IntPointer IntPointer::atOffset(const ASTContext &ASTCtx,
+unsigned Offset) const {
+  if (!this->Desc)
+return *this;
+  const Record *R = this->Desc->ElemRecord;
+  if (!R)
+return *this;
+
+  const Record::Field *F = nullptr;
+  for (auto &It : R->fields()) {
+if (It.Offset == Offset) {
+  F = &It;
+  break;
+}
+  }
+  if (!F)
+return *this;
+
+  const FieldDecl *FD = F->Decl;
+  const ASTRecordLayout &Layout = ASTCtx.getASTRecordLayout(FD->getParent());
+  unsigned FieldIndex = FD->getFieldIndex();
+  uint64_t FieldOffset =
+  ASTCtx.toCharUnitsFromBits(Layout.getFieldOffset(FieldIndex))
+  .getQuantity();
+  return IntPointer{this->Desc, FieldOffset};
+}

diff  --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/Interp/Pointer.h
index 6f6983458ab60..b7b4f82f16f66 100644
--- a/clang/lib/AST/Interp/Pointer.h
+++ b/clang/lib/AST/Interp/Pointer.h
@@ -44,6 +44,8 @@ struct BlockPointer {
 struct IntPointer {
   const Descriptor *Desc;
   uint64_t Value;
+
+  IntPointer atOffset(const ASTContext &ASTCtx, unsigned Offset) const;
 };
 
 enum class Storage { Block, Int, Fn };
@@ -88,6 +90,9 @@ class Pointer {
 PointeeStorage.Int.Value = 0;
 PointeeStorage.Int.Desc = nullptr;
   }
+  Pointer(IntPointer &&IntPtr) : StorageKind(Storage::Int) {
+PointeeStorage.Int = std::move(IntPtr);
+  }
   Pointer(Block *B);
   Pointer(Block *B, uint64_t BaseAndOffset);
   Pointer(const Pointer &P);
@@ -161,9 +166,8 @@ class Pointer {
 
   /// Creates a pointer to a field.
   [[nodiscard]] Pointer atField(unsigned Off) const {
+assert(isBlockPointer());
 unsigned Field = Offset + Off;
-if (isIntegralPointer())
-  return Pointer(asIntPointer().Value + Field, asIntPointer().Desc);
 return Pointer(asBlockPointer().Pointee, Field, Field);
   }
 

diff  --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c
index 9ec305d59c68c..13a5e082a125f 100644
--- a/clang/test/AST/Interp/c.c
+++ b/clang/test/AST/Interp/c.c
@@ -101,8 +101,6 @@ int somefunc(int i) {
  // all-warning {{overflow in expression; result 
is 131'0

[clang] [clang][Interp] Fix getField() for integral pointers (PR #102120)

2024-08-06 Thread Timm Baeder via cfe-commits

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


[clang] [llvm] [X86][AVX10.2] Support AVX10.2-SATCVT new instructions. (PR #101599)

2024-08-06 Thread Freddy Ye via cfe-commits

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


[clang] [Clang] Backport P2741R3 (static_assert with user-generated message) to C++11 (PR #102044)

2024-08-06 Thread Mital Ashok via cfe-commits

https://github.com/MitalAshok updated 
https://github.com/llvm/llvm-project/pull/102044

>From 90441c251c1ec5a3b8be923ca9678c8d3d586bee Mon Sep 17 00:00:00 2001
From: Mital Ashok 
Date: Mon, 5 Aug 2024 20:29:12 +0100
Subject: [PATCH 1/5] [Clang][Sema] Backport P2741R3 (static_assert with
 user-generated message) to C++11

---
 clang/docs/LanguageExtensions.rst |  2 ++
 .../clang/Basic/DiagnosticParseKinds.td   |  6 
 clang/lib/Frontend/InitPreprocessor.cpp   |  6 ++--
 clang/lib/Parse/ParseDeclCXX.cpp  | 10 +--
 clang/test/Lexer/cxx-features.cpp |  2 +-
 clang/test/SemaCXX/static-assert-ext.cpp  | 28 +++
 6 files changed, 46 insertions(+), 8 deletions(-)
 create mode 100644 clang/test/SemaCXX/static-assert-ext.cpp

diff --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index be07f81cc41b0..5953ca5259da2 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -1483,6 +1483,7 @@ Generic lambda expressions   
__cpp_generic_lambdasC+
 variable templates   __cpp_variable_templates 
C++14 C++03
 Binary literals  __cpp_binary_literals
C++14 C++03
 Relaxed constexpr__cpp_constexpr  
C++14 C++11
+Static assert with no message__cpp_static_assert>=201411L 
C++17 C++11
 Pack expansion in generalized lambda-capture __cpp_init_captures  
C++17 C++03
 ``if constexpr`` __cpp_if_constexpr   
C++17 C++11
 fold expressions __cpp_fold_expressions   
C++17 C++03
@@ -1503,6 +1504,7 @@ Conditional ``explicit`` 
__cpp_conditional_explicit   C+
 ``static operator()``__cpp_static_call_operator   
C++23 C++03
 Attributes on Lambda-Expressions  
C++23 C++11
 Attributes on Structured Bindings__cpp_structured_bindings
C++26 C++03
+Static assert with user-generated message__cpp_static_assert>=202306L 
C++26 C++11
 Pack Indexing__cpp_pack_indexing  
C++26 C++03
 ``= delete ("should have a reason");``   __cpp_deleted_function   
C++26 C++03
   
- -
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index f8d50d12bb935..eaad99451eb7f 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -470,6 +470,12 @@ def warn_c17_compat_static_assert_no_message : Warning<
   "'_Static_assert' with no message is incompatible with C standards before "
   "C23">,
   DefaultIgnore, InGroup;
+def ext_cxx_static_assert_user_generated_message : ExtWarn<
+  "'static_assert' with a user-generated message is a C++26 extension">,
+  InGroup;
+def warn_cxx20_compat_static_assert_user_generated_message : Warning<
+  "'static_assert' with a user-generated message is incompatible with "
+  "C++ standards before C++26">, DefaultIgnore, InGroup;
 def err_function_definition_not_allowed : Error<
   "function definition is not allowed here">;
 def err_expected_end_of_enumerator : Error<
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp 
b/clang/lib/Frontend/InitPreprocessor.cpp
index 8e62461d8a181..038fad5272be7 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
 LangOpts.CPlusPlus23   ? "202211L"
 : LangOpts.CPlusPlus17 ? "201603L"
: "200907");
-Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-   : LangOpts.CPlusPlus17
-   ? "201411L"
-   : "200410");
+// C++17 / C++26 static_assert backported
+Builder.defineMacro("__cpp_static_assert", "202306L");
 Builder.defineMacro("__cpp_decltype", "200707L");
 Builder.defineMacro("__cpp_attributes", "200809L");
 Builder.defineMacro("__cpp_rvalue_references", "200610L");
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index aac89d910bbc8..87ba660c35b55 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -1073,7 +1073,7 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation 
&DeclEnd) {
 }
 
 bool ParseAsExpression = false;
-if (

[clang] [Clang][Parser] Accept P2741R3 (static_assert with user-generated message) in C++11 as an extension (PR #102044)

2024-08-06 Thread Mital Ashok via cfe-commits

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


[clang] [ARM] Enable cfi-icall for thumb triples (PR #102126)

2024-08-06 Thread Oliver Stannard via cfe-commits

https://github.com/ostannard created 
https://github.com/llvm/llvm-project/pull/102126

Support for this was added back in 2016 (https://reviews.llvm.org/D27499), but 
never enabled in the driver. Since then, it's been possible to enable this with 
an arm triple and the -mthumb option, but not with a thumb triple.

This also caused -fsanitise=cfi to enable cfi-icall for arm triple but not 
thumb triples, which caused spurious sanitiser failures if mixing the two ISAs 
in one program.

>From 776cac4c0a61f14d2dc2c92123b8600d57123c3d Mon Sep 17 00:00:00 2001
From: Oliver Stannard 
Date: Tue, 6 Aug 2024 12:35:20 +0100
Subject: [PATCH] [ARM] Enable cfi-icall for thumb triples

Support for this was added back in 2016
(https://reviews.llvm.org/D27499), but never enabled in the driver.
Since then, it's been possible to enable this with an arm triple and the
-mthumb option, but not with a thumb triple.

This also caused -fsanitise=cfi to enable cfi-icall for arm triple but
not thumb triples, which caused spurious sanitiser failures if mixing
the two ISAs in one program.
---
 clang/lib/Driver/ToolChain.cpp | 3 ++-
 clang/test/Driver/fsanitize.c  | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 20a555afb8092..2d50c2cbbc881 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -1381,7 +1381,8 @@ SanitizerMask ToolChain::getSupportedSanitizers() const {
   SanitizerKind::Nullability | SanitizerKind::LocalBounds;
   if (getTriple().getArch() == llvm::Triple::x86 ||
   getTriple().getArch() == llvm::Triple::x86_64 ||
-  getTriple().getArch() == llvm::Triple::arm || getTriple().isWasm() ||
+  getTriple().getArch() == llvm::Triple::arm ||
+  getTriple().getArch() == llvm::Triple::thumb || getTriple().isWasm() ||
   getTriple().isAArch64() || getTriple().isRISCV() ||
   getTriple().isLoongArch64())
 Res |= SanitizerKind::CFIICall;
diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
index db14f6e195c64..678fa432fb0a0 100644
--- a/clang/test/Driver/fsanitize.c
+++ b/clang/test/Driver/fsanitize.c
@@ -611,6 +611,8 @@
 // RUN: %clang --target=arm-linux-gnu -fvisibility=hidden -fsanitize=cfi -flto 
-resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
 // RUN: %clang --target=aarch64-linux-gnu -fvisibility=hidden -fsanitize=cfi 
-flto -resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
 // RUN: %clang --target=arm-linux-android -fvisibility=hidden -fsanitize=cfi 
-flto -resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
+// RUN: %clang --target=arm-none-eabi -fvisibility=hidden -fsanitize=cfi -flto 
-resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
+// RUN: %clang --target=thumb-none-eabi -fvisibility=hidden -fsanitize=cfi 
-flto -resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
 // RUN: %clang --target=aarch64-linux-android -fvisibility=hidden 
-fsanitize=cfi -flto -resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CFI
 // RUN: %clang --target=aarch64_be -fvisibility=hidden -fsanitize=cfi -flto 
-resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
 // RUN: %clang --target=riscv32 -fvisibility=hidden -fsanitize=cfi -flto 
-resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI

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


[clang] [ARM] Enable cfi-icall for thumb triples (PR #102126)

2024-08-06 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: Oliver Stannard (ostannard)


Changes

Support for this was added back in 2016 (https://reviews.llvm.org/D27499), but 
never enabled in the driver. Since then, it's been possible to enable this with 
an arm triple and the -mthumb option, but not with a thumb triple.

This also caused -fsanitise=cfi to enable cfi-icall for arm triple but not 
thumb triples, which caused spurious sanitiser failures if mixing the two ISAs 
in one program.

---
Full diff: https://github.com/llvm/llvm-project/pull/102126.diff


2 Files Affected:

- (modified) clang/lib/Driver/ToolChain.cpp (+2-1) 
- (modified) clang/test/Driver/fsanitize.c (+2) 


``diff
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 20a555afb8092..2d50c2cbbc881 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -1381,7 +1381,8 @@ SanitizerMask ToolChain::getSupportedSanitizers() const {
   SanitizerKind::Nullability | SanitizerKind::LocalBounds;
   if (getTriple().getArch() == llvm::Triple::x86 ||
   getTriple().getArch() == llvm::Triple::x86_64 ||
-  getTriple().getArch() == llvm::Triple::arm || getTriple().isWasm() ||
+  getTriple().getArch() == llvm::Triple::arm ||
+  getTriple().getArch() == llvm::Triple::thumb || getTriple().isWasm() ||
   getTriple().isAArch64() || getTriple().isRISCV() ||
   getTriple().isLoongArch64())
 Res |= SanitizerKind::CFIICall;
diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
index db14f6e195c64..678fa432fb0a0 100644
--- a/clang/test/Driver/fsanitize.c
+++ b/clang/test/Driver/fsanitize.c
@@ -611,6 +611,8 @@
 // RUN: %clang --target=arm-linux-gnu -fvisibility=hidden -fsanitize=cfi -flto 
-resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
 // RUN: %clang --target=aarch64-linux-gnu -fvisibility=hidden -fsanitize=cfi 
-flto -resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
 // RUN: %clang --target=arm-linux-android -fvisibility=hidden -fsanitize=cfi 
-flto -resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
+// RUN: %clang --target=arm-none-eabi -fvisibility=hidden -fsanitize=cfi -flto 
-resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
+// RUN: %clang --target=thumb-none-eabi -fvisibility=hidden -fsanitize=cfi 
-flto -resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
 // RUN: %clang --target=aarch64-linux-android -fvisibility=hidden 
-fsanitize=cfi -flto -resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CFI
 // RUN: %clang --target=aarch64_be -fvisibility=hidden -fsanitize=cfi -flto 
-resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI
 // RUN: %clang --target=riscv32 -fvisibility=hidden -fsanitize=cfi -flto 
-resource-dir=%S/Inputs/resource_dir -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-CFI

``




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


[clang] [CLANG][AArch64] Add the modal 8 bit floating-point scalar type (PR #97277)

2024-08-06 Thread Paul Walker via cfe-commits


@@ -221,6 +221,10 @@ FLOATING_TYPE(Float128, Float128Ty)
 // '__ibm128'
 FLOATING_TYPE(Ibm128, Ibm128Ty)
 
+
+// '__fpm8'

paulwalker-arm wrote:

__mfp8

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


[clang] [CLANG][AArch64] Add the modal 8 bit floating-point scalar type (PR #97277)

2024-08-06 Thread Paul Walker via cfe-commits


@@ -1139,6 +1139,7 @@ class ASTContext : public RefCountedBase {
   CanQualType SatShortFractTy, SatFractTy, SatLongFractTy;
   CanQualType SatUnsignedShortFractTy, SatUnsignedFractTy,
   SatUnsignedLongFractTy;
+  CanQualType MFloat8Ty;

paulwalker-arm wrote:

For this and all related "in llvm code" naming, do you mind using the 
`ArmMFloat8` prefix instead of `MFloat8`?  I ask because BFloat16 has an 
architecture independent meaning whereas this new type is specific to Arm and 
its related builtins.

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


[clang] [CLANG][AArch64] Add the modal 8 bit floating-point scalar type (PR #97277)

2024-08-06 Thread Paul Walker via cfe-commits


@@ -3197,6 +3197,13 @@ void CastOperation::CheckCStyleCast() {
 }
   }
 
+  if ((DestType->isMFloat8Type() && !SrcType->isMFloat8Type()) ||
+  (!DestType->isMFloat8Type() && SrcType->isMFloat8Type())) {

paulwalker-arm wrote:

`DestType->isMFloat8Type() != SrcType->isMFloat8Type()` ?

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


[clang] [CLANG][AArch64] Add the modal 8 bit floating-point scalar type (PR #97277)

2024-08-06 Thread Paul Walker via cfe-commits

paulwalker-arm wrote:

Just to add the commit message needs updating to reflect the updated 
specification.

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


[clang] #101784 part 1: introduce ctyped in an independent manner (PR #101941)

2024-08-06 Thread Jannick Kremer via cfe-commits

https://github.com/DeinAlptraum commented:

I agree with what Endill said: this is a rather big change and I'm not sure I 
see it adding enough value to justify this.
It also adds quite some complexity on top of the otherwise relatively 
light-weight Python bindings. I generally like seeing changes towards better 
typing annotations, but this is not something we need to push through 
no-matter-what and e.g. the `type: ignore`s are "good enough" for our case.

Another reason I'm hesitant to support this, is that the bindings currently 
depend only on the Python standard library, and adding e.g. `ctyped` would 
break this. Adding outside dependencies is not _strictly_ a problem, but again 
any change to this would imo need a good justification that I don't see at the 
moment.

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


[clang] [Clang][Parser] Accept P2741R3 (static_assert with user-generated message) in C++11 as an extension (PR #102044)

2024-08-06 Thread Aaron Ballman via cfe-commits


@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
 LangOpts.CPlusPlus23   ? "202211L"
 : LangOpts.CPlusPlus17 ? "201603L"
: "200907");
-Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-   : LangOpts.CPlusPlus17
-   ? "201411L"
-   : "200410");
+// C++17 / C++26 static_assert backported
+Builder.defineMacro("__cpp_static_assert", "202306L");

AaronBallman wrote:

I'm not certain I agree that this is non-conforming, but the standard could be 
made more clear. The *name* of the feature test macro has to be predefined, but 
the standard says nothing about the value beyond what the value is for that 
particular release of the standard. The whole point to feature test macros is 
to be able to use the resulting date to tell you which feature you're working 
with, so not being able to specify an updated value for backported 
functionality... kind of defeats the purpose.

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


[clang] [Clang][Concepts] Fix the constraint equivalence checking for TemplateTypeParmTypes (PR #102131)

2024-08-06 Thread Younan Zhang via cfe-commits

https://github.com/zyn0217 created 
https://github.com/llvm/llvm-project/pull/102131

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

(I'll add a release note and some comments later)

>From 0727e47124af564826a22a718a64a1da79e6131d Mon Sep 17 00:00:00 2001
From: Younan Zhang 
Date: Tue, 6 Aug 2024 20:08:43 +0800
Subject: [PATCH] [Clang][Concepts] Fix the constraint equivalence checking for
 TemplateTypeParmTypes

---
 clang/include/clang/Sema/Template.h   |  2 ++
 clang/lib/Sema/SemaConcept.cpp| 28 +++
 .../SemaTemplate/concepts-out-of-line-def.cpp | 23 +++
 3 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/clang/include/clang/Sema/Template.h 
b/clang/include/clang/Sema/Template.h
index d616865afe807..7b3646f0fcc35 100644
--- a/clang/include/clang/Sema/Template.h
+++ b/clang/include/clang/Sema/Template.h
@@ -245,6 +245,8 @@ enum class TemplateSubstitutionKind : char {
 AssociatedDecl) &&
"Trying to change incorrect declaration?");
 TemplateArgumentLists[0].Args = Args;
+TemplateArgumentLists[0].AssociatedDeclAndFinal.setPointer(
+AssociatedDecl);
   } else {
 --NumRetainedOuterLevels;
 TemplateArgumentLists.push_back({{AssociatedDecl, Final}, Args});
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index d4c9d044985e3..855b145db9586 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -946,7 +946,8 @@ namespace {
 
 static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
 Sema &S, const Sema::TemplateCompareNewDeclInfo &DeclInfo,
-const Expr *ConstrExpr) {
+const Expr *ConstrExpr,
+const Decl *PreferredInnermostAssociatedDecl = nullptr) {
   MultiLevelTemplateArgumentList MLTAL = S.getTemplateInstantiationArgs(
   DeclInfo.getDecl(), DeclInfo.getLexicalDeclContext(), /*Final=*/false,
   /*Innermost=*/std::nullopt,
@@ -957,6 +958,13 @@ static const Expr 
*SubstituteConstraintExpressionWithoutSatisfaction(
   if (MLTAL.getNumSubstitutedLevels() == 0)
 return ConstrExpr;
 
+  if (PreferredInnermostAssociatedDecl)
+if (MLTAL.getAssociatedDecl(MLTAL.getNumLevels() - 1).first !=
+PreferredInnermostAssociatedDecl)
+  MLTAL.replaceInnermostTemplateArguments(
+  const_cast(PreferredInnermostAssociatedDecl),
+  MLTAL.getInnermost());
+
   Sema::SFINAETrap SFINAE(S, /*AccessCheckingSFINAE=*/false);
 
   Sema::InstantiatingTemplate Inst(
@@ -1006,15 +1014,25 @@ bool Sema::AreConstraintExpressionsEqual(const 
NamedDecl *Old,
   // C++ [temp.constr.decl]p4
   if (Old && !New.isInvalid() && !New.ContainsDecl(Old) &&
   Old->getLexicalDeclContext() != New.getLexicalDeclContext()) {
+const Decl *PreferredInnermostAssociatedDecl = nullptr;
+if (const NamedDecl *ND = New.getDecl();
+ND && Old->getDeclContext() == New.getDeclContext() &&
+Old->getDeclName() == ND->getDeclName() &&
+Old->getCanonicalDecl() != ND->getCanonicalDecl())
+  PreferredInnermostAssociatedDecl = Old;
 if (const Expr *SubstConstr =
-SubstituteConstraintExpressionWithoutSatisfaction(*this, Old,
-  OldConstr))
+SubstituteConstraintExpressionWithoutSatisfaction(
+*this, Old, OldConstr,
+/*PreferredInnermostAssociatedDecl=*/
+PreferredInnermostAssociatedDecl))
   OldConstr = SubstConstr;
 else
   return false;
 if (const Expr *SubstConstr =
-SubstituteConstraintExpressionWithoutSatisfaction(*this, New,
-  NewConstr))
+SubstituteConstraintExpressionWithoutSatisfaction(
+*this, New, NewConstr,
+/*PreferredInnermostAssociatedDecl=*/
+PreferredInnermostAssociatedDecl))
   NewConstr = SubstConstr;
 else
   return false;
diff --git a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp 
b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
index 0142efcdc3ee8..333187b0d74ad 100644
--- a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
+++ b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
@@ -599,3 +599,26 @@ template 
 unsigned long DerivedCollection::index() {}
 
 } // namespace GH72557
+
+namespace GH101735 {
+
+template 
+concept True = true;
+
+template 
+class A {
+  template 
+  void method(Ts&... ts)
+requires requires (T t) {
+  { t.method(static_cast(ts)...) } -> True;
+};
+};
+
+template 
+template 
+void A::method(Ts&... ts)
+  requires requires (T t) {
+{ t.method(static_cast(ts)...) } -> True;
+  } {}
+
+}

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


[clang] [Clang][Sema][OpenMP] Allow `num_teams` to accept multiple expressions (PR #99732)

2024-08-06 Thread Shilei Tian via cfe-commits

https://github.com/shiltian updated 
https://github.com/llvm/llvm-project/pull/99732

>From d27b78670ae334bd05c845d14512ee1e3e8d077b Mon Sep 17 00:00:00 2001
From: Shilei Tian 
Date: Fri, 19 Jul 2024 22:07:06 -0400
Subject: [PATCH] [Clang][OpenMP] Allow `num_teams` to accept multiple
 expressions

---
 clang/docs/OpenMPSupport.rst  |  2 +
 clang/docs/ReleaseNotes.rst   |  3 +
 clang/include/clang/AST/OpenMPClause.h| 79 +---
 clang/include/clang/AST/RecursiveASTVisitor.h |  2 +-
 .../clang/Basic/DiagnosticSemaKinds.td|  2 +
 clang/include/clang/Sema/SemaOpenMP.h |  3 +-
 clang/lib/AST/OpenMPClause.cpp| 26 +-
 clang/lib/AST/StmtProfile.cpp |  3 +-
 clang/lib/CodeGen/CGOpenMPRuntime.cpp |  7 +-
 clang/lib/CodeGen/CGStmtOpenMP.cpp|  2 +-
 clang/lib/Parse/ParseOpenMP.cpp   |  8 +-
 clang/lib/Sema/SemaOpenMP.cpp | 92 +++
 clang/lib/Sema/TreeTransform.h|  7 +-
 clang/lib/Serialization/ASTReader.cpp | 10 +-
 clang/lib/Serialization/ASTWriter.cpp |  4 +-
 clang/test/OpenMP/target_teams_ast_print.cpp  |  4 +
 ...et_teams_distribute_num_teams_messages.cpp | 12 +++
 ...ribute_parallel_for_num_teams_messages.cpp |  5 +
 .../test/OpenMP/teams_num_teams_messages.cpp  |  7 ++
 clang/tools/libclang/CIndex.cpp   |  2 +-
 20 files changed, 212 insertions(+), 68 deletions(-)

diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 0e72b3c6e09c9..3fca3318c1fc4 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -363,5 +363,7 @@ considered for standardization. Please post on the
 | device extension | `'ompx_bare' clause on 'target teams' 
construct   | :good:`prototyped`   | 
#66844, #70612 |
 |  | 
`_  
  |  |  
  |
 
+--+---+--++
+| device extension | Multi-dim `'num_teams' clause on 'target 
teams ompx_bare' construct   | :good:`partial`  | #99732, 
#101407|
++--+---+--++
 
 .. _Discourse forums (Runtimes - OpenMP category): 
https://discourse.llvm.org/c/runtimes/openmp/35
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 54decb5dbf230..9d2789b2f94f9 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -331,6 +331,9 @@ Improvements
 
 - Improve the handling of mapping array-section for struct containing nested 
structs with user defined mappers
 
+- `num_teams` now accepts multiple expressions when it is used along in 
``target teams ompx_bare`` construct.
+  This allows the target region to be launched with multi-dim grid on GPUs.
+
 Additional Information
 ==
 
diff --git a/clang/include/clang/AST/OpenMPClause.h 
b/clang/include/clang/AST/OpenMPClause.h
index 3a8337abfe687..1e830b14727c1 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -6369,43 +6369,54 @@ class OMPMapClause final : public 
OMPMappableExprListClause,
 /// \endcode
 /// In this example directive '#pragma omp teams' has clause 'num_teams'
 /// with single expression 'n'.
-class OMPNumTeamsClause : public OMPClause, public OMPClauseWithPreInit {
-  friend class OMPClauseReader;
+///
+/// When 'ompx_bare' clause exists on a 'target' directive, 'num_teams' clause
+/// can accept up to three expressions.
+///
+/// \code
+/// #pragma omp target teams ompx_bare num_teams(x, y, z)
+/// \endcode
+class OMPNumTeamsClause final
+: public OMPVarListClause,
+  public OMPClauseWithPreInit,
+  private llvm::TrailingObjects {
+  friend OMPVarListClause;
+  friend TrailingObjects;
 
   /// Location of '('.
   SourceLocation LParenLoc;
 
-  /// NumTeams number.
-  Stmt *NumTeams = nullptr;
+  OMPNumTeamsClause(const ASTContext &C, SourceLocation StartLoc,
+SourceLocation LParenLoc, SourceLocation EndLoc, unsigned 
N)
+  : OMPVarListClause(llvm::omp::OMPC_num_teams, StartLoc, LParenLoc, 
EndLoc,
+ N),
+OMPClauseWithPreInit(this) {}
 
-  /// Set the NumTeams number.
-  ///
-  /// \param E NumTeams number.
-  void setNumTeams(Expr *E) { NumTeams = E; }
+  /// Build an empty clause.
+  OMPNumTeamsClause(unsigned N)
+  

[clang] #101784 part 1: introduce ctyped in an independent manner (PR #101941)

2024-08-06 Thread Jannick Kremer via cfe-commits

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


[clang] [Clang][Sema][OpenMP] Allow `num_teams` to accept multiple expressions (PR #99732)

2024-08-06 Thread Shilei Tian via cfe-commits

https://github.com/shiltian updated 
https://github.com/llvm/llvm-project/pull/99732

>From 0bd0ff8f905c4e430c7203cede19d7e2179d89ef Mon Sep 17 00:00:00 2001
From: Shilei Tian 
Date: Fri, 19 Jul 2024 22:07:06 -0400
Subject: [PATCH] [Clang][OpenMP] Allow `num_teams` to accept multiple
 expressions

---
 clang/docs/OpenMPSupport.rst  |  2 +
 clang/docs/ReleaseNotes.rst   |  3 +
 clang/include/clang/AST/OpenMPClause.h| 79 +---
 clang/include/clang/AST/RecursiveASTVisitor.h |  2 +-
 .../clang/Basic/DiagnosticSemaKinds.td|  2 +
 clang/include/clang/Sema/SemaOpenMP.h |  3 +-
 clang/lib/AST/OpenMPClause.cpp| 26 +-
 clang/lib/AST/StmtProfile.cpp |  3 +-
 clang/lib/CodeGen/CGOpenMPRuntime.cpp |  7 +-
 clang/lib/CodeGen/CGStmtOpenMP.cpp|  2 +-
 clang/lib/Parse/ParseOpenMP.cpp   |  8 +-
 clang/lib/Sema/SemaOpenMP.cpp | 91 +++
 clang/lib/Sema/TreeTransform.h|  7 +-
 clang/lib/Serialization/ASTReader.cpp | 10 +-
 clang/lib/Serialization/ASTWriter.cpp |  4 +-
 clang/test/OpenMP/target_teams_ast_print.cpp  |  4 +
 ...et_teams_distribute_num_teams_messages.cpp | 12 +++
 ...ribute_parallel_for_num_teams_messages.cpp |  5 +
 .../test/OpenMP/teams_num_teams_messages.cpp  |  7 ++
 clang/tools/libclang/CIndex.cpp   |  2 +-
 20 files changed, 211 insertions(+), 68 deletions(-)

diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 0e72b3c6e09c9..3fca3318c1fc4 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -363,5 +363,7 @@ considered for standardization. Please post on the
 | device extension | `'ompx_bare' clause on 'target teams' 
construct   | :good:`prototyped`   | 
#66844, #70612 |
 |  | 
`_  
  |  |  
  |
 
+--+---+--++
+| device extension | Multi-dim `'num_teams' clause on 'target 
teams ompx_bare' construct   | :good:`partial`  | #99732, 
#101407|
++--+---+--++
 
 .. _Discourse forums (Runtimes - OpenMP category): 
https://discourse.llvm.org/c/runtimes/openmp/35
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 54decb5dbf230..9d2789b2f94f9 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -331,6 +331,9 @@ Improvements
 
 - Improve the handling of mapping array-section for struct containing nested 
structs with user defined mappers
 
+- `num_teams` now accepts multiple expressions when it is used along in 
``target teams ompx_bare`` construct.
+  This allows the target region to be launched with multi-dim grid on GPUs.
+
 Additional Information
 ==
 
diff --git a/clang/include/clang/AST/OpenMPClause.h 
b/clang/include/clang/AST/OpenMPClause.h
index 3a8337abfe687..1e830b14727c1 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -6369,43 +6369,54 @@ class OMPMapClause final : public 
OMPMappableExprListClause,
 /// \endcode
 /// In this example directive '#pragma omp teams' has clause 'num_teams'
 /// with single expression 'n'.
-class OMPNumTeamsClause : public OMPClause, public OMPClauseWithPreInit {
-  friend class OMPClauseReader;
+///
+/// When 'ompx_bare' clause exists on a 'target' directive, 'num_teams' clause
+/// can accept up to three expressions.
+///
+/// \code
+/// #pragma omp target teams ompx_bare num_teams(x, y, z)
+/// \endcode
+class OMPNumTeamsClause final
+: public OMPVarListClause,
+  public OMPClauseWithPreInit,
+  private llvm::TrailingObjects {
+  friend OMPVarListClause;
+  friend TrailingObjects;
 
   /// Location of '('.
   SourceLocation LParenLoc;
 
-  /// NumTeams number.
-  Stmt *NumTeams = nullptr;
+  OMPNumTeamsClause(const ASTContext &C, SourceLocation StartLoc,
+SourceLocation LParenLoc, SourceLocation EndLoc, unsigned 
N)
+  : OMPVarListClause(llvm::omp::OMPC_num_teams, StartLoc, LParenLoc, 
EndLoc,
+ N),
+OMPClauseWithPreInit(this) {}
 
-  /// Set the NumTeams number.
-  ///
-  /// \param E NumTeams number.
-  void setNumTeams(Expr *E) { NumTeams = E; }
+  /// Build an empty clause.
+  OMPNumTeamsClause(unsigned N)
+  

[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)

2024-08-06 Thread Oleksandr T. via cfe-commits


@@ -12370,6 +12379,17 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& 
DS) {
   }
 }
 
+bool Sema::CheckLinkageSpecification(DeclContext *DC, Decl *D) {
+  // [basic.start.main] p2
+  //   The main function shall not be declared with a linkage-specification.
+  if (DC->isExternCContext()) {
+Diag(D->getLocation(), diag::err_main_invalid_linkage_specification);
+D->setInvalidDecl();
+return true;
+  }
+  return false;
+}

a-tarasyuk wrote:

@Sirraide @MitalAshok could you review the latest changes? Thanks 

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


[clang] [Clang][NFC] Restore "Non-comprehensive list of changes in this release" in ReleaseNotes (PR #102134)

2024-08-06 Thread Mital Ashok via cfe-commits

https://github.com/MitalAshok created 
https://github.com/llvm/llvm-project/pull/102134

This was removed in 10c6d6349e51bb245b9deec4aafca9885971135b

>From 664647de07eaa6f1b4b0f94594e867740cb99717 Mon Sep 17 00:00:00 2001
From: Mital Ashok 
Date: Tue, 6 Aug 2024 13:32:04 +0100
Subject: [PATCH] [NFC] Restore "Non-comprehensive list of changes in this
 release" in ReleaseNotes

---
 clang/docs/ReleaseNotes.rst | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 54decb5dbf230..674fdb8aebfaf 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -105,6 +105,9 @@ C2y Feature Support
 C23 Feature Support
 ^^^
 
+Non-comprehensive list of changes in this release
+-
+
 New Compiler Flags
 --
 

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


[clang] [Clang][NFC] Restore "Non-comprehensive list of changes in this release" in ReleaseNotes (PR #102134)

2024-08-06 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Mital Ashok (MitalAshok)


Changes

This was removed in 10c6d6349e51bb245b9deec4aafca9885971135b

---
Full diff: https://github.com/llvm/llvm-project/pull/102134.diff


1 Files Affected:

- (modified) clang/docs/ReleaseNotes.rst (+3) 


``diff
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 54decb5dbf230..674fdb8aebfaf 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -105,6 +105,9 @@ C2y Feature Support
 C23 Feature Support
 ^^^
 
+Non-comprehensive list of changes in this release
+-
+
 New Compiler Flags
 --
 

``




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


[clang] 617cf8a - Reapply "Finish deleting the le32/le64 targets" (#99079) (#101983)

2024-08-06 Thread via cfe-commits

Author: Aaron Ballman
Date: 2024-08-06T08:35:56-04:00
New Revision: 617cf8a72d2ab568bf0e84452faf4e35a322b32f

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

LOG: Reapply "Finish deleting the le32/le64 targets" (#99079) (#101983)

This reverts commit d3f8105c65046173e20c4c59394b4a7f1bbe7627.

Halide no longer relies on this target:
https://github.com/llvm/llvm-project/pull/98497#issuecomment-2253358685

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/docs/tools/clang-formatted-files.txt
clang/lib/Basic/CMakeLists.txt
clang/lib/Basic/Targets.cpp
clang/lib/Basic/Targets/OSTargets.h
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGen/bitfield-access-pad.c
clang/test/CodeGen/bitfield-access-unit.c
clang/test/CodeGenCXX/bitfield-access-empty.cpp
clang/test/CodeGenCXX/bitfield-access-tail.cpp
clang/test/Preprocessor/predefined-macros-no-warnings.c
llvm/include/llvm/TargetParser/Triple.h
llvm/lib/TargetParser/Triple.cpp
llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn

Removed: 
clang/lib/Basic/Targets/Le64.cpp
clang/lib/Basic/Targets/Le64.h



diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 54decb5dbf230..c4e768123eea6 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -37,6 +37,8 @@ These changes are ones which we think may surprise users when 
upgrading to
 Clang |release| because of the opportunity they pose for disruption to existing
 code bases.
 
+- The ``le32`` and ``le64`` targets have been removed.
+
 C/C++ Language Potentially Breaking Changes
 ---
 

diff  --git a/clang/docs/tools/clang-formatted-files.txt 
b/clang/docs/tools/clang-formatted-files.txt
index a8ee8f1fcb87c..62871133a6807 100644
--- a/clang/docs/tools/clang-formatted-files.txt
+++ b/clang/docs/tools/clang-formatted-files.txt
@@ -362,7 +362,6 @@ clang/lib/Basic/Targets/BPF.cpp
 clang/lib/Basic/Targets/BPF.h
 clang/lib/Basic/Targets/Hexagon.h
 clang/lib/Basic/Targets/Lanai.h
-clang/lib/Basic/Targets/Le64.h
 clang/lib/Basic/Targets/M68k.h
 clang/lib/Basic/Targets/MSP430.h
 clang/lib/Basic/Targets/NVPTX.cpp

diff  --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index f30680552e0f5..e7ebc8f191aa6 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -102,7 +102,6 @@ add_clang_library(clangBasic
   Targets/DirectX.cpp
   Targets/Hexagon.cpp
   Targets/Lanai.cpp
-  Targets/Le64.cpp
   Targets/LoongArch.cpp
   Targets/M68k.cpp
   Targets/MSP430.cpp

diff  --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 29133f9ee8fce..0b8e565345b6a 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -23,7 +23,6 @@
 #include "Targets/DirectX.h"
 #include "Targets/Hexagon.h"
 #include "Targets/Lanai.h"
-#include "Targets/Le64.h"
 #include "Targets/LoongArch.h"
 #include "Targets/M68k.h"
 #include "Targets/MSP430.h"
@@ -344,17 +343,6 @@ std::unique_ptr AllocateTarget(const 
llvm::Triple &Triple,
   return std::make_unique(Triple, Opts);
 }
 
-  case llvm::Triple::le32:
-switch (os) {
-case llvm::Triple::NaCl:
-  return std::make_unique>(Triple, Opts);
-default:
-  return nullptr;
-}
-
-  case llvm::Triple::le64:
-return std::make_unique(Triple, Opts);
-
   case llvm::Triple::ppc:
 switch (os) {
 case llvm::Triple::Linux:

diff  --git a/clang/lib/Basic/Targets/Le64.cpp 
b/clang/lib/Basic/Targets/Le64.cpp
deleted file mode 100644
index f7afa0e747d67..0
--- a/clang/lib/Basic/Targets/Le64.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===--- Le64.cpp - Implement Le64 target feature support 
-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-//
-// This file implements Le64 TargetInfo objects.
-//
-//===--===//
-
-#include "Le64.h"
-#include "Targets.h"
-#include "clang/Basic/Builtins.h"
-#include "clang/Basic/MacroBuilder.h"
-#include "clang/Basic/TargetBuiltins.h"
-
-using namespace clang;
-using namespace clang::targets;
-
-ArrayRef Le64TargetInfo::getTargetBuiltins() const {
-  return {};
-}
-
-void Le64TargetInfo::getTargetDefines(const LangOptions &Opts,
-  MacroBuilder &Builder) const {
-  DefineStd(Builder, "unix", Opts);
-  defineCPUMacros(Builder, "le64", /*Tuning=*/false);
-}


[clang] [llvm] Reapply "Finish deleting the le32/le64 targets" (#99079) (PR #101983)

2024-08-06 Thread Aaron Ballman via cfe-commits

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


[clang] [Clang][NFC] Restore "Non-comprehensive list of changes in this release" in ReleaseNotes (PR #102134)

2024-08-06 Thread Mital Ashok via cfe-commits

MitalAshok wrote:

See comment: 
https://github.com/llvm/llvm-project/commit/10c6d6349e51bb245b9deec4aafca9885971135b#r145078148

(This is a separate PR to make sure it isn't reverted as part of a bigger 
change)


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


[clang] [Clang][Sema][OpenMP] Allow `num_teams` to accept multiple expressions (PR #99732)

2024-08-06 Thread Alexey Bataev via cfe-commits

https://github.com/alexey-bataev approved this pull request.

LG

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


[clang] [clang][NFC] Make OffloadLTOMode getter a separate method (PR #101200)

2024-08-06 Thread Yaxun Liu via cfe-commits

yxsamliu wrote:

> @yxsamliu Would you mind reviewing this change?

Sorry for the delay. LGTM

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


[clang] [Clang][Parser] Accept P2741R3 (static_assert with user-generated message) in C++11 as an extension (PR #102044)

2024-08-06 Thread Nikolas Klauser via cfe-commits


@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
 LangOpts.CPlusPlus23   ? "202211L"
 : LangOpts.CPlusPlus17 ? "201603L"
: "200907");
-Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-   : LangOpts.CPlusPlus17
-   ? "201411L"
-   : "200410");
+// C++17 / C++26 static_assert backported
+Builder.defineMacro("__cpp_static_assert", "202306L");

philnik777 wrote:

I'm not exactly sure what's ambiguous here. You say yourself that it specifies 
what the value should be for a given standards version. I also can't find 
anything suggesting that implementations are allowed to define then to 
something else. Anyways, since we seem to agree that implementations should be 
allowed to define them to some higher number, I'm not sure it makes a ton of 
sense to do anything other than filing an issue. But where should it be filed? 
Is that core wording or library? Both? Neither?

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


[clang] [Clang][Sema][OpenMP] Allow `num_teams` to accept multiple expressions (PR #99732)

2024-08-06 Thread Shilei Tian via cfe-commits

https://github.com/shiltian updated 
https://github.com/llvm/llvm-project/pull/99732

>From f9e58d7acdd6a61a811c838efa2aae377233c608 Mon Sep 17 00:00:00 2001
From: Shilei Tian 
Date: Fri, 19 Jul 2024 22:07:06 -0400
Subject: [PATCH] [Clang][OpenMP] Allow `num_teams` to accept multiple
 expressions

---
 clang/docs/OpenMPSupport.rst  |  2 +
 clang/docs/ReleaseNotes.rst   |  3 +
 clang/include/clang/AST/OpenMPClause.h| 79 +---
 clang/include/clang/AST/RecursiveASTVisitor.h |  2 +-
 .../clang/Basic/DiagnosticSemaKinds.td|  2 +
 clang/include/clang/Sema/SemaOpenMP.h |  3 +-
 clang/lib/AST/OpenMPClause.cpp| 26 +-
 clang/lib/AST/StmtProfile.cpp |  3 +-
 clang/lib/CodeGen/CGOpenMPRuntime.cpp |  7 +-
 clang/lib/CodeGen/CGStmtOpenMP.cpp|  2 +-
 clang/lib/Parse/ParseOpenMP.cpp   |  8 +-
 clang/lib/Sema/SemaOpenMP.cpp | 91 +++
 clang/lib/Sema/TreeTransform.h|  7 +-
 clang/lib/Serialization/ASTReader.cpp | 10 +-
 clang/lib/Serialization/ASTWriter.cpp |  4 +-
 clang/test/OpenMP/target_teams_ast_print.cpp  |  4 +
 ...et_teams_distribute_num_teams_messages.cpp | 12 +++
 ...ribute_parallel_for_num_teams_messages.cpp |  5 +
 .../test/OpenMP/teams_num_teams_messages.cpp  |  7 ++
 clang/tools/libclang/CIndex.cpp   |  2 +-
 20 files changed, 211 insertions(+), 68 deletions(-)

diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 0e72b3c6e09c9..3fca3318c1fc4 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -363,5 +363,7 @@ considered for standardization. Please post on the
 | device extension | `'ompx_bare' clause on 'target teams' 
construct   | :good:`prototyped`   | 
#66844, #70612 |
 |  | 
`_  
  |  |  
  |
 
+--+---+--++
+| device extension | Multi-dim `'num_teams' clause on 'target 
teams ompx_bare' construct   | :good:`partial`  | #99732, 
#101407|
++--+---+--++
 
 .. _Discourse forums (Runtimes - OpenMP category): 
https://discourse.llvm.org/c/runtimes/openmp/35
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index c4e768123eea6..68c3c3b685675 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -333,6 +333,9 @@ Improvements
 
 - Improve the handling of mapping array-section for struct containing nested 
structs with user defined mappers
 
+- `num_teams` now accepts multiple expressions when it is used along in 
``target teams ompx_bare`` construct.
+  This allows the target region to be launched with multi-dim grid on GPUs.
+
 Additional Information
 ==
 
diff --git a/clang/include/clang/AST/OpenMPClause.h 
b/clang/include/clang/AST/OpenMPClause.h
index 3a8337abfe687..1e830b14727c1 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -6369,43 +6369,54 @@ class OMPMapClause final : public 
OMPMappableExprListClause,
 /// \endcode
 /// In this example directive '#pragma omp teams' has clause 'num_teams'
 /// with single expression 'n'.
-class OMPNumTeamsClause : public OMPClause, public OMPClauseWithPreInit {
-  friend class OMPClauseReader;
+///
+/// When 'ompx_bare' clause exists on a 'target' directive, 'num_teams' clause
+/// can accept up to three expressions.
+///
+/// \code
+/// #pragma omp target teams ompx_bare num_teams(x, y, z)
+/// \endcode
+class OMPNumTeamsClause final
+: public OMPVarListClause,
+  public OMPClauseWithPreInit,
+  private llvm::TrailingObjects {
+  friend OMPVarListClause;
+  friend TrailingObjects;
 
   /// Location of '('.
   SourceLocation LParenLoc;
 
-  /// NumTeams number.
-  Stmt *NumTeams = nullptr;
+  OMPNumTeamsClause(const ASTContext &C, SourceLocation StartLoc,
+SourceLocation LParenLoc, SourceLocation EndLoc, unsigned 
N)
+  : OMPVarListClause(llvm::omp::OMPC_num_teams, StartLoc, LParenLoc, 
EndLoc,
+ N),
+OMPClauseWithPreInit(this) {}
 
-  /// Set the NumTeams number.
-  ///
-  /// \param E NumTeams number.
-  void setNumTeams(Expr *E) { NumTeams = E; }
+  /// Build an empty clause.
+  OMPNumTeamsClause(unsigned N)
+  

[clang] [Clang][Parser] Accept P2741R3 (static_assert with user-generated message) in C++11 as an extension (PR #102044)

2024-08-06 Thread Nikolas Klauser via cfe-commits


@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
 LangOpts.CPlusPlus23   ? "202211L"
 : LangOpts.CPlusPlus17 ? "201603L"
: "200907");
-Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-   : LangOpts.CPlusPlus17
-   ? "201411L"
-   : "200410");
+// C++17 / C++26 static_assert backported
+Builder.defineMacro("__cpp_static_assert", "202306L");

philnik777 wrote:

Oh, also note that this could potentially be a huge breaking change, since 
users may rely on them guarding for a version.

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


[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

2024-08-06 Thread Nikita Popov via cfe-commits

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


[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)

2024-08-06 Thread via cfe-commits


@@ -12210,7 +12215,22 @@ bool Sema::CheckFunctionDeclaration(Scope *S, 
FunctionDecl *NewFD,
   return Redeclaration;
 }
 
-void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) {
+void Sema::CheckMain(FunctionDecl *FD, const DeclSpec &DS) {
+  // [basic.start.main]p3
+  //The main function shall not be declared with a linkage-specification.
+  if ((FD->isExternCContext() || FD->isExternCXXContext())) {

Sirraide wrote:

```suggestion
  if (FD->isExternCContext() || FD->isExternCXXContext()) {
```

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


[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)

2024-08-06 Thread via cfe-commits


@@ -990,6 +990,12 @@ def warn_main_redefined : Warning<"variable named 'main' 
with external linkage "
 "has undefined behavior">, InGroup;
 def ext_main_used : Extension<
 "referring to 'main' within an expression is a Clang extension">, 
InGroup;
+def ext_main_invalid_linkage_specification : ExtWarn<
+  "'main' should not be "
+  "'extern \"%select{C|C++}0\"'">, InGroup;
+def err_main_invalid_linkage_specification : Error<
+  "'main' should not be "
+  "'extern \"%select{C|C++}0\"'">;

Sirraide wrote:

Thinking about this again, I think making these an error by default is a bit 
too strong; no-one else does that by default; the most you’ll get is a warning 
from EDG and a pedantic warning from GCC. I think making this a single 
`ExtWarn` is fine.

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


[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)

2024-08-06 Thread via cfe-commits

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


[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)

2024-08-06 Thread via cfe-commits


@@ -145,6 +145,8 @@ Improvements to Clang's diagnostics
 
 - -Wdangling-assignment-gsl is enabled by default.
 
+- Clang now diagnoses the use of `main` in an `extern "C"` context as invalid 
according to [basic.start.main] p3. Fixes #GH101512.

Sirraide wrote:

```suggestion
- Clang now diagnoses the use of `main` in an `extern` context as invalid 
according to [basic.start.main] p3. Fixes #GH101512.
```

Actually, my bad, I didn’t realise that `extern "C++" int main()` was also 
invalid at global scope, so this should in fact just say `extern` .

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


[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)

2024-08-06 Thread via cfe-commits


@@ -7353,6 +7353,14 @@ void emitReadOnlyPlacementAttrWarning(Sema &S, const 
VarDecl *VD) {
   }
 }
 
+static bool isMainVar(DeclarationName Name, VarDecl *VD) {

Sirraide wrote:

Nit: maybe a comment on this explaining what it does would be nice. E.g. 
something like ‘Checks whether VD is declared at global scope or with C 
language linkage’.

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


[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)

2024-08-06 Thread via cfe-commits

https://github.com/Sirraide commented:

A few minor things, but other than that this is pretty much done I’d say.

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


[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)

2024-08-06 Thread via cfe-commits


@@ -990,6 +990,12 @@ def warn_main_redefined : Warning<"variable named 'main' 
with external linkage "
 "has undefined behavior">, InGroup;
 def ext_main_used : Extension<
 "referring to 'main' within an expression is a Clang extension">, 
InGroup;
+def ext_main_invalid_linkage_specification : ExtWarn<
+  "'main' should not be "
+  "'extern \"%select{C|C++}0\"'">, InGroup;
+def err_main_invalid_linkage_specification : Error<
+  "'main' should not be "
+  "'extern \"%select{C|C++}0\"'">;

Sirraide wrote:

(for future reference, you can use `.Summary` if you have to diags w/ the same 
text)

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


[clang] [Clang][Parser] Accept P2741R3 (static_assert with user-generated message) in C++11 as an extension (PR #102044)

2024-08-06 Thread Aaron Ballman via cfe-commits


@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
 LangOpts.CPlusPlus23   ? "202211L"
 : LangOpts.CPlusPlus17 ? "201603L"
: "200907");
-Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-   : LangOpts.CPlusPlus17
-   ? "201411L"
-   : "200410");
+// C++17 / C++26 static_assert backported
+Builder.defineMacro("__cpp_static_assert", "202306L");

AaronBallman wrote:

> I'm not exactly sure what's ambiguous here. You say yourself that it 
> specifies what the value should be for a given standards version.

https://eel.is/c++draft/cpp.predefined has two styles of predefined macros. 
Ones where there is normative text explaining what the macro has to expand to, 
and others where it simply lists a value in a table. Nothing in that subclause 
says "shall be defined as" for the values in the table. It just says the 
*names* shall be defined.

> Anyways, since we seem to agree that implementations should be allowed to 
> define them to some higher number, I'm not sure it makes a ton of sense to do 
> anything other than filing an issue. But where should it be filed? Is that 
> core wording or library? Both? Neither?

Probably one Core issue and one Library issue.

Worth remembering that all of these came out of 
[SD6](https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations)
 which says: "The value specified for a feature-test macro is based on the year 
and month in which the feature is voted into the working draft. In a case where 
a feature is subsequently changed in a significant way, but arguably remains 
the same feature, the value of the macro is changed to indicate the “revision 
level” of the specification of the feature. However, in most cases it is 
expected that the presence of a feature can be determined by the presence of 
any non-zero macro value; for example:"

> Oh, also note that this could potentially be a huge breaking change, since 
> users may rely on them guarding for a version.

Huh? The idiomatic use is `#if defined(__cplusplus) && __cpp_whatever >= 
201907L`, so bumping to a later revision is not a breaking change. It's of 
course possible for a user to test using `==` or some other approach, but 
they're using the feature testing macro incorrectly at that point.

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


[clang] 295e4f4 - Correct a comment and update a return type; NFC

2024-08-06 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2024-08-06T08:55:30-04:00
New Revision: 295e4f49aefb2b07501be9f845df598b3ee280f1

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

LOG: Correct a comment and update a return type; NFC

These changes were inspired by a post-commit review comment:
https://github.com/llvm/llvm-project/pull/97274#pullrequestreview-2220175564

Added: 


Modified: 
clang/include/clang/Lex/Preprocessor.h
clang/lib/Sema/SemaExpr.cpp

Removed: 




diff  --git a/clang/include/clang/Lex/Preprocessor.h 
b/clang/include/clang/Lex/Preprocessor.h
index 623f868ca1e64..1307659e27d13 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -2139,8 +2139,8 @@ class Preprocessor {
   }
 
   /// Given a Token \p Tok that is a numeric constant with length 1,
-  /// return the character.
-  char
+  /// return the value of constant as an unsigned 8-bit integer.
+  uint8_t
   getSpellingOfSingleCharacterNumericConstant(const Token &Tok,
   bool *Invalid = nullptr) const {
 assert((Tok.is(tok::numeric_constant) || Tok.is(tok::binary_data)) &&

diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index b1b0d1cbbd31d..72cd92a7537f9 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -3652,7 +3652,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, 
Scope *UDLScope) {
   // Fast path for a single digit (which is quite common).  A single digit
   // cannot have a trigraph, escaped newline, radix prefix, or suffix.
   if (Tok.getLength() == 1 || Tok.getKind() == tok::binary_data) {
-const char Val = PP.getSpellingOfSingleCharacterNumericConstant(Tok);
+const uint8_t Val = PP.getSpellingOfSingleCharacterNumericConstant(Tok);
 return ActOnIntegerConstant(Tok.getLocation(), Val);
   }
 



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


[clang] [clang] Inject tokens containing #embed back into token stream (PR #97274)

2024-08-06 Thread Aaron Ballman via cfe-commits


@@ -2123,17 +2123,18 @@ class Preprocessor {
   char
   getSpellingOfSingleCharacterNumericConstant(const Token &Tok,

AaronBallman wrote:

I've updated the comment and the interface in 
295e4f49aefb2b07501be9f845df598b3ee280f1

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


[clang] [Clang][Parser] Accept P2741R3 (static_assert with user-generated message) in C++11 as an extension (PR #102044)

2024-08-06 Thread Vlad Serebrennikov via cfe-commits


@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
 LangOpts.CPlusPlus23   ? "202211L"
 : LangOpts.CPlusPlus17 ? "201603L"
: "200907");
-Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-   : LangOpts.CPlusPlus17
-   ? "201411L"
-   : "200410");
+// C++17 / C++26 static_assert backported
+Builder.defineMacro("__cpp_static_assert", "202306L");

Endilll wrote:

Looking at how we handle other backported features, it appears that we didn't 
change anything about feature test macros when we enabled them. In other words, 
what was undefined remain undefined, what was defined is still defined to have 
the same value as if backport never happened.

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


[clang] [Clang][Parser] Accept P2741R3 (static_assert with user-generated message) in C++11 as an extension (PR #102044)

2024-08-06 Thread Vlad Serebrennikov via cfe-commits


@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
 LangOpts.CPlusPlus23   ? "202211L"
 : LangOpts.CPlusPlus17 ? "201603L"
: "200907");
-Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-   : LangOpts.CPlusPlus17
-   ? "201411L"
-   : "200410");
+// C++17 / C++26 static_assert backported
+Builder.defineMacro("__cpp_static_assert", "202306L");

Endilll wrote:

I suggest that we remain consistent with that

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


[clang] [clang-tools-extra] [flang] [lld] [llvm] [mlir] [CMake] Fold export_executable_symbols_* into function args. (PR #101741)

2024-08-06 Thread Steven Wu via cfe-commits

cachemeifyoucan wrote:

Yes, please revert. Do you have link to the build failure?

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


[clang] [lldb] [clang][AST] fix ast-print of extern with >=2 declarators, fixed, fixed (PR #98795)

2024-08-06 Thread Aaron Ballman via cfe-commits

AaronBallman wrote:

Ping @JDevlieghere for lldb test suite assistance.

As for ORC JIT, [the compiler-rt project](https://compiler-rt.llvm.org/) does 
not claim to support Windows to begin with, so it's unclear whether the bot 
should not be testing on Windows or whether compiler-rt needs to update their 
support claims. CC @vitalybuka for more opinions/help on this one (my 
preference is for Windows to be a first-class citizen with compiler-rt, but if 
nobody is willing to do the maintenance work, we should not let bots failing 
when testing compiler-rt on Windows be a blocking concern).

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


  1   2   3   4   5   >