Author: Pushpinder Singh Date: 2021-05-10T07:33:30Z New Revision: c711aa0f6f9d9400fbe619c7f0d6d4aa723b3a64
URL: https://github.com/llvm/llvm-project/commit/c711aa0f6f9d9400fbe619c7f0d6d4aa723b3a64 DIFF: https://github.com/llvm/llvm-project/commit/c711aa0f6f9d9400fbe619c7f0d6d4aa723b3a64.diff LOG: [amdgpu-arch] Guard hsa.h with __has_include This patch is suppose to fix the issue of hsa.h not found. Issue was reported in D99949 Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D102067 Added: Modified: clang/tools/amdgpu-arch/AMDGPUArch.cpp Removed: ################################################################################ diff --git a/clang/tools/amdgpu-arch/AMDGPUArch.cpp b/clang/tools/amdgpu-arch/AMDGPUArch.cpp index 29f9c8bc23974..4fae78b4f121c 100644 --- a/clang/tools/amdgpu-arch/AMDGPUArch.cpp +++ b/clang/tools/amdgpu-arch/AMDGPUArch.cpp @@ -11,7 +11,24 @@ // //===----------------------------------------------------------------------===// -#include <hsa.h> +#if defined(__has_include) +#if __has_include("hsa.h") +#define HSA_HEADER_FOUND 1 +#include "hsa.h" +#elif __has_include("hsa/hsa.h") +#define HSA_HEADER_FOUND 1 +#include "hsa/hsa.h" +#else +#define HSA_HEADER_FOUND 0 +#endif +#else +#define HSA_HEADER_FOUND 0 +#endif + +#if !HSA_HEADER_FOUND +int main() { return 1; } +#else + #include <string> #include <vector> @@ -57,3 +74,5 @@ int main() { hsa_shut_down(); return 0; } + +#endif _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits