================
@@ -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));
----------------
HerrCai0907 wrote:
> Out of curiosity, is the CplusPlus26 needed? Won't isPlaceholderVar return
> false otherwise?
Yes, `isPlaceholderVar` does not check cpp version.
https://github.com/llvm/llvm-project/pull/121783
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits