[HIPIFY] [Fix] An argument of a function used as macro argument is not hipified.

https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues/35


[ROCm/clr commit: e740d368d9]
This commit is contained in:
Evgeny Mankov
2016-12-27 18:54:02 +03:00
parent a959a094dc
commit 80f4190967
@@ -1671,8 +1671,6 @@ public:
const MacroDefinition &MD, SourceRange Range, const MacroDefinition &MD, SourceRange Range,
const MacroArgs *Args) override { const MacroArgs *Args) override {
if (_sm->isWrittenInMainFile(MacroNameTok.getLocation())) { if (_sm->isWrittenInMainFile(MacroNameTok.getLocation())) {
StringRef macroName = MacroNameTok.getIdentifierInfo()->getName();
if (N.cudaExcludes.end() == N.cudaExcludes.find(macroName)) {
for (unsigned int i = 0; Args && i < MD.getMacroInfo()->getNumArgs(); i++) { for (unsigned int i = 0; Args && i < MD.getMacroInfo()->getNumArgs(); i++) {
std::vector<Token> toks; std::vector<Token> toks;
// Code below is a kind of stolen from 'MacroArgs::getPreExpArgument' // Code below is a kind of stolen from 'MacroArgs::getPreExpArgument'
@@ -1684,16 +1682,13 @@ public:
#else #else
_pp->EnterTokenStream(start, len, false, false); _pp->EnterTokenStream(start, len, false, false);
#endif #endif
int j = 0;
do { do {
toks.push_back(Token()); toks.push_back(Token());
Token &tk = toks.back(); Token &tk = toks.back();
_pp->Lex(tk); _pp->Lex(tk);
j++;
} while (toks.back().isNot(tok::eof)); } while (toks.back().isNot(tok::eof));
_pp->RemoveTopOfLexerStack(); _pp->RemoveTopOfLexerStack();
// end of stolen code // end of stolen code
j = 0;
for (auto tok : toks) { for (auto tok : toks) {
if (tok.isAnyIdentifier()) { if (tok.isAnyIdentifier()) {
StringRef name = tok.getIdentifierInfo()->getName(); StringRef name = tok.getIdentifierInfo()->getName();
@@ -1750,10 +1745,8 @@ public:
} }
} }
} }
j++;
} }
} }
}
} }
} }