[all-commits] [llvm/llvm-project] 133c3e: Streamline expression parser error messages.

Adrian Prantl via All-commits all-commits at lists.llvm.org
Mon Jun 12 10:30:13 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 133c3eaac0a532380c3d6ad21a60da1490f51fb8
      https://github.com/llvm/llvm-project/commit/133c3eaac0a532380c3d6ad21a60da1490f51fb8
  Author: Adrian Prantl <aprantl at apple.com>
  Date:   2023-06-12 (Mon, 12 Jun 2023)

  Changed paths:
    M lldb/source/Expression/UserExpression.cpp
    M lldb/source/Interpreter/CommandReturnObject.cpp
    M lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py
    M lldb/test/API/commands/expression/fixits/TestFixIts.py

  Log Message:
  -----------
  Streamline expression parser error messages.

Currently the expression parser prints a mostly useless generic error before printing the compiler error:

  (lldb) p 1+x)
  error: expression failed to parse:
  error: <user expression 18>:1:3: use of undeclared identifier 'x'
  1+x)
     ^

This is distracting and as far as I can tell only exists to work
around the fact that the first "error: " is unconditionally injected
by CommandReturnObject. The solution is not very elegant, but the
result looks much better.

(Partially addresses rdar://110492710)

Differential Revision: https://reviews.llvm.org/D152590




More information about the All-commits mailing list