[Mlir-commits] [clang] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

Rahul Joshi llvmlistbot at llvm.org
Thu Aug 29 07:51:31 PDT 2024


================
@@ -1654,12 +1654,12 @@ void OperationFormat::genElementParser(FormatElement *element, MethodBody &body,
           dir->shouldBeQualified() ? qualifiedTypeParserCode : typeParserCode;
       TypeSwitch<FormatElement *>(dir->getArg())
           .Case<OperandVariable, ResultVariable>([&](auto operand) {
-            body << formatv(parserCode,
+            body << formatv(false, parserCode,
----------------
jurahul wrote:

Yeah, because parserCode is either with 1 or 2 placeholders:

```
      const char *parserCode =
          dir->shouldBeQualified() ? qualifiedTypeParserCode : typeParserCode;
```

We could add if's in the code around calls to formatv() as well, but I though the code duplication just to get validation was not warranted.

https://github.com/llvm/llvm-project/pull/105745


More information about the Mlir-commits mailing list