[Mlir-commits] [mlir] 1b928e5 - [MLIR] Apply clang-tidy fixes for misc-use-internal-linkage in OpFormatGen.cpp (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Thu Sep 4 15:11:50 PDT 2025
Author: Mehdi Amini
Date: 2025-09-04T15:11:18-07:00
New Revision: 1b928e5346851ccc343cdedf06c076baf12c255a
URL: https://github.com/llvm/llvm-project/commit/1b928e5346851ccc343cdedf06c076baf12c255a
DIFF: https://github.com/llvm/llvm-project/commit/1b928e5346851ccc343cdedf06c076baf12c255a.diff
LOG: [MLIR] Apply clang-tidy fixes for misc-use-internal-linkage in OpFormatGen.cpp (NFC)
Added:
Modified:
mlir/tools/mlir-tblgen/OpFormatGen.cpp
Removed:
################################################################################
diff --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index 67fc7636af60f..0d113b3748354 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -672,7 +672,7 @@ const char *const inferReturnTypesParserCode = R"(
/// The code snippet used to generate a parser call for a region list.
///
/// {0}: The name for the region list.
-const char *regionListParserCode = R"(
+static const char *regionListParserCode = R"(
{
std::unique_ptr<::mlir::Region> region;
auto firstRegionResult = parser.parseOptionalRegion(region);
@@ -695,7 +695,7 @@ const char *regionListParserCode = R"(
/// The code snippet used to ensure a list of regions have terminators.
///
/// {0}: The name of the region list.
-const char *regionListEnsureTerminatorParserCode = R"(
+static const char *regionListEnsureTerminatorParserCode = R"(
for (auto ®ion : {0}Regions)
ensureTerminator(*region, parser.getBuilder(), result.location);
)";
@@ -703,7 +703,7 @@ const char *regionListEnsureTerminatorParserCode = R"(
/// The code snippet used to ensure a list of regions have a block.
///
/// {0}: The name of the region list.
-const char *regionListEnsureSingleBlockParserCode = R"(
+static const char *regionListEnsureSingleBlockParserCode = R"(
for (auto ®ion : {0}Regions)
if (region->empty()) region->emplaceBlock();
)";
@@ -711,7 +711,7 @@ const char *regionListEnsureSingleBlockParserCode = R"(
/// The code snippet used to generate a parser call for an optional region.
///
/// {0}: The name of the region.
-const char *optionalRegionParserCode = R"(
+static const char *optionalRegionParserCode = R"(
{
auto parseResult = parser.parseOptionalRegion(*{0}Region);
if (parseResult.has_value() && failed(*parseResult))
@@ -722,7 +722,7 @@ const char *optionalRegionParserCode = R"(
/// The code snippet used to generate a parser call for a region.
///
/// {0}: The name of the region.
-const char *regionParserCode = R"(
+static const char *regionParserCode = R"(
if (parser.parseRegion(*{0}Region))
return ::mlir::failure();
)";
@@ -730,21 +730,21 @@ const char *regionParserCode = R"(
/// The code snippet used to ensure a region has a terminator.
///
/// {0}: The name of the region.
-const char *regionEnsureTerminatorParserCode = R"(
+static const char *regionEnsureTerminatorParserCode = R"(
ensureTerminator(*{0}Region, parser.getBuilder(), result.location);
)";
/// The code snippet used to ensure a region has a block.
///
/// {0}: The name of the region.
-const char *regionEnsureSingleBlockParserCode = R"(
+static const char *regionEnsureSingleBlockParserCode = R"(
if ({0}Region->empty()) {0}Region->emplaceBlock();
)";
/// The code snippet used to generate a parser call for a successor list.
///
/// {0}: The name for the successor list.
-const char *successorListParserCode = R"(
+static const char *successorListParserCode = R"(
{
::mlir::Block *succ;
auto firstSucc = parser.parseOptionalSuccessor(succ);
@@ -766,7 +766,7 @@ const char *successorListParserCode = R"(
/// The code snippet used to generate a parser call for a successor.
///
/// {0}: The name of the successor.
-const char *successorParserCode = R"(
+static const char *successorParserCode = R"(
if (parser.parseSuccessor({0}Successor))
return ::mlir::failure();
)";
@@ -774,7 +774,7 @@ const char *successorParserCode = R"(
/// The code snippet used to generate a parser for OIList
///
/// {0}: literal keyword corresponding to a case for oilist
-const char *oilistParserCode = R"(
+static const char *oilistParserCode = R"(
if ({0}Clause) {
return parser.emitError(parser.getNameLoc())
<< "`{0}` clause can appear at most once in the expansion of the "
@@ -1976,7 +1976,7 @@ void OperationFormat::genParserVariadicSegmentResolution(Operator &op,
// operation that has the SingleBlockImplicitTerminator trait.
///
/// {0}: The name of the region.
-const char *regionSingleBlockImplicitTerminatorPrinterCode = R"(
+static const char *regionSingleBlockImplicitTerminatorPrinterCode = R"(
{
bool printTerminator = true;
if (auto *term = {0}.empty() ? nullptr : {0}.begin()->getTerminator()) {{
@@ -1994,7 +1994,7 @@ const char *regionSingleBlockImplicitTerminatorPrinterCode = R"(
///
/// {0}: The name of the enum attribute.
/// {1}: The name of the enum attributes symbolToString function.
-const char *enumAttrBeginPrinterCode = R"(
+static const char *enumAttrBeginPrinterCode = R"(
{
auto caseValue = {0}();
auto caseValueStr = {1}(caseValue);
@@ -2386,8 +2386,8 @@ static void genOptionalGroupPrinterAnchor(FormatElement *anchor,
});
}
-void collect(FormatElement *element,
- SmallVectorImpl<VariableElement *> &variables) {
+static void collect(FormatElement *element,
+ SmallVectorImpl<VariableElement *> &variables) {
TypeSwitch<FormatElement *>(element)
.Case([&](VariableElement *var) { variables.emplace_back(var); })
.Case([&](CustomDirective *ele) {
More information about the Mlir-commits
mailing list