From d5fd5e55c5060d9213f301a903438608805b2a32 Mon Sep 17 00:00:00 2001 From: Chris Kitching Date: Tue, 17 Oct 2017 15:30:38 +0100 Subject: [PATCH] Do not process __fetch_builtin_* in cudaCall() Fixes #205 --- hipamd/hipify-clang/src/Cuda2Hip.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hipamd/hipify-clang/src/Cuda2Hip.cpp b/hipamd/hipify-clang/src/Cuda2Hip.cpp index 4bffcdaed9..375ab8e8b2 100644 --- a/hipamd/hipify-clang/src/Cuda2Hip.cpp +++ b/hipamd/hipify-clang/src/Cuda2Hip.cpp @@ -814,7 +814,15 @@ void addAllMatchers(ast_matchers::MatchFinder &Finder, Cuda2HipCallback *Callbac isExpansionInMainFile(), callee( functionDecl( - matchesName("cu.*") + matchesName("cu.*"), + unless( + // Clang generates structs with functions on them to represent things like + // threadIdx.x. We have other logic to handle those builtins directly, so + // we need to suppress the call-handling. + // We can't handle those directly in the call-handler without special-casing + // it unpleasantly, since the names of the functions are unique only per-struct. + matchesName("__fetch_builtin.*") + ) ) ) ).bind("cudaCall"),