[clang] 63c4ca9 - [analyzer] Turn missing tablegen doc entry of a checker into fatal error
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 19 03:14:52 PDT 2022
Author: Balazs Benics
Date: 2022-04-19T12:14:27+02:00
New Revision: 63c4ca9d14bad909f92ef019ec85f7a1c42311f2
URL: https://github.com/llvm/llvm-project/commit/63c4ca9d14bad909f92ef019ec85f7a1c42311f2
DIFF: https://github.com/llvm/llvm-project/commit/63c4ca9d14bad909f92ef019ec85f7a1c42311f2.diff
LOG: [analyzer] Turn missing tablegen doc entry of a checker into fatal error
It turns out all checkers explicitly mention the `Documentation<>`.
It makes sense to demand this, so emit a fatal tablegen error if such
happens.
Reviewed By: martong, Szelethus
Differential Revision: https://reviews.llvm.org/D122244
Added:
Modified:
clang/utils/TableGen/ClangSACheckersEmitter.cpp
Removed:
################################################################################
diff --git a/clang/utils/TableGen/ClangSACheckersEmitter.cpp b/clang/utils/TableGen/ClangSACheckersEmitter.cpp
index 586cc95071cf5..61a47ee61fac4 100644
--- a/clang/utils/TableGen/ClangSACheckersEmitter.cpp
+++ b/clang/utils/TableGen/ClangSACheckersEmitter.cpp
@@ -76,14 +76,17 @@ static inline uint64_t getValueFromBitsInit(const BitsInit *B, const Record &R)
static std::string getCheckerDocs(const Record &R) {
StringRef LandingPage;
- if (BitsInit *BI = R.getValueAsBitsInit("Documentation")) {
- uint64_t V = getValueFromBitsInit(BI, R);
- if (V == 1)
- LandingPage = "available_checks.html";
- else if (V == 2)
- LandingPage = "alpha_checks.html";
- }
-
+ const BitsInit *BI = R.getValueAsBitsInit("Documentation");
+ if (!BI)
+ PrintFatalError(R.getLoc(), "missing Documentation<...> member for " +
+ getCheckerFullName(&R));
+
+ uint64_t V = getValueFromBitsInit(BI, R);
+ if (V == 1)
+ LandingPage = "available_checks.html";
+ else if (V == 2)
+ LandingPage = "alpha_checks.html";
+
if (LandingPage.empty())
return "";
More information about the cfe-commits
mailing list