@@ -2938,10 +2938,12 @@ void VectorTypeNamespaceRule::registerMatcher(MatchFinder &MF) {
2938
2938
.bind("vectorTypeTL"),
2939
2939
this);
2940
2940
2941
- MF.addMatcher(
2942
- cxxRecordDecl(isDirectlyDerivedFrom(hasAnyName(SUPPORTEDVECTORTYPENAMES)))
2943
- .bind("inheritanceType"),
2944
- this);
2941
+ MF.addMatcher(cxxRecordDecl(isDirectlyDerivedFrom(hasAnyName(
2942
+ "char1", "uchar1", "short1", "ushort1",
2943
+ "int1", "uint1", "long1", "ulong1", "float1",
2944
+ "longlong1", "ulonglong1", "double1")))
2945
+ .bind("inherit"),
2946
+ this);
2945
2947
}
2946
2948
2947
2949
void VectorTypeNamespaceRule::runRule(const MatchFinder::MatchResult &Result) {
@@ -3056,60 +3058,9 @@ void VectorTypeNamespaceRule::runRule(const MatchFinder::MatchResult &Result) {
3056
3058
}
3057
3059
}
3058
3060
}
3059
- if (auto CRD = getNodeAsType<CXXRecordDecl>(Result, "inheritanceType")) {
3060
- const auto *Base = CRD->bases_begin();
3061
- std::string TypeName = Base->getBaseTypeInfo()->getType().getAsString();
3062
- if (MapNames::SupportedVectorTypes.find(TypeName) ==
3063
- MapNames::SupportedVectorTypes.end())
3064
- return;
3065
- auto Begin = Base->getSourceRange().getBegin();
3066
- auto End = Base->getSourceRange().getEnd();
3067
- if (Begin.isInvalid()) {
3068
- return;
3069
- }
3070
- if (*(TypeName.end() - 1) == '1') {
3071
- if (Begin.isMacroID() &&
3072
- (SM->isWrittenInScratchSpace(SM->getSpellingLoc(Begin)) ||
3073
- SM->isWrittenInScratchSpace(SM->getSpellingLoc(End)))) {
3074
- // Macro concatenate --> use immediateExpansion
3075
- // Make (Begin, End) be the range of "##1"
3076
- Begin = SM->getImmediateExpansionRange(Begin).getBegin();
3077
- End = SM->getImmediateExpansionRange(End).getEnd();
3078
- Begin = SM->getSpellingLoc(Begin);
3079
- End = SM->getSpellingLoc(End);
3080
- Begin = Begin.getLocWithOffset(Lexer::MeasureTokenLength(
3081
- Begin, *SM, DpctGlobalInfo::getContext().getLangOpts()));
3082
- End = End.getLocWithOffset(Lexer::MeasureTokenLength(
3083
- End, *SM, DpctGlobalInfo::getContext().getLangOpts()));
3084
- report(Begin, Comments::VECTYPE_INHERITATED, false);
3085
- } else {
3086
- // Make (Begin, End) be the range of "1"
3087
- Begin = SM->getSpellingLoc(Begin);
3088
- End = SM->getSpellingLoc(End);
3089
- Begin = Begin.getLocWithOffset(
3090
- Lexer::MeasureTokenLength(
3091
- Begin, *SM, DpctGlobalInfo::getContext().getLangOpts()) -
3092
- 1);
3093
- End = End.getLocWithOffset(Lexer::MeasureTokenLength(
3094
- End, *SM, DpctGlobalInfo::getContext().getLangOpts()));
3095
- }
3096
- auto Length = SM->getFileOffset(End) - SM->getFileOffset(Begin);
3097
- return emplaceTransformation(new ReplaceText(Begin, Length, ""));
3098
- }
3099
-
3100
- if (Begin.isInvalid())
3101
- return;
3102
3061
3103
- if (Begin.isMacroID()) {
3104
- // Macro concatenate --> use immediateExpansion
3105
- // Make Begin being the begin of "MACROARG##1"
3106
- if (SM->isWrittenInScratchSpace(SM->getSpellingLoc(Begin))) {
3107
- Begin = SM->getImmediateExpansionRange(Begin).getBegin();
3108
- }
3109
- Begin = SM->getSpellingLoc(Begin);
3110
- }
3111
- return emplaceTransformation(
3112
- new InsertText(Begin, MapNames::getClNamespace()));
3062
+ if (auto RD = getNodeAsType<CXXRecordDecl>(Result, "inherit")) {
3063
+ report(RD->getBeginLoc(), Diagnostics::VECTYPE_INHERITATED, false);
3113
3064
}
3114
3065
}
3115
3066
0 commit comments