Skip to content

Commit

Permalink
[clang] Fix assertion failure when printing atomic apvalues (#85259)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
tbaederr committed Mar 26, 2024
1 parent 6ff6191 commit 6a6f9bf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/lib/AST/APValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>";
Expand Down

0 comments on commit 6a6f9bf

Please sign in to comment.