Timm =?utf-8?q?Bäder?= <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
================
@@ -319,6 +319,107 @@ ConstantResultStorageKind
ConstantExpr::getStorageKind(const APValue &Value) {
}
}
+// Check that V is a valid APValue result of E, i.e. the node type needs to
+// match the APValue kind.
+static void assertAPValueKind(const ConstantExpr *E, const APValue &V) {
+ // FIXME: We shouldn't be creating ConstantExpr nodes for missing APValues in
+ // the first place, but for the time being, accept this for any type.
+ if (V.isAbsent())
+ return;
+
+ if (E->isGLValue()) {
+ // NOTE: The restrictions for lvalue expressions are not 100% clear. We
+ // can't assert(V.isLValue()) because some ConstantExprs are lvalue and
+ // their result is a string literal, so an Array.
----------------
efriedma-quic wrote:
Oh, I see.
Maybe we should have a cast kind for "array lvalue-to-rvalue conversion", and
use that in cases where we treat a string as an rvalue. (This is similar to
HLSLArrayRValue cast.)
https://github.com/llvm/llvm-project/pull/230388
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits