[clang-tools-extra] 116c597 - [clang-tidy] Add ZeroOnly integer literal mode to argument-comment (#237890)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 9 00:03:32 PST 2026


Author: Daan De Meyer
Date: 2026-11-09T16:03:16+08:00
New Revision: 116c597cd0c29ea7a4fb74ba87d60f940f2d5fca

URL: https://github.com/llvm/llvm-project/commit/116c597cd0c29ea7a4fb74ba87d60f940f2d5fca
DIFF: https://github.com/llvm/llvm-project/commit/116c597cd0c29ea7a4fb74ba87d60f940f2d5fca.diff

LOG: [clang-tidy] Add ZeroOnly integer literal mode to argument-comment (#237890)

Many C APIs take 0 to mean "no flags" or "the default", and a bare 0
doesn't
tell the reader which parameter it sets. CommentIntegerLiterals of
bugprone-argument-comment asks for a comment on every integer literal
though,
including sizes, modes and counts whose meaning is clear from their
value.

Let's turn CommentIntegerLiterals into an enum with the values None,
ZeroOnly
and All. ZeroOnly only asks for a comment on integer literals with the
value
zero. The option keeps accepting true and false, which mean All and
None, so
existing configurations keep working. --dump-config prints All or None
for
them.

Split out of https://github.com/llvm/llvm-project/pull/237623.

Signed-off-by: Daan De Meyer <daan at amutable.com>

Added: 
    clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment-integer-literals.cpp

Modified: 
    clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
    clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.h
    clang-tools-extra/docs/ReleaseNotes.md
    clang-tools-extra/docs/clang-tidy/checks/bugprone/argument-comment.md

Removed: 
    


################################################################################<html><body><h1>504 Gateway Time-out</h1>
The server didn't respond in time.
</body></html>


        


More information about the cfe-commits mailing list