Skip to content

Commit

Permalink
Merge pull request #532 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY][#531][SWDEV_331863][temporary][workaround] Add a workaround for the `SWDEV_331863` blocker
  • Loading branch information
emankov authored Apr 22, 2022
2 parents 2692f3c + 81102b0 commit 75feb17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ else()
set(addr_var )
endif()

# [ToDo] Remove SWDEV_331863 related guards from CMakeLists.txt and HipifyAction.cpp when the blocker SWDEV_331863 is overcome
option (SWDEV_331863 "Enables SWDEV-331863 blocker workaround" OFF)
if(SWDEV_331863)
add_definitions(-DSWDEV_331863)
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${addr_var}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\" ${addr_var}")

Expand Down
6 changes: 3 additions & 3 deletions src/HipifyAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,10 @@ class PPCallbackProxy : public clang::PPCallbacks {

public:
explicit PPCallbackProxy(HipifyAction &action): hipifyAction(action) {}

// [ToDo] Remove SWDEV_331863 related guards from CMakeLists.txt and HipifyAction.cpp when the blocker SWDEV_331863 is overcome
void InclusionDirective(clang::SourceLocation hash_loc, const clang::Token &include_token,
StringRef file_name, bool is_angled, clang::CharSourceRange filename_range,
#if LLVM_VERSION_MAJOR < 15
#if (LLVM_VERSION_MAJOR < 15) || (LLVM_VERSION_MAJOR == 15 && SWDEV_331863)
const clang::FileEntry *file,
#else
Optional<clang::FileEntryRef> file,
Expand All @@ -695,7 +695,7 @@ class PPCallbackProxy : public clang::PPCallbacks {
, clang::SrcMgr::CharacteristicKind FileType
#endif
) override {
#if LLVM_VERSION_MAJOR < 15
#if (LLVM_VERSION_MAJOR < 15) || (LLVM_VERSION_MAJOR == 15 && SWDEV_331863)
auto f = file;
#else
auto f = &file->getFileEntry();
Expand Down

0 comments on commit 75feb17

Please sign in to comment.