llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

When printing an `_Atomic(some struct type)`, we would later run into an 
assertion because we do a `Ty-&gt;castAs&lt;RecordType&gt;()`, 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(?).

---
Full diff: https://github.com/llvm/llvm-project/pull/85259.diff


1 Files Affected:

- (modified) clang/lib/AST/APValue.cpp (+3) 


``````````diff
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>";

``````````

</details>


https://github.com/llvm/llvm-project/pull/85259
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to