@@ -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 ;
0 commit comments