[clang] 6a6f9bf - [clang] Fix assertion failure when printing atomic apvalues (#85259)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 26 00:35:07 PDT 2024
Author: Timm Baeder
Date: 2024-03-26T08:35:03+01:00
New Revision: 6a6f9bf38e65ec45b32da4b578e2830341a9b364
URL: https://github.com/llvm/llvm-project/commit/6a6f9bf38e65ec45b32da4b578e2830341a9b364
DIFF: https://github.com/llvm/llvm-project/commit/6a6f9bf38e65ec45b32da4b578e2830341a9b364.diff
LOG: [clang] Fix assertion failure when printing atomic apvalues (#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`.
Added:
Modified:
clang/lib/AST/APValue.cpp
Removed:
################################################################################
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>";
More information about the cfe-commits
mailing list