Skip to content

Commit e490686

Browse files
authored
[mlir] [tablegen] Make hasSummary and hasDescription useful (llvm#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
1 parent 6816a13 commit e490686

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mlir/lib/TableGen/Operator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,14 +798,14 @@ const InferredResultType &Operator::getInferredResultType(int index) const {
798798
ArrayRef<SMLoc> Operator::getLoc() const { return def.getLoc(); }
799799

800800
bool Operator::hasDescription() const {
801-
return def.getValue("description") != nullptr;
801+
return !getDescription().trim().empty();
802802
}
803803

804804
StringRef Operator::getDescription() const {
805805
return def.getValueAsString("description");
806806
}
807807

808-
bool Operator::hasSummary() const { return def.getValue("summary") != nullptr; }
808+
bool Operator::hasSummary() const { return !getSummary().trim().empty(); }
809809

810810
StringRef Operator::getSummary() const {
811811
return def.getValueAsString("summary");

0 commit comments

Comments
 (0)