[PATCH] D77741: [FileCheck] Better diagnostic for format conflict

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 02:40:58 PDT 2020


grimar added a comment.

I am not well familar with the code of FileCheck,
the code looks good to me (I've found no issues with how errors are handled either),
Two observations/suggestions are below.



================
Comment at: llvm/lib/Support/FileCheck.cpp:30
+  switch (Value) {
+  default:
+    llvm_unreachable("unknown expression format");
----------------
I'd put it to the end, after other cases. It is more consistent with the resto of the code and also,
`default` is the most unlikely case here.


================
Comment at: llvm/lib/Support/FileCheck.cpp:298
+    return std::make_unique<ExpressionLiteral>(OperandExpr, LiteralValue);
+  }
 
----------------
Perhaps, I'd inline:
```
   if (!Expr.consumeInteger((AO == AllowedOperand::LegacyLiteral) ? 10 : 0,
                            LiteralValue))
     return std::make_unique<ExpressionLiteral>(
         OperandExpr.drop_back(Expr.size()), LiteralValue);
```




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77741/new/

https://reviews.llvm.org/D77741





More information about the llvm-commits mailing list