================
@@ -60,6 +60,30 @@ static bool exceedsArraySizeLimit(const LangOptions 
&LangOpts,
   return Limit != 0 && NumElems > Limit;
 }
 
+[[maybe_unused]] static bool blockEndsInReturn(const Stmt *S) {
+  if (isa<ReturnStmt>(S))
+    return true;
+
+  if (const auto *CS = dyn_cast<CompoundStmt>(S); CS && !CS->body_empty())
+    return isa<ReturnStmt>(CS->body_back());
+
+  return false;
+}
+
+const CXXConstructorDecl *findCopyCtor(const CXXRecordDecl *RD,
+                                       unsigned ExpectedQualifiers) {
+  if (!RD)
+    return nullptr;
+
+  unsigned Qualifiers;
+  for (CXXConstructorDecl *Ctor : RD->ctors()) {
+    if (Ctor->isCopyConstructor(Qualifiers) && Qualifiers == 
ExpectedQualifiers)
----------------
zwuis wrote:

Seems problematic. The type of the exception object isn't cv-qualified.

<details>
<summary>Reproducer</summary>

```cpp
struct E {
  bool copied = false;
  constexpr E(int) {}
  constexpr E(const E&) { copied = true; }
};
constexpr int f() try {
  throw E(1);
} catch (E e) {
  return e.copied ? 42 : 0;
}
static_assert(f() == 42);
```

</details>

https://github.com/llvm/llvm-project/pull/189410
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to