[clang] [llvm] Enable LLDB tests in Linux pre-merge CI (PR #94208)

2024-06-07 Thread Jonas Devlieghere via cfe-commits

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


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


[clang] [llvm] Enable LLDB tests in Linux pre-merge CI (PR #94208)

2024-06-07 Thread Jonas Devlieghere via cfe-commits

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


[compiler-rt] [libcxx] [libcxxabi] [libunwind] [libunwind][libcxx][libcxxabi][compiler-rt-builtins] Fix Exception Handling build for wasm (PR #79667)

2024-06-07 Thread via cfe-commits

https://github.com/trcrsired updated 
https://github.com/llvm/llvm-project/pull/79667

>From 4f1ce895254dd9505150c1f5f5cb77454b9aca68 Mon Sep 17 00:00:00 2001
From: cqwrteur <100043421+trcrsi...@users.noreply.github.com>
Date: Sat, 1 Jun 2024 02:55:50 -0400
Subject: [PATCH] [libunwind][libcxx][libcxxabi] Fix Exception Handling build
 for wasm

The wasm unwind build appears to be dysfunctional, likely because the author 
has only supplied a customized LLVM build on request, rather than a fully 
functional patch.

This patch fixes the build

Apply formatting patch proposed by github bot

use "" to prevent CMAKE_SYSTEM_PROCESSOR not defined

[libunwind] logAPI functions should also be built

[libcxxabi] Fix function signatures for wasm

wasm does not define the function signatures correctly for cxxabi
Fix them

Fix formatting issues for libcxxabi's wasm eh change

Merge remote-tracking branch 'parent/main' into wasmlibunwindfix

remove unwanted changes in unwind-wasm.c

Make Unwind-wasm.c compile correctly without workaround in
CMakeLists.txt

using __wasm__ macro to guard against all wasm eh build

fix UnwindLevel.c's formatting issue

ISO C requires a translation unit to contain at least one declaration 
[-Werror,-Wempty-translation-unit]

compiler-rt does not define CMP_RESULT correct on wasm64
Fixed

Merge code
---
 compiler-rt/lib/builtins/fp_compare_impl.inc |   2 +-
 libcxx/include/__exception/exception_ptr.h   |  21 +-
 libcxxabi/include/cxxabi.h   | 179 ++---
 libcxxabi/src/cxa_exception.cpp  | 712 ---
 libcxxabi/src/cxa_exception.h|   7 +-
 libunwind/include/libunwind.h|   2 +
 libunwind/src/Unwind-wasm.c  |  13 +-
 libunwind/src/UnwindRegistersRestore.S   |   3 +-
 libunwind/src/UnwindRegistersSave.S  |   3 +
 libunwind/src/assembly.h |   2 +
 libunwind/src/cet_unwind.h   |   3 +
 libunwind/src/config.h   |  15 +-
 libunwind/src/libunwind.cpp  |   2 +
 libunwind/src/libunwind_ext.h|   2 +
 14 files changed, 423 insertions(+), 543 deletions(-)

diff --git a/compiler-rt/lib/builtins/fp_compare_impl.inc 
b/compiler-rt/lib/builtins/fp_compare_impl.inc
index a9a4f6fbf5dfe..83bdea46a45da 100644
--- a/compiler-rt/lib/builtins/fp_compare_impl.inc
+++ b/compiler-rt/lib/builtins/fp_compare_impl.inc
@@ -12,7 +12,7 @@
 // functions. We need to ensure that the return value is sign-extended in the
 // same way as GCC expects (since otherwise GCC-generated __builtin_isinf
 // returns true for finite 128-bit floating-point numbers).
-#ifdef __aarch64__
+#if defined(__aarch64__) || defined(__wasm__)
 // AArch64 GCC overrides libgcc_cmp_return to use int instead of long.
 typedef int CMP_RESULT;
 #elif __SIZEOF_POINTER__ == 8 && __SIZEOF_LONG__ == 4
diff --git a/libcxx/include/__exception/exception_ptr.h 
b/libcxx/include/__exception/exception_ptr.h
index 0a8337fa39de3..01f340a587ec3 100644
--- a/libcxx/include/__exception/exception_ptr.h
+++ b/libcxx/include/__exception/exception_ptr.h
@@ -29,22 +29,21 @@
 
 namespace __cxxabiv1 {
 
+#if defined(__wasm__)
+typedef void* (*__libcpp_exception_destructor_func)(void*);
+#elif defined(_WIN32)
+typedef void(__thiscall* __libcpp_exception_destructor_func)(void*);
+#else
+typedef void (*__libcpp_exception_destructor_func)(void*);
+#endif
+
 extern "C" {
 _LIBCPP_OVERRIDABLE_FUNC_VIS void* __cxa_allocate_exception(size_t) throw();
 _LIBCPP_OVERRIDABLE_FUNC_VIS void __cxa_free_exception(void*) throw();
 
 struct __cxa_exception;
-_LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception* __cxa_init_primary_exception(
-void*,
-std::type_info*,
-#if defined(_WIN32)
-void(__thiscall*)(void*)) throw();
-#elif defined(__wasm__)
-// In Wasm, a destructor returns its argument
-void* (*)(void*)) throw();
-#else
-void (*)(void*)) throw();
-#endif
+_LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception*
+__cxa_init_primary_exception(void*, std::type_info*, 
__libcpp_exception_destructor_func) throw();
 }
 
 } // namespace __cxxabiv1
diff --git a/libcxxabi/include/cxxabi.h b/libcxxabi/include/cxxabi.h
index 0e3969084e04f..4162fd7ec2ba7 100644
--- a/libcxxabi/include/cxxabi.h
+++ b/libcxxabi/include/cxxabi.h
@@ -20,62 +20,51 @@
 #include <__cxxabi_config.h>
 
 #define _LIBCPPABI_VERSION 15000
-#define _LIBCXXABI_NORETURN  __attribute__((noreturn))
+#define _LIBCXXABI_NORETURN __attribute__((noreturn))
 #define _LIBCXXABI_ALWAYS_COLD __attribute__((cold))
 
 #ifdef __cplusplus
 
 namespace std {
-#if defined(_WIN32)
+#  if defined(_WIN32)
 class _LIBCXXABI_TYPE_VIS type_info; // forward declaration
-#else
+#  else
 class type_info; // forward declaration
-#endif
-}
-
+#  endif
+} // namespace std
 
 // runtime routines use C calling conventions, but are in __cxxabiv1 namespace
 namespace __cxxabiv1 {
 
 struct __cxa_exception;
+#  if defined(__wasm__)
+typedef 

[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits

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


[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

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


@@ -68,6 +68,10 @@ enum class fltNonfiniteBehavior {
   // `fltNanEncoding` enum. We treat all NaNs as quiet, as the available
   // encodings do not distinguish between signalling and quiet NaN.
   NanOnly,
+
+  // This behavior is present in Float6E3M2FN and Float6E2M3FN types.
+  // There is no representation for Inf or NaN.
+  NoNanInf,

arsenm wrote:

Invert and call SupportsNonFinite? 

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


[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balázs Kéri via cfe-commits
ad.
+if (1 == fread(, sizeof(s.b), 1, fp)) {
+  long p = s.b;
+  clang_analyzer_isTainted(p); // expected-warning {{YES}}
+  clang_analyzer_dump(p); // expected-warning {{conj_}}
+} else {
+  long p = s.b;
+  clang_analyzer_isTainted(p); // expected-warning {{YES}}
+  clang_analyzer_dump(p); // expected-warning {{conj_}}
+}
+fclose(fp);
+  }
+}
+
+void compound_read2(void) {
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+struct S s; // s.a is not touched by fread.
+if (1 == fread(, sizeof(s.b), 1, fp)) {
+  long p = s.a; // expected-warning {{Assigned value is garbage or 
undefined}}
+} else {
+  long p = s.a; // expected-warning {{Assigned value is garbage or 
undefined}}
+}
+fclose(fp);
+  }
+}
+
+void var_read(void) {
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+int a, b; // 'a' is not touched by fread.
+if (1 == fread(, sizeof(b), 1, fp)) {
+  long p = a; // expected-warning{{Assigned value is garbage or undefined}}
+} else {
+  long p = a; // expected-warning{{Assigned value is garbage or undefined}}
+}
+fclose(fp);
+  }
+}
+
+// When reading a lot of data, invalidating all elements is too time-consuming.
+// Instead, the knowledge of the whole array is lost.
+#define MaxInvalidatedElementRegion 64 // See StreamChecker::evalFreadFwrite 
in StreamChecker.cpp.
+#define PastMaxComplexity MaxInvalidatedElementRegion + 1
+void test_large_read(void) {
+  int buffer[PastMaxComplexity + 1];
+  buffer[PastMaxComplexity] = 42;
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+if (buffer[PastMaxComplexity] != 42) {
+  clang_analyzer_warnIfReached(); // Unreachable.
+}
+if (1 == fread(buffer, sizeof(int), PastMaxComplexity, fp)) {
+  if (buffer[PastMaxComplexity] != 42) {
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  }
+}
+fclose(fp);
+  }
+}
+
+void test_small_read(void) {
+  int buffer[10];
+  buffer[5] = 42;
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+clang_analyzer_dump(buffer[5]); // expected-warning{{42 S32b}}
+if (1 == fread(buffer, sizeof(int), 5, fp)) {
+  clang_analyzer_dump(buffer[5]); // expected-warning{{42 S32b}}
+}
+fclose(fp);
+  }
+}
+
+void test_partial_elements_read(void) {
+  clang_analyzer_dump(sizeof(int)); // expected-warning {{4 S32b}}
+
+  int buffer[100];
+  buffer[0] = 1;
+  buffer[1] = 2;
+  buffer[2] = 3;
+  buffer[3] = 4;
+  buffer[4] = 5;
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+// 3*5: 15 bytes read; which is not exactly 4 integers, thus we invalidate 
the whole buffer.

balazske wrote:

This changes the check for uninitialized `c[4+13]`? But probably only indexes 
4, 8, 12, 16 in `c` (start of the integer values) are marked as initialized, 
and c[4+9] would be uninitialized too.

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


[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

2024-06-07 Thread Jakub Kuderski via cfe-commits


@@ -1499,16 +1521,18 @@ static void tcSetLeastSignificantBits(APInt::WordType 
*dst, unsigned parts,
 /* Handle overflow.  Sign is preserved.  We either become infinity or
the largest finite number.  */
 IEEEFloat::opStatus IEEEFloat::handleOverflow(roundingMode rounding_mode) {
-  /* Infinity?  */
-  if (rounding_mode == rmNearestTiesToEven ||
-  rounding_mode == rmNearestTiesToAway ||
-  (rounding_mode == rmTowardPositive && !sign) ||
-  (rounding_mode == rmTowardNegative && sign)) {
-if (semantics->nonFiniteBehavior == fltNonfiniteBehavior::NanOnly)
-  makeNaN(false, sign);
-else
-  category = fcInfinity;
-return (opStatus) (opOverflow | opInexact);
+  if (semantics->nonFiniteBehavior != fltNonfiniteBehavior::NoNanInf) {
+/* Infinity?  */
+if (rounding_mode == rmNearestTiesToEven ||
+rounding_mode == rmNearestTiesToAway ||
+(rounding_mode == rmTowardPositive && !sign) ||
+(rounding_mode == rmTowardNegative && sign)) {
+  if (semantics->nonFiniteBehavior == fltNonfiniteBehavior::NanOnly)
+makeNaN(false, sign);
+  else
+category = fcInfinity;
+  return (opStatus)(opOverflow | opInexact);

kuhar wrote:

nit: prefer `static_cast`

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


[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

2024-06-07 Thread Jakub Kuderski via cfe-commits


@@ -68,6 +68,10 @@ enum class fltNonfiniteBehavior {
   // `fltNanEncoding` enum. We treat all NaNs as quiet, as the available
   // encodings do not distinguish between signalling and quiet NaN.
   NanOnly,
+
+  // This behavior is present in Float6E3M2FN and Float6E2M3FN types.
+  // There is no representation for Inf or NaN.
+  NoNanInf,

kuhar wrote:

nit:
```suggestion
  // This behavior is present in Float6E3M2FN and Float6E2M3FN types,
  // which do not support Inf or NaN values.
  NoNanInf,
```
also, is there a standard name for such FP types? Maybe `Finite` or would that 
be too overloaded?


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


[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

2024-06-07 Thread Jakub Kuderski via cfe-commits


@@ -878,6 +896,10 @@ void IEEEFloat::copySignificand(const IEEEFloat ) {
for the significand.  If double or longer, this is a signalling NaN,
which may not be ideal.  If float, this is QNaN(0).  */
 void IEEEFloat::makeNaN(bool SNaN, bool Negative, const APInt *fill) {
+  if (semantics->nonFiniteBehavior == fltNonfiniteBehavior::NoNanInf) {
+assert(false && "This floating point format does not support NaN\n");
+return;

kuhar wrote:

Also no `\n`

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


[clang] [clang] always use resolved arguments for default argument deduction (PR #94756)

2024-06-07 Thread Krystian Stasiowski via cfe-commits

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

LGTM

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


[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-07 Thread Matheus Izvekov via cfe-commits


@@ -390,29 +390,37 @@ bool Sema::isAcceptableNestedNameSpecifier(const 
NamedDecl *SD,
 /// (e.g., Base::), perform name lookup for that identifier as a
 /// nested-name-specifier within the given scope, and return the result of that
 /// name lookup.
-NamedDecl *Sema::FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS) 
{
-  if (!S || !NNS)
-return nullptr;
+bool Sema::LookupFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS,
+   UnresolvedSetImpl ) {
+  if (!S)
+return false;
 
   while (NNS->getPrefix())
 NNS = NNS->getPrefix();
 
-  if (NNS->getKind() != NestedNameSpecifier::Identifier)
-return nullptr;
-
-  LookupResult Found(*this, NNS->getAsIdentifier(), SourceLocation(),
- LookupNestedNameSpecifierName);
+  // FIXME: This is a rather nasty hack! Ideally we should get the results

mizvekov wrote:

I don't think this is a hack per se, I think this is just a consequence of not 
having a special NNS kind for this situation, and representing it with a DTST.

The alternative that I see is to implement a new NNS prefix which is composed 
by an identifier followed by template arguments.

It can still be represented internally with the type, if that's cheaper, but 
having a special accessor, and making `NNS->getAsIdentifier()` work for it, 
would be nicer.

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


[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-07 Thread Matheus Izvekov via cfe-commits


@@ -548,6 +575,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, 
NestedNameSpecInfo ,
 // Perform unqualified name lookup in the current scope.
 LookupName(Found, S);
   }
+#endif

mizvekov wrote:

A left-over.

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


[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-07 Thread Matheus Izvekov via cfe-commits

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

LGTM save a few minor cleanups needed.

I think this patch has an incredible amount of noise due to amount of cosmetic 
changes caused by reformatting, specially due to changing parameters and such.

This is fine for now and I am not suggesting you go back and do it for this 
patch, but I think it would have been helpful to pre-clang-format the file, and 
offload more of the minor changes into a previous patch.

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


[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-07 Thread Matheus Izvekov via cfe-commits


@@ -2923,10 +2920,9 @@ class TreeTransform {
 }
 
 return getSema().BuildMemberReferenceExpr(Base, BaseType, OpLoc, isArrow,
-  SS, TemplateKWLoc,
-  FirstQualifierInScope,
-  R, ExplicitTemplateArgs,
-  /*S*/nullptr);
+  SS, TemplateKWLoc, R,
+  ExplicitTemplateArgs,
+  /*S*/ nullptr);

mizvekov wrote:

```suggestion
  /*S=*/nullptr);
```

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


[clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

2024-06-07 Thread Matheus Izvekov via cfe-commits

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


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)

2024-06-07 Thread Nikolas Klauser via llvm-branch-commits

philnik777 wrote:

@EricWF When switching to `__libcpp_operator_{new,delete}` everything gets 
compiled exactly the same on my system. Could you disclose which test you used 
for this code? You also claim that the `__pointer_int_pair` causes the 
optimizer to lose track of the function pointer causing the call to not be 
elided, but I can't see any calls other than `new` and `delete` in the code you 
posted either.

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


[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits




jcsxky wrote:

crash on trunk assertion.

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


[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits

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


[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits
+}
diff --git a/clang/test/SemaTemplate/PR91677.cpp 
b/clang/test/SemaTemplate/PR91677.cpp
new file mode 100644
index 0..cc8db60a438ea
--- /dev/null
+++ b/clang/test/SemaTemplate/PR91677.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -verify -std=c++20 -fsyntax-only %s
+// expected-no-diagnostics
+
+template  struct t1 {
+  template 
+  struct t2 {};
+};
+
+template 
+t1::template t2 f1();
+
+void f2() {
+  f1();
+}
diff --git a/clang/test/SemaTemplate/instantiate-scope.cpp 
b/clang/test/SemaTemplate/instantiate-scope.cpp
index 733105674b7a4..3a1708a695ceb 100644
--- a/clang/test/SemaTemplate/instantiate-scope.cpp
+++ b/clang/test/SemaTemplate/instantiate-scope.cpp
@@ -11,10 +11,10 @@ template using A = T;
 // These definitions are OK, X...> is equivalent to X
 // so this defines the member of the primary template.
 template
-void X...>::f(int) {} // expected-error {{undeclared}}
+void X...>::f(int) {} // expected-error {{use of 
undeclared identifier 'f'}}
 
 template
-int X...>::n = 0; // expected-error {{undeclared}}
+int X...>::n = 0; // expected-error {{use of undeclared 
identifier 'f'}}
 
 struct Y {}; void f(Y);
 
@@ -25,6 +25,6 @@ void g() {
 
   // Error, substitution fails; this should not be treated as a SFINAE-able
   // condition, so we don't select X::f(...).
-  X().f(0); // expected-note {{instantiation of}}
-  X::n = 1; // expected-note {{instantiation of}}
+  X().f(0); // expected-note {{in instantiation of member function 
'X::f' requested here}}
+  X::n = 1; // expected-note {{in instantiation of static data member 
'X::n' requested here}}
 }
diff --git a/clang/test/SemaTemplate/typename-specifier-3.cpp 
b/clang/test/SemaTemplate/typename-specifier-3.cpp
index 714830f0032d2..40f9430386773 100644
--- a/clang/test/SemaTemplate/typename-specifier-3.cpp
+++ b/clang/test/SemaTemplate/typename-specifier-3.cpp
@@ -28,16 +28,17 @@ namespace PR12884_original {
   typedef int arg;
 };
 struct C {
-  typedef B::X x; // precxx17-warning{{missing 'typename' 
prior to dependent type name B::X; implicit 'typename' is a C++20 extension}}
+  typedef B::X x; // precxx17-warning{{missing 'typename' 
prior to dependent type name B::X; implicit 'typename' is a C++20 extension}} \
+   expected-error{{typename specifier 
refers to non-type member 'arg' in 'PR12884_original::A::B'}}
 };
   };
 
   template <> struct A::B {
 template  struct X {};
-static const int arg = 0;
+static const int arg = 0; // expected-note{{referenced member 'arg' is 
declared here}}
   };
 
-  A::C::x a;
+  A::C::x a; // expected-note{{in instantiation of member class 
'PR12884_original::A::C' requested here}}
 }
 namespace PR12884_half_fixed {
   template  struct A {

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


[clang] [Clang][Sema] qualifier should be transformed (PR #94725)

2024-06-07 Thread Qizhi Hu via cfe-commits
\ No newline at end of file
diff --git a/clang/test/SemaTemplate/PR91677.cpp 
b/clang/test/SemaTemplate/PR91677.cpp
new file mode 100644
index 0..cc8db60a438ea
--- /dev/null
+++ b/clang/test/SemaTemplate/PR91677.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -verify -std=c++20 -fsyntax-only %s
+// expected-no-diagnostics
+
+template  struct t1 {
+  template 
+  struct t2 {};
+};
+
+template 
+t1::template t2 f1();
+
+void f2() {
+  f1();
+}
diff --git a/clang/test/SemaTemplate/instantiate-scope.cpp 
b/clang/test/SemaTemplate/instantiate-scope.cpp
index 733105674b7a4..3a1708a695ceb 100644
--- a/clang/test/SemaTemplate/instantiate-scope.cpp
+++ b/clang/test/SemaTemplate/instantiate-scope.cpp
@@ -11,10 +11,10 @@ template using A = T;
 // These definitions are OK, X...> is equivalent to X
 // so this defines the member of the primary template.
 template
-void X...>::f(int) {} // expected-error {{undeclared}}
+void X...>::f(int) {} // expected-error {{use of 
undeclared identifier 'f'}}
 
 template
-int X...>::n = 0; // expected-error {{undeclared}}
+int X...>::n = 0; // expected-error {{use of undeclared 
identifier 'f'}}
 
 struct Y {}; void f(Y);
 
@@ -25,6 +25,6 @@ void g() {
 
   // Error, substitution fails; this should not be treated as a SFINAE-able
   // condition, so we don't select X::f(...).
-  X().f(0); // expected-note {{instantiation of}}
-  X::n = 1; // expected-note {{instantiation of}}
+  X().f(0); // expected-note {{in instantiation of member function 
'X::f' requested here}}
+  X::n = 1; // expected-note {{in instantiation of static data member 
'X::n' requested here}}
 }
diff --git a/clang/test/SemaTemplate/typename-specifier-3.cpp 
b/clang/test/SemaTemplate/typename-specifier-3.cpp
index 714830f0032d2..40f9430386773 100644
--- a/clang/test/SemaTemplate/typename-specifier-3.cpp
+++ b/clang/test/SemaTemplate/typename-specifier-3.cpp
@@ -28,16 +28,17 @@ namespace PR12884_original {
   typedef int arg;
 };
 struct C {
-  typedef B::X x; // precxx17-warning{{missing 'typename' 
prior to dependent type name B::X; implicit 'typename' is a C++20 extension}}
+  typedef B::X x; // precxx17-warning{{missing 'typename' 
prior to dependent type name B::X; implicit 'typename' is a C++20 extension}} \
+   expected-error{{typename specifier 
refers to non-type member 'arg' in 'PR12884_original::A::B'}}
 };
   };
 
   template <> struct A::B {
 template  struct X {};
-static const int arg = 0;
+static const int arg = 0; // expected-note{{referenced member 'arg' is 
declared here}}
   };
 
-  A::C::x a;
+  A::C::x a; // expected-note{{in instantiation of member class 
'PR12884_original::A::C' requested here}}
 }
 namespace PR12884_half_fixed {
   template  struct A {

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


[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balázs Kéri via cfe-commits
ad.
+if (1 == fread(, sizeof(s.b), 1, fp)) {
+  long p = s.b;
+  clang_analyzer_isTainted(p); // expected-warning {{YES}}
+  clang_analyzer_dump(p); // expected-warning {{conj_}}
+} else {
+  long p = s.b;
+  clang_analyzer_isTainted(p); // expected-warning {{YES}}
+  clang_analyzer_dump(p); // expected-warning {{conj_}}
+}
+fclose(fp);
+  }
+}
+
+void compound_read2(void) {
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+struct S s; // s.a is not touched by fread.
+if (1 == fread(, sizeof(s.b), 1, fp)) {
+  long p = s.a; // expected-warning {{Assigned value is garbage or 
undefined}}
+} else {
+  long p = s.a; // expected-warning {{Assigned value is garbage or 
undefined}}
+}
+fclose(fp);
+  }
+}
+
+void var_read(void) {
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+int a, b; // 'a' is not touched by fread.
+if (1 == fread(, sizeof(b), 1, fp)) {
+  long p = a; // expected-warning{{Assigned value is garbage or undefined}}
+} else {
+  long p = a; // expected-warning{{Assigned value is garbage or undefined}}
+}
+fclose(fp);
+  }
+}
+
+// When reading a lot of data, invalidating all elements is too time-consuming.
+// Instead, the knowledge of the whole array is lost.
+#define MaxInvalidatedElementRegion 64 // See StreamChecker::evalFreadFwrite 
in StreamChecker.cpp.
+#define PastMaxComplexity MaxInvalidatedElementRegion + 1
+void test_large_read(void) {
+  int buffer[PastMaxComplexity + 1];
+  buffer[PastMaxComplexity] = 42;
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+if (buffer[PastMaxComplexity] != 42) {
+  clang_analyzer_warnIfReached(); // Unreachable.
+}
+if (1 == fread(buffer, sizeof(int), PastMaxComplexity, fp)) {
+  if (buffer[PastMaxComplexity] != 42) {
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  }
+}
+fclose(fp);
+  }
+}
+
+void test_small_read(void) {
+  int buffer[10];
+  buffer[5] = 42;
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+clang_analyzer_dump(buffer[5]); // expected-warning{{42 S32b}}
+if (1 == fread(buffer, sizeof(int), 5, fp)) {
+  clang_analyzer_dump(buffer[5]); // expected-warning{{42 S32b}}
+}
+fclose(fp);
+  }
+}
+
+void test_partial_elements_read(void) {
+  clang_analyzer_dump(sizeof(int)); // expected-warning {{4 S32b}}
+
+  int buffer[100];
+  buffer[0] = 1;
+  buffer[1] = 2;
+  buffer[2] = 3;
+  buffer[3] = 4;
+  buffer[4] = 5;
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+// 3*5: 15 bytes read; which is not exactly 4 integers, thus we invalidate 
the whole buffer.

balazske wrote:

I meant to add a `buffer[5] = 6;` at the begin and use 
`clang_analyzer_dump(buffer[5]);` after the read. If a value is initialized 
before the read it should not change to uninitialized.

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


[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

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


@@ -878,6 +896,10 @@ void IEEEFloat::copySignificand(const IEEEFloat ) {
for the significand.  If double or longer, this is a signalling NaN,
which may not be ideal.  If float, this is QNaN(0).  */
 void IEEEFloat::makeNaN(bool SNaN, bool Negative, const APInt *fill) {
+  if (semantics->nonFiniteBehavior == fltNonfiniteBehavior::NoNanInf) {
+assert(false && "This floating point format does not support NaN\n");
+return;

arsenm wrote:

llvm_unreachable, also no dead return 

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


[clang] [clang] always use resolved arguments for default argument deduction (PR #94756)

2024-06-07 Thread Erich Keane via cfe-commits

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


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


[clang] [clang] always use resolved arguments for default argument deduction (PR #94756)

2024-06-07 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

@kadircet @yozhu FYI this fixes the problem you reported.

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


[clang] [clang] always use resolved arguments for default argument deduction (PR #94756)

2024-06-07 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Matheus Izvekov (mizvekov)


Changes

This fixes a regression introduced with the changes in 
https://github.com/llvm/llvm-project/pull/93433 around preservation of 
TemplateName sugar in template type deduction.

Since the argument side TST is non-canonical, we have to extract the arguments 
from it's canonical type.
This was done for the deduction of the TST arguments, but we missed it for the 
default arguments used in the deduction of the TST name.

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


2 Files Affected:

- (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+6-7) 
- (modified) clang/test/SemaTemplate/cwg2398.cpp (+16) 


``diff
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp 
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 1011db2d2830d..befeb38e1fe5b 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -712,13 +712,6 @@ DeduceTemplateSpecArguments(Sema , TemplateParameterList 
*TemplateParams,
 if (const auto *TD = TNA.getAsTemplateDecl(); TD && TD->isTypeAlias())
   return TemplateDeductionResult::Success;
 
-// Perform template argument deduction for the template name.
-if (auto Result =
-DeduceTemplateArguments(S, TemplateParams, TNP, TNA, Info,
-SA->template_arguments(), Deduced);
-Result != TemplateDeductionResult::Success)
-  return Result;
-
 // FIXME: To preserve sugar, the TST needs to carry sugared resolved
 // arguments.
 ArrayRef AResolved =
@@ -726,6 +719,12 @@ DeduceTemplateSpecArguments(Sema , TemplateParameterList 
*TemplateParams,
 ->castAs()
 ->template_arguments();
 
+// Perform template argument deduction for the template name.
+if (auto Result = DeduceTemplateArguments(S, TemplateParams, TNP, TNA, 
Info,
+  AResolved, Deduced);
+Result != TemplateDeductionResult::Success)
+  return Result;
+
 // Perform template argument deduction on each template
 // argument. Ignore any missing/extra arguments, since they could be
 // filled in by default arguments.
diff --git a/clang/test/SemaTemplate/cwg2398.cpp 
b/clang/test/SemaTemplate/cwg2398.cpp
index 45e74cce3a98c..f7f69e9d4268a 100644
--- a/clang/test/SemaTemplate/cwg2398.cpp
+++ b/clang/test/SemaTemplate/cwg2398.cpp
@@ -201,3 +201,19 @@ namespace consistency {
 // new-error@-1 {{ambiguous partial specializations}}
   } // namespace t2
 } // namespace consistency
+
+namespace regression1 {
+  template  struct map {};
+  template  class foo {};
+
+  template  class MapType, typename Value>
+  Value bar(MapType map);
+
+  template  class MapType, typename Value>
+  Value bar(MapType> map);
+
+  void aux() {
+map> input;
+bar(input);
+  }
+} // namespace regression1

``




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


[clang] [clang] always use resolved arguments for default argument deduction (PR #94756)

2024-06-07 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov created 
https://github.com/llvm/llvm-project/pull/94756

This fixes a regression introduced with the changes in 
https://github.com/llvm/llvm-project/pull/93433 around preservation of 
TemplateName sugar in template type deduction.

Since the argument side TST is non-canonical, we have to extract the arguments 
from it's canonical type.
This was done for the deduction of the TST arguments, but we missed it for the 
default arguments used in the deduction of the TST name.

>From df6049fd91c95e341dd80a61e5bd173ce5837131 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Fri, 7 Jun 2024 10:32:12 -0300
Subject: [PATCH] [clang] always use resolved arguments for default argument
 deduction

This fixes a regression introduced with the changes in
https://github.com/llvm/llvm-project/pull/93433 around preservation
of TemplateName sugar in template type deduction.

Since the argument side TST is non-canonical, we have to extract the
arguments from it's canonical type.
This was done for the deduction of the TST arguments, but we missed it
for the default arguments used in the deduction of the TST name.
---
 clang/lib/Sema/SemaTemplateDeduction.cpp | 13 ++---
 clang/test/SemaTemplate/cwg2398.cpp  | 16 
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp 
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 1011db2d2830d..befeb38e1fe5b 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -712,13 +712,6 @@ DeduceTemplateSpecArguments(Sema , TemplateParameterList 
*TemplateParams,
 if (const auto *TD = TNA.getAsTemplateDecl(); TD && TD->isTypeAlias())
   return TemplateDeductionResult::Success;
 
-// Perform template argument deduction for the template name.
-if (auto Result =
-DeduceTemplateArguments(S, TemplateParams, TNP, TNA, Info,
-SA->template_arguments(), Deduced);
-Result != TemplateDeductionResult::Success)
-  return Result;
-
 // FIXME: To preserve sugar, the TST needs to carry sugared resolved
 // arguments.
 ArrayRef AResolved =
@@ -726,6 +719,12 @@ DeduceTemplateSpecArguments(Sema , TemplateParameterList 
*TemplateParams,
 ->castAs()
 ->template_arguments();
 
+// Perform template argument deduction for the template name.
+if (auto Result = DeduceTemplateArguments(S, TemplateParams, TNP, TNA, 
Info,
+  AResolved, Deduced);
+Result != TemplateDeductionResult::Success)
+  return Result;
+
 // Perform template argument deduction on each template
 // argument. Ignore any missing/extra arguments, since they could be
 // filled in by default arguments.
diff --git a/clang/test/SemaTemplate/cwg2398.cpp 
b/clang/test/SemaTemplate/cwg2398.cpp
index 45e74cce3a98c..f7f69e9d4268a 100644
--- a/clang/test/SemaTemplate/cwg2398.cpp
+++ b/clang/test/SemaTemplate/cwg2398.cpp
@@ -201,3 +201,19 @@ namespace consistency {
 // new-error@-1 {{ambiguous partial specializations}}
   } // namespace t2
 } // namespace consistency
+
+namespace regression1 {
+  template  struct map {};
+  template  class foo {};
+
+  template  class MapType, typename Value>
+  Value bar(MapType map);
+
+  template  class MapType, typename Value>
+  Value bar(MapType> map);
+
+  void aux() {
+map> input;
+bar(input);
+  }
+} // namespace regression1

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


[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

2024-06-07 Thread Durgadoss R via cfe-commits
28, NegLargest.convertToFloat());
+  APFloat PosSmallest =
+  APFloat::getSmallestNormalized(APFloat::Float6E3M2FN(), false);
+  EXPECT_EQ(0x1p-2, PosSmallest.convertToFloat());
+  APFloat NegSmallest =
+  APFloat::getSmallestNormalized(APFloat::Float6E3M2FN(), true);
+  EXPECT_EQ(-0x1p-2, NegSmallest.convertToFloat());
+
+  APFloat SmallestDenorm = APFloat::getSmallest(APFloat::Float6E3M2FN(), 
false);
+  EXPECT_TRUE(SmallestDenorm.isDenormal());
+  EXPECT_EQ(0x0.1p0, SmallestDenorm.convertToFloat());
+}
+
+TEST(APFloatTest, Float6E2M3FNToFloat) {
+  APFloat PosZero = APFloat::getZero(APFloat::Float6E2M3FN());
+  APFloat PosZeroToFloat(PosZero.convertToFloat());
+  EXPECT_TRUE(PosZeroToFloat.isPosZero());
+  APFloat NegZero = APFloat::getZero(APFloat::Float6E2M3FN(), true);
+  APFloat NegZeroToFloat(NegZero.convertToFloat());
+  EXPECT_TRUE(NegZeroToFloat.isNegZero());
+
+  APFloat One(APFloat::Float6E2M3FN(), "1.0");
+  EXPECT_EQ(1.0F, One.convertToFloat());
+  APFloat Two(APFloat::Float6E2M3FN(), "2.0");
+  EXPECT_EQ(2.0F, Two.convertToFloat());
+
+  APFloat PosLargest = APFloat::getLargest(APFloat::Float6E2M3FN(), false);
+  EXPECT_EQ(7.5, PosLargest.convertToFloat());
+  APFloat NegLargest = APFloat::getLargest(APFloat::Float6E2M3FN(), true);
+  EXPECT_EQ(-7.5, NegLargest.convertToFloat());
+  APFloat PosSmallest =
+  APFloat::getSmallestNormalized(APFloat::Float6E2M3FN(), false);
+  EXPECT_EQ(0x1p0, PosSmallest.convertToFloat());
+  APFloat NegSmallest =
+  APFloat::getSmallestNormalized(APFloat::Float6E2M3FN(), true);
+  EXPECT_EQ(-0x1p0, NegSmallest.convertToFloat());
+
+  APFloat SmallestDenorm = APFloat::getSmallest(APFloat::Float6E2M3FN(), 
false);
+  EXPECT_TRUE(SmallestDenorm.isDenormal());
+  EXPECT_EQ(0x0.2p0, SmallestDenorm.convertToFloat());
+}
 } // namespace

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


[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

2024-06-07 Thread Durgadoss R via cfe-commits


@@ -1881,6 +1890,20 @@ TEST(APFloatTest, getSmallest) {
   EXPECT_TRUE(test.isFiniteNonZero());
   EXPECT_TRUE(test.isDenormal());
   EXPECT_TRUE(test.bitwiseIsEqual(expected));
+
+  test = APFloat::getSmallest(APFloat::Float6E3M2FN(), false);
+  expected = APFloat(APFloat::Float6E3M2FN(), "0x0.1p0");
+  EXPECT_FALSE(test.isNegative());
+  EXPECT_TRUE(test.isFiniteNonZero());
+  EXPECT_TRUE(test.isDenormal());
+  EXPECT_TRUE(test.bitwiseIsEqual(expected));
+
+  test = APFloat::getSmallest(APFloat::Float6E2M3FN(), false);
+  expected = APFloat(APFloat::Float6E2M3FN(), "0x0.2p0");
+  EXPECT_FALSE(test.isNegative());
+  EXPECT_TRUE(test.isFiniteNonZero());
+  EXPECT_TRUE(test.isDenormal());
+  EXPECT_TRUE(test.bitwiseIsEqual(expected));
 }
 

durga4github wrote:

Yes, the getZero test is added below.
We have added tests for get{Zero/Largest/Smallest/SmallestNormalized} and 
negative tests for get{Nan/Inf} cases.

Please let me know if I am still missing something.


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


[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

2024-06-07 Thread Durgadoss R via cfe-commits


@@ -47,6 +47,10 @@ static std::string convertToString(double d, unsigned Prec, 
unsigned Pad,
   return std::string(Buffer.data(), Buffer.size());
 }
 
+static bool hasNanOrInf(APFloat::Semantics S) {
+  return (S != APFloat::S_Float6E3M2FN) && (S != APFloat::S_Float6E2M3FN);
+}

durga4github wrote:

Sure, moved it as a static-helper inside APFloat and using that here

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


[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

2024-06-07 Thread Durgadoss R via cfe-commits
 EXPECT_EQ(-28, NegLargest.convertToFloat());
+  APFloat PosSmallest =
+  APFloat::getSmallestNormalized(APFloat::Float6E3M2FN(), false);
+  EXPECT_EQ(0x1p-2, PosSmallest.convertToFloat());
+  APFloat NegSmallest =
+  APFloat::getSmallestNormalized(APFloat::Float6E3M2FN(), true);
+  EXPECT_EQ(-0x1p-2, NegSmallest.convertToFloat());
+
+  APFloat SmallestDenorm = APFloat::getSmallest(APFloat::Float6E3M2FN(), 
false);
+  EXPECT_TRUE(SmallestDenorm.isDenormal());
+  EXPECT_EQ(0x0.1p0, SmallestDenorm.convertToFloat());
+}
+
+TEST(APFloatTest, Float6E2M3FNToFloat) {
+  APFloat PosZero = APFloat::getZero(APFloat::Float6E2M3FN());
+  APFloat PosZeroToFloat(PosZero.convertToFloat());
+  EXPECT_TRUE(PosZeroToFloat.isPosZero());
+  APFloat NegZero = APFloat::getZero(APFloat::Float6E2M3FN(), true);
+  APFloat NegZeroToFloat(NegZero.convertToFloat());
+  EXPECT_TRUE(NegZeroToFloat.isNegZero());
+
+  APFloat One(APFloat::Float6E2M3FN(), "1.0");
+  EXPECT_EQ(1.0F, One.convertToFloat());
+  APFloat Two(APFloat::Float6E2M3FN(), "2.0");
+  EXPECT_EQ(2.0F, Two.convertToFloat());
+
+  APFloat PosLargest = APFloat::getLargest(APFloat::Float6E2M3FN(), false);
+  EXPECT_EQ(7.5, PosLargest.convertToFloat());
+  APFloat NegLargest = APFloat::getLargest(APFloat::Float6E2M3FN(), true);
+  EXPECT_EQ(-7.5, NegLargest.convertToFloat());
+  APFloat PosSmallest =
+  APFloat::getSmallestNormalized(APFloat::Float6E2M3FN(), false);
+  EXPECT_EQ(0x1p0, PosSmallest.convertToFloat());
+  APFloat NegSmallest =
+  APFloat::getSmallestNormalized(APFloat::Float6E2M3FN(), true);
+  EXPECT_EQ(-0x1p0, NegSmallest.convertToFloat());
+
+  APFloat SmallestDenorm = APFloat::getSmallest(APFloat::Float6E2M3FN(), 
false);
+  EXPECT_TRUE(SmallestDenorm.isDenormal());
+  EXPECT_EQ(0x0.2p0, SmallestDenorm.convertToFloat());
+}
 } // namespace

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


[clang] [Clang] Add timeout for GPU detection utilities (PR #94751)

2024-06-07 Thread Joseph Huber via cfe-commits

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


[clang] 2981f3a - [Clang] Add timeout for GPU detection utilities (#94751)

2024-06-07 Thread via cfe-commits

Author: Joseph Huber
Date: 2024-06-07T08:45:35-05:00
New Revision: 2981f3a284302bb12b292bcf09e7e09ae2eb696a

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

LOG: [Clang] Add timeout for GPU detection utilities (#94751)

Summary:
The utilities `nvptx-arch` and `amdgpu-arch` are used to support
`--offload-arch=native` among other utilities in clang. However, these
rely on the GPU drivers to query the features. In certain cases these
drivers can become locked up, which will lead to indefinate hangs on any
compiler jobs running in the meantime.

This patch adds a ten second timeout period for these utilities before
it kills the job and errors out.

Added: 


Modified: 
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/AMDGPU.cpp
clang/lib/Driver/ToolChains/Cuda.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index a4f9cad98aa8b..9789cfacafd78 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -205,7 +205,8 @@ class ToolChain {
 
   /// Executes the given \p Executable and returns the stdout.
   llvm::Expected>
-  executeToolChainProgram(StringRef Executable) const;
+  executeToolChainProgram(StringRef Executable,
+  unsigned SecondsToWait = 0) const;
 
   void setTripleEnvironment(llvm::Triple::EnvironmentType Env);
 

diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 0e86bc07e0ea2..40ab2e91125d1 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -104,7 +104,8 @@ ToolChain::ToolChain(const Driver , const llvm::Triple ,
 }
 
 llvm::Expected>
-ToolChain::executeToolChainProgram(StringRef Executable) const {
+ToolChain::executeToolChainProgram(StringRef Executable,
+   unsigned SecondsToWait) const {
   llvm::SmallString<64> OutputFile;
   llvm::sys::fs::createTemporaryFile("toolchain-program", "txt", OutputFile);
   llvm::FileRemover OutputRemover(OutputFile.c_str());
@@ -115,9 +116,8 @@ ToolChain::executeToolChainProgram(StringRef Executable) 
const {
   };
 
   std::string ErrorMessage;
-  if (llvm::sys::ExecuteAndWait(Executable, {}, {}, Redirects,
-/* SecondsToWait */ 0,
-/*MemoryLimit*/ 0, ))
+  if (llvm::sys::ExecuteAndWait(Executable, {}, {}, Redirects, SecondsToWait,
+/*MemoryLimit=*/0, ))
 return llvm::createStringError(std::error_code(),
Executable + ": " + ErrorMessage);
 

diff  --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp 
b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 9ffea57b005de..11a98a0ec314d 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -877,7 +877,7 @@ AMDGPUToolChain::getSystemGPUArchs(const ArgList ) 
const {
   else
 Program = GetProgramPath("amdgpu-arch");
 
-  auto StdoutOrErr = executeToolChainProgram(Program);
+  auto StdoutOrErr = executeToolChainProgram(Program, /*SecondsToWait=*/10);
   if (!StdoutOrErr)
 return StdoutOrErr.takeError();
 

diff  --git a/clang/lib/Driver/ToolChains/Cuda.cpp 
b/clang/lib/Driver/ToolChains/Cuda.cpp
index bbc8be91fd70b..2dfc7457b0ac7 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -826,7 +826,7 @@ NVPTXToolChain::getSystemGPUArchs(const ArgList ) 
const {
   else
 Program = GetProgramPath("nvptx-arch");
 
-  auto StdoutOrErr = executeToolChainProgram(Program);
+  auto StdoutOrErr = executeToolChainProgram(Program, /*SecondsToWait=*/10);
   if (!StdoutOrErr)
 return StdoutOrErr.takeError();
 


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


[clang] [libcxx] [clang] Preserve Qualifiers and type sugar in TemplateNames (PR #93433)

2024-06-07 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

> so after this patch, clang seems to be crashing on:

Thanks for the reproducer. Yeah this is about default argument deduction, which 
doesn't involve default arguments as written in source.

I confirm the crash and it's indeed caused by changes in this patch. The fix is 
very simple and I will be posting a patch shortly.



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


[clang] [Clang] Add timeout for GPU detection utilities (PR #94751)

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

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


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


[clang] Testing32 bit for https://github.com/llvm/llvm-project/pull/92083 (PR #94603)

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

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


[clang] [clang][CodeComplete] Omit ExplicitObject when completing code (PR #92743)

2024-06-07 Thread kadir çetinkaya via cfe-commits

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


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


branch wip-wget deleted (was e781fc526f)

2024-06-07 Thread guix-commits
andreas pushed a change to branch wip-wget
in repository guix.

 was e781fc526f gnu: wget: Update to 1.21.4.

This change permanently discards the following revisions:

 discard e781fc526f gnu: wget: Update to 1.21.4.



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

2024-06-07 Thread Erich Keane via cfe-commits

erichkeane wrote:

I see the 2nds commit doesn't add any tests!  Please make it do so, else LGTM 
(plus might want to do a 'merge' commit to reset the CI to a more stable state).

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


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

2024-06-07 Thread Erich Keane via lldb-commits

erichkeane wrote:

I see the 2nds commit doesn't add any tests!  Please make it do so, else LGTM 
(plus might want to do a 'merge' commit to reset the CI to a more stable state).

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


[tianocore/edk2] df8c61: CryptoPkg: Fix BaseCryptLib CrtWrapper strcpy

2024-06-07 Thread Sebastian Witt via edk2-commits
  Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: df8c61e4c071d1c6ab04e3ebeeb07cf97fc893e0
  
https://github.com/tianocore/edk2/commit/df8c61e4c071d1c6ab04e3ebeeb07cf97fc893e0
  Author: Sebastian Witt 
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
M CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c

  Log Message:
  ---
  CryptoPkg: Fix BaseCryptLib CrtWrapper strcpy

strcpy fails when strSource is closer than 4096 bytes after strDest.

This is caused by an overlap check in AsciiStrCpyS:
  //
  // 5. Copying shall not take place between objects that overlap.
  //
  SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoAsciiStrOverlap
  (Destination, DestMax, (CHAR8 *)Source, SourceLen + 1),
  RETURN_ACCESS_DENIED);

Since DestMax is MAX_STRING_SIZE (0x1000) and with a Source
that is in this area behind Destination, AsciiStrCpyS will fail
and strcpy will do nothing.

When called by CRYPTO_strdup in openssl this leads to uninitialzed
memory that gets accessed instead of the copied string.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2817

Signed-off-by: Sebastian Witt 


  Commit: 948f23417010309a5557d46195eae258f6105025
  
https://github.com/tianocore/edk2/commit/948f23417010309a5557d46195eae258f6105025
  Author: Sebastian Witt 
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
M CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
M CryptoPkg/Library/Include/CrtLibSupport.h

  Log Message:
  ---
  CryptoPkg: Fix BaseCryptLib CrtWrapper strncpy and strcat

Following https://bugzilla.tianocore.org/show_bug.cgi?id=2817 this
bug could also apply to strncpy and strcat.

For strncpy use count+1 if smaller than MAX_STRING_SIZE. This still
restricts the destination size to MAX_STRING_SIZE as before but allows
a strncpy when the source is close after destination without triggering
the InternalSafeStringNoAsciiStrOverlap check in AsciiStrnCpyS.

For strcat use the destination string length + the size of the source
string including the terminator as destination size if smaller than
MAX_STRING_SIZE.

Also move both functions to CrtWrapper.c as they do not return the
correct return value. AsciiStrnCpyS and AsciiStrCatS return
RETURN_VALUE instead of a char * to the destination buffer.

Signed-off-by: Sebastian Witt 


Compare: https://github.com/tianocore/edk2/compare/8c826be35c73...948f23417010

To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


___
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits


[clang] [Clang] Add timeout for GPU detection utilities (PR #94751)

2024-06-07 Thread Joseph Huber via cfe-commits

https://github.com/jhuber6 updated 
https://github.com/llvm/llvm-project/pull/94751

>From 0e367c72a1cc163fd781f98b9fac809d90f4beb7 Mon Sep 17 00:00:00 2001
From: Joseph Huber 
Date: Fri, 7 Jun 2024 08:15:06 -0500
Subject: [PATCH] [Clang] Add timeout for GPU detection utilities

Summary:
The utilities `nvptx-arch` and `amdgpu-arch` are used to support
`--offload-arch=native` among other utilities in clang. However, these
rely on the GPU drivers to query the features. In certain cases these
drivers can become locked up, which will lead to indefinate hangs on any
compiler jobs running in the meantime.

This patch adds a ten second timeout period for these utilities before
it kills the job and errors out.
---
 clang/include/clang/Driver/ToolChain.h | 3 ++-
 clang/lib/Driver/ToolChain.cpp | 8 
 clang/lib/Driver/ToolChains/AMDGPU.cpp | 2 +-
 clang/lib/Driver/ToolChains/Cuda.cpp   | 2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index a4f9cad98aa8b..9789cfacafd78 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -205,7 +205,8 @@ class ToolChain {
 
   /// Executes the given \p Executable and returns the stdout.
   llvm::Expected>
-  executeToolChainProgram(StringRef Executable) const;
+  executeToolChainProgram(StringRef Executable,
+  unsigned SecondsToWait = 0) const;
 
   void setTripleEnvironment(llvm::Triple::EnvironmentType Env);
 
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 0e86bc07e0ea2..40ab2e91125d1 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -104,7 +104,8 @@ ToolChain::ToolChain(const Driver , const llvm::Triple ,
 }
 
 llvm::Expected>
-ToolChain::executeToolChainProgram(StringRef Executable) const {
+ToolChain::executeToolChainProgram(StringRef Executable,
+   unsigned SecondsToWait) const {
   llvm::SmallString<64> OutputFile;
   llvm::sys::fs::createTemporaryFile("toolchain-program", "txt", OutputFile);
   llvm::FileRemover OutputRemover(OutputFile.c_str());
@@ -115,9 +116,8 @@ ToolChain::executeToolChainProgram(StringRef Executable) 
const {
   };
 
   std::string ErrorMessage;
-  if (llvm::sys::ExecuteAndWait(Executable, {}, {}, Redirects,
-/* SecondsToWait */ 0,
-/*MemoryLimit*/ 0, ))
+  if (llvm::sys::ExecuteAndWait(Executable, {}, {}, Redirects, SecondsToWait,
+/*MemoryLimit=*/0, ))
 return llvm::createStringError(std::error_code(),
Executable + ": " + ErrorMessage);
 
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp 
b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 9ffea57b005de..11a98a0ec314d 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -877,7 +877,7 @@ AMDGPUToolChain::getSystemGPUArchs(const ArgList ) 
const {
   else
 Program = GetProgramPath("amdgpu-arch");
 
-  auto StdoutOrErr = executeToolChainProgram(Program);
+  auto StdoutOrErr = executeToolChainProgram(Program, /*SecondsToWait=*/10);
   if (!StdoutOrErr)
 return StdoutOrErr.takeError();
 
diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp 
b/clang/lib/Driver/ToolChains/Cuda.cpp
index bbc8be91fd70b..2dfc7457b0ac7 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -826,7 +826,7 @@ NVPTXToolChain::getSystemGPUArchs(const ArgList ) 
const {
   else
 Program = GetProgramPath("nvptx-arch");
 
-  auto StdoutOrErr = executeToolChainProgram(Program);
+  auto StdoutOrErr = executeToolChainProgram(Program, /*SecondsToWait=*/10);
   if (!StdoutOrErr)
 return StdoutOrErr.takeError();
 

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


[clang] [Sema][CTAD] Allow user defined conversion for copy-list-initialization (PR #94752)

2024-06-07 Thread Gábor Spaits via cfe-commits

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


[clang] [Clang] Add timeout for GPU detection utilities (PR #94751)

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


@@ -205,7 +205,7 @@ class ToolChain {
 
   /// Executes the given \p Executable and returns the stdout.
   llvm::Expected>
-  executeToolChainProgram(StringRef Executable) const;
+  executeToolChainProgram(StringRef Executable, unsigned Timeout = 0) const;

arsenm wrote:

Name this SecondsToWait to match ExecuteAndWait? 

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


[clang] [Clang] Add timeout for GPU detection utilities (PR #94751)

2024-06-07 Thread Joseph Huber via cfe-commits

jhuber6 wrote:

No active test because I have no clue how you would, but I intentionally made 
it time out and it returns a 'Child timed out` error as expected.

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


[clang] [Sema][CTAD] Allow user defined conversion for copy-list-initialization (PR #94752)

2024-06-07 Thread via cfe-commits
  : _M_array(__a), _M_len(__l) { }
+
+public:
+  constexpr initializer_list() noexcept
+  : _M_array(0), _M_len(0) { }
+
+
+  constexpr size_type
+  size() const noexcept { return _M_len; }
+
+
+  constexpr const_iterator
+  begin() const noexcept { return _M_array; }
+
+
+  constexpr const_iterator
+  end() const noexcept { return begin() + size(); }
+};
+
+  template
+constexpr const _Tp*
+begin(initializer_list<_Tp> __ils) noexcept
+{ return __ils.begin(); }
+
+  template
+constexpr const _Tp*
+end(initializer_list<_Tp> __ils) noexcept
+{ return __ils.end(); }
+}
+
+template
+class pair{
+private:
+T fst;
+Y snd;
+public:
+pair(T f, Y s) : fst(f), snd(s) {}
+};
+
+template
+class map {
+public:
+map(std::initializer_list>, int a = 4, int b = 5) {}
+};
+
+template
+class Contained {
+  public:
+  Contained(T, Y) {}
+};
+
+template
+class A {
+  public:
+  A(std::initializer_list >, int) {}
+};
+
+int main() {
+map mOk ={pair{5, 'a'}, {6, 'b'}, {7, 'c'}};
+map mNarrow ={pair{5, 'a'}, {6.0f, 'b'}, {7, 'c'}}; // expected-error 
{{type 'float' cannot be narrowed to 'int' in initializer list}} // 
expected-note {{insert an explicit cast to silence this issue}}
+
+A aOk = {{Contained{5, 'c'}, {5, 'c'}}, 5};
+A aNarrowNested = {{Contained{5, 'c'}, {5.0f, 'c'}}, 5}; // expected-error 
{{type 'float' cannot be narrowed to 'int' in initializer list}} // 
expected-note {{insert an explicit cast to silence this issue}}
+A aNarrow = {{Contained{5, 'c'}, {5, 'c'}}, 5.0f}; // expected-error 
{{type 'float' cannot be narrowed to 'int' in initializer list}} // 
expected-note {{insert an explicit cast to silence this issue}}
+}

``




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


[clang] [Clang] Add timeout for GPU detection utilities (PR #94751)

2024-06-07 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-backend-amdgpu

@llvm/pr-subscribers-clang-driver

Author: Joseph Huber (jhuber6)


Changes

Summary:
The utilities `nvptx-arch` and `amdgpu-arch` are used to support
`--offload-arch=native` among other utilities in clang. However, these
rely on the GPU drivers to query the features. In certain cases these
drivers can become locked up, which will lead to indefinate hangs on any
compiler jobs running in the meantime.

This patch adds a ten second timeout period for these utilities before
it kills the job and errors out.


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


4 Files Affected:

- (modified) clang/include/clang/Driver/ToolChain.h (+1-1) 
- (modified) clang/lib/Driver/ToolChain.cpp (+4-4) 
- (modified) clang/lib/Driver/ToolChains/AMDGPU.cpp (+1-1) 
- (modified) clang/lib/Driver/ToolChains/Cuda.cpp (+1-1) 


``diff
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index a4f9cad98aa8b..87a5034dfd78b 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -205,7 +205,7 @@ class ToolChain {
 
   /// Executes the given \p Executable and returns the stdout.
   llvm::Expected>
-  executeToolChainProgram(StringRef Executable) const;
+  executeToolChainProgram(StringRef Executable, unsigned Timeout = 0) const;
 
   void setTripleEnvironment(llvm::Triple::EnvironmentType Env);
 
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 0e86bc07e0ea2..8c746ac8066cb 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -104,7 +104,8 @@ ToolChain::ToolChain(const Driver , const llvm::Triple ,
 }
 
 llvm::Expected>
-ToolChain::executeToolChainProgram(StringRef Executable) const {
+ToolChain::executeToolChainProgram(StringRef Executable,
+   unsigned Timeout) const {
   llvm::SmallString<64> OutputFile;
   llvm::sys::fs::createTemporaryFile("toolchain-program", "txt", OutputFile);
   llvm::FileRemover OutputRemover(OutputFile.c_str());
@@ -115,9 +116,8 @@ ToolChain::executeToolChainProgram(StringRef Executable) 
const {
   };
 
   std::string ErrorMessage;
-  if (llvm::sys::ExecuteAndWait(Executable, {}, {}, Redirects,
-/* SecondsToWait */ 0,
-/*MemoryLimit*/ 0, ))
+  if (llvm::sys::ExecuteAndWait(Executable, {}, {}, Redirects, Timeout,
+/*MemoryLimit=*/0, ))
 return llvm::createStringError(std::error_code(),
Executable + ": " + ErrorMessage);
 
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp 
b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 9ffea57b005de..92895d8186e83 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -877,7 +877,7 @@ AMDGPUToolChain::getSystemGPUArchs(const ArgList ) 
const {
   else
 Program = GetProgramPath("amdgpu-arch");
 
-  auto StdoutOrErr = executeToolChainProgram(Program);
+  auto StdoutOrErr = executeToolChainProgram(Program, /*Timeout=*/10);
   if (!StdoutOrErr)
 return StdoutOrErr.takeError();
 
diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp 
b/clang/lib/Driver/ToolChains/Cuda.cpp
index bbc8be91fd70b..47dac0e439f10 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -826,7 +826,7 @@ NVPTXToolChain::getSystemGPUArchs(const ArgList ) 
const {
   else
 Program = GetProgramPath("nvptx-arch");
 
-  auto StdoutOrErr = executeToolChainProgram(Program);
+  auto StdoutOrErr = executeToolChainProgram(Program, /*Timeout=*/10);
   if (!StdoutOrErr)
 return StdoutOrErr.takeError();
 

``




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


[clang] [Sema][CTAD] Allow user defined conversion for copy-list-initialization (PR #94752)

2024-06-07 Thread Gábor Spaits via cfe-commits
iterator;
+  typedef const _E* const_iterator;
+
+private:
+  iterator _M_array;
+  size_type _M_len;
+
+
+  constexpr initializer_list(const_iterator __a, size_type __l)
+  : _M_array(__a), _M_len(__l) { }
+
+public:
+  constexpr initializer_list() noexcept
+  : _M_array(0), _M_len(0) { }
+
+
+  constexpr size_type
+  size() const noexcept { return _M_len; }
+
+
+  constexpr const_iterator
+  begin() const noexcept { return _M_array; }
+
+
+  constexpr const_iterator
+  end() const noexcept { return begin() + size(); }
+};
+
+  template
+constexpr const _Tp*
+begin(initializer_list<_Tp> __ils) noexcept
+{ return __ils.begin(); }
+
+  template
+constexpr const _Tp*
+end(initializer_list<_Tp> __ils) noexcept
+{ return __ils.end(); }
+}
+
+template
+class pair{
+private:
+T fst;
+Y snd;
+public:
+pair(T f, Y s) : fst(f), snd(s) {}
+};
+
+template
+class map {
+public:
+map(std::initializer_list>, int a = 4, int b = 5) {}
+};
+
+template
+class Contained {
+  public:
+  Contained(T, Y) {}
+};
+
+template
+class A {
+  public:
+  A(std::initializer_list >, int) {}
+};
+
+int main() {
+map mOk ={pair{5, 'a'}, {6, 'b'}, {7, 'c'}};
+map mNarrow ={pair{5, 'a'}, {6.0f, 'b'}, {7, 'c'}}; // expected-error 
{{type 'float' cannot be narrowed to 'int' in initializer list}} // 
expected-note {{insert an explicit cast to silence this issue}}
+
+A aOk = {{Contained{5, 'c'}, {5, 'c'}}, 5};
+A aNarrowNested = {{Contained{5, 'c'}, {5.0f, 'c'}}, 5}; // expected-error 
{{type 'float' cannot be narrowed to 'int' in initializer list}} // 
expected-note {{insert an explicit cast to silence this issue}}
+A aNarrow = {{Contained{5, 'c'}, {5, 'c'}}, 5.0f}; // expected-error 
{{type 'float' cannot be narrowed to 'int' in initializer list}} // 
expected-note {{insert an explicit cast to silence this issue}}
+}

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


[clang] [Clang] Add timeout for GPU detection utilities (PR #94751)

2024-06-07 Thread Joseph Huber via cfe-commits

https://github.com/jhuber6 created 
https://github.com/llvm/llvm-project/pull/94751

Summary:
The utilities `nvptx-arch` and `amdgpu-arch` are used to support
`--offload-arch=native` among other utilities in clang. However, these
rely on the GPU drivers to query the features. In certain cases these
drivers can become locked up, which will lead to indefinate hangs on any
compiler jobs running in the meantime.

This patch adds a ten second timeout period for these utilities before
it kills the job and errors out.


>From a7bcd6b0568b00d0cac9bf0a6f9b17ca681425f2 Mon Sep 17 00:00:00 2001
From: Joseph Huber 
Date: Fri, 7 Jun 2024 08:15:06 -0500
Subject: [PATCH] [Clang] Add timeout for GPU detection utilities

Summary:
The utilities `nvptx-arch` and `amdgpu-arch` are used to support
`--offload-arch=native` among other utilities in clang. However, these
rely on the GPU drivers to query the features. In certain cases these
drivers can become locked up, which will lead to indefinate hangs on any
compiler jobs running in the meantime.

This patch adds a ten second timeout period for these utilities before
it kills the job and errors out.
---
 clang/include/clang/Driver/ToolChain.h | 2 +-
 clang/lib/Driver/ToolChain.cpp | 8 
 clang/lib/Driver/ToolChains/AMDGPU.cpp | 2 +-
 clang/lib/Driver/ToolChains/Cuda.cpp   | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index a4f9cad98aa8b..87a5034dfd78b 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -205,7 +205,7 @@ class ToolChain {
 
   /// Executes the given \p Executable and returns the stdout.
   llvm::Expected>
-  executeToolChainProgram(StringRef Executable) const;
+  executeToolChainProgram(StringRef Executable, unsigned Timeout = 0) const;
 
   void setTripleEnvironment(llvm::Triple::EnvironmentType Env);
 
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 0e86bc07e0ea2..8c746ac8066cb 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -104,7 +104,8 @@ ToolChain::ToolChain(const Driver , const llvm::Triple ,
 }
 
 llvm::Expected>
-ToolChain::executeToolChainProgram(StringRef Executable) const {
+ToolChain::executeToolChainProgram(StringRef Executable,
+   unsigned Timeout) const {
   llvm::SmallString<64> OutputFile;
   llvm::sys::fs::createTemporaryFile("toolchain-program", "txt", OutputFile);
   llvm::FileRemover OutputRemover(OutputFile.c_str());
@@ -115,9 +116,8 @@ ToolChain::executeToolChainProgram(StringRef Executable) 
const {
   };
 
   std::string ErrorMessage;
-  if (llvm::sys::ExecuteAndWait(Executable, {}, {}, Redirects,
-/* SecondsToWait */ 0,
-/*MemoryLimit*/ 0, ))
+  if (llvm::sys::ExecuteAndWait(Executable, {}, {}, Redirects, Timeout,
+/*MemoryLimit=*/0, ))
 return llvm::createStringError(std::error_code(),
Executable + ": " + ErrorMessage);
 
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp 
b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 9ffea57b005de..92895d8186e83 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -877,7 +877,7 @@ AMDGPUToolChain::getSystemGPUArchs(const ArgList ) 
const {
   else
 Program = GetProgramPath("amdgpu-arch");
 
-  auto StdoutOrErr = executeToolChainProgram(Program);
+  auto StdoutOrErr = executeToolChainProgram(Program, /*Timeout=*/10);
   if (!StdoutOrErr)
 return StdoutOrErr.takeError();
 
diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp 
b/clang/lib/Driver/ToolChains/Cuda.cpp
index bbc8be91fd70b..47dac0e439f10 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -826,7 +826,7 @@ NVPTXToolChain::getSystemGPUArchs(const ArgList ) 
const {
   else
 Program = GetProgramPath("nvptx-arch");
 
-  auto StdoutOrErr = executeToolChainProgram(Program);
+  auto StdoutOrErr = executeToolChainProgram(Program, /*Timeout=*/10);
   if (!StdoutOrErr)
 return StdoutOrErr.takeError();
 

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


[tianocore/edk2] 20e4d9: pip: bump edk2-pytool-library from 0.21.5 to 0.21.6

2024-06-07 Thread dependabot[bot] via edk2-commits
  Branch: refs/heads/dependabot/pip/edk2-pytool-library-0.21.6
  Home:   https://github.com/tianocore/edk2
  Commit: 20e4d9c15be7719add87c389765a83e891186def
  
https://github.com/tianocore/edk2/commit/20e4d9c15be7719add87c389765a83e891186def
  Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
M pip-requirements.txt

  Log Message:
  ---
  pip: bump edk2-pytool-library from 0.21.5 to 0.21.6

Bumps [edk2-pytool-library](https://github.com/tianocore/edk2-pytool-library) 
from 0.21.5 to 0.21.6.
- [Release notes](https://github.com/tianocore/edk2-pytool-library/releases)
- 
[Commits](https://github.com/tianocore/edk2-pytool-library/compare/v0.21.5...v0.21.6)

---
updated-dependencies:
- dependency-name: edk2-pytool-library
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] 



To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


___
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits


[clang] [Clang] Substitute for the type aliases inside of a CTAD guide (PR #94740)

2024-06-07 Thread via cfe-commits
 // the typedef has a dependent context.
-if (OrigDecl->getDeclContext()->isDependentContext()) {
+bool InDependentContext = OrigDecl->getDeclContext()->isDependentContext();
+
+// A typedef/alias Decl within the NestedPattern may reference the outer
+// template parameters. They're substituted with corresponding 
instantiation
+// arguments here and in RebuildTemplateSpecializationType() above.
+// Otherwise, we would have a CTAD guide with "dangling" template
+// parameters.
+// For example,
+//   template  struct Outer {
+// using Alias = S;
+// template  struct Inner {
+//   Inner(Alias);
+// };
+//   };
+if (OuterInstantiationArgs && InDependentContext) {
+  Decl = cast_if_present(SemaRef.SubstDecl(
+  OrigDecl, Context.getTranslationUnitDecl(), 
*OuterInstantiationArgs));
+  if (!Decl)
+return QualType();
+  MaterializedTypedefs.push_back(Decl);
+} else if (InDependentContext) {
   TypeLocBuilder InnerTLB;
   QualType Transformed =
   TransformType(InnerTLB, OrigDecl->getTypeSourceInfo()->getTypeLoc());
@@ -2577,8 +2657,9 @@ struct ConvertConstructorToDeductionGuideTransform {
   // defined outside of the surrounding class template. That is T in the
   // above example.
   if (NestedPattern) {
-NewParam = transformFunctionTypeParam(NewParam, OuterInstantiationArgs,
-  MaterializedTypedefs);
+NewParam = transformFunctionTypeParam(
+NewParam, OuterInstantiationArgs, MaterializedTypedefs,
+/*TransformingOuterPatterns=*/true);
 if (!NewParam)
   return QualType();
   }
@@ -2630,7 +2711,8 @@ struct ConvertConstructorToDeductionGuideTransform {
 
   ParmVarDecl *transformFunctionTypeParam(
   ParmVarDecl *OldParam, MultiLevelTemplateArgumentList ,
-  llvm::SmallVectorImpl ) {
+  llvm::SmallVectorImpl ,
+  bool TransformingOuterPatterns = false) {
 TypeSourceInfo *OldDI = OldParam->getTypeSourceInfo();
 TypeSourceInfo *NewDI;
 if (auto PackTL = OldDI->getTypeLoc().getAs()) {
@@ -2653,7 +2735,9 @@ struct ConvertConstructorToDeductionGuideTransform {
 // members of the current instantiations with the definitions of those
 // typedefs, avoiding triggering instantiation of the deduced type during
 // deduction.
-NewDI = ExtractTypeForDeductionGuide(SemaRef, MaterializedTypedefs)
+NewDI = ExtractTypeForDeductionGuide(
+SemaRef, MaterializedTypedefs, NestedPattern,
+TransformingOuterPatterns ?  : nullptr)
 .transform(NewDI);
 
 // Resolving a wording defect, we also inherit default arguments from the
diff --git a/clang/test/SemaTemplate/nested-deduction-guides.cpp 
b/clang/test/SemaTemplate/nested-deduction-guides.cpp
index 38410b93ead3b..913042810ae82 100644
--- a/clang/test/SemaTemplate/nested-deduction-guides.cpp
+++ b/clang/test/SemaTemplate/nested-deduction-guides.cpp
@@ -16,3 +16,73 @@ using T = A::B;
 
 using Copy = decltype(copy);
 using Copy = A::B;
+
+namespace GH94614 {
+
+template  struct S {};
+
+struct trouble_1 {
+} constexpr t1;
+struct trouble_2 {
+} constexpr t2;
+struct trouble_3 {
+} constexpr t3;
+struct trouble_4 {
+} constexpr t4;
+struct trouble_5 {
+} constexpr t5;
+struct trouble_6 {
+} constexpr t6;
+struct trouble_7 {
+} constexpr t7;
+struct trouble_8 {
+} constexpr t8;
+struct trouble_9 {
+} constexpr t9;
+
+template  struct Unrelated {
+  using Trouble = S;
+
+  template  using Trouble2 = S;
+};
+
+template  struct Outer {
+  using Trouble = S;
+
+  template  using Trouble2 = S;
+
+  template  using Trouble3 = S;
+
+  template  struct Inner {
+template  struct Paranoid {
+  using Trouble4 = S;
+
+  template  using Trouble5 = S;
+};
+
+Inner(trouble_1, V v, Trouble trouble) {}
+Inner(trouble_2, V v, Trouble2 trouble) {}
+Inner(trouble_3, V v, Trouble3 trouble) {}
+Inner(trouble_4, V v, typename Unrelated::template Trouble2 
trouble) {}
+Inner(trouble_5, V v, typename Unrelated::Trouble trouble) {}
+Inner(trouble_6, V v, typename Unrelated::Trouble trouble) {}
+Inner(trouble_7, V v, typename Paranoid::Trouble4 trouble) {}
+Inner(trouble_8, V v, typename Paranoid::template Trouble5 trouble) 
{}
+template 
+Inner(trouble_9, V v, W w, typename Paranoid::template Trouble5 
trouble) {}
+  };
+};
+
+S s;
+
+Outer::Inner _1(t1, 42, s);
+Outer::Inner _2(t2, 42, s);
+Outer::Inner _3(t3, 42, s);
+Outer::Inner _4(t4, 42, s);
+Outer::Inner _5(t5, 42, s);
+Outer::Inner _6(t6, 42, s);
+Outer::Inner _7(t7, 42, s);
+Outer::Inner _8(t8, 42, s);
+Outer::Inner _9(t9, 42, 24, s);
+
+} // namespace GH94614

``




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


[tianocore/edk2] 713bd4: pip: bump edk2-pytool-extensions from 0.27.5 to 0....

2024-06-07 Thread dependabot[bot] via edk2-commits
  Branch: refs/heads/dependabot/pip/edk2-pytool-extensions-0.27.6
  Home:   https://github.com/tianocore/edk2
  Commit: 713bd40e57d8f2c9511854f8af46cf419e769825
  
https://github.com/tianocore/edk2/commit/713bd40e57d8f2c9511854f8af46cf419e769825
  Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
M pip-requirements.txt

  Log Message:
  ---
  pip: bump edk2-pytool-extensions from 0.27.5 to 0.27.6

Bumps 
[edk2-pytool-extensions](https://github.com/tianocore/edk2-pytool-extensions) 
from 0.27.5 to 0.27.6.
- [Release notes](https://github.com/tianocore/edk2-pytool-extensions/releases)
- 
[Commits](https://github.com/tianocore/edk2-pytool-extensions/compare/v0.27.5...v0.27.6)

---
updated-dependencies:
- dependency-name: edk2-pytool-extensions
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] 



To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


___
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits


[clang] [Clang] Substitute for the type aliases inside of a CTAD guide (PR #94740)

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

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


[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

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

AaronBallman wrote:

> @AaronBallman Is the prototype of the implementation here at least sound? Or 
> should this go somewhere completely different? Maybe in one of the TSA source 
> files?

This is a semantic concern rather than a syntactic one, so I would expect this 
to happen in Sema rather than in Parser. My intuition is that this would be 
most natural in `mergeDeclAttributes()` as that's where this sort of thing 
typically lives for non-late parsed attributes. We merge the attributes when 
merging function declarations, so perhaps we need to add 
`mergeLateParsedDeclAttributes()` for ones that require late parsing?

CC @erichkeane in case he has opinions.


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


[clang] [Clang] Substitute for the type aliases inside of a CTAD guide (PR #94740)

2024-06-07 Thread Younan Zhang via cfe-commits
V v, Trouble3 trouble) {}
-Inner(trouble_4, V v, Unrelated::template Trouble2 trouble) {}
-Inner(trouble_5, V v, Unrelated::Trouble trouble) {}
-Inner(trouble_6, V v, Unrelated::Trouble trouble) {}
-Inner(trouble_7, V v, Paranoid::Trouble4 trouble) {}
-Inner(trouble_8, V v, Paranoid::template Trouble5 trouble) {}
+Inner(trouble_4, V v, typename Unrelated::template Trouble2 
trouble) {}
+Inner(trouble_5, V v, typename Unrelated::Trouble trouble) {}
+Inner(trouble_6, V v, typename Unrelated::Trouble trouble) {}
+Inner(trouble_7, V v, typename Paranoid::Trouble4 trouble) {}
+Inner(trouble_8, V v, typename Paranoid::template Trouble5 trouble) 
{}
 template 
-Inner(trouble_9, V v, W w, Paranoid::template Trouble5 trouble) {}
+Inner(trouble_9, V v, W w, typename Paranoid::template Trouble5 
trouble) {}
   };
 };
 

>From f5a196a61b71ce6a002f2a25c26670d7d804cca1 Mon Sep 17 00:00:00 2001
From: Younan Zhang 
Date: Fri, 7 Jun 2024 21:03:52 +0800
Subject: [PATCH 3/3] Give up if we exit a RecordDecl

---
 clang/lib/Sema/SemaTemplate.cpp | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 1e921dd26bd7d..baf2f12bcbb07 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -2236,14 +2236,16 @@ class ExtractTypeForDeductionGuide
 
   TypeSourceInfo *transform(TypeSourceInfo *TSI) { return TransformType(TSI); }
 
+  /// Returns true if it's safe to substitute \p Typedef with
+  /// \p OuterInstantiationArgs.
   bool mightReferToOuterTemplateParameters(TypedefNameDecl *Typedef) {
 if (!NestedPattern)
   return false;
 
 static auto WalkUp = [](DeclContext *DC, DeclContext *TargetDC) {
-  if (DC == TargetDC)
+  if (DC->Equals(TargetDC))
 return true;
-  while (!DC->isTranslationUnit()) {
+  while (DC->isRecord()) {
 if (DC->Equals(TargetDC))
   return true;
 DC = DC->getParent();

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


[clang] Testing32 bit for https://github.com/llvm/llvm-project/pull/92083 (PR #94603)

2024-06-07 Thread David Spickett via cfe-commits

DavidSpickett wrote:

Looks like this fixed things: 
https://lab.llvm.org/buildbot/#/builders/245/builds/25578

Thanks for working with me on this.

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


[clang] [flang] [llvm] [mlir] [Flang]Fix for changed code at the end of AllocaIP. (PR #92430)

2024-06-07 Thread Tom Eccles via cfe-commits

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


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


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)

2024-06-07 Thread via llvm-branch-commits

EricWF wrote:

Oh, I just noticed there are no tests for exception safety. Could you please 
add some throwing types? (Or perhaps I just missed those tests?).

Currently this code terminates:
```
#include 
#include 

struct ThrowsOnConstruct {
  explicit ThrowsOnConstruct(int x) : value(x) { if (x == 42) throw 42; }
  ThrowsOnConstruct(ThrowsOnConstruct const&) = delete;
  ThrowsOnConstruct(ThrowsOnConstruct && other) : value(other.value) { if 
(other.value == 101) throw 101; other.value = -1; }

  ~ThrowsOnConstruct() {
assert(value != -1);
value = -1;
  }

  int operator()() const noexcept { return value; }

  int value;
};

int main() {
  using MV = std::move_only_function;
  try {
MV f(ThrowsOnConstruct(101));
  } catch (...) {
  }
}
```

In particular, I don't think this constructor can be `noexcept`. 

I also think there are some missing tests for reference_wrapper. 

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


[clang-tools-extra] [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (PR #94362)

2024-06-07 Thread Felix Berger via cfe-commits

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


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


[clang-tools-extra] [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (PR #94362)

2024-06-07 Thread Felix Berger via cfe-commits

fberger wrote:

> Thanks for looking into this.
> 
> > So unfortunately this change won't improve 
> > `performance-unnecessary-value-param`.
> > I can have a look at unifying both in a subsequent PR.
> 
> Simply adding comments to the tickets in question, so the information is not 
> lost to time, would suffice for now.

Originally these checks were using the same logic to determine whether the 
variable was mutated. I don't know why why this was changed for one of these 
checks. 

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


[clang] [clang-repl] Lay the foundation of pretty printing for C. (PR #89811)

2024-06-07 Thread David Spickett via cfe-commits

DavidSpickett wrote:

Actually, as someone pointed out, I've been conflating clang-repl with the 
constant expression interpreter. So the issue covers the latter and this must 
be something else.

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


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)

2024-06-07 Thread via llvm-branch-commits

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

Please see the previous comment for the requested changes.

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


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)

2024-06-07 Thread Nikolas Klauser via llvm-branch-commits


@@ -0,0 +1,46 @@
+//===--===//
+//
+// 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
+//
+//===--===//
+
+#ifndef _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_COMMON_H
+#define _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_COMMON_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template 
+class move_only_function;
+
+template 
+struct __is_move_only_function : false_type {};
+
+template 
+struct __is_move_only_function> : true_type {};
+
+template 
+struct _MoveOnlyFunctionTrivialVTable {
+  using _CallFunc = _ReturnT(_BufferT&, _ArgTypes...);
+
+  _CallFunc* __call_;
+};
+
+template 
+struct _MoveOnlyFunctionNonTrivialVTable : 
_MoveOnlyFunctionTrivialVTable<_BufferT, _ReturnT, _ArgTypes...> {

philnik777 wrote:

The call function pointer is in the base class though. I always want the call 
pointer and only sometimes the destructor pointer.

https://github.com/llvm/llvm-project/pull/94670
_______
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)

2024-06-07 Thread via llvm-branch-commits
std::__2::__small_buffer<24ul, 8ul>&)

std::__2::move_only_function::__trivial_vtable_:
  .quad std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)

std::__2::move_only_function::__non_trivial_vtable_:
  .quad std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)
  .quad std::__2::move_only_function::__non_trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)

std::__2::move_only_function::__non_trivial_vtable_:
  .quad std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul, 
8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)
  .quad std::__2::move_only_function::__non_trivial_vtable_::{lambda(std::__2::__small_buffer<24ul, 
8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)

std::__2::move_only_function::__trivial_vtable_:
  .quad std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul, 8ul>&, 
S)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&, S)

std::__2::move_only_function::__trivial_vtable_:
  .quad std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)

std::__2::move_only_function::__trivial_vtable_:
  .quad std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul, 8ul>&, 
int)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&, int)

std::__2::move_only_function::__trivial_vtable_:
  .quad std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&, int)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&, int)

std::__2::move_only_function::__non_trivial_vtable_:
  .quad std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&, int)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&, int)
  .quad std::__2::move_only_function::__non_trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)

std::__2::move_only_function::__non_trivial_vtable_:
  .quad std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul, 
8ul>&, int)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&, int)
  .quad std::__2::move_only_function::__non_trivial_vtable_::{lambda(std::__2::__small_buffer<24ul, 
8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)

DW.ref.__gxx_personality_v0:
  .quad __gxx_personality_v0

  ```

vs 

```c++
test(): # @test()
  mov byte ptr [rip + called], 1
  ret
test_return(): # @test_return()
  mov byte ptr [rip + called], 0
  ret
main: # @main
  mov byte ptr [rip + called], 1
  xor eax, eax
  ret
called:
  .byte 0 # 0x0
```

I also think the `__pointer_int_pair` idiom is unneeded, and should be removed. 
It causes the optimizer to lose track of the `__call_` function pointer, which 
prevents the ellision of the call. That's a big issue, and one that I think 
should block.

Further, the use of `__small_buffer` prevents the ellision of the allocations, 
further hurting the optimizer.
I think this too should be simplified before proceeding. You can replace it 
with 
```c++ 
union { 
   void* __ptr_; 
   std::byte __buff_[sizeof(void*) * 3];
 }
```

I'm very happy to proceed using your mechanism for stamping out the 
specializations using repeated includes, In fact I prefer it over my 
overcomplicated metaprogramming. 

however I think there are a lot of simplifications that can be taken from my 
implementation that make things more readable and performant.

To Summarize, the requested changes are:

* remove `__pointer_int_pair`. 
* remove `__small_buffer`. 
* Simplify the vtable. There's no  need for inheritance. Use `__delete_ == 
nullptr` to signal trivially destructible types.


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


[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

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


@@ -1881,6 +1890,20 @@ TEST(APFloatTest, getSmallest) {
   EXPECT_TRUE(test.isFiniteNonZero());
   EXPECT_TRUE(test.isDenormal());
   EXPECT_TRUE(test.bitwiseIsEqual(expected));
+
+  test = APFloat::getSmallest(APFloat::Float6E3M2FN(), false);
+  expected = APFloat(APFloat::Float6E3M2FN(), "0x0.1p0");
+  EXPECT_FALSE(test.isNegative());
+  EXPECT_TRUE(test.isFiniteNonZero());
+  EXPECT_TRUE(test.isDenormal());
+  EXPECT_TRUE(test.bitwiseIsEqual(expected));
+
+  test = APFloat::getSmallest(APFloat::Float6E2M3FN(), false);
+  expected = APFloat(APFloat::Float6E2M3FN(), "0x0.2p0");
+  EXPECT_FALSE(test.isNegative());
+  EXPECT_TRUE(test.isFiniteNonZero());
+  EXPECT_TRUE(test.isDenormal());
+  EXPECT_TRUE(test.bitwiseIsEqual(expected));
 }
 

arsenm wrote:

Should also test getZero and the other special case constructors 

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


[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

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


@@ -47,6 +47,10 @@ static std::string convertToString(double d, unsigned Prec, 
unsigned Pad,
   return std::string(Buffer.data(), Buffer.size());
 }
 
+static bool hasNanOrInf(APFloat::Semantics S) {
+  return (S != APFloat::S_Float6E3M2FN) && (S != APFloat::S_Float6E2M3FN);
+}

arsenm wrote:

Probably would be useful as a helper somewhere in APFloat or Semantics 

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


[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits

steakhal wrote:

Let's do another round.

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


[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits

https://github.com/steakhal updated 
https://github.com/llvm/llvm-project/pull/93408

>From f9e841ddaa865d529c806b2d115d5ddbc7109243 Mon Sep 17 00:00:00 2001
From: Balazs Benics 
Date: Sun, 26 May 2024 11:40:01 +0200
Subject: [PATCH 01/16] [analyzer] Refine invalidation caused by `fread`

This change enables more accurate modeling of the write effects of `fread`.
In particular, instead of invalidating the whole buffer, in a best-effort
basis, we would try to invalidate the actually accesses elements of the buffer.
This preserves the previous value of the buffer of the unaffected slots.
As a result, diagnose more uninitialized buffer uses for example.

Currently, this refined invalidation only triggers for `fread` if and
only if the `count` parameter and the buffer pointer's index component
are concrete or perfectly-constrained symbols.
Additionally, if the `fread` would read more than 64 elements, the whole
buffer is invalidated as before. This is to have safeguards against
performance issues.

Refer to the comments of the assertions in the following example to see
the changes in the diagnostics:

```c++
void demo() {
  FILE *fp = fopen("/home/test", "rb+");
  if (!fp) return;
  int buffer[10]; // uninitialized
  int read_items = fread(buffer+1, sizeof(int), 5, fp);
  if (5 == read_items) {
int v1 = buffer[1]; // Unknown value but not garbage.
clang_analyzer_isTainted(v1); // expected-warning {{YES}} <-- Would be "NO" 
without this patch.
clang_analyzer_dump(v1); // expected-warning {{conj_}} <-- Not a "derived" 
symbol, so it's directly invalidated now.
int v0 = buffer[0]; // expected-warning {{Assigned value is garbage or 
undefined}} <-- Had no report here before.
(void)(v1 + v0);
  } else {
// If 'fread' had an error.
int v0 = buffer[0]; // expected-warning {{Assigned value is garbage or 
undefined}} <-- Had no report here before.
(void)v0;
  }
  fclose(fp);
}
```

[CPP-3247](https://sonarsource.atlassian.net/browse/CPP-3247)

Patch by Marco Borgeaud (marco-antognini-sonarsource)
---
 .../StaticAnalyzer/Checkers/StreamChecker.cpp |  88 -
 clang/test/Analysis/fread.cpp | 328 ++
 2 files changed, 405 insertions(+), 11 deletions(-)
 create mode 100644 clang/test/Analysis/fread.cpp

diff --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
index d4e020f7a72a0..7b42c4f72b322 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -717,18 +717,71 @@ const ExplodedNode 
*StreamChecker::getAcquisitionSite(const ExplodedNode *N,
   return nullptr;
 }
 
+/// Invalidate only the requested elements instead of the whole buffer.
+/// This is basically a refinement of the more generic 'escapeArgs' or
+/// the plain old 'invalidateRegions'.
+/// This only works if the \p StartIndex and \p Count are concrete or
+/// perfectly-constrained.
+static ProgramStateRef
+escapeByStartIndexAndCount(ProgramStateRef State, CheckerContext ,
+   const CallEvent , const MemRegion *Buffer,
+   QualType ElemType, SVal StartIndex, SVal Count) {
+  if (!llvm::isa_and_nonnull(Buffer))
+return State;
+
+  auto UnboxAsInt = [, ](SVal V) -> std::optional {
+auto  = C.getSValBuilder();
+if (const llvm::APSInt *Int = SVB.getKnownValue(State, V))
+  return Int->tryExtValue();
+return std::nullopt;
+  };
+
+  auto StartIndexVal = UnboxAsInt(StartIndex);
+  auto CountVal = UnboxAsInt(Count);
+
+  // FIXME: Maybe we could make this more generic, and expose this by the
+  // 'invalidateRegions' API. After doing so, it might make sense to make this
+  // limit configurable.
+  constexpr int MaxInvalidatedElementsLimit = 64;
+  if (!StartIndexVal || !CountVal || *CountVal > MaxInvalidatedElementsLimit) {
+return State->invalidateRegions({loc::MemRegionVal{Buffer}},
+Call.getOriginExpr(), C.blockCount(),
+C.getLocationContext(),
+/*CausesPointerEscape=*/false);
+  }
+
+  constexpr auto DoNotInvalidateSuperRegion =
+  RegionAndSymbolInvalidationTraits::InvalidationKinds::
+  TK_DoNotInvalidateSuperRegion;
+
+  auto  = Buffer->getMemRegionManager();
+  SmallVector EscapingVals;
+  EscapingVals.reserve(*CountVal);
+
+  RegionAndSymbolInvalidationTraits ITraits;
+  for (auto Idx : llvm::seq(*StartIndexVal, *StartIndexVal + *CountVal)) {
+NonLoc Index = C.getSValBuilder().makeArrayIndex(Idx);
+const auto *Element = RegionManager.getElementRegion(
+ElemType, Index, cast(Buffer), C.getASTContext());
+EscapingVals.push_back(loc::MemRegionVal(Element));
+ITraits.setTrait(Element, DoNotInvalidateSuperRegion);
+  }
+  return State->invalidateRegions(EscapingVals, Call.getOriginExpr(),
+  C.blockCount(), 

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits

https://github.com/steakhal updated 
https://github.com/llvm/llvm-project/pull/93408

>From f9e841ddaa865d529c806b2d115d5ddbc7109243 Mon Sep 17 00:00:00 2001
From: Balazs Benics 
Date: Sun, 26 May 2024 11:40:01 +0200
Subject: [PATCH 01/16] [analyzer] Refine invalidation caused by `fread`

This change enables more accurate modeling of the write effects of `fread`.
In particular, instead of invalidating the whole buffer, in a best-effort
basis, we would try to invalidate the actually accesses elements of the buffer.
This preserves the previous value of the buffer of the unaffected slots.
As a result, diagnose more uninitialized buffer uses for example.

Currently, this refined invalidation only triggers for `fread` if and
only if the `count` parameter and the buffer pointer's index component
are concrete or perfectly-constrained symbols.
Additionally, if the `fread` would read more than 64 elements, the whole
buffer is invalidated as before. This is to have safeguards against
performance issues.

Refer to the comments of the assertions in the following example to see
the changes in the diagnostics:

```c++
void demo() {
  FILE *fp = fopen("/home/test", "rb+");
  if (!fp) return;
  int buffer[10]; // uninitialized
  int read_items = fread(buffer+1, sizeof(int), 5, fp);
  if (5 == read_items) {
int v1 = buffer[1]; // Unknown value but not garbage.
clang_analyzer_isTainted(v1); // expected-warning {{YES}} <-- Would be "NO" 
without this patch.
clang_analyzer_dump(v1); // expected-warning {{conj_}} <-- Not a "derived" 
symbol, so it's directly invalidated now.
int v0 = buffer[0]; // expected-warning {{Assigned value is garbage or 
undefined}} <-- Had no report here before.
(void)(v1 + v0);
  } else {
// If 'fread' had an error.
int v0 = buffer[0]; // expected-warning {{Assigned value is garbage or 
undefined}} <-- Had no report here before.
(void)v0;
  }
  fclose(fp);
}
```

[CPP-3247](https://sonarsource.atlassian.net/browse/CPP-3247)

Patch by Marco Borgeaud (marco-antognini-sonarsource)
---
 .../StaticAnalyzer/Checkers/StreamChecker.cpp |  88 -
 clang/test/Analysis/fread.cpp | 328 ++
 2 files changed, 405 insertions(+), 11 deletions(-)
 create mode 100644 clang/test/Analysis/fread.cpp

diff --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
index d4e020f7a72a0..7b42c4f72b322 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -717,18 +717,71 @@ const ExplodedNode 
*StreamChecker::getAcquisitionSite(const ExplodedNode *N,
   return nullptr;
 }
 
+/// Invalidate only the requested elements instead of the whole buffer.
+/// This is basically a refinement of the more generic 'escapeArgs' or
+/// the plain old 'invalidateRegions'.
+/// This only works if the \p StartIndex and \p Count are concrete or
+/// perfectly-constrained.
+static ProgramStateRef
+escapeByStartIndexAndCount(ProgramStateRef State, CheckerContext ,
+   const CallEvent , const MemRegion *Buffer,
+   QualType ElemType, SVal StartIndex, SVal Count) {
+  if (!llvm::isa_and_nonnull(Buffer))
+return State;
+
+  auto UnboxAsInt = [, ](SVal V) -> std::optional {
+auto  = C.getSValBuilder();
+if (const llvm::APSInt *Int = SVB.getKnownValue(State, V))
+  return Int->tryExtValue();
+return std::nullopt;
+  };
+
+  auto StartIndexVal = UnboxAsInt(StartIndex);
+  auto CountVal = UnboxAsInt(Count);
+
+  // FIXME: Maybe we could make this more generic, and expose this by the
+  // 'invalidateRegions' API. After doing so, it might make sense to make this
+  // limit configurable.
+  constexpr int MaxInvalidatedElementsLimit = 64;
+  if (!StartIndexVal || !CountVal || *CountVal > MaxInvalidatedElementsLimit) {
+return State->invalidateRegions({loc::MemRegionVal{Buffer}},
+Call.getOriginExpr(), C.blockCount(),
+C.getLocationContext(),
+/*CausesPointerEscape=*/false);
+  }
+
+  constexpr auto DoNotInvalidateSuperRegion =
+  RegionAndSymbolInvalidationTraits::InvalidationKinds::
+  TK_DoNotInvalidateSuperRegion;
+
+  auto  = Buffer->getMemRegionManager();
+  SmallVector EscapingVals;
+  EscapingVals.reserve(*CountVal);
+
+  RegionAndSymbolInvalidationTraits ITraits;
+  for (auto Idx : llvm::seq(*StartIndexVal, *StartIndexVal + *CountVal)) {
+NonLoc Index = C.getSValBuilder().makeArrayIndex(Idx);
+const auto *Element = RegionManager.getElementRegion(
+ElemType, Index, cast(Buffer), C.getASTContext());
+EscapingVals.push_back(loc::MemRegionVal(Element));
+ITraits.setTrait(Element, DoNotInvalidateSuperRegion);
+  }
+  return State->invalidateRegions(EscapingVals, Call.getOriginExpr(),
+  C.blockCount(), 

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits
ad.
+if (1 == fread(, sizeof(s.b), 1, fp)) {
+  long p = s.b;
+  clang_analyzer_isTainted(p); // expected-warning {{YES}}
+  clang_analyzer_dump(p); // expected-warning {{conj_}}
+} else {
+  long p = s.b;
+  clang_analyzer_isTainted(p); // expected-warning {{YES}}
+  clang_analyzer_dump(p); // expected-warning {{conj_}}
+}
+fclose(fp);
+  }
+}
+
+void compound_read2(void) {
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+struct S s; // s.a is not touched by fread.
+if (1 == fread(, sizeof(s.b), 1, fp)) {
+  long p = s.a; // expected-warning {{Assigned value is garbage or 
undefined}}
+} else {
+  long p = s.a; // expected-warning {{Assigned value is garbage or 
undefined}}
+}
+fclose(fp);
+  }
+}
+
+void var_read(void) {
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+int a, b; // 'a' is not touched by fread.
+if (1 == fread(, sizeof(b), 1, fp)) {
+  long p = a; // expected-warning{{Assigned value is garbage or undefined}}
+} else {
+  long p = a; // expected-warning{{Assigned value is garbage or undefined}}
+}
+fclose(fp);
+  }
+}
+
+// When reading a lot of data, invalidating all elements is too time-consuming.
+// Instead, the knowledge of the whole array is lost.
+#define MaxInvalidatedElementRegion 64 // See StreamChecker::evalFreadFwrite 
in StreamChecker.cpp.
+#define PastMaxComplexity MaxInvalidatedElementRegion + 1
+void test_large_read(void) {
+  int buffer[PastMaxComplexity + 1];
+  buffer[PastMaxComplexity] = 42;
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+if (buffer[PastMaxComplexity] != 42) {
+  clang_analyzer_warnIfReached(); // Unreachable.
+}
+if (1 == fread(buffer, sizeof(int), PastMaxComplexity, fp)) {
+  if (buffer[PastMaxComplexity] != 42) {
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  }
+}
+fclose(fp);
+  }
+}
+
+void test_small_read(void) {
+  int buffer[10];
+  buffer[5] = 42;
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+clang_analyzer_dump(buffer[5]); // expected-warning{{42 S32b}}
+if (1 == fread(buffer, sizeof(int), 5, fp)) {
+  clang_analyzer_dump(buffer[5]); // expected-warning{{42 S32b}}
+}
+fclose(fp);
+  }
+}
+
+void test_partial_elements_read(void) {
+  clang_analyzer_dump(sizeof(int)); // expected-warning {{4 S32b}}
+
+  int buffer[100];
+  buffer[0] = 1;
+  buffer[1] = 2;
+  buffer[2] = 3;
+  buffer[3] = 4;
+  buffer[4] = 5;
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+// 3*5: 15 bytes read; which is not exactly 4 integers, thus we invalidate 
the whole buffer.

steakhal wrote:

I can't dump that because one byte (the last one) of that 'int' object is left 
uninitialized by the fread and reading uninit values will kill the execution 
path, making the rest of the checks unreachable.

This is caused by the current implementation which pretends that we only read 
into the first 4 elements of the buffer.

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


[llvm-branch-commits] [llvm] [Frontend] Introduce `getDirectiveCategory` for ACC/OMP directives (PR #94689)

2024-06-07 Thread Krzysztof Parzyszek via llvm-branch-commits
T:  enum class Directive {
 // CHECK-NEXT:TDLD_dira,
 // CHECK-NEXT:  };
@@ -91,6 +103,7 @@ def TDL_DirA : Directive<"dira"> {
 // CHECK-EMPTY:
 // CHECK-NEXT:  constexpr std::size_t getMaxLeafCount() { return 0; }
 // CHECK-NEXT:  Association getDirectiveAssociation(Directive D);
+// CHECK-NEXT:  Category getDirectiveCategory(Directive D);
 // CHECK-NEXT:  } // namespace tdl
 // CHECK-NEXT:  } // namespace llvm
 // CHECK-NEXT:  #endif // LLVM_Tdl_INC
@@ -295,7 +308,15 @@ def TDL_DirA : Directive<"dira"> {
 // IMPL-NEXT:switch (Dir) {
 // IMPL-NEXT:case llvm::tdl::Directive::TDLD_dira:
 // IMPL-NEXT:  return llvm::tdl::Association::Block;
-// IMPL-NEXT:} // switch(Dir)
+// IMPL-NEXT:} // switch (Dir)
+// IMPL-NEXT:llvm_unreachable("Unexpected directive");
+// IMPL-NEXT:  }
+// IMPL-EMPTY:
+// IMPL-NEXT:  llvm::tdl::Category 
llvm::tdl::getDirectiveCategory(llvm::tdl::Directive Dir) {
+// IMPL-NEXT:switch (Dir) {
+// IMPL-NEXT:case llvm::tdl::TDLD_dira:
+// IMPL-NEXT:  return llvm::tdl::Category::Declarative;
+// IMPL-NEXT:} // switch (Dir)
 // IMPL-NEXT:llvm_unreachable("Unexpected directive");
 // IMPL-NEXT:  }
 // IMPL-EMPTY:
diff --git a/llvm/utils/TableGen/DirectiveEmitter.cpp 
b/llvm/utils/TableGen/DirectiveEmitter.cpp
index 8bc3f026853cc..581bc09d5e053 100644
--- a/llvm/utils/TableGen/DirectiveEmitter.cpp
+++ b/llvm/utils/TableGen/DirectiveEmitter.cpp
@@ -228,6 +228,9 @@ static void EmitDirectivesDecl(RecordKeeper , 
raw_ostream ) {
   GenerateEnumClass(associations, OS, "Association",
 /*Prefix=*/"", DirLang, /*ExportEnums=*/false);
 
+  GenerateEnumClass(DirLang.getCategories(), OS, "Category", /*Prefix=*/"",
+DirLang, /*ExportEnums=*/false);
+
   // Emit Directive enumeration
   GenerateEnumClass(DirLang.getDirectives(), OS, "Directive",
 DirLang.getDirectivePrefix(), DirLang,
@@ -264,6 +267,7 @@ static void EmitDirectivesDecl(RecordKeeper , 
raw_ostream ) {
   OS << "constexpr std::size_t getMaxLeafCount() { return "
  << GetMaxLeafCount(DirLang) << "; }\n";
   OS << "Association getDirectiveAssociation(Directive D);\n";
+  OS << "Category getDirectiveCategory(Directive D);\n";
   if (EnumHelperFuncs.length() > 0) {
 OS << EnumHelperFuncs;
 OS << "\n";
@@ -743,7 +747,29 @@ static void GenerateGetDirectiveAssociation(const 
DirectiveLanguage ,
  << "::" << getAssocName(F->second) << ";\n";
 }
   }
-  OS << "  } // switch(Dir)\n";
+  OS << "  } // switch (Dir)\n";
+  OS << "  llvm_unreachable(\"Unexpected directive\");\n";
+  OS << "}\n";
+}
+
+static void GenerateGetDirectiveCategory(const DirectiveLanguage ,
+ raw_ostream ) {
+  std::string LangNamespace = "llvm::" + DirLang.getCppNamespace().str();
+  std::string CategoryTypeName = LangNamespace + "::Category";
+  std::string CategoryNamespace = CategoryTypeName + "::";
+
+  OS << '\n';
+  OS << CategoryTypeName << ' ' << LangNamespace << "::getDirectiveCategory("
+ << GetDirectiveType(DirLang) << " Dir) {\n";
+  OS << "  switch (Dir) {\n";
+
+  for (Record *R : DirLang.getDirectives()) {
+Directive D{R};
+OS << "  case " << GetDirectiveName(DirLang, R) << ":\n";
+OS << "return " << CategoryNamespace
+   << D.getCategory()->getValueAsString("name") << ";\n";
+  }
+  OS << "  } // switch (Dir)\n";
   OS << "  llvm_unreachable(\"Unexpected directive\");\n";
   OS << "}\n";
 }
@@ -1196,6 +1222,9 @@ void EmitDirectivesBasicImpl(const DirectiveLanguage 
,
   // getDirectiveAssociation(Directive D)
   GenerateGetDirectiveAssociation(DirLang, OS);
 
+  // getDirectiveCategory(Directive D)
+  GenerateGetDirectiveCategory(DirLang, OS);
+
   // Leaf table for getLeafConstructs, etc.
   EmitLeafTable(DirLang, OS, "LeafConstructTable");
 }

>From 88403df321fe47145cd797388b352f3f934bab2b Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek 
Date: Thu, 6 Jun 2024 17:11:17 -0500
Subject: [PATCH 2/3] typo

---
 llvm/include/llvm/Frontend/Directive/DirectiveBase.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td 
b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
index 6889c7e642ec6..707239c7ba364 100644
--- a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
+++ b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
@@ -203,6 +203,6 @@ class Directive {
   // What the directive is associated with.
   Association association = AS_FromLeaves;
 
-  // The category if the directive.
+  // The category of the directive.
   Category category = ?;
 }

>From b243f852d7ac3fcc4cbaa3622ecaa9d7b5cde3ee Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek 
Date: Fri, 7 Jun 2024 07:30:49 -0500
Subject: [PATCH 3/3] Update llvm/include/llvm/Frontend/OpenACC/ACC.td
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Valentin Clement (バレンタイン クレメン) 
---
 llvm/include/llvm/Frontend/OpenACC/ACC.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td 
b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index 30a81efe7f8a6..cda1d96b2a8cf 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -310,7 +310,7 @@ def ACC_Declare : Directive<"declare"> {
 VersionedClause
   ];
   let association = AS_None;
-  let category = CA_Executable;
+  let category = CA_Declarative;
 }
 
 // 2.5.3

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


[llvm-branch-commits] [clang] [clang] Define ptrauth_sign_constant builtin. (PR #93904)

2024-06-07 Thread Daniil Kovalev via llvm-branch-commits

https://github.com/kovdan01 edited 
https://github.com/llvm/llvm-project/pull/93904
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits
ump(buffer[15]); // expected-warning{{conj_}}
+  clang_analyzer_dump(buffer[16]); // expected-warning{{3 S32b}}
+  clang_analyzer_dump(buffer[17]); // expected-warning{{1st function call 
argument is an uninitialized value}}
+} else {
+  clang_analyzer_dump(buffer[0]);  // expected-warning{{1 S32b}}
+  clang_analyzer_dump(buffer[15]); // expected-warning{{conj_}}
+  clang_analyzer_dump(buffer[16]); // expected-warning{{3 S32b}}
+  clang_analyzer_dump(buffer[17]); // expected-warning{{1st function call 
argument is an uninitialized value}}
+}
+fclose(fp);
+  }
+}
+
+void test_unaligned_start_read(void) {
+  clang_analyzer_dump(sizeof(int)); // expected-warning {{4 S32b}}
+
+  int buffer[100];
+  buffer[0] = 3;
+  buffer[1] = 4;
+  buffer[2] = 5;
+  char *asChar = (char*)buffer;
+
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+// We have an 'int' binding at offset 0 of value 3.
+// We read 4 bytes at byte offset: 1,2,3,4.
+if (4 == fread(asChar + 1, 1, 4, fp)) {
+  clang_analyzer_dump(buffer[0]); // expected-warning{{3 S32b}} FIXME 
Reading a 8 bit 'char' should not result in a 'S32b' value.
+  clang_analyzer_dump(buffer[1]); // expected-warning{{conj_}}
+  clang_analyzer_dump(buffer[2]); // expected-warning{{5 S32b}}
+
+  clang_analyzer_dump(asChar[0]); // expected-warning{{3 S32b}} FIXME 
Reading a 8 bit 'char' should not result in a 'S32b' value.

steakhal wrote:

It shouldn't as the lvalue to rvalue conversion (aka. the load) operation 
should have been done before the call.
In contrast to this, CSA appears to contradict this assumption, and the 
`clang_analyzer_dump_char()` would have dumped `3 S8b`, which is the correct 
solution for little-endian systems - like the one I pinned as the target

I fixed this by dumping these as chars, and refined the expectation messages to 
meet this.

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


[clang] [serialization] no transitive decl change (PR #92083)

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

ChuanqiXu9 wrote:

Thanks for testing. I've resent 
https://github.com/llvm/llvm-project/commit/5a0181f568e56e37df80d0f74eca4775776fa8cd.

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


[clang] 5a0181f - [serialization] no transitive decl change (#92083)

2024-06-07 Thread Chuanqi Xu via cfe-commits
file=m:partB=%t/m-partB.pcm
+// RUN: %clang_cc1 -std=c++20 %t/useBOnly.cppm -emit-reduced-module-interface 
-o %t/useBOnly.v1.pcm \
+// RUN: -fmodule-file=m=%t/m.v1.pcm 
-fmodule-file=m:partA=%t/m-partA.v1.pcm \
+// RUN: -fmodule-file=m:partB=%t/m-partB.pcm
+// Since useBOnly only uses partB from module M, the change in partA shouldn't 
affect
+// useBOnly.
+// RUN: 
diff  %t/useBOnly.pcm %t/useBOnly.v1.pcm &> /dev/null
+
+//--- m-partA.cppm
+export module m:partA;
+
+namespace A_Impl {
+inline int getAImpl() {
+return 43;
+}
+
+inline int getA2Impl() {
+return 43;
+}
+}
+
+namespace A {
+using A_Impl::getAImpl;
+}
+
+export inline int getA() {
+return 43;
+}
+
+export inline int getA2(int) {
+return 88;
+}
+
+//--- m-partA.v1.cppm
+export module m:partA;
+
+namespace A_Impl {
+inline int getAImpl() {
+return 43;
+}
+
+inline int getA2Impl() {
+return 43;
+}
+}
+
+namespace A {
+using A_Impl::getAImpl;
+// Adding a new declaration without introducing a new declaration name.
+using A_Impl::getA2Impl;
+}
+
+inline int getA() {
+return 43;
+}
+
+inline int getA2(int) {
+return 88;
+}
+
+// Now we add a new declaration without introducing new identifier and new 
types.
+// The consuming module which didn't use m:partA completely is expected to be
+// not changed.
+inline int getA(int) {
+return 88;
+}
+
+//--- m-partB.cppm
+export module m:partB;
+
+export inline int getB() {
+return 430;
+}
+
+//--- m.cppm
+export module m;
+export import :partA;
+export import :partB;
+
+//--- useBOnly.cppm
+export module useBOnly;
+import m;
+
+export inline int get() {
+return getB();
+}
+
+//--- useAOnly.cppm
+export module useAOnly;
+import m;
+
+export inline int get() {
+A a;
+return a.getValue();
+}



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


[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits
ump(buffer[15]); // expected-warning{{conj_}}
+  clang_analyzer_dump(buffer[16]); // expected-warning{{3 S32b}}
+  clang_analyzer_dump(buffer[17]); // expected-warning{{1st function call 
argument is an uninitialized value}}
+} else {
+  clang_analyzer_dump(buffer[0]);  // expected-warning{{1 S32b}}
+  clang_analyzer_dump(buffer[15]); // expected-warning{{conj_}}
+  clang_analyzer_dump(buffer[16]); // expected-warning{{3 S32b}}
+  clang_analyzer_dump(buffer[17]); // expected-warning{{1st function call 
argument is an uninitialized value}}
+}
+fclose(fp);
+  }
+}
+
+void test_unaligned_start_read(void) {
+  clang_analyzer_dump(sizeof(int)); // expected-warning {{4 S32b}}
+
+  int buffer[100];
+  buffer[0] = 3;
+  buffer[1] = 4;
+  buffer[2] = 5;
+  char *asChar = (char*)buffer;
+
+  FILE *fp = fopen("/home/test", "rb+");
+  if (fp) {
+// We have an 'int' binding at offset 0 of value 3.
+// We read 4 bytes at byte offset: 1,2,3,4.
+if (4 == fread(asChar + 1, 1, 4, fp)) {
+  clang_analyzer_dump(buffer[0]); // expected-warning{{3 S32b}} FIXME 
Reading a 8 bit 'char' should not result in a 'S32b' value.
----
steakhal wrote:

You are right. I copypasted the reasoning from the `asChar[0]`. In fact, the 
reason is:  `FIXME The int binding should have been partially overwritten by 
the read call. This definitely should not be 3.`.

Fixed the description of the FIXME.

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


[clang] Testing32 bit for https://github.com/llvm/llvm-project/pull/92083 (PR #94603)

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

ChuanqiXu9 wrote:

Thank you very much!

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


[clang-tools-extra] [clang-tidy] Add WarnOnSizeOfPointer mode to bugprone-sizeof-expression (PR #94356)

2024-06-07 Thread Donát Nagy via cfe-commits
_rerun=New)
 | [1 resolved 
reports](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=protobuf_v3.13.0_old_sizeofexpressions_with_new_messages=protobuf_v3.13.0_new_sizeofexpressions_rerun=Resolved)
 | resolved report is FP, new reports are mostly `sizeof(array[0])` FPs + one 
confusing trickery
| qtbase | [10 new 
reports](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=qtbase_v6.2.0_old_sizeofexpressions_with_new_messages=qtbase_v6.2.0_new_sizeofexpressions_rerun=New)
 | No reports | most of them are FPs, including a few `sizeof(array[0])` issues
| contour | No reports | No reports  | –
| openrct2 | [1 new 
reports](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=openrct2_v0.4.8_old_sizeofexpressions_with_new_messages=openrct2_v0.4.8_new_sizeofexpressions_rerun=New)
 | No reports | arguably a false positive, but the highlighted code is 
suspicious
| llvm-project | No reports | [1 resolved 
reports](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=llvm-project_llvmorg-12.0.0_old_sizeofexpressions_with_new_messages=llvm-project_llvmorg-12.0.0_new_sizeofexpressions_rerun=Resolved)
 | false positive


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


[jenkinsci/collabnet-plugin] cc1c64: Changes done:

2024-06-07 Thread 'Arun Pandurangan' via Jenkins Commits
  Branch: refs/heads/master
  Home:   https://github.com/jenkinsci/collabnet-plugin
  Commit: cc1c64a92379dbc8ad88a1c67449aced0fcc055c
  
https://github.com/jenkinsci/collabnet-plugin/commit/cc1c64a92379dbc8ad88a1c67449aced0fcc055c
  Author: preyanka babu 
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
M src/main/java/com/collabnet/ce/webservices/CTFUser.java
M src/main/java/hudson/plugins/collabnet/auth/CNAuthenticatedUserACL.java
M src/main/java/hudson/plugins/collabnet/auth/CNAuthentication.java
M src/main/java/hudson/plugins/collabnet/auth/CNConnection.java
M src/main/java/hudson/plugins/collabnet/auth/CNFilter.java
M src/main/java/hudson/plugins/collabnet/auth/CNProjectACL.java
M src/main/java/hudson/plugins/collabnet/auth/CNRootACL.java
M src/main/java/hudson/plugins/collabnet/auth/CollabNetAuthManager.java
M src/main/java/hudson/plugins/collabnet/util/CNFormFieldValidator.java
M src/main/java/hudson/plugins/collabnet/util/CommonUtil.java
M 
src/main/java/jenkins/plugins/collabnet/steps/SynchNonBlockingStepExecution.java

  Log Message:
  ---
  Changes done:

* Replaced the deprecated acegisecurity with springframework.security packages.
* Fixed the Jenkins group admin and Jenkins group read-only access


  Commit: 2ea698358d8748019aa27a4f95fdb3724f1d56f7
  
https://github.com/jenkinsci/collabnet-plugin/commit/2ea698358d8748019aa27a4f95fdb3724f1d56f7
  Author: Arun Pandurangan 
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
M src/main/java/com/collabnet/ce/webservices/CTFUser.java
M src/main/java/hudson/plugins/collabnet/auth/CNAuthenticatedUserACL.java
M src/main/java/hudson/plugins/collabnet/auth/CNAuthentication.java
M src/main/java/hudson/plugins/collabnet/auth/CNConnection.java
M src/main/java/hudson/plugins/collabnet/auth/CNFilter.java
M src/main/java/hudson/plugins/collabnet/auth/CNProjectACL.java
M src/main/java/hudson/plugins/collabnet/auth/CNRootACL.java
M src/main/java/hudson/plugins/collabnet/auth/CollabNetAuthManager.java
M src/main/java/hudson/plugins/collabnet/util/CNFormFieldValidator.java
M src/main/java/hudson/plugins/collabnet/util/CommonUtil.java
M 
src/main/java/jenkins/plugins/collabnet/steps/SynchNonBlockingStepExecution.java

  Log Message:
  ---
  Merge pull request #69 from preyankababu/view_jobs

Changes done:


Compare: 
https://github.com/jenkinsci/collabnet-plugin/compare/2fd9c5977fef...2ea698358d87

To unsubscribe from these emails, change your notification settings at 
https://github.com/jenkinsci/collabnet-plugin/settings/notifications

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-commits+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-commits/jenkinsci/collabnet-plugin/push/refs/heads/master/2fd9c5-2ea698%40github.com.


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)

2024-06-07 Thread via llvm-branch-commits


@@ -0,0 +1,233 @@
+//===--===//
+//
+// 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 header is unguarded on purpose. This header is an implementation 
detail of move_only_function.h
+// and generates multiple versions of std::move_only_function
+
+#include <__config>
+#include <__functional/invoke.h>
+#include <__functional/move_only_function_common.h>
+#include <__type_traits/is_trivially_destructible.h>
+#include <__utility/exchange.h>
+#include <__utility/forward.h>
+#include <__utility/in_place.h>
+#include <__utility/move.h>
+#include <__utility/pointer_int_pair.h>
+#include <__utility/small_buffer.h>
+#include <__utility/swap.h>
+#include 
+#include 
+#include 
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#ifndef _LIBCPP_IN_MOVE_ONLY_FUNCTION_H
+#  error This header should only be included from move_only_function.h
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#  define _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_REF

EricWF wrote:

Huh, so I stand corrected here.

Normally, the way the terrible diagnostics come about is through the diagnostic 
caret pointing at a macro expansion. For example, were an invalid expression 
formed via a macro expansion, it would produce a diagnostic like:
https://godbolt.org/z/dKr1nzPd9
```
:12:1: error: no matching function for call to 'invoke'
   12 | EXPAND
```

However, since we never actually expand any of the expressions fully from a 
macro, and none of the macros lead an expression (where the caret might point, 
`_VSTD` was notorious for this), the diagnostics produced by your 
implementation don't get all muddy.

Neither do they really appear to hide too much information. I was worried it 
would be hard to tell the actual CV, ref, and noexcept qualifiers were  present 
from a particular diagnostic. And while you can't see what's used from the 
source, the clang diagnostics always seem to provide enough information to 
figure out which specialization your in. But that also seems to work:

```
/home/eric/llvm-project/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const_noexcept.pass.cpp:51:5:
 error: no matching function for call to object of type 
'std::move_only_function'
  51 | f();
   | ^
 
/home/eric/llvm-project/libcxx/include/__functional/move_only_function_impl.h:200:34:
 note: candidate function not viable: expects an rvalue for object argument
   200 |   _LIBCPP_HIDE_FROM_ABI _ReturnT operator()(_ArgTypes... __args) 
_LIBCPP_MOVE_ONLY_FUNCTION_CVREF
```

Now I still hate using the preprocessor, and dislike creating non-modular 
re-includable headers. And I have a strong aversion to its use. But diagnostics 
don't appear to be an issue here.

https://github.com/llvm/llvm-project/pull/94670
_______
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[Lldb-commits] [lldb] [lldb] Skip declaration DIEs in the debug_names index (PR #94744)

2024-06-07 Thread Michael Buch via lldb-commits

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

LGTM, thanks for the tests

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


[jenkinsci/git-client-plugin] be38a1: we do have testcontainer tests

2024-06-07 Thread 'Olivier Lamy' via Jenkins Commits
  Branch: refs/heads/master
  Home:   https://github.com/jenkinsci/git-client-plugin
  Commit: be38a10aa18e23b91ccff0b14edd9ef94af85513
  
https://github.com/jenkinsci/git-client-plugin/commit/be38a10aa18e23b91ccff0b14edd9ef94af85513
  Author: Olivier Lamy 
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
M Jenkinsfile

  Log Message:
  ---
  we do have testcontainer tests

Signed-off-by: Olivier Lamy 



To unsubscribe from these emails, change your notification settings at 
https://github.com/jenkinsci/git-client-plugin/settings/notifications

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-commits+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-commits/jenkinsci/git-client-plugin/push/refs/heads/master/27b759-be38a1%40github.com.


[clang] [clang] Fix loss of `dllexport` for exported template specialization (PR #94664)

2024-06-07 Thread via cfe-commits

zmodem wrote:

> > It would be nice to keep `GetOrCreateLLVMGlobal` and 
> > `GetOrCreateLLVMFunction` in sync. Would it be possible to extract the 
> > "Handle dropped DLL attributes" logic into a small utility function that 
> > could be called from both?
> 
> I did briefly think about this, but does this change really apply to 
> `GetOrCreateLLVMGlobal`? Is there any test case to exercise it? Perhaps it 
> would be better to leave `GetOrCreateLLVMGlobal` as is?

I think we should look at it the other way around: unless there's a reason that 
the functions should behave differently (and I'm not aware of any), it seems 
better for them to keep using the same logic.

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


[clang] [clang][AArch64] Add validation for Global Register Variable. (PR #94271)

2024-06-07 Thread KAWASHIMA Takahiro via cfe-commits

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


[clang] [clang][AArch64] Add validation for Global Register Variable. (PR #94271)

2024-06-07 Thread KAWASHIMA Takahiro via cfe-commits


@@ -0,0 +1,13 @@
+// Check that -ffixed register handled for globals.
+// Regression test for #76426
+// RUN: %clang --target=aarch64-none-gnu -ffixed-x15 -### %s 2>&1 | FileCheck 
%s
+// CHECK-NOT: fatal error: error in backend: Invalid register name "x15".

kawashima-fj wrote:

You modified Clang code but this error message is the one of the LLVM backend.
Is it better to check the Clang-side message `error: size of register 'x15' 
does not match variable size`?

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


[clang] [clang][AArch64] Add validation for Global Register Variable. (PR #94271)

2024-06-07 Thread KAWASHIMA Takahiro via cfe-commits

https://github.com/kawashima-fj approved this pull request.

Thanks for the fix. I left a minor suggestion.

Some notes:

- This commit make Clang emit `error: size of register '???' does not match 
variable size` error instead of `fatal error: error in backend: Invalid 
register name "???"`, regardless of the `-ffixed-???` option.
- #76426 says "When `-ffixed-x15` is specified, it can be compiled.". When 
`-ffixed-x15` is specified, older revisions (including 18.1.x releases) 
compiles the program in #76426 without an error but the generated code is 
incorrect (the `foo` function is compiled into `mrs w0, NZCV; ret`!). Recent 
revisions emits `fatal error: error in backend: Invalid register name "x15".`. 
So make it a Clang error is appropriate.
- GCC allows this variable-register size mismatch. Clang does not allow.
- We don't need to use `starts_with_insensitive`. Register names are 
case-sensitive (same as GCC).

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


[clang] [libcxx] [clang] Preserve Qualifiers and type sugar in TemplateNames (PR #93433)

2024-06-07 Thread kadir çetinkaya via cfe-commits
os/llvm/llvm/include/llvm/Support/Error.h:239:16
#46 0x56194380728d 
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) 
/usr/local/google/home/kadircet/repos/llvm/clang/lib/Frontend/CompilerInstance.cpp:1061:23
#47 0x56194398013e 
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) 
/usr/local/google/home/kadircet/repos/llvm/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:280:25
#48 0x5619404c7baf cc1_main(llvm::ArrayRef, char const*, 
void*) 
/usr/local/google/home/kadircet/repos/llvm/clang/tools/driver/cc1_main.cpp:232:15
#49 0x5619404c448d ExecuteCC1Tool(llvm::SmallVectorImpl&, 
llvm::ToolContext const&) 
/usr/local/google/home/kadircet/repos/llvm/clang/tools/driver/driver.cpp:215:12
#50 0x561943645c99 operator() 
/usr/local/google/home/kadircet/repos/llvm/clang/lib/Driver/Job.cpp:440:30
#51 0x561943645c99 void llvm::function_ref::callback_fn>,
 std::__cxx11::basic_string, 
std::allocator>*, bool*) const::$_0>(long) 
/usr/local/google/home/kadircet/repos/llvm/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#52 0x561942b8c3c6 operator() 
/usr/local/google/home/kadircet/repos/llvm/llvm/include/llvm/ADT/STLFunctionalExtras.h:0:12
#53 0x561942b8c3c6 
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) 
/usr/local/google/home/kadircet/repos/llvm/llvm/lib/Support/CrashRecoveryContext.cpp:426:3
#54 0x561943645392 
clang::driver::CC1Command::Execute(llvm::ArrayRef>,
 std::__cxx11::basic_string, 
std::allocator>*, bool*) const 
/usr/local/google/home/kadircet/repos/llvm/clang/lib/Driver/Job.cpp:440:7
#55 0x5619435fd4c7 
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, 
clang::driver::Command const*&, bool) const 
/usr/local/google/home/kadircet/repos/llvm/clang/lib/Driver/Compilation.cpp:199:15
#56 0x5619435fda07 
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, 
llvm::SmallVectorImpl>&, bool) 
const 
/usr/local/google/home/kadircet/repos/llvm/clang/lib/Driver/Compilation.cpp:253:13
#57 0x56194361e719 empty 
/usr/local/google/home/kadircet/repos/llvm/llvm/include/llvm/ADT/SmallVector.h:94:46
#58 0x56194361e719 
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, 
llvm::SmallVectorImpl>&) 
/usr/local/google/home/kadircet/repos/llvm/clang/lib/Driver/Driver.cpp:1942:23
#59 0x5619404c398d clang_main(int, char**, llvm::ToolContext const&) 
/usr/local/google/home/kadircet/repos/llvm/clang/tools/driver/driver.cpp:391:21
#60 0x5619404d44f7 main 
/usr/local/google/home/kadircet/repos/llvm/build/tools/clang/tools/driver/clang-driver.cpp:17:10
#61 0x7fa5f6e456ca __libc_start_call_main 
./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#62 0x7fa5f6e45785 call_init ./csu/../csu/libc-start.c:128:20
#63 0x7fa5f6e45785 __libc_start_main ./csu/../csu/libc-start.c:347:5
#64 0x5619404c1de1 _start (./bin/clang+0x546ede1)
```

@yozhu this is the same assertion you mentioned in 
https://github.com/llvm/llvm-project/pull/94659, but doesn't really involve 
default template args, so I am not sure if this is the same kind of reproducer.

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


[clang] 9eb8a13 - [clang][Interp][NFC] Fix a const-correctness warning

2024-06-07 Thread Timm Bäder via cfe-commits

Author: Timm Bäder
Date: 2024-06-07T13:29:23+02:00
New Revision: 9eb8a130c5d708dbabe824113add072436ae9997

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

LOG: [clang][Interp][NFC] Fix a const-correctness warning

Added: 


Modified: 
clang/lib/AST/Interp/MemberPointer.h

Removed: 




diff  --git a/clang/lib/AST/Interp/MemberPointer.h 
b/clang/lib/AST/Interp/MemberPointer.h
index 5c61f6a439574..f56dc530431e4 100644
--- a/clang/lib/AST/Interp/MemberPointer.h
+++ b/clang/lib/AST/Interp/MemberPointer.h
@@ -86,7 +86,7 @@ class MemberPointer final {
   bool hasBase() const { return !Base.isZero(); }
 
   void print(llvm::raw_ostream ) const {
-OS << "MemberPtr(" << Base << " " << (void *)Dcl << " + " << PtrOffset
+OS << "MemberPtr(" << Base << " " << (const void *)Dcl << " + " << 
PtrOffset
<< ")";
   }
 



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


[clang] b8cc85b - [clang][Interp] Limit lambda capture lazy visting to actual captures

2024-06-07 Thread Timm Bäder via cfe-commits

Author: Timm Bäder
Date: 2024-06-07T13:29:23+02:00
New Revision: b8cc85b318c0dd89e4dd69e3691ffcad5e401885

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

LOG: [clang][Interp] Limit lambda capture lazy visting to actual captures

Check this by looking at the VarDecl.

Added: 


Modified: 
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/test/AST/Interp/lambda.cpp

Removed: 




diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp 
b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 8dc71b2527f3b..ff2b51e3fb6fa 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -3895,12 +3895,13 @@ bool ByteCodeExprGen::visitDeclRef(const 
ValueDecl *D, const Expr *E) {
   return this->emitGetThisFieldPtr(Offset, E);
 return this->emitGetPtrThisField(Offset, E);
   } else if (const auto *DRE = dyn_cast(E);
- DRE && DRE->refersToEnclosingVariableOrCapture() &&
- isa(D)) {
-if (!this->visitVarDecl(cast(D)))
-  return false;
-// Retry.
-return this->visitDeclRef(D, E);
+ DRE && DRE->refersToEnclosingVariableOrCapture()) {
+if (const auto *VD = dyn_cast(D); VD && VD->isInitCapture()) {
+  if (!this->visitVarDecl(cast(D)))
+return false;
+  // Retry.
+  return this->visitDeclRef(D, E);
+}
   }
 
   // Try to lazily visit (or emit dummy pointers for) declarations

diff  --git a/clang/test/AST/Interp/lambda.cpp 
b/clang/test/AST/Interp/lambda.cpp
index 71e7077550b28..0eb12643b1b7f 100644
--- a/clang/test/AST/Interp/lambda.cpp
+++ b/clang/test/AST/Interp/lambda.cpp
@@ -267,3 +267,16 @@ namespace CaptureDefaults {
 
 constexpr auto t4 = ([x=42]() consteval { return x; }());
 static_assert(t4 == 42, "");
+
+namespace InvalidCapture {
+
+  int (int *p);
+  char (...);
+  void g() {
+int n = -1;   // both-note {{declared here}}
+[=] {
+  int arr[n]; // both-warning {{variable length arrays in C++ are a Clang 
extension}} \
+ both-note {{read of non-const variable 'n' is not allowed 
in a constant expression}}
+} ();
+  }
+}



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


[clang] [clang-repl] Lay the foundation of pretty printing for C. (PR #89811)

2024-06-07 Thread David Spickett via cfe-commits

DavidSpickett wrote:

> I will get you instructions on how to do that (will be tomorrow at this 
> point).

https://github.com/llvm/llvm-project/issues/94741#issuecomment-2154656315

There is some underlying issue 
(https://github.com/llvm/llvm-project/issues/94741), so if you want to try and 
fix it, that's great, but it's also fine if you'd rather wait and see what I 
find on native hardware.

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


[clang] [clang] Fix loss of `dllexport` for exported template specialization (PR #94664)

2024-06-07 Thread Andrew Ng via cfe-commits

nga888 wrote:

> It would be nice to keep `GetOrCreateLLVMGlobal` and 
> `GetOrCreateLLVMFunction` in sync. Would it be possible to extract the 
> "Handle dropped DLL attributes" logic into a small utility function that 
> could be called from both?

I did briefly think about this, but does this change really apply to 
`GetOrCreateLLVMGlobal`? Is there any test case to exercise it? Perhaps it 
would be better to leave `GetOrCreateLLVMGlobal` as is?


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


[tianocore/edk2] 8c826b: MdeModulePkg: In RemoveTableFromRsdt don't read fr...

2024-06-07 Thread Rebecca Cran via edk2-commits
  Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: 8c826be35c736f4b718c8f927853aa957a1973d8
  
https://github.com/tianocore/edk2/commit/8c826be35c736f4b718c8f927853aa957a1973d8
  Author: Rebecca Cran 
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
M MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c

  Log Message:
  ---
  MdeModulePkg: In RemoveTableFromRsdt don't read from unallocated memory

Instead of copying from unallocated memory in RemoveTableFromRsdt, do a
CopyMem followed by ZeroMem.

Signed-off-by: Rebecca Cran 



To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


___
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits


[clang] 9ece3eb - [clang][Interp] Check ConstantExpr results for initialization

2024-06-07 Thread Timm Bäder via cfe-commits

Author: Timm Bäder
Date: 2024-06-07T13:29:23+02:00
New Revision: 9ece3eb1459309f9fbd18ce8ec8f771c238e8815

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

LOG: [clang][Interp] Check ConstantExpr results for initialization

They need to be fully initialized, similar to global variables.

Added: 


Modified: 
clang/lib/AST/Interp/EvalEmitter.cpp
clang/lib/AST/Interp/EvaluationResult.cpp
clang/test/AST/Interp/cxx20.cpp

Removed: 




diff  --git a/clang/lib/AST/Interp/EvalEmitter.cpp 
b/clang/lib/AST/Interp/EvalEmitter.cpp
index 6d8aa3f20f01f..f6191d8ed6345 100644
--- a/clang/lib/AST/Interp/EvalEmitter.cpp
+++ b/clang/lib/AST/Interp/EvalEmitter.cpp
@@ -41,6 +41,7 @@ EvaluationResult EvalEmitter::interpretExpr(const Expr *E,
 bool ConvertResultToRValue) {
   S.setEvalLocation(E->getExprLoc());
   this->ConvertResultToRValue = ConvertResultToRValue;
+  this->CheckFullyInitialized = isa(E);
   EvalResult.setSource(E);
 
   if (!this->visitExpr(E)) {
@@ -175,6 +176,10 @@ bool EvalEmitter::emitRetVoid(const SourceInfo ) {
 
 bool EvalEmitter::emitRetValue(const SourceInfo ) {
   const auto  = S.Stk.pop();
+
+  if (CheckFullyInitialized && !EvalResult.checkFullyInitialized(S, Ptr))
+return false;
+
   if (std::optional APV = Ptr.toRValue(S.getCtx())) {
 EvalResult.setValue(*APV);
 return true;

diff  --git a/clang/lib/AST/Interp/EvaluationResult.cpp 
b/clang/lib/AST/Interp/EvaluationResult.cpp
index c04b0fc0a1121..29977232975fc 100644
--- a/clang/lib/AST/Interp/EvaluationResult.cpp
+++ b/clang/lib/AST/Interp/EvaluationResult.cpp
@@ -141,16 +141,14 @@ bool EvaluationResult::checkFullyInitialized(InterpState 
,
  const Pointer ) const {
   assert(Source);
   assert(empty());
-
-  // Our Source must be a VarDecl.
-  const Decl *SourceDecl = Source.dyn_cast();
-  assert(SourceDecl);
-  const auto *VD = cast(SourceDecl);
-  assert(VD->getType()->isRecordType() || VD->getType()->isArrayType());
-  SourceLocation InitLoc = VD->getAnyInitializer()->getExprLoc();
-
   assert(!Ptr.isZero());
 
+  SourceLocation InitLoc;
+  if (const auto *D = Source.dyn_cast())
+InitLoc = cast(D)->getAnyInitializer()->getExprLoc();
+  else if (const auto *E = Source.dyn_cast())
+InitLoc = E->getExprLoc();
+
   if (const Record *R = Ptr.getRecord())
 return CheckFieldsInitialized(S, InitLoc, Ptr, R);
   const auto *CAT =

diff  --git a/clang/test/AST/Interp/cxx20.cpp b/clang/test/AST/Interp/cxx20.cpp
index c750be866ca7c..434823644a7a3 100644
--- a/clang/test/AST/Interp/cxx20.cpp
+++ b/clang/test/AST/Interp/cxx20.cpp
@@ -797,3 +797,20 @@ namespace self_referencing {
 S s(1);
   }
 }
+
+namespace GH64949 {
+  struct f {
+int g; // both-note {{subobject declared here}}
+constexpr ~f() {}
+  };
+
+  class h {
+  public:
+consteval h(char *) {}
+f i;
+  };
+
+  void test() { h{nullptr}; } // both-error {{call to consteval function 
'GH64949::h::h' is not a constant expression}} \
+  // both-note {{subobject 'g' is not 
initialized}} \
+  // both-warning {{expression result unused}}
+}



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


[clang] [clang] Fix loss of `dllexport` for exported template specialization (PR #94664)

2024-06-07 Thread via cfe-commits

https://github.com/zmodem commented:

Thanks! This basically looks good to me.

It would be nice to keep `GetOrCreateLLVMGlobal` and `GetOrCreateLLVMFunction` 
in sync. Would it be possible to extract the "Handle dropped DLL attributes" 
logic into a small utility function that could be called from both?

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


[clang] [llvm] Add SonarCloud (PR #94745)

2024-06-07 Thread Balazs Benics via cfe-commits
fetch-depth: 250
+  - name: Setup ccache
+uses: hendrikmuhs/ccache-action@v1
+with:
+  # A full build of llvm, clang, lld, and lldb takes about 250MB
+  # of ccache space. There's not much reason to have more than this,
+  # because we usually won't need to save cache entries from older
+  # builds.  Also, there is an overall 10GB cache limit, and each
+  # run creates a new cache entry so we want to ensure that we have
+  # enough cache space for all the tests to run at once and still
+  # fit under the 10 GB limit.
+  # Default to 2G to workaround: 
https://github.com/hendrikmuhs/ccache-action/issues/174
+  max-size: 2G
+  key: ${{ matrix.os }}
+  variant: sccache
+  - name: Install sonar-scanner and build-wrapper
+uses: SonarSource/sonarcloud-github-c-cpp@v2
+  - name: Build and log with Build Wrapper
+env:
+  # Workaround for 
https://github.com/actions/virtual-environments/issues/5900.
+  # This should be a no-op for non-mac OSes
+  PKG_CONFIG_PATH: 
/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12
+shell: bash
+id: build-llvm
+run: |
+  if [ "${{ runner.os }}" == "Linux" ]; then
+builddir="/mnt/build/"
+mkdir -p $builddir
+extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ 
-DCMAKE_C_COMPILER=clang"
+  else
+builddir="$(pwd)"/build
+  fi
+  if [ "${{ runner.os }}" == "macOS" ]; then
+# Workaround test failure on some lld tests on MacOS
+# https://github.com/llvm/llvm-project/issues/81967
+extra_cmake_args="-DLLVM_DISABLE_ASSEMBLY_FILES=ON"
+  fi
+  echo "llvm-builddir=$builddir" >> "$GITHUB_OUTPUT"
+  cmake -G Ninja \
+-B "$builddir" \
+-S llvm \
+-DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" \
+-DCMAKE_BUILD_TYPE=Release \
+-DLLVM_ENABLE_ASSERTIONS=ON \
+-DLLDB_INCLUDE_TESTS=OFF \
+-DCMAKE_C_COMPILER_LAUNCHER=sccache \
+-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
+$extra_cmake_args \
+${{ inputs.extra_cmake_args }}
+  build-wrapper-linux-x86-64 --out-dir bwout \
+ninja -C "$builddir" '${{ inputs.build_target }}'
+  - name: Run sonar-scanner
+env:
+  SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+run: |
+  sonar-scanner --define 
sonar.cfamily.compile-commands="bwout/compile_commands.json"
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 0..e213f623be8b3
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,7 @@
+sonar.projectKey=steakhal_llvm-project
+sonar.organization=balazs-benics
+sonar.projectName=llvm-project
+
+sonar.sources=clang,llvm
+sonar.inclusions=**/*.c,**/*.cc,**/*.cpp,**/*.cxx,**/*.h
+sonar.exclusions=**/examples/**,**/unittests/**,**/benchmarks/**,**/benchmark/**,compiler-rt/lib/crt/crt*.c,**/*Fuzzer.*,**/test/**,clang/lib/Testing/*.cpp

>From da2900a70a1f5ca4ecffa6d5a1736318f3176e7d Mon Sep 17 00:00:00 2001
From: Balazs Benics 
Date: Fri, 7 Jun 2024 13:02:34 +0200
Subject: [PATCH 2/3] trigger analysis

---
 clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
index 238e87a712a43..ff6900b4acf1e 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -56,7 +56,7 @@ static ErrorMessage createOutOfBoundErrorMsg(StringRef 
FunctionDescription,
  << ()[1];
 
   if (Access == AccessKind::write) {
-Os << " overflows the destination buffer";
+Os << " overflows the destination buffer"; // testtest
   } else { // read access
 Os << " accesses out-of-bound array element";
   }

>From cd6f174776f2a974c181c04156c352e6c4375929 Mon Sep 17 00:00:00 2001
From: Balazs Benics 
Date: Fri, 7 Jun 2024 13:04:33 +0200
Subject: [PATCH 3/3] Enable for steakhal repo owner

---
 .github/workflows/clang-tests-sonar-cloud.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/clang-tests-sonar-cloud.yml 
b/.github/workflows/clang-tests-sonar-cloud.yml
index 2969687708629..1dad77dbe6072 100644
--- a/.github/workflows/clang-tests-sonar-cloud.yml
+++ b/.github/workflows/clang-tests-sonar-cloud.yml
@@ -30,7 +30,7 @@ concurrency:
 
 jobs:
   check_clang:
-if: github.repository_owner == 'llvm'
+if: github.repository_owner == 'steak

[clang] [llvm] Add SonarCloud (PR #94745)

2024-06-07 Thread via cfe-commits
   # of ccache space. There's not much reason to have more than this,
+  # because we usually won't need to save cache entries from older
+  # builds.  Also, there is an overall 10GB cache limit, and each
+  # run creates a new cache entry so we want to ensure that we have
+  # enough cache space for all the tests to run at once and still
+  # fit under the 10 GB limit.
+  # Default to 2G to workaround: 
https://github.com/hendrikmuhs/ccache-action/issues/174
+  max-size: 2G
+  key: ${{ matrix.os }}
+  variant: sccache
+  - name: Install sonar-scanner and build-wrapper
+uses: SonarSource/sonarcloud-github-c-cpp@v2
+  - name: Build and log with Build Wrapper
+env:
+  # Workaround for 
https://github.com/actions/virtual-environments/issues/5900.
+  # This should be a no-op for non-mac OSes
+  PKG_CONFIG_PATH: 
/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12
+shell: bash
+id: build-llvm
+run: |
+  if [ "${{ runner.os }}" == "Linux" ]; then
+builddir="/mnt/build/"
+mkdir -p $builddir
+extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ 
-DCMAKE_C_COMPILER=clang"
+  else
+builddir="$(pwd)"/build
+  fi
+  if [ "${{ runner.os }}" == "macOS" ]; then
+# Workaround test failure on some lld tests on MacOS
+# https://github.com/llvm/llvm-project/issues/81967
+extra_cmake_args="-DLLVM_DISABLE_ASSEMBLY_FILES=ON"
+  fi
+  echo "llvm-builddir=$builddir" >> "$GITHUB_OUTPUT"
+  cmake -G Ninja \
+-B "$builddir" \
+-S llvm \
+-DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" \
+-DCMAKE_BUILD_TYPE=Release \
+-DLLVM_ENABLE_ASSERTIONS=ON \
+-DLLDB_INCLUDE_TESTS=OFF \
+-DCMAKE_C_COMPILER_LAUNCHER=sccache \
+-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
+$extra_cmake_args \
+${{ inputs.extra_cmake_args }}
+  build-wrapper-linux-x86-64 --out-dir bwout \
+ninja -C "$builddir" '${{ inputs.build_target }}'
+  - name: Run sonar-scanner
+env:
+  SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+run: |
+  sonar-scanner --define 
sonar.cfamily.compile-commands="bwout/compile_commands.json"
diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
index 238e87a712a43..ff6900b4acf1e 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -56,7 +56,7 @@ static ErrorMessage createOutOfBoundErrorMsg(StringRef 
FunctionDescription,
  << ()[1];
 
   if (Access == AccessKind::write) {
-Os << " overflows the destination buffer";
+Os << " overflows the destination buffer"; // testtest
   } else { // read access
 Os << " accesses out-of-bound array element";
   }
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 0..e213f623be8b3
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,7 @@
+sonar.projectKey=steakhal_llvm-project
+sonar.organization=balazs-benics
+sonar.projectName=llvm-project
+
+sonar.sources=clang,llvm
+sonar.inclusions=**/*.c,**/*.cc,**/*.cpp,**/*.cxx,**/*.h
+sonar.exclusions=**/examples/**,**/unittests/**,**/benchmarks/**,**/benchmark/**,compiler-rt/lib/crt/crt*.c,**/*Fuzzer.*,**/test/**,clang/lib/Testing/*.cpp

``




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


[clang] [llvm] Add SonarCloud (PR #94745)

2024-06-07 Thread Balazs Benics via cfe-commits
fetch-depth: 250
+  - name: Setup ccache
+uses: hendrikmuhs/ccache-action@v1
+with:
+  # A full build of llvm, clang, lld, and lldb takes about 250MB
+  # of ccache space. There's not much reason to have more than this,
+  # because we usually won't need to save cache entries from older
+  # builds.  Also, there is an overall 10GB cache limit, and each
+  # run creates a new cache entry so we want to ensure that we have
+  # enough cache space for all the tests to run at once and still
+  # fit under the 10 GB limit.
+  # Default to 2G to workaround: 
https://github.com/hendrikmuhs/ccache-action/issues/174
+  max-size: 2G
+  key: ${{ matrix.os }}
+  variant: sccache
+  - name: Install sonar-scanner and build-wrapper
+uses: SonarSource/sonarcloud-github-c-cpp@v2
+  - name: Build and log with Build Wrapper
+env:
+  # Workaround for 
https://github.com/actions/virtual-environments/issues/5900.
+  # This should be a no-op for non-mac OSes
+  PKG_CONFIG_PATH: 
/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12
+shell: bash
+id: build-llvm
+run: |
+  if [ "${{ runner.os }}" == "Linux" ]; then
+builddir="/mnt/build/"
+mkdir -p $builddir
+extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ 
-DCMAKE_C_COMPILER=clang"
+  else
+builddir="$(pwd)"/build
+  fi
+  if [ "${{ runner.os }}" == "macOS" ]; then
+# Workaround test failure on some lld tests on MacOS
+# https://github.com/llvm/llvm-project/issues/81967
+extra_cmake_args="-DLLVM_DISABLE_ASSEMBLY_FILES=ON"
+  fi
+  echo "llvm-builddir=$builddir" >> "$GITHUB_OUTPUT"
+  cmake -G Ninja \
+-B "$builddir" \
+-S llvm \
+-DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" \
+-DCMAKE_BUILD_TYPE=Release \
+-DLLVM_ENABLE_ASSERTIONS=ON \
+-DLLDB_INCLUDE_TESTS=OFF \
+-DCMAKE_C_COMPILER_LAUNCHER=sccache \
+-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
+$extra_cmake_args \
+${{ inputs.extra_cmake_args }}
+  build-wrapper-linux-x86-64 --out-dir bwout \
+ninja -C "$builddir" '${{ inputs.build_target }}'
+  - name: Run sonar-scanner
+env:
+  SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+run: |
+  sonar-scanner --define 
sonar.cfamily.compile-commands="bwout/compile_commands.json"
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 0..e213f623be8b3
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,7 @@
+sonar.projectKey=steakhal_llvm-project
+sonar.organization=balazs-benics
+sonar.projectName=llvm-project
+
+sonar.sources=clang,llvm
+sonar.inclusions=**/*.c,**/*.cc,**/*.cpp,**/*.cxx,**/*.h
+sonar.exclusions=**/examples/**,**/unittests/**,**/benchmarks/**,**/benchmark/**,compiler-rt/lib/crt/crt*.c,**/*Fuzzer.*,**/test/**,clang/lib/Testing/*.cpp

>From da2900a70a1f5ca4ecffa6d5a1736318f3176e7d Mon Sep 17 00:00:00 2001
From: Balazs Benics 
Date: Fri, 7 Jun 2024 13:02:34 +0200
Subject: [PATCH 2/2] trigger analysis

---
 clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
index 238e87a712a43..ff6900b4acf1e 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -56,7 +56,7 @@ static ErrorMessage createOutOfBoundErrorMsg(StringRef 
FunctionDescription,
  << ()[1];
 
   if (Access == AccessKind::write) {
-Os << " overflows the destination buffer";
+Os << " overflows the destination buffer"; // testtest
   } else { // read access
 Os << " accesses out-of-bound array element";
   }

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


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)

2024-06-07 Thread via llvm-branch-commits


@@ -0,0 +1,46 @@
+//===--===//
+//
+// 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
+//
+//===--===//
+
+#ifndef _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_COMMON_H
+#define _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_COMMON_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template 
+class move_only_function;
+
+template 
+struct __is_move_only_function : false_type {};
+
+template 
+struct __is_move_only_function> : true_type {};
+
+template 
+struct _MoveOnlyFunctionTrivialVTable {
+  using _CallFunc = _ReturnT(_BufferT&, _ArgTypes...);
+
+  _CallFunc* __call_;
+};
+
+template 
+struct _MoveOnlyFunctionNonTrivialVTable : 
_MoveOnlyFunctionTrivialVTable<_BufferT, _ReturnT, _ArgTypes...> {

EricWF wrote:

You either don't need the inheritance, or you don't need to give the "destruct" 
base class all the arguments, you only need that for the call.

https://github.com/llvm/llvm-project/pull/94670
_______
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[Lldb-commits] [lldb] [lldb] Skip declaration DIEs in the debug_names index (PR #94744)

2024-06-07 Thread Pavel Labath via lldb-commits

labath wrote:

I should add that I'm pretty sure the index entries pointing to signature 
declaration DIEs were not the cause of crashes in @ZequanWu CLs, after creating 
the test case (what I think is the worst possible situation) and stepping 
through the code, I realized that these DIEs would get filtered out anyway on 
line DWARFIndex.cpp:126 (because `GetDWARFDeclContext` does not work on 
DW_AT_signature DIEs). Nonetheless, I think that this change makes sense 
because the fact that `GetDWARFDeclContext` is a bug that's probably preventing 
the correct lookup of types in some type unit scenarios. The check may very 
well become load-bearing if that function is fixed.

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


[jenkinsci/hpe-application-automation-tools-plugin] babba6: Update plugin version to 24.2 (#669)

2024-06-07 Thread 'andreibangau99' via Jenkins Commits
  Branch: refs/heads/latest
  Home:   https://github.com/jenkinsci/hpe-application-automation-tools-plugin
  Commit: babba633da33e0cd92dce95b59d3bee0931282b6
  
https://github.com/jenkinsci/hpe-application-automation-tools-plugin/commit/babba633da33e0cd92dce95b59d3bee0931282b6
  Author: andreibangau99 <62278993+andreibanga...@users.noreply.github.com>
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
M HpToolsAborter/Program.cs
M HpToolsAborter/Properties/AssemblyInfo.cs
M HpToolsLauncher/Common/McConnectionInfo.cs
M HpToolsLauncher/Common/WinUserNativeMethods.cs
M HpToolsLauncher/ConsoleQuickEdit.cs
M HpToolsLauncher/ConsoleWriter.cs
M HpToolsLauncher/ElevatedProcess.cs
M HpToolsLauncher/ExportOptions.cs
M HpToolsLauncher/HpToolsLauncherTests/ParallelRunnerEnvironmentUtilTests.cs
M HpToolsLauncher/HpToolsLauncherTests/Properties/AssemblyInfo.cs
M HpToolsLauncher/HpToolsLauncherTests/UnitTest1.cs
M HpToolsLauncher/IProcessAdapter.cs
M HpToolsLauncher/IniManager.cs
M HpToolsLauncher/Interfaces/IAssetRunner.cs
M HpToolsLauncher/Interfaces/IFileSysTestRunner.cs
M HpToolsLauncher/Interfaces/IMtbManager.cs
M HpToolsLauncher/Interfaces/IXmlBuilder.cs
M HpToolsLauncher/Interfaces/JavaProperties/JavaIniFile.cs
M HpToolsLauncher/Interfaces/JavaProperties/JavaProperties.cs
M HpToolsLauncher/JavaProperties/JavaIniFile.cs
M HpToolsLauncher/JavaProperties/JavaProperties.cs
M HpToolsLauncher/JunitXml/JunitXmlBuilder.cs
M HpToolsLauncher/JunitXml/junit.xsd
M HpToolsLauncher/Launcher.cs
M HpToolsLauncher/MtbManager.cs
M HpToolsLauncher/MtbxManager.cs
M HpToolsLauncher/MtbxSchema.xsd
M HpToolsLauncher/NativeProcess.cs
M HpToolsLauncher/ParallelRunner/ParallelRunnerEnvironmentUtil.cs
M HpToolsLauncher/ParallelRunner/ParallelTestRunConfiguration.cs
M HpToolsLauncher/ProcessExtensions.cs
M HpToolsLauncher/Program.cs
M HpToolsLauncher/Properties/AssemblyInfo.cs
M HpToolsLauncher/RTS/AdditionalAttributeModel.cs
M HpToolsLauncher/RTS/RTSHelper.cs
M HpToolsLauncher/RTS/ScriptRTSModel.cs
M HpToolsLauncher/Runners/AlmTestSetsRunner.cs
M HpToolsLauncher/Runners/FileSystemTestsRunner.cs
M HpToolsLauncher/Runners/MBTRunner.cs
M HpToolsLauncher/Runners/RunnerBase.cs
M HpToolsLauncher/SummaryDataLogger.cs
M HpToolsLauncher/TestData.cs
M HpToolsLauncher/TestInfo.cs
M HpToolsLauncher/TestParameter.cs
M HpToolsLauncher/TestParameterInfo.cs
M HpToolsLauncher/TestRunResults.cs
M HpToolsLauncher/TestRunners/ApiTestRunner.cs
M HpToolsLauncher/TestRunners/GuiTestRunner.cs
M HpToolsLauncher/TestRunners/IterationInfo.cs
M HpToolsLauncher/TestRunners/ParallelTestRunner.cs
M HpToolsLauncher/TestRunners/PerformanceTestRunner.cs
M HpToolsLauncher/TestSuiteRunResults.cs
M HpToolsLauncher/Utils/Encoder.cs
M HpToolsLauncher/Utils/Encrypter.cs
M HpToolsLauncher/Utils/Extensions.cs
M HpToolsLauncher/Utils/Helper.cs
M HpToolsLauncher/Utils/RunAsUser.cs
M LICENSE.txt
M LRAnalysisLauncher/Helper.cs
M LRAnalysisLauncher/Program.cs
M LRAnalysisLauncher/Properties/AssemblyInfo.cs
M pom.xml
M sonar-project.properties
M 
src/main/java/com/microfocus/application/automation/tools/AlmToolsUtils.java
M 
src/main/java/com/microfocus/application/automation/tools/EncryptionUtils.java
M 
src/main/java/com/microfocus/application/automation/tools/JenkinsUtils.java
M 
src/main/java/com/microfocus/application/automation/tools/common/ALMRESTVersionUtils.java
M src/main/java/com/microfocus/application/automation/tools/common/Func.java
M src/main/java/com/microfocus/application/automation/tools/common/Pair.java
M 
src/main/java/com/microfocus/application/automation/tools/common/RuntimeIOException.java
M 
src/main/java/com/microfocus/application/automation/tools/common/RuntimeUtils.java
M 
src/main/java/com/microfocus/application/automation/tools/common/SSEException.java
M 
src/main/java/com/microfocus/application/automation/tools/common/masterToSlave/FunctionFileCallable.java
M 
src/main/java/com/microfocus/application/automation/tools/common/masterToSlave/SupplierFileCallable.java
M 
src/main/java/com/microfocus/application/automation/tools/common/masterToSlave/ThrowingFunction.java
M 
src/main/java/com/microfocus/application/automation/tools/common/masterToSlave/ThrowingSupplier.java
M 
src/main/java/com/microfocus/application/automation/tools/common/model/HealthAnalyzerModel.java
M 
src/main/java/com/microfocus/application/automation/tools/common/model/VariableListWrapper.java
M 
src/main/java/com/microfocus/application/automation/tools/common/model/VariableWrapper.java
M 
src/main/java/com/microfocus/application/automation/tools/common/run/HealthAnalyzerBuilder.java
M 

[libunwind] [libunwind] Tweak tests for musl support. (PR #85097)

2024-06-07 Thread Alastair Houghton via cfe-commits

al45tair wrote:

I don't have merge rights here, so someone else will need to hit the Merge 
button.

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


<    5   6   7   8   9   10   11   12   13   14   >