@@ -711,11 +712,54 @@ void APValue::printPretty(raw_ostream &Out, const
PrintingPolicy &Policy,
case APValue::Indeterminate:
Out << "";
return;
- case APValue::Int:
+ case APValue::Int: {
+const APSInt &Val = getInt();
+if (const EnumType *ET = Ty->getAs())
@@ -17256,6 +17378,56 @@ static bool ConvertAPValueToString(const APValue &V,
QualType T,
OS << "i)";
} break;
+ case APValue::ValueKind::Array:
+ case APValue::ValueKind::Vector: {
+llvm::raw_svector_ostream OS(Str);
+// we hope to emit a valid initalizer exp
@@ -84,6 +84,7 @@ class DiagnosticOptions : public
RefCountedBase{
DefaultMacroBacktraceLimit = 6,
DefaultTemplateBacktraceLimit = 10,
DefaultConstexprBacktraceLimit = 10,
+DefaultConstexprValueSizeLimit = 320,
cor3ntin wrote:
320?
https://gi
@@ -17256,6 +17378,56 @@ static bool ConvertAPValueToString(const APValue &V,
QualType T,
OS << "i)";
} break;
+ case APValue::ValueKind::Array:
+ case APValue::ValueKind::Vector: {
+llvm::raw_svector_ostream OS(Str);
+// we hope to emit a valid initalizer exp
@@ -17172,6 +17179,113 @@ static void WriteCharValueForDiagnostic(uint32_t
Value, const BuiltinType *BTy,
}
}
+/// A raw_ostream that clips its output beyond a certain size, inserting a
cor3ntin wrote:
I this we should move that to llvm/Support - either in
@@ -17256,6 +17378,56 @@ static bool ConvertAPValueToString(const APValue &V,
QualType T,
OS << "i)";
} break;
+ case APValue::ValueKind::Array:
+ case APValue::ValueKind::Vector: {
+llvm::raw_svector_ostream OS(Str);
+// we hope to emit a valid initalizer exp
tbaederr wrote:
Ping
https://github.com/llvm/llvm-project/pull/74852
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
sethp wrote:
Ping @cor3ntin @cjdb
https://github.com/llvm/llvm-project/pull/74852
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
sethp wrote:
Ping @cor3ntin @cjdb
https://github.com/llvm/llvm-project/pull/74852
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
yronglin wrote:
> @yronglin Thanks for introducing me to `__builtin_dump_struct`, that looks
> useful!
>
> I'm not sure I see much in the way of overlap with this PR, though: would you
> say more about what you mean? Is there maybe some commonality that you're
> concerned might drift apart?
sethp wrote:
@yronglin Thanks for introducing me to `__builtin_dump_struct`, that looks
useful!
I'm not sure I see much in the way of overlap with this PR, though: would you
say more about what you mean? Is there maybe some commonality that you're
concerned might drift apart?
https://github.
yronglin wrote:
FYI, Does this PR have some overlapping functions with `__builtin_dump_struct`
in structure printing?
https://github.com/llvm/llvm-project/blob/db4170a4f3a701a62f5c1ef2e6a30f490f107f7d/clang/lib/Sema/SemaChecking.cpp#L453-L695
https://github.com/llvm/llvm-project/pull/74852
___
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 01/13] [Clang][Sema] Print more static_assert exprs
This change int
sethp wrote:
Ping @cor3ntin @cjdb —this one definitely needs a rebase from me, but I don't
want to do that if y'all have a review in progress.
https://github.com/llvm/llvm-project/pull/74852
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 01/12] [Clang][Sema] Print more static_assert exprs
This change int
tbaederr wrote:
Ping @cor3ntin @cjdb
https://github.com/llvm/llvm-project/pull/74852
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
tbaederr wrote:
Ping @cor3ntin @cjdb
https://github.com/llvm/llvm-project/pull/74852
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 01/12] [Clang][Sema] Print more static_assert exprs
This change int
sethp wrote:
Looks like I missed the branch for v18 with this one, hence the conflict (now
resolved), too bad.
The test that's failing is looking for clang to emit some options that it's
not; it looks like the same test is failing on main, so I haven't dug too deep
into it. I believe I'm just
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 01/12] [Clang][Sema] Print more static_assert exprs
This change int
https://github.com/erichkeane commented:
I think this needs a 'merge' to get rid of the }}} patch changes from its diff,
but I'm in favor of the patch otherwise. Probably could use a release note,
and a look over @cor3ntin or @cjdb perhaps?
https://github.com/llvm/llvm-project/pull/74852
___
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 01/11] [Clang][Sema] Print more static_assert exprs
This change int
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 01/10] [Clang][Sema] Print more static_assert exprs
This change int
sethp wrote:
Yeah, definitely agree about adding no new issues like
https://github.com/llvm/llvm-project/issues/71675 . The good news is that ought
to make for an easy test case: something like `struct {
_BitInt(__BITINT_MAXWIDTH__ >> 6) F }` should do it. I'll take a look!
https://github.com
@@ -0,0 +1,115 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to 'A{0, {0, 3, 4}, 5} == A{1, {2, 3, 4}, 5}'}}
+static_assert
@@ -0,0 +1,115 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to 'A{0, {0, 3, 4}, 5} == A{1, {2, 3, 4}, 5}'}}
+static_assert
erichkeane wrote:
> I think this change is useful enough on its own that I'd like us to consider
> merging it: to me, teaching the compiler to do additional diffing or further
> clarifying the structure of complicated sub-objects feel like they'd benefit
> from having this work as a fallback.
@@ -0,0 +1,115 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to 'A{0, {0, 3, 4}, 5} == A{1, {2, 3, 4}, 5}'}}
+static_assert
sethp wrote:
I think this change is useful enough on its own that I'd like us to consider
merging it: to me, teaching the compiler to do additional diffing or further
clarifying the structure of complicated sub-objects feel like they'd benefit
from having this work as a fallback. We could then
@@ -0,0 +1,205 @@
+// RUN: %clang_cc1 -std=c++2a -verify -fsyntax-only -triple wasm32 %s
+// RUN: %clang_cc1 -std=c++2a -verify -fsyntax-only -triple
aarch64_be-linux-gnu %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 =
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 1/9] [Clang][Sema] Print more static_assert exprs
This change intro
@@ -711,11 +712,54 @@ void APValue::printPretty(raw_ostream &Out, const
PrintingPolicy &Policy,
case APValue::Indeterminate:
Out << "";
return;
- case APValue::Int:
+ case APValue::Int: {
+const APSInt &Val = getInt();
+if (const EnumType *ET = Ty->getAs())
@@ -0,0 +1,115 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to 'A{0, {0, 3, 4}, 5} == A{1, {2, 3, 4}, 5}'}}
+static_assert
https://github.com/sethp edited https://github.com/llvm/llvm-project/pull/74852
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,115 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to 'A{0, {0, 3, 4}, 5} == A{1, {2, 3, 4}, 5}'}}
+static_assert
@@ -0,0 +1,115 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to 'A{0, {0, 3, 4}, 5} == A{1, {2, 3, 4}, 5}'}}
+static_assert
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 1/8] [Clang][Sema] Print more static_assert exprs
This change intro
@@ -0,0 +1,115 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to 'A{0, {0, 3, 4}, 5} == A{1, {2, 3, 4}, 5}'}}
+static_assert
@@ -0,0 +1,115 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to 'A{0, {0, 3, 4}, 5} == A{1, {2, 3, 4}, 5}'}}
+static_assert
@@ -0,0 +1,115 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to 'A{0, {0, 3, 4}, 5} == A{1, {2, 3, 4}, 5}'}}
+static_assert
sethp wrote:
In playing around with this some more, I found it was pretty effective for me
to have an intializer-like expression (as in
[e769f15](https://github.com/llvm/llvm-project/pull/74852/commits/e769f158c8ee001e95299ce4c83e5250e2a8f963)
), because then I could copy/paste the output from
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 1/7] [Clang][Sema] Print more static_assert exprs
This change intro
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 1/6] [Clang][Sema] Print more static_assert exprs
This change intro
@@ -0,0 +1,117 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to '{0, {0, 3, 4}, 5} == {1, {2, 3, 4}, 5}'}}
+static_assert(a
https://github.com/topperc updated
https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 1/4] [Clang][Sema] Print more static_assert exprs
This change in
@@ -0,0 +1,117 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to '{0, {0, 3, 4}, 5} == {1, {2, 3, 4}, 5}'}}
+static_assert(a
@@ -0,0 +1,117 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to '{0, {0, 3, 4}, 5} == {1, {2, 3, 4}, 5}'}}
+static_assert(a
https://github.com/erichkeane edited
https://github.com/llvm/llvm-project/pull/74852
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,117 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+struct A {
+ int a, b[3], c;
+ bool operator==(const A&) const = default;
+};
+
+constexpr auto a0 = A{0, 0, 3, 4, 5};
+
+// expected-note@+1 {{evaluates to '{0, {0, 3, 4}, 5} == {1, {2, 3, 4}, 5}'}}
+static_assert(a
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 1/3] [Clang][Sema] Print more static_assert exprs
This change intro
@@ -6,20 +6,20 @@ struct A {
};
static_assert(A{1, 2, 3, 4, 5} == A{1, 2, 3, 4, 5});
-static_assert(A{1, 2, 3, 4, 5} == A{0, 2, 3, 4, 5}); // expected-error
{{failed}}
-static_assert(A{1, 2, 3, 4, 5} == A{1, 0, 3, 4, 5}); // expected-error
{{failed}}
-static_assert(A{1, 2, 3
@@ -6,20 +6,20 @@ struct A {
};
static_assert(A{1, 2, 3, 4, 5} == A{1, 2, 3, 4, 5});
-static_assert(A{1, 2, 3, 4, 5} == A{0, 2, 3, 4, 5}); // expected-error
{{failed}}
-static_assert(A{1, 2, 3, 4, 5} == A{1, 0, 3, 4, 5}); // expected-error
{{failed}}
-static_assert(A{1, 2, 3
https://github.com/sethp updated https://github.com/llvm/llvm-project/pull/74852
>From f281d34a51f662c934f158e4770774b0dc3588a2 Mon Sep 17 00:00:00 2001
From: Seth Pellegrino
Date: Thu, 7 Dec 2023 08:45:51 -0800
Subject: [PATCH 1/2] [Clang][Sema] Print more static_assert exprs
This change intro
@@ -6,20 +6,20 @@ struct A {
};
static_assert(A{1, 2, 3, 4, 5} == A{1, 2, 3, 4, 5});
-static_assert(A{1, 2, 3, 4, 5} == A{0, 2, 3, 4, 5}); // expected-error
{{failed}}
-static_assert(A{1, 2, 3, 4, 5} == A{1, 0, 3, 4, 5}); // expected-error
{{failed}}
-static_assert(A{1, 2, 3
@@ -6,20 +6,20 @@ struct A {
};
static_assert(A{1, 2, 3, 4, 5} == A{1, 2, 3, 4, 5});
-static_assert(A{1, 2, 3, 4, 5} == A{0, 2, 3, 4, 5}); // expected-error
{{failed}}
-static_assert(A{1, 2, 3, 4, 5} == A{1, 0, 3, 4, 5}); // expected-error
{{failed}}
-static_assert(A{1, 2, 3
https://github.com/erichkeane commented:
I too would like to see some more complicated dumps for 'complicated' structs
(inheritance, multiple inheritance, etc), and vectors/arrays of complicated
structs.
I am really concerned with the 'depth' that this will show and be unwieldy as a
result.
https://github.com/erichkeane edited
https://github.com/llvm/llvm-project/pull/74852
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
sethp wrote:
Thanks for the feedback! I've definitely found it helpful trying to puzzle out
why one of my static_asserts is failing, though it's certainly a far less
complete solution than the document @tahonermann shared.
The output from `printPretty` will definitely fall apart for a complex
tbaederr wrote:
I like this change, the only thing I'm a little afraid of is that the output
will deteriorate for large structs
https://github.com/llvm/llvm-project/pull/74852
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.
tahonermann wrote:
This looks like a good change to me since coercing a compiler to reveal the
values of compile-time objects can be frustrating. We could really use
something like `constexpr_print` from [P2758 (Emitting messages at compile
time)](https://wg21.link/p2758).
https://github.com/
https://github.com/shafik commented:
I don't feel like the changes are an improvement to the diagnostic but I would
like to hear from others who focus on clang front-end reviews.
https://github.com/llvm/llvm-project/pull/74852
___
cfe-commits mailing
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: None (sethp)
Changes
This change introspects more values involved in a static_assert, and extends
the supported set of operators for introspection to include binary operator
method calls.
It's intended to address the use-case where a sma
https://github.com/sethp created https://github.com/llvm/llvm-project/pull/74852
This change introspects more values involved in a static_assert, and extends
the supported set of operators for introspection to include binary operator
method calls.
It's intended to address the use-case where a
63 matches
Mail list logo