diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-03-05 08:21:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-05 08:21:51 +0100 |
commit | 107fe0ec6cb36dca6bfafbfdf2996ce38d84e5bd (patch) | |
tree | b92a0015baddc667e4df87f6f1cd89faacad1d39 /clang/lib/AST/ByteCode/Pointer.cpp | |
parent | f1dbc45210cec766bed7dd320ed9420484ac3ec6 (diff) | |
download | llvm-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.cpp | 3 |
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. |