[all-commits] [llvm/llvm-project] 077e1b: [clang] Preserve UDL nodes in RemoveNestedImmediat...

zyn0217 via All-commits all-commits at lists.llvm.org
Wed Oct 4 02:46:00 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 077e1b892d9555c503b86d5361278aa999764884
      https://github.com/llvm/llvm-project/commit/077e1b892d9555c503b86d5361278aa999764884
  Author: zyn0217 <117258288+zyn0217 at users.noreply.github.com>
  Date:   2023-10-04 (Wed, 04 Oct 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaExpr.cpp
    A clang/test/AST/ast-dump-udl-consteval.cpp

  Log Message:
  -----------
  [clang] Preserve UDL nodes in RemoveNestedImmediateInvocation (#66641)

D63960 performs a tree transformation on AST to prevent evaluating
constant expressions eagerly by removing recorded immediate consteval
invocations from subexpressions. (See
https://reviews.llvm.org/D63960#inline-600736 for its motivation.)

However, the UDL node has been replaced with a CallExpr in the default
TreeTransform since ca844ab0 (inadvertently?). This confuses clangd as
it relies on the exact AST node type to decide whether or not to present
inlay hints for an expression.

With regard to the fix, I think it's enough to return the UDL expression
as-is during the transformation: We've bound it to temporary in its
construction, and there's no ConstantExpr to visit under a UDL.

Fixes https://github.com/llvm/llvm-project/issues/63898.




More information about the All-commits mailing list