[OPENMP]Improve diagnostics for unsupported unified addressing.
Improved diagnostics for better user experience.
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
index eab2d7b..96716c0 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
@@ -4954,7 +4954,8 @@
const OMPRequiresDecl *D) {
for (const OMPClause *Clause : D->clauselists()) {
if (Clause->getClauseKind() == OMPC_unified_shared_memory) {
- switch (getCudaArch(CGM)) {
+ CudaArch Arch = getCudaArch(CGM);
+ switch (Arch) {
case CudaArch::SM_20:
case CudaArch::SM_21:
case CudaArch::SM_30:
@@ -4966,10 +4967,14 @@
case CudaArch::SM_53:
case CudaArch::SM_60:
case CudaArch::SM_61:
- case CudaArch::SM_62:
- CGM.Error(Clause->getBeginLoc(),
- "Target architecture does not support unified addressing");
+ case CudaArch::SM_62: {
+ SmallString<256> Buffer;
+ llvm::raw_svector_ostream Out(Buffer);
+ Out << "Target architecture " << CudaArchToString(Arch)
+ << " does not support unified addressing";
+ CGM.Error(Clause->getBeginLoc(), Out.str());
return;
+ }
case CudaArch::SM_70:
case CudaArch::SM_72:
case CudaArch::SM_75: