[all-commits] [llvm/llvm-project] 363e03: [AST] NFC: add an assertion for invariant of CXXFo...

Ilya Biryukov via All-commits all-commits at lists.llvm.org
Tue Jul 23 03:32:06 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 363e036ac002d5af4bb82e303052b806a98086a1
      https://github.com/llvm/llvm-project/commit/363e036ac002d5af4bb82e303052b806a98086a1
  Author: Ilya Biryukov <ibiryukov at google.com>
  Date:   2024-07-23 (Tue, 23 Jul 2024)

  Changed paths:
    M clang/include/clang/AST/ExprCXX.h
    M clang/lib/AST/ExprCXX.cpp

  Log Message:
  -----------
  [AST] NFC: add an assertion for invariant of CXXFoldExpr

CXXFoldExpr relies on exactly one of the two operands to have unexpanded
parameter packs. If this invariant does not holds, results of
`getPattern()`, `isLeftFold()` and other related members are incorrect.

Asserting this on construction makes debugging the problems easier as
the failure is happening closer to the code that contains the error.

Also move the constructor to the `.cpp` file to avoid potential ODR
violations from having an `assert` in the header in combination with
precompiled libraries.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list