HIPIFY icon indicating copy to clipboard operation
HIPIFY copied to clipboard

[HIPIFY][clang] Add a callback in clang to decide on hipify-clang's side whether to exclude the particular false conditional block or not

Open emankov opened this issue 5 years ago • 1 comments

With the change https://github.com/ROCm-Developer-Tools/HIP/pull/1372, all the blocks are not excluded from AST when -skip-excluded-preprocessor-conditional-blocks option is set. The corresponding change in clang: https://reviews.llvm.org/D66597.

The main idea is: if there is nothing to hipify in a particular false conditional block, then such block might be excluded from AST.

Such a callback in clang's preprocessor will be useful for the following main cases:

  • conditional branches with multiplatform code;
  • variables redefinition in conditional branches;
  • other cases, which may lead to syntactical errors.

emankov avatar Mar 03 '20 10:03 emankov

The following example should be successfully hipified after implementing the feature in clang: deviceQuery.zip

emankov avatar Apr 27 '20 15:04 emankov