aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaExceptionSpec.cpp
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2024-11-15 06:58:36 -0600
committerGitHub <noreply@github.com>2024-11-15 06:58:36 -0600
commitb9d678d22f74ebd6e34f0a3501fb01d3d80984e7 (patch)
tree19883d356b7b2b9057443aa248ecd341a8a6bea6 /clang/lib/Sema/SemaExceptionSpec.cpp
parent40afff7bd95090a75bc68a0d26b8017cc0ae65c1 (diff)
downloadllvm-b9d678d22f74ebd6e34f0a3501fb01d3d80984e7.zip
llvm-b9d678d22f74ebd6e34f0a3501fb01d3d80984e7.tar.gz
llvm-b9d678d22f74ebd6e34f0a3501fb01d3d80984e7.tar.bz2
[Clang] Use TargetInfo when deciding if an address space is compatible (#115777)
Summary: Address spaces are used in several embedded and GPU targets to describe accesses to different types of memory. Currently we use the address space enumerations to control which address spaces are considered supersets of eachother, however this is also a target level property as described by the C standard's passing mentions. This patch allows the address space checks to use the target information to decide if a pointer conversion is legal. For AMDGPU and NVPTX, all supported address spaces can be converted to the default address space. More semantic checks can be added on top of this, for now I'm mainly looking to get more standard semantics working for C/C++. Right now the address space conversions must all be done explicitly in C/C++ unlike the offloading languages which define their own custom address spaces that just map to the same target specific ones anyway. The main question is if this behavior is a function of the target or the language.
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r--clang/lib/Sema/SemaExceptionSpec.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp
index 0d5ab0b..bfcdab91 100644
--- a/clang/lib/Sema/SemaExceptionSpec.cpp
+++ b/clang/lib/Sema/SemaExceptionSpec.cpp
@@ -717,9 +717,9 @@ bool Sema::handlerCanCatch(QualType HandlerType, QualType ExceptionType) {
Qualifiers EQuals, HQuals;
ExceptionType = Context.getUnqualifiedArrayType(
ExceptionType->getPointeeType(), EQuals);
- HandlerType = Context.getUnqualifiedArrayType(
- HandlerType->getPointeeType(), HQuals);
- if (!HQuals.compatiblyIncludes(EQuals))
+ HandlerType =
+ Context.getUnqualifiedArrayType(HandlerType->getPointeeType(), HQuals);
+ if (!HQuals.compatiblyIncludes(EQuals, getASTContext()))
return false;
if (HandlerType->isVoidType() && ExceptionType->isObjectType())