2
0

[HIPIFY] Add file:line:col info to [HIPIFY] warnings/errors.

[ROCm/hip commit: e39ed24a50]
Este cometimento está contido em:
Evgeny Mankov
2017-02-14 21:36:49 +03:00
ascendente f8ad2028a4
cometimento 8a8a7bc843
+79 -48
Ver ficheiro
@@ -1695,7 +1695,8 @@ StringRef unquoteStr(StringRef s) {
class Cuda2Hip { class Cuda2Hip {
public: public:
Cuda2Hip(Replacements *R): Replace(R) {} Cuda2Hip(Replacements *R, const std::string &srcFileName) :
Replace(R), mainFileName(srcFileName) {}
uint64_t countReps[CONV_LAST] = { 0 }; uint64_t countReps[CONV_LAST] = { 0 };
uint64_t countApiReps[API_LAST] = { 0 }; uint64_t countApiReps[API_LAST] = { 0 };
uint64_t countRepsUnsupported[CONV_LAST] = { 0 }; uint64_t countRepsUnsupported[CONV_LAST] = { 0 };
@@ -1704,15 +1705,28 @@ public:
std::map<std::string, uint64_t> cuda2hipUnconverted; std::map<std::string, uint64_t> cuda2hipUnconverted;
std::set<unsigned> LOCs; std::set<unsigned> LOCs;
enum msgTypes {
HIPIFY_ERROR = 0,
HIPIFY_WARNING
};
std::string getMsgType(msgTypes type) {
switch (type) {
case HIPIFY_ERROR: return "error";
default:
case HIPIFY_WARNING: return "warning";
}
}
protected: protected:
struct cuda2hipMap N; struct cuda2hipMap N;
Replacements *Replace; Replacements *Replace;
std::string mainFileName;
virtual void insertReplacement(const Replacement &rep, const FullSourceLoc &fullSL) { virtual void insertReplacement(const Replacement &rep, const FullSourceLoc &fullSL) {
Replace->insert(rep); Replace->insert(rep);
if (PrintStats) { if (PrintStats) {
LOCs.insert(fullSL.getExpansionLineNumber()); LOCs.insert(fullSL.getExpansionLineNumber());
// llvm::outs() << " [HIPIFY] expansion line num: " << fullSL.getExpansionLineNumber() << " for replacement '" << rep.getReplacementText() << "'\n";
} }
} }
void insertHipHeaders(Cuda2Hip *owner, const SourceManager &SM) { void insertHipHeaders(Cuda2Hip *owner, const SourceManager &SM) {
@@ -1727,6 +1741,11 @@ protected:
} }
} }
void printHipifyMessage(const SourceManager &SM, const SourceLocation &sl, const std::string &message, msgTypes msgType = HIPIFY_WARNING) {
FullSourceLoc fullSL(sl, SM);
llvm::errs() << "[HIPIFY] " << getMsgType(msgType) << ": " << mainFileName << ":" << fullSL.getExpansionLineNumber() << ":" << fullSL.getExpansionColumnNumber() << ": " << message << "\n";
}
void updateCountersExt(const hipCounter &counter, const std::string &cudaName) { void updateCountersExt(const hipCounter &counter, const std::string &cudaName) {
std::map<std::string, uint64_t> *map = &cuda2hipConverted; std::map<std::string, uint64_t> *map = &cuda2hipConverted;
std::map<std::string, uint64_t> *mapTotal = &cuda2hipConvertedTotal; std::map<std::string, uint64_t> *mapTotal = &cuda2hipConvertedTotal;
@@ -1783,7 +1802,8 @@ protected:
insertReplacement(Rep, fullSL); insertReplacement(Rep, fullSL);
} }
} else { } else {
// llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [string literal].\n"; // std::string msg = "the following reference is not handled: '" + name.str() + "' [string literal].";
// printHipifyMessage(SM, start, msg);
} }
if (end == StringRef::npos) { if (end == StringRef::npos) {
break; break;
@@ -1797,8 +1817,8 @@ class Cuda2HipCallback;
class HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks, public Cuda2Hip { class HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks, public Cuda2Hip {
public: public:
HipifyPPCallbacks(Replacements *R) HipifyPPCallbacks(Replacements *R, const std::string &mainFileName)
: Cuda2Hip(R), SeenEnd(false), _sm(nullptr), _pp(nullptr) {} : Cuda2Hip(R, mainFileName), SeenEnd(false), _sm(nullptr), _pp(nullptr) {}
virtual bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override { virtual bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override {
Preprocessor &PP = CI.getPreprocessor(); Preprocessor &PP = CI.getPreprocessor();
@@ -2005,12 +2025,12 @@ private:
if (const CallExpr *call = Result.Nodes.getNodeAs<CallExpr>("cudaCall")) { if (const CallExpr *call = Result.Nodes.getNodeAs<CallExpr>("cudaCall")) {
const FunctionDecl *funcDcl = call->getDirectCallee(); const FunctionDecl *funcDcl = call->getDirectCallee();
StringRef name = funcDcl->getDeclName().getAsString(); StringRef name = funcDcl->getDeclName().getAsString();
SourceManager *SM = Result.SourceManager;
SourceLocation sl = call->getLocStart();
const auto found = N.cuda2hipRename.find(name); const auto found = N.cuda2hipRename.find(name);
if (found != N.cuda2hipRename.end()) { if (found != N.cuda2hipRename.end()) {
if (!found->second.unsupported) { if (!found->second.unsupported) {
SourceManager *SM = Result.SourceManager;
StringRef repName = found->second.hipName; StringRef repName = found->second.hipName;
SourceLocation sl = call->getLocStart();
size_t length = name.size(); size_t length = name.size();
bool bReplace = true; bool bReplace = true;
if (SM->isMacroArgExpansion(sl)) { if (SM->isMacroArgExpansion(sl)) {
@@ -2037,7 +2057,8 @@ private:
updateCounters(found->second, name.str()); updateCounters(found->second, name.str());
} }
} else { } else {
llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [function call].\n"; std::string msg = "the following reference is not handled: '" + name.str() + "' [function call].";
printHipifyMessage(*SM, sl, msg);
} }
return true; return true;
} }
@@ -2121,6 +2142,8 @@ private:
dyn_cast<OpaqueValueExpr>(threadIdx->getBase())) { dyn_cast<OpaqueValueExpr>(threadIdx->getBase())) {
if (const DeclRefExpr *declRef = if (const DeclRefExpr *declRef =
dyn_cast<DeclRefExpr>(refBase->getSourceExpr())) { dyn_cast<DeclRefExpr>(refBase->getSourceExpr())) {
SourceLocation sl = threadIdx->getLocStart();
SourceManager *SM = Result.SourceManager;
StringRef name = declRef->getDecl()->getName(); StringRef name = declRef->getDecl()->getName();
StringRef memberName = threadIdx->getMemberDecl()->getName(); StringRef memberName = threadIdx->getMemberDecl()->getName();
size_t pos = memberName.find_first_not_of("__fetch_builtin_"); size_t pos = memberName.find_first_not_of("__fetch_builtin_");
@@ -2132,14 +2155,13 @@ private:
updateCounters(found->second, name.str()); updateCounters(found->second, name.str());
if (!found->second.unsupported) { if (!found->second.unsupported) {
StringRef repName = found->second.hipName; StringRef repName = found->second.hipName;
SourceLocation sl = threadIdx->getLocStart();
SourceManager *SM = Result.SourceManager;
Replacement Rep(*SM, sl, name.size(), repName); Replacement Rep(*SM, sl, name.size(), repName);
FullSourceLoc fullSL(sl, *SM); FullSourceLoc fullSL(sl, *SM);
insertReplacement(Rep, fullSL); insertReplacement(Rep, fullSL);
} }
} else { } else {
llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [builtin].\n"; std::string msg = "the following reference is not handled: '" + name.str() + "' [builtin].";
printHipifyMessage(*SM, sl, msg);
} }
} }
} }
@@ -2151,19 +2173,20 @@ private:
bool cudaEnumConstantRef(const MatchFinder::MatchResult &Result) { bool cudaEnumConstantRef(const MatchFinder::MatchResult &Result) {
if (const DeclRefExpr *enumConstantRef = Result.Nodes.getNodeAs<DeclRefExpr>("cudaEnumConstantRef")) { if (const DeclRefExpr *enumConstantRef = Result.Nodes.getNodeAs<DeclRefExpr>("cudaEnumConstantRef")) {
StringRef name = enumConstantRef->getDecl()->getNameAsString(); StringRef name = enumConstantRef->getDecl()->getNameAsString();
SourceLocation sl = enumConstantRef->getLocStart();
SourceManager *SM = Result.SourceManager;
const auto found = N.cuda2hipRename.find(name); const auto found = N.cuda2hipRename.find(name);
if (found != N.cuda2hipRename.end()) { if (found != N.cuda2hipRename.end()) {
updateCounters(found->second, name.str()); updateCounters(found->second, name.str());
if (!found->second.unsupported) { if (!found->second.unsupported) {
StringRef repName = found->second.hipName; StringRef repName = found->second.hipName;
SourceLocation sl = enumConstantRef->getLocStart();
SourceManager *SM = Result.SourceManager;
Replacement Rep(*SM, sl, name.size(), repName); Replacement Rep(*SM, sl, name.size(), repName);
FullSourceLoc fullSL(sl, *SM); FullSourceLoc fullSL(sl, *SM);
insertReplacement(Rep, fullSL); insertReplacement(Rep, fullSL);
} }
} else { } else {
llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [enum constant ref].\n"; std::string msg = "the following reference is not handled: '" + name.str() + "' [enum constant ref].";
printHipifyMessage(*SM, sl, msg);
} }
return true; return true;
} }
@@ -2179,19 +2202,20 @@ private:
QualType QT = enumConstantDecl->getType().getUnqualifiedType(); QualType QT = enumConstantDecl->getType().getUnqualifiedType();
name = QT.getAsString(); name = QT.getAsString();
} }
SourceLocation sl = enumConstantDecl->getLocStart();
SourceManager *SM = Result.SourceManager;
const auto found = N.cuda2hipRename.find(name); const auto found = N.cuda2hipRename.find(name);
if (found != N.cuda2hipRename.end()) { if (found != N.cuda2hipRename.end()) {
updateCounters(found->second, name.str()); updateCounters(found->second, name.str());
if (!found->second.unsupported) { if (!found->second.unsupported) {
StringRef repName = found->second.hipName; StringRef repName = found->second.hipName;
SourceLocation sl = enumConstantDecl->getLocStart();
SourceManager *SM = Result.SourceManager;
Replacement Rep(*SM, sl, name.size(), repName); Replacement Rep(*SM, sl, name.size(), repName);
FullSourceLoc fullSL(sl, *SM); FullSourceLoc fullSL(sl, *SM);
insertReplacement(Rep, fullSL); insertReplacement(Rep, fullSL);
} }
} else { } else {
llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [enum constant decl].\n"; std::string msg = "the following reference is not handled: '" + name.str() + "' [enum constant decl].";
printHipifyMessage(*SM, sl, msg);
} }
return true; return true;
} }
@@ -2206,19 +2230,20 @@ private:
} }
QT = QT.getUnqualifiedType(); QT = QT.getUnqualifiedType();
StringRef name = QT.getAsString(); StringRef name = QT.getAsString();
SourceLocation sl = typedefVar->getLocStart();
SourceManager *SM = Result.SourceManager;
const auto found = N.cuda2hipRename.find(name); const auto found = N.cuda2hipRename.find(name);
if (found != N.cuda2hipRename.end()) { if (found != N.cuda2hipRename.end()) {
updateCounters(found->second, name.str()); updateCounters(found->second, name.str());
if (!found->second.unsupported) { if (!found->second.unsupported) {
StringRef repName = found->second.hipName; StringRef repName = found->second.hipName;
SourceLocation sl = typedefVar->getLocStart();
SourceManager *SM = Result.SourceManager;
Replacement Rep(*SM, sl, name.size(), repName); Replacement Rep(*SM, sl, name.size(), repName);
FullSourceLoc fullSL(sl, *SM); FullSourceLoc fullSL(sl, *SM);
insertReplacement(Rep, fullSL); insertReplacement(Rep, fullSL);
} }
} else { } else {
llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [typedef var].\n"; std::string msg = "the following reference is not handled: '" + name.str() + "' [typedef var].";
printHipifyMessage(*SM, sl, msg);
} }
return true; return true;
} }
@@ -2229,6 +2254,9 @@ private:
if (const VarDecl *typedefVarPtr = Result.Nodes.getNodeAs<VarDecl>("cudaTypedefVarPtr")) { if (const VarDecl *typedefVarPtr = Result.Nodes.getNodeAs<VarDecl>("cudaTypedefVarPtr")) {
const Type *t = typedefVarPtr->getType().getTypePtrOrNull(); const Type *t = typedefVarPtr->getType().getTypePtrOrNull();
if (t) { if (t) {
SourceManager *SM = Result.SourceManager;
TypeLoc TL = typedefVarPtr->getTypeSourceInfo()->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
QualType QT = t->getPointeeType(); QualType QT = t->getPointeeType();
QT = QT.getUnqualifiedType(); QT = QT.getUnqualifiedType();
StringRef name = QT.getAsString(); StringRef name = QT.getAsString();
@@ -2237,16 +2265,14 @@ private:
updateCounters(found->second, name.str()); updateCounters(found->second, name.str());
if (!found->second.unsupported) { if (!found->second.unsupported) {
StringRef repName = found->second.hipName; StringRef repName = found->second.hipName;
TypeLoc TL = typedefVarPtr->getTypeSourceInfo()->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
SourceManager *SM = Result.SourceManager;
Replacement Rep(*SM, sl, name.size(), repName); Replacement Rep(*SM, sl, name.size(), repName);
FullSourceLoc fullSL(sl, *SM); FullSourceLoc fullSL(sl, *SM);
insertReplacement(Rep, fullSL); insertReplacement(Rep, fullSL);
} }
} }
else { else {
llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [typedef var ptr].\n"; std::string msg = "the following reference is not handled: '" + name.str() + "' [typedef var ptr].";
printHipifyMessage(*SM, sl, msg);
} }
} }
return true; return true;
@@ -2260,20 +2286,21 @@ private:
->getAsStructureType() ->getAsStructureType()
->getDecl() ->getDecl()
->getNameAsString(); ->getNameAsString();
TypeLoc TL = structVar->getTypeSourceInfo()->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
SourceManager *SM = Result.SourceManager;
const auto found = N.cuda2hipRename.find(name); const auto found = N.cuda2hipRename.find(name);
if (found != N.cuda2hipRename.end()) { if (found != N.cuda2hipRename.end()) {
updateCounters(found->second, name.str()); updateCounters(found->second, name.str());
if (!found->second.unsupported) { if (!found->second.unsupported) {
StringRef repName = found->second.hipName; StringRef repName = found->second.hipName;
TypeLoc TL = structVar->getTypeSourceInfo()->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
SourceManager *SM = Result.SourceManager;
Replacement Rep(*SM, sl, name.size(), repName); Replacement Rep(*SM, sl, name.size(), repName);
FullSourceLoc fullSL(sl, *SM); FullSourceLoc fullSL(sl, *SM);
insertReplacement(Rep, fullSL); insertReplacement(Rep, fullSL);
} }
} else { } else {
llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [struct var].\n"; std::string msg = "the following reference is not handled: '" + name.str() + "' [struct var].";
printHipifyMessage(*SM, sl, msg);
} }
return true; return true;
} }
@@ -2284,21 +2311,22 @@ private:
if (const VarDecl *structVarPtr = Result.Nodes.getNodeAs<VarDecl>("cudaStructVarPtr")) { if (const VarDecl *structVarPtr = Result.Nodes.getNodeAs<VarDecl>("cudaStructVarPtr")) {
const Type *t = structVarPtr->getType().getTypePtrOrNull(); const Type *t = structVarPtr->getType().getTypePtrOrNull();
if (t) { if (t) {
TypeLoc TL = structVarPtr->getTypeSourceInfo()->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
SourceManager *SM = Result.SourceManager;
StringRef name = t->getPointeeCXXRecordDecl()->getName(); StringRef name = t->getPointeeCXXRecordDecl()->getName();
const auto found = N.cuda2hipRename.find(name); const auto found = N.cuda2hipRename.find(name);
if (found != N.cuda2hipRename.end()) { if (found != N.cuda2hipRename.end()) {
updateCounters(found->second, name.str()); updateCounters(found->second, name.str());
if (!found->second.unsupported) { if (!found->second.unsupported) {
StringRef repName = found->second.hipName; StringRef repName = found->second.hipName;
TypeLoc TL = structVarPtr->getTypeSourceInfo()->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
SourceManager *SM = Result.SourceManager;
Replacement Rep(*SM, sl, name.size(), repName); Replacement Rep(*SM, sl, name.size(), repName);
FullSourceLoc fullSL(sl, *SM); FullSourceLoc fullSL(sl, *SM);
insertReplacement(Rep, fullSL); insertReplacement(Rep, fullSL);
} }
} else { } else {
llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [struct var ptr].\n"; std::string msg = "the following reference is not handled: '" + name.str() + "' [struct var ptr].";
printHipifyMessage(*SM, sl, msg);
} }
} }
return true; return true;
@@ -2309,6 +2337,9 @@ private:
bool cudaStructSizeOf(const MatchFinder::MatchResult &Result) { bool cudaStructSizeOf(const MatchFinder::MatchResult &Result) {
if (const UnaryExprOrTypeTraitExpr *expr = Result.Nodes.getNodeAs<UnaryExprOrTypeTraitExpr>("cudaStructSizeOf")) { if (const UnaryExprOrTypeTraitExpr *expr = Result.Nodes.getNodeAs<UnaryExprOrTypeTraitExpr>("cudaStructSizeOf")) {
TypeSourceInfo *typeInfo = expr->getArgumentTypeInfo(); TypeSourceInfo *typeInfo = expr->getArgumentTypeInfo();
TypeLoc TL = typeInfo->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
SourceManager *SM = Result.SourceManager;
QualType QT = typeInfo->getType().getUnqualifiedType(); QualType QT = typeInfo->getType().getUnqualifiedType();
const Type *type = QT.getTypePtr(); const Type *type = QT.getTypePtr();
StringRef name = type->getAsCXXRecordDecl()->getName(); StringRef name = type->getAsCXXRecordDecl()->getName();
@@ -2317,15 +2348,13 @@ private:
updateCounters(found->second, name.str()); updateCounters(found->second, name.str());
if (!found->second.unsupported) { if (!found->second.unsupported) {
StringRef repName = found->second.hipName; StringRef repName = found->second.hipName;
TypeLoc TL = typeInfo->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
SourceManager *SM = Result.SourceManager;
Replacement Rep(*SM, sl, name.size(), repName); Replacement Rep(*SM, sl, name.size(), repName);
FullSourceLoc fullSL(sl, *SM); FullSourceLoc fullSL(sl, *SM);
insertReplacement(Rep, fullSL); insertReplacement(Rep, fullSL);
} }
} else { } else {
llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [struct sizeof].\n"; std::string msg = "the following reference is not handled: '" + name.str() + "' [struct sizeof].";
printHipifyMessage(*SM, sl, msg);
} }
return true; return true;
} }
@@ -2383,20 +2412,21 @@ private:
if (t->isStructureOrClassType()) { if (t->isStructureOrClassType()) {
name = t->getAsCXXRecordDecl()->getName(); name = t->getAsCXXRecordDecl()->getName();
} }
TypeLoc TL = paramDecl->getTypeSourceInfo()->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
SourceManager *SM = Result.SourceManager;
const auto found = N.cuda2hipRename.find(name); const auto found = N.cuda2hipRename.find(name);
if (found != N.cuda2hipRename.end()) { if (found != N.cuda2hipRename.end()) {
updateCounters(found->second, name.str()); updateCounters(found->second, name.str());
if (!found->second.unsupported) { if (!found->second.unsupported) {
StringRef repName = found->second.hipName; StringRef repName = found->second.hipName;
TypeLoc TL = paramDecl->getTypeSourceInfo()->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
SourceManager *SM = Result.SourceManager;
Replacement Rep(*SM, sl, name.size(), repName); Replacement Rep(*SM, sl, name.size(), repName);
FullSourceLoc fullSL(sl, *SM); FullSourceLoc fullSL(sl, *SM);
insertReplacement(Rep, fullSL); insertReplacement(Rep, fullSL);
} }
} else { } else {
llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [param decl].\n"; std::string msg = "the following reference is not handled: '" + name.str() + "' [param decl].";
printHipifyMessage(*SM, sl, msg);
} }
return true; return true;
} }
@@ -2407,6 +2437,9 @@ private:
if (const ParmVarDecl *paramDeclPtr = Result.Nodes.getNodeAs<ParmVarDecl>("cudaParamDeclPtr")) { if (const ParmVarDecl *paramDeclPtr = Result.Nodes.getNodeAs<ParmVarDecl>("cudaParamDeclPtr")) {
const Type *pt = paramDeclPtr->getType().getTypePtrOrNull(); const Type *pt = paramDeclPtr->getType().getTypePtrOrNull();
if (pt) { if (pt) {
TypeLoc TL = paramDeclPtr->getTypeSourceInfo()->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
SourceManager *SM = Result.SourceManager;
QualType QT = pt->getPointeeType(); QualType QT = pt->getPointeeType();
const Type *t = QT.getTypePtr(); const Type *t = QT.getTypePtr();
StringRef name = t->isStructureOrClassType() StringRef name = t->isStructureOrClassType()
@@ -2417,15 +2450,13 @@ private:
updateCounters(found->second, name.str()); updateCounters(found->second, name.str());
if (!found->second.unsupported) { if (!found->second.unsupported) {
StringRef repName = found->second.hipName; StringRef repName = found->second.hipName;
TypeLoc TL = paramDeclPtr->getTypeSourceInfo()->getTypeLoc();
SourceLocation sl = TL.getUnqualifiedLoc().getLocStart();
SourceManager *SM = Result.SourceManager;
Replacement Rep(*SM, sl, name.size(), repName); Replacement Rep(*SM, sl, name.size(), repName);
FullSourceLoc fullSL(sl, *SM); FullSourceLoc fullSL(sl, *SM);
insertReplacement(Rep, fullSL); insertReplacement(Rep, fullSL);
} }
} else { } else {
llvm::outs() << "[HIPIFY] warning: the following reference is not handled: '" << name << "' [param decl ptr].\n"; std::string msg = "the following reference is not handled: '" + name.str() + "' [param decl ptr].";
printHipifyMessage(*SM, sl, msg);
} }
} }
return true; return true;
@@ -2455,8 +2486,8 @@ private:
} }
public: public:
Cuda2HipCallback(Replacements *Replace, ast_matchers::MatchFinder *parent, HipifyPPCallbacks *PPCallbacks) Cuda2HipCallback(Replacements *Replace, ast_matchers::MatchFinder *parent, HipifyPPCallbacks *PPCallbacks, const std::string &mainFileName)
: Cuda2Hip(Replace), owner(parent), PP(PPCallbacks) { : Cuda2Hip(Replace, mainFileName), owner(parent), PP(PPCallbacks) {
PP->setMatch(this); PP->setMatch(this);
} }
@@ -2884,8 +2915,8 @@ int main(int argc, const char **argv) {
} }
RefactoringTool Tool(OptionsParser.getCompilations(), dst); RefactoringTool Tool(OptionsParser.getCompilations(), dst);
ast_matchers::MatchFinder Finder; ast_matchers::MatchFinder Finder;
HipifyPPCallbacks PPCallbacks(&Tool.getReplacements()); HipifyPPCallbacks PPCallbacks(&Tool.getReplacements(), src);
Cuda2HipCallback Callback(&Tool.getReplacements(), &Finder, &PPCallbacks); Cuda2HipCallback Callback(&Tool.getReplacements(), &Finder, &PPCallbacks, src);
addAllMatchers(Finder, &Callback); addAllMatchers(Finder, &Callback);