This change enables OpenCL diagnostics for the pointers annotated with
address space attribute SYCL mode.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Sema/SemaExpr.cpp | ||
---|---|---|
10089–10090 | Alternative approach would be to remove S.getLangOpts().OpenCL to enable this check for all modes. @Anastasia, do you know if it's safe to do? |
clang/lib/Sema/SemaExpr.cpp | ||
---|---|---|
10089–10090 | If I look at embedded C (ISO/IEC TR 18037) s5.3 rules that we are following largely in Clang I believe this is a universal rule! Especially looking at the followong statement:
So I think that it should apply to at least OpenCL, C and C++. I am surprised though that this has not been fixed yet. I am CCing @rjmccall and @jeroen.dobbelaere in case they have any more insights on this. |
clang/lib/Sema/SemaExpr.cpp | ||
---|---|---|
10089–10090 | Yes, I agree, this should apply in all modes. You should able to restructure the isAddressSpaceOverlapping function so that it can work directly on the address spaces of LHSPointeeTy and RHSPointeeTy; the code will be both cleaner and faster. |
Thanks for the review.
I've enabled the diagnostics for all the modes.
I also applied the refactoring suggested by @rjmccall. Hopefully I understand it correctly.
Please add a C test case just using the address_space attribute.
clang/include/clang/AST/Type.h | ||
---|---|---|
1069 | It's idiomatic to take QualType by value rather than const &. Can you rewrite the PointerType method to delegate to this? Assuming it isn't completely dead, that is. |
- Added C test case with address_space attribute.
- Move isAddressSpaceOverlapping from PointerType to QualType.
- Move C++ test case to clang/test/SemaCXX
clang/include/clang/AST/Type.h | ||
---|---|---|
1069 | It isn't completely dead, but there were just a few uses of the PointerType method, so I've updated all of them to avoid code duplication in two classes. |
It's idiomatic to take QualType by value rather than const &.
Can you rewrite the PointerType method to delegate to this? Assuming it isn't completely dead, that is.