Merge pull request #741 from emankov/master

[HIPIFY][fix][#739] Fix garbage after replacements
Tá an tiomantas seo le fáil i:
Evgeny Mankov
2018-10-30 19:37:19 +03:00
tiomanta ag GitHub
tuismitheoir ce2a7b849f a8e6033aa3
tiomantas e17d24b46f
+3 -3
Féach ar an gComhad
@@ -24,7 +24,7 @@ void HipifyAction::RewriteString(StringRef s, clang::SourceLocation start) {
Statistics::current().incrementCounter(counter, name.str());
if (!counter.unsupported) {
clang::SourceLocation sl = start.getLocWithOffset(begin + 1);
ct::Replacement Rep(SM, sl, name.size(), repName);
ct::Replacement Rep(SM, sl, name.size(), repName.str());
clang::FullSourceLoc fullSL(sl, SM);
insertReplacement(Rep, fullSL);
}
@@ -70,7 +70,7 @@ void HipifyAction::RewriteToken(const clang::Token& t) {
return;
}
StringRef repName = found->second.hipName;
ct::Replacement Rep(SM, sl, name.size(), repName);
ct::Replacement Rep(SM, sl, name.size(), repName.str());
clang::FullSourceLoc fullSL(sl, SM);
insertReplacement(Rep, fullSL);
}
@@ -219,7 +219,7 @@ void HipifyAction::InclusionDirective(clang::SourceLocation hash_loc,
}
const char *B = SM.getCharacterData(sl);
const char *E = SM.getCharacterData(filename_range.getEnd());
ct::Replacement Rep(SM, sl, E - B, newInclude);
ct::Replacement Rep(SM, sl, E - B, newInclude.str());
insertReplacement(Rep, clang::FullSourceLoc{sl, SM});
}