[HIPIFY][fix] Fix PragmaDirective

File location have to be verified, otherwise location of the first found '#pragma once' in any included header even system will be erroneously handled, which might lead to attempt to including hip_runtime.h in it.


[ROCm/clr commit: b9fc653b08]
Αυτή η υποβολή περιλαμβάνεται σε:
Evgeny Mankov
2018-01-23 23:06:55 +03:00
γονέας 653517758c
υποβολή d3d192e62c
@@ -198,8 +198,13 @@ void HipifyAction::InclusionDirective(clang::SourceLocation hash_loc,
}
void HipifyAction::PragmaDirective(clang::SourceLocation Loc, clang::PragmaIntroducerKind Introducer) {
if (pragmaOnce) { return; }
if (pragmaOnce) {
return;
}
clang::SourceManager& SM = getCompilerInstance().getSourceManager();
if (!SM.isWrittenInMainFile(Loc)) {
return;
}
clang::Preprocessor& PP = getCompilerInstance().getPreprocessor();
const clang::Token tok = PP.LookAhead(0);
StringRef Text(SM.getCharacterData(tok.getLocation()), tok.getLength());