Timm =?utf-8?q?Bäder?= <[email protected]> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
================ @@ -0,0 +1,56 @@ +//===-------------------------- 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" + +using namespace clang; +using namespace clang::interp; + +bool ExceptionTableEntry::canCatch(const Type *ThrowType) 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. + if (ThrowType->isNullPtrType() && CatchType->isPointerType()) + return true; + + // void* can catch all thown pointer types. + if (ThrowType->isPointerType() && CatchType->isVoidPointerType()) + return true; + + if (CatchType->isPointerType() && !ThrowType->isPointerType()) + return false; + + if (CatchType->isPointerOrReferenceType()) + CatchType = CatchType->getPointeeType().getTypePtr(); + if (ThrowType->isPointerOrReferenceType()) + ThrowType = ThrowType->getPointeeType().getTypePtr(); ---------------- efriedma-quic wrote: This still looks wrong? https://github.com/llvm/llvm-project/pull/189410 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
