This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Turn missing tablegen doc entry of a checker into fatal error
ClosedPublic

Authored by steakhal on Mar 22 2022, 11:07 AM.

Details

Summary

It turns out all checkers explicitly mention the Documentation<>.
It makes sense to demand this, so emit a fatal tablegen error if such
happens.

Diff Detail

Event Timeline

steakhal created this revision.Mar 22 2022, 11:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2022, 11:07 AM
steakhal requested review of this revision.Mar 22 2022, 11:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2022, 11:07 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Szelethus accepted this revision.Mar 24 2022, 1:44 AM

LGTM! You did check whether a missing doc field will actually trigger this error, right?

clang/utils/TableGen/ClangSACheckersEmitter.cpp
82

We might as well give an extra hand, and state that a Documentation<> field is missing.

This revision is now accepted and ready to land.Mar 24 2022, 1:44 AM

LGTM! You did check whether a missing doc field will actually trigger this error, right?

Yup, it works as expected!

ninja: Entering directory `build/release'
[1/375] Building Checkers.inc...
FAILED: tools/clang/include/clang/StaticAnalyzer/Checkers/Checkers.inc /git/llvm-project/build/release/tools/clang/include/clang/StaticAnalyzer/Checkers/Checkers.inc
cd /git/llvm-project/build/release && /git/llvm-project/build/release/bin/clang-tblgen -gen-clang-sa-checkers -I /git/llvm-project/clang/include/clang/StaticAnalyzer/Checkers -I/git/llvm-project/clang/include -I/git/llvm-project/build/release/tools/clang/include -I/git/llvm-project/build/release/include -I/git/llvm-project/llvm/include /git/llvm-project/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td --write-if-changed -o tools/clang/include/clang/StaticAnalyzer/Checkers/Checkers.inc -d tools/clang/include/clang/StaticAnalyzer/Checkers/Checkers.inc.d
/git/llvm-project/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:585:1: error: missing Documentation for cplusplus.NewDelete
def NewDeleteChecker : Checker<"NewDelete">,
^
ninja: build stopped: subcommand failed.
clang/utils/TableGen/ClangSACheckersEmitter.cpp
82

Hmm, indeed.

steakhal updated this revision to Diff 417862.Mar 24 2022, 3:08 AM

reword error message

martong accepted this revision.Mar 26 2022, 6:13 AM

Good.