Skip to content

Commit 497e8fe

Browse files
committed
up
Signed-off-by: Chen, Sheng S <sheng.s.chen@intel.com>
1 parent 0f2e2f9 commit 497e8fe

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

clang/lib/DPCT/RulesLangLib/CUBAPIMigration.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,6 @@ void CubRule::registerMatcher(ast_matchers::MatchFinder &MF) {
799799
hasType(hasCanonicalType(qualType(hasDeclaration(
800800
recordDecl(isUnion(), has(fieldDecl())))))),
801801
hasType(typeContainsString("TempStorage"))))))
802-
// hasType(namedDecl(hasAnyName("TempStorage")))))))
803802
.bind("DeclStmt"),
804803
this);
805804

@@ -926,6 +925,7 @@ void CubRule::processCubDeclStmt(const DeclStmt *DS) {
926925
VDecl->getType()->getAsUnionType()->getDecl()->getCanonicalDecl();
927926
emplaceTransformation(new ReplaceDecl(RD, ""));
928927
}
928+
929929
// always remove TempStorage variable declaration
930930
emplaceTransformation(new ReplaceStmt(DS, ""));
931931

@@ -975,24 +975,19 @@ void CubRule::processCubTypeDefOrUsing(const TypedefNameDecl *TD) {
975975
DpctGlobalInfo::getContext())) &&
976976
CanonicalTypeStr.find("class cub::") != 0)
977977
return;
978-
TD->dump();
978+
979979
std::string TypeName = TD->getNameAsString();
980980
auto &Context = dpct::DpctGlobalInfo::getContext();
981981
auto &SM = dpct::DpctGlobalInfo::getSourceManager();
982982

983-
984983
auto MyMatcher = compoundStmt(
985984
forEachDescendant(typeLoc(loc(qualType(hasDeclaration(
986-
anyOf(typedefDecl(hasName(TypeName)),
985+
anyOf(typedefDecl(hasName(TypeName)),
987986
typeAliasDecl(hasName(TypeName)))))))
988-
989-
// typeLoc(loc(qualType(hasDeclaration(
990-
// typeAliasDecl(hasName(TypeName)))))))
991987
.bind("typeLoc")));
992988
auto MatcherScope = DpctGlobalInfo::findAncestor<CompoundStmt>(TD);
993989
if (!MatcherScope)
994990
return;
995-
996991
auto TypeLocMatchResult =
997992
ast_matchers::match(MyMatcher, *MatcherScope, Context);
998993
bool DeleteFlag = true;

clang/test/dpct/cub/type/fix_alias_bug.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ template <> struct warp_reduce<false> {
3737
int main() {
3838
int a, b;
3939
warp_reduce<true>()(a, true, b);
40-
}
40+
}

0 commit comments

Comments
 (0)