aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Pointer.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-06-03 16:26:31 +0200
committerGitHub <noreply@github.com>2025-06-03 16:26:31 +0200
commit2e70da3fba14f9ff0b29f65fed174f075d94d9a4 (patch)
treeb3d6e69b1cfc30930bc69980b354ff0073820dae /clang/lib/AST/ByteCode/Pointer.cpp
parentd9df71045441e02d33cd01fad203862c7efd637e (diff)
downloadllvm-2e70da3fba14f9ff0b29f65fed174f075d94d9a4.zip
llvm-2e70da3fba14f9ff0b29f65fed174f075d94d9a4.tar.gz
llvm-2e70da3fba14f9ff0b29f65fed174f075d94d9a4.tar.bz2
[clang][bytecode] Partially address string literal uniqueness (#142555)
This still leaves the case of the constexpr auto b3 = name1() == name1(); test from cxx20.cpp broken.
Diffstat (limited to 'clang/lib/AST/ByteCode/Pointer.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Pointer.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp
index 6c2566b..50453c7 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -571,6 +571,17 @@ bool Pointer::pointsToLiteral() const {
return E && !isa<MaterializeTemporaryExpr, StringLiteral>(E);
}
+bool Pointer::pointsToStringLiteral() const {
+ if (isZero() || !isBlockPointer())
+ return false;
+
+ if (block()->isDynamic())
+ return false;
+
+ const Expr *E = block()->getDescriptor()->asExpr();
+ return E && isa<StringLiteral>(E);
+}
+
std::optional<std::pair<Pointer, Pointer>>
Pointer::computeSplitPoint(const Pointer &A, const Pointer &B) {
if (!A.isBlockPointer() || !B.isBlockPointer())