[Mlir-commits] [mlir] 032810f - [NFC] Fix comment style in MLIR unittests to conform to LLVM coding standards.

Rahul Joshi llvmlistbot at llvm.org
Sun Jul 12 07:28:16 PDT 2020


Author: Rahul Joshi
Date: 2020-07-12T07:27:02-07:00
New Revision: 032810f58986cd568980227c9531de91d8bcb1cd

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

LOG: [NFC] Fix comment style in MLIR unittests to conform to LLVM coding standards.

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

Added: 
    

Modified: 
    mlir/unittests/Dialect/SPIRV/DeserializationTest.cpp
    mlir/unittests/SDBM/SDBMTest.cpp
    mlir/unittests/TableGen/EnumsGenTest.cpp
    mlir/unittests/TableGen/FormatTest.cpp
    mlir/unittests/TableGen/StructsGenTest.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/unittests/Dialect/SPIRV/DeserializationTest.cpp b/mlir/unittests/Dialect/SPIRV/DeserializationTest.cpp
index a81b7741deea..fe5632d7ae16 100644
--- a/mlir/unittests/Dialect/SPIRV/DeserializationTest.cpp
+++ b/mlir/unittests/Dialect/SPIRV/DeserializationTest.cpp
@@ -25,7 +25,7 @@
 
 using namespace mlir;
 
-// Load the SPIRV dialect
+/// Load the SPIRV dialect.
 static DialectRegistration<spirv::SPIRVDialect> SPIRVRegistration;
 
 using ::testing::StrEq;
@@ -159,7 +159,7 @@ TEST_F(DeserializationTest, InsufficientWordFailure) {
   addHeader();
   binary.push_back((2u << 16) |
                    static_cast<uint32_t>(spirv::Opcode::OpTypeVoid));
-  // Missing word for type <id>
+  // Missing word for type <id>.
 
   ASSERT_FALSE(deserialize());
   expectDiagnostic("insufficient words for the last instruction");
@@ -248,7 +248,7 @@ TEST_F(DeserializationTest, FunctionMissingEndFailure) {
   auto voidType = addVoidType();
   auto fnType = addFunctionType(voidType, {});
   addFunction(voidType, fnType);
-  // Missing OpFunctionEnd
+  // Missing OpFunctionEnd.
 
   ASSERT_FALSE(deserialize());
   expectDiagnostic("expected OpFunctionEnd instruction");
@@ -260,7 +260,7 @@ TEST_F(DeserializationTest, FunctionMissingParameterFailure) {
   auto i32Type = addIntType(32);
   auto fnType = addFunctionType(voidType, {i32Type});
   addFunction(voidType, fnType);
-  // Missing OpFunctionParameter
+  // Missing OpFunctionParameter.
 
   ASSERT_FALSE(deserialize());
   expectDiagnostic("expected OpFunctionParameter instruction");
@@ -271,7 +271,7 @@ TEST_F(DeserializationTest, FunctionMissingLabelForFirstBlockFailure) {
   auto voidType = addVoidType();
   auto fnType = addFunctionType(voidType, {});
   addFunction(voidType, fnType);
-  // Missing OpLabel
+  // Missing OpLabel.
   addReturn();
   addFunctionEnd();
 

diff  --git a/mlir/unittests/SDBM/SDBMTest.cpp b/mlir/unittests/SDBM/SDBMTest.cpp
index e599094ee592..61d670650b4b 100644
--- a/mlir/unittests/SDBM/SDBMTest.cpp
+++ b/mlir/unittests/SDBM/SDBMTest.cpp
@@ -17,7 +17,7 @@
 
 using namespace mlir;
 
-// Load the SDBM dialect
+/// Load the SDBM dialect.
 static DialectRegistration<SDBMDialect> SDBMRegistration;
 
 static MLIRContext *ctx() {

diff  --git a/mlir/unittests/TableGen/EnumsGenTest.cpp b/mlir/unittests/TableGen/EnumsGenTest.cpp
index 47f0910403b2..a5580197a0a3 100644
--- a/mlir/unittests/TableGen/EnumsGenTest.cpp
+++ b/mlir/unittests/TableGen/EnumsGenTest.cpp
@@ -13,12 +13,11 @@
 #include "gmock/gmock.h"
 #include <type_traits>
 
-// Pull in generated enum utility declarations
+/// Pull in generated enum utility declarations and definitions.
 #include "EnumsGenTest.h.inc"
-// And definitions
 #include "EnumsGenTest.cpp.inc"
 
-// Test namespaces and enum class/utility names
+/// Test namespaces and enum class/utility names.
 using Outer::Inner::ConvertToEnum;
 using Outer::Inner::ConvertToString;
 using Outer::Inner::StrEnum;

diff  --git a/mlir/unittests/TableGen/FormatTest.cpp b/mlir/unittests/TableGen/FormatTest.cpp
index ee609291150c..0cae408bc3fb 100644
--- a/mlir/unittests/TableGen/FormatTest.cpp
+++ b/mlir/unittests/TableGen/FormatTest.cpp
@@ -19,14 +19,14 @@ TEST(FormatTest, EmptyFmtStr) {
   EXPECT_TRUE(result.empty());
 }
 
-// Allow extra unused positional parameters
+/// Allow extra unused positional parameters.
 TEST(FormatTest, EmptyFmtStrExtraParams) {
   FmtContext ctx;
   std::string result = std::string(tgfmt("", &ctx, "a", "b", "c"));
   EXPECT_TRUE(result.empty());
 }
 
-// Allow unused placeholder substitution in context
+/// Allow unused placeholder substitution in context.
 TEST(FormatTest, EmptyFmtStrPopulatedCtx) {
   FmtContext ctx;
   ctx.withBuilder("builder");
@@ -40,21 +40,21 @@ TEST(FormatTest, LiteralFmtStr) {
   EXPECT_THAT(result, StrEq("void foo {}"));
 }
 
-// Print single dollar literally
+/// Print single dollar literally.
 TEST(FormatTest, AdjacentDollar) {
   FmtContext ctx;
   std::string result = std::string(tgfmt("$", &ctx));
   EXPECT_THAT(result, StrEq("$"));
 }
 
-// Print dangling dollar literally
+/// Print dangling dollar literally.
 TEST(FormatTest, DanglingDollar) {
   FmtContext ctx;
   std::string result = std::string(tgfmt("foo bar baz$", &ctx));
   EXPECT_THAT(result, StrEq("foo bar baz$"));
 }
 
-// Allow escape dollars with '$$'
+/// Allow escape dollars with '$$'.
 TEST(FormatTest, EscapeDollars) {
   FmtContext ctx;
   std::string result =
@@ -72,14 +72,14 @@ TEST(FormatTest, PositionalFmtStr) {
   EXPECT_THAT(result, StrEq("a b 43 d"));
 }
 
-// Output the placeholder if missing substitution
+/// Output the placeholder if missing substitution.
 TEST(FormatTest, PositionalFmtStrMissingParams) {
   FmtContext ctx;
   std::string result = std::string(tgfmt("$0 %1 $2", &ctx));
   EXPECT_THAT(result, StrEq("$0<no-subst-found> %1 $2<no-subst-found>"));
 }
 
-// Allow flexible reference of positional parameters
+/// Allow flexible reference of positional parameters.
 TEST(FormatTest, PositionalFmtStrFlexibleRef) {
   FmtContext ctx;
   std::string result = std::string(tgfmt("$2 $0 $2", &ctx, "a", "b", "c"));
@@ -122,7 +122,7 @@ TEST(FormatTest, PlaceHolderMissingSubst) {
   EXPECT_THAT(result, StrEq("$_op<no-subst-found>"));
 }
 
-// Test commonly used delimiters in C++
+/// Test commonly used delimiters in C++.
 TEST(FormatTest, PlaceHolderFmtStrDelimiter) {
   FmtContext ctx;
   ctx.addSubst("m", "");
@@ -130,7 +130,7 @@ TEST(FormatTest, PlaceHolderFmtStrDelimiter) {
   EXPECT_THAT(result, StrEq("{([])}|"));
 }
 
-// Test allowed characters in placeholder symbol
+/// Test allowed characters in placeholder symbol.
 TEST(FormatTest, CustomPlaceHolderFmtStrPlaceHolderChars) {
   FmtContext ctx;
   ctx.addSubst("m", "0 ");

diff  --git a/mlir/unittests/TableGen/StructsGenTest.cpp b/mlir/unittests/TableGen/StructsGenTest.cpp
index 19aff1c83b0f..c58fedb4ec4f 100644
--- a/mlir/unittests/TableGen/StructsGenTest.cpp
+++ b/mlir/unittests/TableGen/StructsGenTest.cpp
@@ -17,12 +17,12 @@
 
 namespace mlir {
 
-// Pull in generated enum utility declarations
+/// Pull in generated enum utility declarations and definitions.
 #include "StructAttrGenTest.h.inc"
-// And definitions
 #include "StructAttrGenTest.cpp.inc"
-// Helper that returns an example test::TestStruct for testing its
-// implementation.
+
+/// Helper that returns an example test::TestStruct for testing its
+/// implementation.
 static test::TestStruct getTestStruct(mlir::MLIRContext *context) {
   auto integerType = mlir::IntegerType::get(32, context);
   auto integerAttr = mlir::IntegerAttr::get(integerType, 127);
@@ -39,16 +39,16 @@ static test::TestStruct getTestStruct(mlir::MLIRContext *context) {
                                optionalAttr, context);
 }
 
-// Validates that test::TestStruct::classof correctly identifies a valid
-// test::TestStruct.
+/// Validates that test::TestStruct::classof correctly identifies a valid
+/// test::TestStruct.
 TEST(StructsGenTest, ClassofTrue) {
   mlir::MLIRContext context;
   auto structAttr = getTestStruct(&context);
   ASSERT_TRUE(test::TestStruct::classof(structAttr));
 }
 
-// Validates that test::TestStruct::classof fails when an extra attribute is in
-// the class.
+/// Validates that test::TestStruct::classof fails when an extra attribute is in
+/// the class.
 TEST(StructsGenTest, ClassofExtraFalse) {
   mlir::MLIRContext context;
   mlir::DictionaryAttr structAttr = getTestStruct(&context);
@@ -69,8 +69,8 @@ TEST(StructsGenTest, ClassofExtraFalse) {
   ASSERT_FALSE(test::TestStruct::classof(badDictionary));
 }
 
-// Validates that test::TestStruct::classof fails when a NamedAttribute has an
-// incorrect name.
+/// Validates that test::TestStruct::classof fails when a NamedAttribute has an
+/// incorrect name.
 TEST(StructsGenTest, ClassofBadNameFalse) {
   mlir::MLIRContext context;
   mlir::DictionaryAttr structAttr = getTestStruct(&context);
@@ -90,8 +90,8 @@ TEST(StructsGenTest, ClassofBadNameFalse) {
   ASSERT_FALSE(test::TestStruct::classof(badDictionary));
 }
 
-// Validates that test::TestStruct::classof fails when a NamedAttribute has an
-// incorrect type.
+/// Validates that test::TestStruct::classof fails when a NamedAttribute has an
+/// incorrect type.
 TEST(StructsGenTest, ClassofBadTypeFalse) {
   mlir::MLIRContext context;
   mlir::DictionaryAttr structAttr = getTestStruct(&context);
@@ -115,8 +115,8 @@ TEST(StructsGenTest, ClassofBadTypeFalse) {
   ASSERT_FALSE(test::TestStruct::classof(badDictionary));
 }
 
-// Validates that test::TestStruct::classof fails when a NamedAttribute is
-// missing.
+/// Validates that test::TestStruct::classof fails when a NamedAttribute is
+/// missing.
 TEST(StructsGenTest, ClassofMissingFalse) {
   mlir::MLIRContext context;
   mlir::DictionaryAttr structAttr = getTestStruct(&context);
@@ -132,7 +132,7 @@ TEST(StructsGenTest, ClassofMissingFalse) {
   ASSERT_FALSE(test::TestStruct::classof(badDictionary));
 }
 
-// Validate the accessor for the FloatAttr value.
+/// Validate the accessor for the FloatAttr value.
 TEST(StructsGenTest, GetFloat) {
   mlir::MLIRContext context;
   auto structAttr = getTestStruct(&context);
@@ -140,7 +140,7 @@ TEST(StructsGenTest, GetFloat) {
   EXPECT_EQ(returnedAttr.getValueAsDouble(), 0.25);
 }
 
-// Validate the accessor for the IntegerAttr value.
+/// Validate the accessor for the IntegerAttr value.
 TEST(StructsGenTest, GetInteger) {
   mlir::MLIRContext context;
   auto structAttr = getTestStruct(&context);
@@ -148,7 +148,7 @@ TEST(StructsGenTest, GetInteger) {
   EXPECT_EQ(returnedAttr.getInt(), 127);
 }
 
-// Validate the accessor for the ElementsAttr value.
+/// Validate the accessor for the ElementsAttr value.
 TEST(StructsGenTest, GetElements) {
   mlir::MLIRContext context;
   auto structAttr = getTestStruct(&context);


        


More information about the Mlir-commits mailing list