7a441aef10
Most of what hipify does is really just replacing CUDA idenitifers with HIP ones. CUDA function calls, preprocessor macro calls, enum references, types, etc. This is problematic: calls/types/enum-refs require name resolution for the AST matcher to work. This fails in the presence of code deleted by the preprocessor, and in two-pass template compilation. Instead, we can simply hook the lexer and have it rewrite the identifiers for us. This approach means identifier transformations will work correctly regardless of where they appear (and we get to delete lots of code) - Fixes #260 - Helps a bit with #207 - it will still fail to translate kernel calls in preprocessor-ignored code, but everything except kerel launches should translate correctly now, even in preprocessor-deleted code.
20 lines
488 B
C++
20 lines
488 B
C++
#pragma once
|
|
|
|
#include "clang/Tooling/CommonOptionsParser.h"
|
|
#include "llvm/Support/CommandLine.h"
|
|
|
|
namespace cl = llvm::cl;
|
|
namespace ct = clang::tooling;
|
|
|
|
extern cl::OptionCategory ToolTemplateCategory;
|
|
|
|
extern cl::opt<std::string> OutputFilename;
|
|
extern cl::opt<bool> Inplace;
|
|
extern cl::opt<bool> NoBackup;
|
|
extern cl::opt<bool> NoOutput;
|
|
extern cl::opt<bool> PrintStats;
|
|
extern cl::opt<std::string> OutputStatsFilename;
|
|
extern cl::opt<bool> Examine;
|
|
|
|
extern cl::extrahelp CommonHelp;
|