[Mlir-commits] [mlir] deb9961 - Improve doc comments for several methods returning bools

Kamlesh Kumar llvmlistbot at llvm.org
Sun Aug 30 01:03:45 PDT 2020


Author: Kamlesh Kumar
Date: 2020-08-30T13:33:05+05:30
New Revision: deb99610ab002702f43de79d818c2ccc80371569

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

LOG: Improve doc comments for several methods returning bools

Differential Revision: https://reviews.llvm.org/D86848

Added: 
    

Modified: 
    mlir/include/mlir/Analysis/CallGraph.h
    mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
    mlir/include/mlir/IR/Attributes.h
    mlir/include/mlir/IR/Diagnostics.h
    mlir/include/mlir/IR/Operation.h
    mlir/include/mlir/IR/OperationSupport.h
    mlir/include/mlir/IR/Visitors.h
    mlir/include/mlir/Interfaces/SideEffectInterfaces.td
    mlir/include/mlir/Pass/AnalysisManager.h
    mlir/include/mlir/TableGen/Dialect.h
    mlir/lib/Analysis/CallGraph.cpp
    mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    mlir/lib/IR/AsmPrinter.cpp
    mlir/lib/IR/Attributes.cpp
    mlir/lib/Parser/DialectSymbolParser.cpp
    mlir/lib/Parser/Parser.cpp
    mlir/lib/Transforms/DialectConversion.cpp
    mlir/tools/mlir-tblgen/OpFormatGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Analysis/CallGraph.h b/mlir/include/mlir/Analysis/CallGraph.h
index b4ef04969b5a..189641502d56 100644
--- a/mlir/include/mlir/Analysis/CallGraph.h
+++ b/mlir/include/mlir/Analysis/CallGraph.h
@@ -59,13 +59,13 @@ class CallGraphNode {
     };
 
   public:
-    /// Returns if this edge represents an `Abstract` edge.
+    /// Returns true if this edge represents an `Abstract` edge.
     bool isAbstract() const { return targetAndKind.getInt() == Kind::Abstract; }
 
-    /// Returns if this edge represents a `Call` edge.
+    /// Returns true if this edge represents a `Call` edge.
     bool isCall() const { return targetAndKind.getInt() == Kind::Call; }
 
-    /// Returns if this edge represents a `Child` edge.
+    /// Returns true if this edge represents a `Child` edge.
     bool isChild() const { return targetAndKind.getInt() == Kind::Child; }
 
     /// Returns the target node for this edge.
@@ -87,7 +87,7 @@ class CallGraphNode {
     friend class CallGraphNode;
   };
 
-  /// Returns if this node is the external node.
+  /// Returns true if this node is an external node.
   bool isExternal() const;
 
   /// Returns the callable region this node represents. This can only be called

diff  --git a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
index b8b29ff63355..96b7fd1e345b 100644
--- a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
+++ b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
@@ -372,7 +372,8 @@ void fullyComposeAffineMapAndOperands(AffineMap *map,
 #define GET_OP_CLASSES
 #include "mlir/Dialect/Affine/IR/AffineOps.h.inc"
 
-/// Returns if the provided value is the induction variable of a AffineForOp.
+/// Returns true if the provided value is the induction variable of a
+/// AffineForOp.
 bool isForInductionVar(Value val);
 
 /// Returns the loop parent of an induction variable. If the provided value is

diff  --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h
index d1b25cdbde80..48ca29d7625d 100644
--- a/mlir/include/mlir/IR/Attributes.h
+++ b/mlir/include/mlir/IR/Attributes.h
@@ -899,7 +899,7 @@ class DenseElementsAttr : public ElementsAttr {
   // Value Querying
   //===--------------------------------------------------------------------===//
 
-  /// Returns if this attribute corresponds to a splat, i.e. if all element
+  /// Returns true if this attribute corresponds to a splat, i.e. if all element
   /// values are the same.
   bool isSplat() const;
 

diff  --git a/mlir/include/mlir/IR/Diagnostics.h b/mlir/include/mlir/IR/Diagnostics.h
index 84411b720336..0dbf18284131 100644
--- a/mlir/include/mlir/IR/Diagnostics.h
+++ b/mlir/include/mlir/IR/Diagnostics.h
@@ -361,10 +361,11 @@ class InFlightDiagnostic {
   InFlightDiagnostic(DiagnosticEngine *owner, Diagnostic &&rhs)
       : owner(owner), impl(std::move(rhs)) {}
 
-  /// Returns if the diagnostic is still active, i.e. it has a live diagnostic.
+  /// Returns true if the diagnostic is still active, i.e. it has a live
+  /// diagnostic.
   bool isActive() const { return impl.hasValue(); }
 
-  /// Returns if the diagnostic is still in flight to be reported.
+  /// Returns true if the diagnostic is still in flight to be reported.
   bool isInFlight() const { return owner; }
 
   // Allow access to the constructor.

diff  --git a/mlir/include/mlir/IR/Operation.h b/mlir/include/mlir/IR/Operation.h
index 329eb7a5974f..5f5e9017ae51 100644
--- a/mlir/include/mlir/IR/Operation.h
+++ b/mlir/include/mlir/IR/Operation.h
@@ -457,12 +457,12 @@ class Operation final
     return TerminatorStatus::Unknown;
   }
 
-  /// Returns if the operation is known to be a terminator.
+  /// Returns true if the operation is known to be a terminator.
   bool isKnownTerminator() {
     return getTerminatorStatus() == TerminatorStatus::Terminator;
   }
 
-  /// Returns if the operation is known to *not* be a terminator.
+  /// Returns true if the operation is known to *not* be a terminator.
   bool isKnownNonTerminator() {
     return getTerminatorStatus() == TerminatorStatus::NonTerminator;
   }
@@ -483,7 +483,7 @@ class Operation final
   LogicalResult fold(ArrayRef<Attribute> operands,
                      SmallVectorImpl<OpFoldResult> &results);
 
-  /// Returns if the operation was registered with a particular trait, e.g.
+  /// Returns true if the operation was registered with a particular trait, e.g.
   /// hasTrait<OperandsAreSignlessIntegerLike>().
   template <template <typename T> class Trait> bool hasTrait() {
     auto *absOp = getAbstractOperation();

diff  --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index 23a37cc2e2a9..b1758ec8f5ca 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -140,7 +140,7 @@ class AbstractOperation {
     return interfaceMap.lookup<T>();
   }
 
-  /// Returns if the operation has a particular trait.
+  /// Returns true if the operation has a particular trait.
   template <template <typename T> class Trait> bool hasTrait() const {
     return hasRawTrait(TypeID::get<Trait>());
   }

diff  --git a/mlir/include/mlir/IR/Visitors.h b/mlir/include/mlir/IR/Visitors.h
index 8554b7a7b885..490ba92662a2 100644
--- a/mlir/include/mlir/IR/Visitors.h
+++ b/mlir/include/mlir/IR/Visitors.h
@@ -43,7 +43,7 @@ class WalkResult {
   static WalkResult interrupt() { return {Interrupt}; }
   static WalkResult advance() { return {Advance}; }
 
-  /// Returns if the walk was interrupted.
+  /// Returns true if the walk was interrupted.
   bool wasInterrupted() const { return result == Interrupt; }
 };
 

diff  --git a/mlir/include/mlir/Interfaces/SideEffectInterfaces.td b/mlir/include/mlir/Interfaces/SideEffectInterfaces.td
index 2a4da16deec2..1ee623b61365 100644
--- a/mlir/include/mlir/Interfaces/SideEffectInterfaces.td
+++ b/mlir/include/mlir/Interfaces/SideEffectInterfaces.td
@@ -104,7 +104,7 @@ class EffectOpInterfaceBase<string name, string baseEffect>
       });
     }
 
-    /// Returns if this operation only has the given effect.
+    /// Returns true if this operation only has the given effect.
     template <typename Effect> bool onlyHasEffect() {
       SmallVector<SideEffects::EffectInstance<}] # baseEffect # [{>, 4> effects;
       getEffects(effects);
@@ -113,14 +113,14 @@ class EffectOpInterfaceBase<string name, string baseEffect>
       });
     }
 
-    /// Returns if this operation has no effects.
+    /// Returns true if this operation has no effects.
     bool hasNoEffect() {
       SmallVector<SideEffects::EffectInstance<}] # baseEffect # [{>, 4> effects;
       getEffects(effects);
       return effects.empty();
     }
 
-    /// Returns if the given operation has no effects for this interface.
+    /// Returns true if the given operation has no effects for this interface.
     static bool hasNoEffect(Operation *op) {
       if (auto interface = dyn_cast<}] # name # [{>(op))
         return interface.hasNoEffect();

diff  --git a/mlir/include/mlir/Pass/AnalysisManager.h b/mlir/include/mlir/Pass/AnalysisManager.h
index 0981ce2d0210..d5e095c35457 100644
--- a/mlir/include/mlir/Pass/AnalysisManager.h
+++ b/mlir/include/mlir/Pass/AnalysisManager.h
@@ -50,9 +50,9 @@ class PreservedAnalyses {
   }
   void preserve(TypeID id) { preservedIDs.insert(id); }
 
-  /// Returns if the given analysis has been marked as preserved. Note that this
-  /// simply checks for the presence of a given analysis ID and should not be
-  /// used as a general preservation checker.
+  /// Returns true if the given analysis has been marked as preserved. Note that
+  /// this simply checks for the presence of a given analysis ID and should not
+  /// be used as a general preservation checker.
   template <typename AnalysisT> bool isPreserved() const {
     return isPreserved(TypeID::get<AnalysisT>());
   }

diff  --git a/mlir/include/mlir/TableGen/Dialect.h b/mlir/include/mlir/TableGen/Dialect.h
index 99217d8c7d3d..623d614d26d3 100644
--- a/mlir/include/mlir/TableGen/Dialect.h
+++ b/mlir/include/mlir/TableGen/Dialect.h
@@ -51,16 +51,16 @@ class Dialect {
   // Returns the dialects extra class declaration code.
   llvm::Optional<StringRef> getExtraClassDeclaration() const;
 
-  // Returns if this dialect has a constant materializer or not.
+  // Returns true if this dialect has a constant materializer.
   bool hasConstantMaterializer() const;
 
-  /// Returns if this dialect has an operation attribute verifier.
+  /// Returns true if this dialect has an operation attribute verifier.
   bool hasOperationAttrVerify() const;
 
-  /// Returns if this dialect has a region argument attribute verifier.
+  /// Returns true if this dialect has a region argument attribute verifier.
   bool hasRegionArgAttrVerify() const;
 
-  /// Returns if this dialect has a region result attribute verifier.
+  /// Returns true if this dialect has a region result attribute verifier.
   bool hasRegionResultAttrVerify() const;
 
   // Returns whether two dialects are equal by checking the equality of the

diff  --git a/mlir/lib/Analysis/CallGraph.cpp b/mlir/lib/Analysis/CallGraph.cpp
index 52898bfdb9ab..f9c8c48d275b 100644
--- a/mlir/lib/Analysis/CallGraph.cpp
+++ b/mlir/lib/Analysis/CallGraph.cpp
@@ -24,7 +24,7 @@ using namespace mlir;
 // CallGraphNode
 //===----------------------------------------------------------------------===//
 
-/// Returns if this node refers to the indirect/external node.
+/// Returns true if this node refers to the indirect/external node.
 bool CallGraphNode::isExternal() const { return !callableRegion; }
 
 /// Return the callable region this node represents. This can only be called

diff  --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 443e326faeb3..2ffc002b0e4a 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -1662,7 +1662,8 @@ LogicalResult AffineForOp::moveOutOfLoop(ArrayRef<Operation *> ops) {
   return success();
 }
 
-/// Returns if the provided value is the induction variable of a AffineForOp.
+/// Returns true if the provided value is the induction variable of a
+/// AffineForOp.
 bool mlir::isForInductionVar(Value val) {
   return getForInductionVarOwner(val) != AffineForOp();
 }

diff  --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index 2247fe390ad1..3deb7b477bea 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -1143,8 +1143,8 @@ void ModulePrinter::printLocation(LocationAttr loc) {
   }
 }
 
-/// Returns if the given dialect symbol data is simple enough to print in the
-/// pretty form, i.e. without the enclosing "".
+/// Returns true if the given dialect symbol data is simple enough to print in
+/// the pretty form, i.e. without the enclosing "".
 static bool isDialectSymbolSimpleEnoughForPrettyForm(StringRef symName) {
   // The name must start with an identifier.
   if (symName.empty() || !isalpha(symName.front()))
@@ -1233,7 +1233,7 @@ static void printDialectSymbol(raw_ostream &os, StringRef symPrefix,
   os << "<\"" << symString << "\">";
 }
 
-/// Returns if the given string can be represented as a bare identifier.
+/// Returns true if the given string can be represented as a bare identifier.
 static bool isBareIdentifier(StringRef name) {
   assert(!name.empty() && "invalid name");
 

diff  --git a/mlir/lib/IR/Attributes.cpp b/mlir/lib/IR/Attributes.cpp
index ac51cba88f1c..a25119fddada 100644
--- a/mlir/lib/IR/Attributes.cpp
+++ b/mlir/lib/IR/Attributes.cpp
@@ -597,8 +597,8 @@ static APInt readBits(const char *rawData, size_t bitPos, size_t bitWidth) {
   return result;
 }
 
-/// Returns if 'values' corresponds to a splat, i.e. one element, or has the
-/// same element count as 'type'.
+/// Returns true if 'values' corresponds to a splat, i.e. one element, or has
+/// the same element count as 'type'.
 template <typename Values>
 static bool hasSameElementsOrSplat(ShapedType type, const Values &values) {
   return (values.size() == 1) ||
@@ -913,7 +913,7 @@ bool DenseElementsAttr::isValidComplex(int64_t dataEltSize, bool isInt,
       dataEltSize / 2, isInt, isSigned);
 }
 
-/// Returns if this attribute corresponds to a splat, i.e. if all element
+/// Returns true if this attribute corresponds to a splat, i.e. if all element
 /// values are the same.
 bool DenseElementsAttr::isSplat() const {
   return static_cast<DenseElementsAttributeStorage *>(impl)->isSplat;

diff  --git a/mlir/lib/Parser/DialectSymbolParser.cpp b/mlir/lib/Parser/DialectSymbolParser.cpp
index d45ddf071989..7782b59ab1a6 100644
--- a/mlir/lib/Parser/DialectSymbolParser.cpp
+++ b/mlir/lib/Parser/DialectSymbolParser.cpp
@@ -248,7 +248,7 @@ class CustomDialectAsmParser : public DialectAsmParser {
     return success();
   }
 
-  /// Returns if the current token corresponds to a keyword.
+  /// Returns true if the current token corresponds to a keyword.
   bool isCurrentTokenAKeyword() const {
     return parser.getToken().is(Token::bare_identifier) ||
            parser.getToken().isKeyword();

diff  --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp
index 32d11e571ded..cc102b9e97a4 100644
--- a/mlir/lib/Parser/Parser.cpp
+++ b/mlir/lib/Parser/Parser.cpp
@@ -1106,7 +1106,7 @@ class CustomOpAsmParser : public OpAsmParser {
   // Identifier Parsing
   //===--------------------------------------------------------------------===//
 
-  /// Returns if the current token corresponds to a keyword.
+  /// Returns true if the current token corresponds to a keyword.
   bool isCurrentTokenAKeyword() const {
     return parser.getToken().is(Token::bare_identifier) ||
            parser.getToken().isKeyword();

diff  --git a/mlir/lib/Transforms/DialectConversion.cpp b/mlir/lib/Transforms/DialectConversion.cpp
index a8d7fe71f75f..5f6c97272922 100644
--- a/mlir/lib/Transforms/DialectConversion.cpp
+++ b/mlir/lib/Transforms/DialectConversion.cpp
@@ -1462,7 +1462,7 @@ class OperationLegalizer {
   OperationLegalizer(ConversionTarget &targetInfo,
                      const OwningRewritePatternList &patterns);
 
-  /// Returns if the given operation is known to be illegal on the target.
+  /// Returns true if the given operation is known to be illegal on the target.
   bool isIllegal(Operation *op) const;
 
   /// Attempt to legalize the given operation. Returns success if the operation

diff  --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index 1f3ac4934224..3cce5262b50d 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -356,8 +356,8 @@ struct OperationFormat {
 //===----------------------------------------------------------------------===//
 // Parser Gen
 
-/// Returns if we can format the given attribute as an EnumAttr in the parser
-/// format.
+/// Returns true if we can format the given attribute as an EnumAttr in the
+/// parser format.
 static bool canFormatEnumAttr(const NamedAttribute *attr) {
   const EnumAttr *enumAttr = dyn_cast<EnumAttr>(&attr->attr);
   if (!enumAttr)


        


More information about the Mlir-commits mailing list