aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Pointer.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-03-05 08:21:51 +0100
committerGitHub <noreply@github.com>2025-03-05 08:21:51 +0100
commit107fe0ec6cb36dca6bfafbfdf2996ce38d84e5bd (patch)
treeb92a0015baddc667e4df87f6f1cd89faacad1d39 /clang/lib/AST/ByteCode/Pointer.cpp
parentf1dbc45210cec766bed7dd320ed9420484ac3ec6 (diff)
downloadllvm-107fe0ec6cb36dca6bfafbfdf2996ce38d84e5bd.zip
llvm-107fe0ec6cb36dca6bfafbfdf2996ce38d84e5bd.tar.gz
llvm-107fe0ec6cb36dca6bfafbfdf2996ce38d84e5bd.tar.bz2
[clang][bytecode] Fix a crash in CheckConstantExpression (#129752)
The APValue we generated for a pointer with a LValueReferenceType base had an incorrect lvalue path attached. The attached test case is extracted from libc++'s regex.cpp.
Diffstat (limited to 'clang/lib/AST/ByteCode/Pointer.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Pointer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp
index 324097a..8abdc54b 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -210,7 +210,8 @@ APValue Pointer::toAPValue(const ASTContext &ASTCtx) const {
};
bool UsePath = true;
- if (getType()->isLValueReferenceType())
+ if (const ValueDecl *VD = getDeclDesc()->asValueDecl();
+ VD && VD->getType()->isLValueReferenceType())
UsePath = false;
// Build the path into the object.