[Mlir-commits] [mlir] e490686 - [mlir] [tablegen] Make `hasSummary` and `hasDescription` useful (#105531)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Aug 21 09:14:37 PDT 2024
Author: Alex Rice
Date: 2024-08-21T17:14:33+01:00
New Revision: e49068624c48f4d906707b32b31f6a1d561605be
URL: https://github.com/llvm/llvm-project/commit/e49068624c48f4d906707b32b31f6a1d561605be
DIFF: https://github.com/llvm/llvm-project/commit/e49068624c48f4d906707b32b31f6a1d561605be.diff
LOG: [mlir] [tablegen] Make `hasSummary` and `hasDescription` useful (#105531)
The `hasSummary` and `hasDescription` functions are currently useless as
they check if the corresponding `summary` and `description` are present.
However, these values are set to a default value of `""`, and so these
functions always return true.
This PR changes these functions to check if the summary and description
are just whitespace, which is presumably closer to their original
intent.
@math-fehr
@zero9178
Added:
Modified:
mlir/lib/TableGen/Operator.cpp
Removed:
################################################################################
diff --git a/mlir/lib/TableGen/Operator.cpp b/mlir/lib/TableGen/Operator.cpp
index bd3e3b1c6b7ccf..76af82a827da13 100644
--- a/mlir/lib/TableGen/Operator.cpp
+++ b/mlir/lib/TableGen/Operator.cpp
@@ -798,14 +798,14 @@ const InferredResultType &Operator::getInferredResultType(int index) const {
ArrayRef<SMLoc> Operator::getLoc() const { return def.getLoc(); }
bool Operator::hasDescription() const {
- return def.getValue("description") != nullptr;
+ return !getDescription().trim().empty();
}
StringRef Operator::getDescription() const {
return def.getValueAsString("description");
}
-bool Operator::hasSummary() const { return def.getValue("summary") != nullptr; }
+bool Operator::hasSummary() const { return !getSummary().trim().empty(); }
StringRef Operator::getSummary() const {
return def.getValueAsString("summary");
More information about the Mlir-commits
mailing list