https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/85259
When printing an `_Atomic(some struct type)`, we would later run into an assertion because we do a `Ty->castAs<RecordType>()`, which doesn't work with an `AtomicType`. Not sure how to best write a test for, this, but OTOH, `printPretty` is currently only used for debugging as far as I know(?). >From c38eb08c9dd22e35b43d9832006dda38ddb711fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com> Date: Thu, 14 Mar 2024 13:50:20 +0100 Subject: [PATCH] [clang] Fix assertion failure when printing atomic apvalues --- clang/lib/AST/APValue.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp index 4eae308ef5b34c..d8042321319a67 100644 --- a/clang/lib/AST/APValue.cpp +++ b/clang/lib/AST/APValue.cpp @@ -704,6 +704,9 @@ void APValue::printPretty(raw_ostream &Out, const PrintingPolicy &Policy, return; } + if (const auto *AT = Ty->getAs<AtomicType>()) + Ty = AT->getValueType(); + switch (getKind()) { case APValue::None: Out << "<out of lifetime>"; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits