[PATCH] D102067: [amdgpu-arch] Guard hsa.h with __has_include

Pushpinder Singh via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 7 05:13:57 PDT 2021


pdhaliwal created this revision.
pdhaliwal added reviewers: jdoerfert, JonChesterfield, ronlieb, davezarzycki.
Herald added subscribers: kerbowa, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
pdhaliwal requested review of this revision.
Herald added subscribers: cfe-commits, wdng.
Herald added a project: clang.

This patch is suppose to fix the issue of hsa.h not found.
Issue was reported in D99949 <https://reviews.llvm.org/D99949>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102067

Files:
  clang/tools/amdgpu-arch/AMDGPUArch.cpp


Index: clang/tools/amdgpu-arch/AMDGPUArch.cpp
===================================================================
--- clang/tools/amdgpu-arch/AMDGPUArch.cpp
+++ clang/tools/amdgpu-arch/AMDGPUArch.cpp
@@ -11,7 +11,16 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include <hsa.h>
+#if defined(__has_include)
+#if __has_include("hsa.h")
+#include "hsa.h"
+#elif __has_include("hsa/hsa.h")
+#include "hsa/hsa.h"
+#endif
+#else
+#include "hsa.h"
+#endif
+
 #include <string>
 #include <vector>
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102067.343651.patch
Type: text/x-patch
Size: 538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210507/d972b8ad/attachment.bin>


More information about the cfe-commits mailing list