Skip to content

Commit daa350c

Browse files
committed
[mlir] Work around MSVC bug
MSVC fails to parse this construct, leading to MlirTranslateMain.cpp(70): error C2065: 'inputSplitMarker': undeclared identifier Just switching to brace init works around the issue
1 parent 7b766a6 commit daa350c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

mlir/lib/Tools/mlir-opt/MlirOptMain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct MlirOptMainConfigCLOptions : public MlirOptMainConfig {
128128
cl::desc("Print the list of registered dialects and exit"),
129129
cl::location(showDialectsFlag), cl::init(false));
130130

131-
static cl::opt<std::string, /*ExternalStorage=*/true> splitInputFile(
131+
static cl::opt<std::string, /*ExternalStorage=*/true> splitInputFile{
132132
"split-input-file", llvm::cl::ValueOptional,
133133
cl::callback([&](const std::string &str) {
134134
// Implicit value: use default marker if flag was used without value.
@@ -137,7 +137,7 @@ struct MlirOptMainConfigCLOptions : public MlirOptMainConfig {
137137
}),
138138
cl::desc("Split the input file into chunks using the given or "
139139
"default marker and process each chunk independently"),
140-
cl::location(splitInputFileFlag), cl::init(""));
140+
cl::location(splitInputFileFlag), cl::init("")};
141141

142142
static cl::opt<std::string, /*ExternalStorage=*/true> outputSplitMarker(
143143
"output-split-marker",

mlir/lib/Tools/mlir-translate/MlirTranslateMain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ LogicalResult mlir::mlirTranslateMain(int argc, char **argv,
6262
llvm::cl::desc("Allow operation with no registered dialects (discouraged: testing only!)"),
6363
llvm::cl::init(false));
6464

65-
static llvm::cl::opt<std::string> inputSplitMarker(
65+
static llvm::cl::opt<std::string> inputSplitMarker{
6666
"split-input-file", llvm::cl::ValueOptional,
6767
llvm::cl::callback([&](const std::string &str) {
6868
// Implicit value: use default marker if flag was used without value.
@@ -71,7 +71,7 @@ LogicalResult mlir::mlirTranslateMain(int argc, char **argv,
7171
}),
7272
llvm::cl::desc("Split the input file into chunks using the given or "
7373
"default marker and process each chunk independently"),
74-
llvm::cl::init(""));
74+
llvm::cl::init("")};
7575

7676
static llvm::cl::opt<bool> verifyDiagnostics(
7777
"verify-diagnostics",

mlir/tools/mlir-pdll/mlir-pdll.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int main(int argc, char **argv) {
136136
llvm::cl::desc(
137137
"Print out the parsed ODS information from the input file"),
138138
llvm::cl::init(false));
139-
llvm::cl::opt<std::string> inputSplitMarker(
139+
llvm::cl::opt<std::string> inputSplitMarker{
140140
"split-input-file", llvm::cl::ValueOptional,
141141
llvm::cl::callback([&](const std::string &str) {
142142
// Implicit value: use default marker if flag was used without value.
@@ -145,7 +145,7 @@ int main(int argc, char **argv) {
145145
}),
146146
llvm::cl::desc("Split the input file into chunks using the given or "
147147
"default marker and process each chunk independently"),
148-
llvm::cl::init(""));
148+
llvm::cl::init("")};
149149
llvm::cl::opt<std::string> outputSplitMarker(
150150
"output-split-marker",
151151
llvm::cl::desc("Split marker to use for merging the ouput"),

0 commit comments

Comments
 (0)