================
@@ -70,20 +70,56 @@ void RedundantConstCheck::registerMatchers(MatchFinder
*Finder) {
this);
}
+static bool hasProblemSibling(const VarDecl *VD, SourceLocation ConstLoc,
+ const SourceManager &SM, const LangOptions &LO) {
+ const SourceLocation Semi =
+ utils::lexer::findNextAnyTokenKind(ConstLoc, SM, LO, tok::semi);
+ if (Semi.isInvalid())
+ return false;
+
+ const SourceLocation Comma =
+ utils::lexer::findNextAnyTokenKind(ConstLoc, SM, LO, tok::comma);
+ if (Comma.isInvalid() || !SM.isBeforeInTranslationUnit(Comma, Semi))
+ return false;
+
+ for (Decl *D : VD->getDeclContext()->decls()) {
----------------
vbvictor wrote:
I don't think we need to find all decls in declcontext for this case.
You can match `DeclStmt` class which incapsulates multiple decls and then check
how much decls you have. If one you can process with normal path, if multiple
then check that all decls are non-reference, non-etc... as you do with
`Sib->getType()`.
So I think whole "hasProblemSibling" with lexing is not needed.
https://github.com/llvm/llvm-project/pull/189733
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits