Skip to content

Commit e95e17b

Browse files
committed
Address review comments
Signed-off-by: chenwei.sun <chenwei.sun@intel.com>
1 parent 4a181f0 commit e95e17b

3 files changed

Lines changed: 4 additions & 13 deletions

File tree

clang/lib/DPCT/AnalysisInfo.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,18 +1487,9 @@ std::string DpctGlobalInfo::getStringForRegexReplacement(StringRef MatchedStr) {
14871487
HelperFuncType::HFT_DefaultQueuePtr, Index);
14881488
case 'E': {
14891489
auto &Vec = DpctGlobalInfo::getInstance().getCSourceFileList();
1490-
SourceProcessType FileType = GetSourceFileType(Vec[Index].first);
1491-
14921490
const bool HasCUDASyntax = DpctGlobalInfo::hasCUDASyntax(Vec[Index].first);
1493-
const bool IsCppSource = (FileType & SPT_CppSource);
14941491
const auto Extention = Vec[Index].second;
1495-
1496-
if (Extention == ".cc") {
1497-
return (HasCUDASyntax && IsCppSource)
1498-
? "cc" + DpctGlobalInfo::getSYCLSourceExtension()
1499-
: "cc";
1500-
}
1501-
return HasCUDASyntax ? "c" + DpctGlobalInfo::getSYCLSourceExtension() : "c";
1492+
return HasCUDASyntax ? Extention + DpctGlobalInfo::getSYCLSourceExtension() : Extention;
15021493
}
15031494
case 'P': {
15041495
std::string ReplStr;

clang/lib/DPCT/RulesInclude/InclusionHeaders.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ void IncludesCallbacks::InclusionDirective(
180180
auto &Vec = DpctGlobalInfo::getInstance().getCSourceFileList();
181181
path::replace_extension(
182182
NewFileName, "{{NEEDREPLACEE" + std::to_string(Vec.size()) + "}}");
183-
Vec.push_back(std::pair<tooling::UnifiedPath, std::string>(IncludedFile,
184-
Extension));
183+
Vec.push_back(std::pair<tooling::UnifiedPath, std::string>(
184+
IncludedFile, Extension.substr(1)));
185185
} else {
186186
clang::tooling::UnifiedPath NewFilePath = FileName;
187187
rewriteFileName(NewFilePath, IncludedFile);

clang/test/dpct/include/main.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
// CHECK: #include "test9.cc.dp.cpp"
6767
#include "test9.cc"
6868
// case 10: source file has CUDA syntax, not in database.
69-
// CHECK: #include "test10.cc"
69+
// CHECK: #include "test10.cc.dp.cpp"
7070
#include "test10.cc"
7171
// case 11: source file does not have CUDA syntax, in database.
7272
// CHECK: #include "test11.cc"

0 commit comments

Comments
 (0)