Timm =?utf-8?q?Bäder?= <[email protected]>,
Timm =?utf-8?q?Bäder?= <[email protected]>,
Timm =?utf-8?q?Bäder?= <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>


================
@@ -0,0 +1,94 @@
+//===-------------------------- Exceptions.cpp ------------------*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "Exceptions.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/CXXInheritance.h"
+
+using namespace clang;
+using namespace clang::interp;
+
+static bool isRecordOrPointerToRecordType(const Type *T) {
+  return T->isRecordType() ||
+         (T->isPointerOrReferenceType() && 
T->getPointeeType()->isRecordType());
+}
+
+bool ExceptionTableEntry::canCatch(const Type *ThrowType,
+                                   const ASTContext &ASTCtx) const {
+  const Type *CatchType = this->CatchType;
+
+  if (!CatchType || ASTContext::hasSameType(CatchType, ThrowType))
+    return true;
+
+  assert(CatchType);
+
+  // nullptr_t can be caught by any pointer type (including member pointers)
+  // and references of pointer types.
+  if (ThrowType->isNullPtrType()) {
+    if (CatchType->isPointerType() || CatchType->isMemberPointerType())
+      return true;
+    if (CatchType->isReferenceType() &&
+        CatchType->getPointeeType()->isPointerType())
----------------
tbaederr wrote:

I asked a gcc developer about the nullptr->memberpointer conversion, which 
doesn't work in gcc: https://godbolt.org/z/dnacEcP38

In my case, there's not really a good point where we could do the pointer -> 
memberpointer conversion. I added a test case and wrote a comment for it. It's 
currently failing in `LoadPop()`.

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