================
@@ -29,6 +29,12 @@ static constexpr StringRef DefaultIncludeTypeRegex =
AST_MATCHER(VarDecl, isLocalVarDecl) { return Node.isLocalVarDecl(); }
AST_MATCHER(VarDecl, isReferenced) { return Node.isReferenced(); }
+AST_MATCHER_P(VarDecl, explicitMarkUnused, LangOptions, LangOpts) {
+ // Implementations should not emit a warning that a name-independent
+ // declaration is used or unused.
+ return Node.hasAttr<UnusedAttr>() ||
+ (LangOpts.CPlusPlus26 && Node.isPlaceholderVar(LangOpts));
----------------
PiotrZSL wrote:
And, you dont need to pass LangOptions via argument.
>From matcher you got access to ASTContext, and that class got
>[getLangOpts](https://clang.llvm.org/doxygen/classclang_1_1ASTContext.html#a50f31d935973dd09016088579ba81944)
https://github.com/llvm/llvm-project/pull/121783
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits