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

Differential Revision: https://reviews.llvm.org/D83632
This commit is contained in:
Rahul Joshi 2020-07-11 15:15:22 -07:00
parent 39009a8245
commit 032810f589
5 changed files with 34 additions and 35 deletions

View File

@ -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();

View File

@ -17,7 +17,7 @@
using namespace mlir;
// Load the SDBM dialect
/// Load the SDBM dialect.
static DialectRegistration<SDBMDialect> SDBMRegistration;
static MLIRContext *ctx() {

View File

@ -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;

View File

@ -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 ");

View File

@ -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);