[PATCH] D79936: [FileCheck] Add function call support to numerical expressions.

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 29 04:18:26 PDT 2020


thopre added inline comments.


================
Comment at: llvm/lib/Support/FileCheck.cpp:287
+  // Try to parse a function call.
+  if (Expr.startswith(CallPrefix)) {
+    if (AO != AllowedOperand::Any)
----------------
jhenderson wrote:
> I'm not strongly opposed to the use of `!` to indicate a function call, but is it actually necessary? It seems like a function call could just be identified by `<sequence of identifier chars>(<some chars>)`. The code would look something like the following semi-pseudo code:
> 
> ```
> size_t Parenthesis = Expr.find_first_of('(');
> if (Parenthesis != npos) {
>   if (all_of(Expr.take_front(Parenthesis), [](char C) { 
>       return isValidIdentifierChar(C);
>     }) {
>     if (AO != AllowedOperand::Any)
>       return ErrorDiagnostic::get(SM, Expr, "unexpected function call");
> 
>     return parseCallExpr(Expr, LineNumber, Context, SM);
>   }
> }
> ```
> 
> Assuming I've not missed something, that would allow us to simplify all the usages of function calls.
Regardless of the ease of implementation, I like the ! prefix since these are builtin functions/operators, not something the user can define. YMMV of course


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79936





More information about the llvm-commits mailing list