[all-commits] [llvm/llvm-project] 1ae531: Changing some strange code into an assert; NFC

Aaron Ballman via All-commits all-commits at lists.llvm.org
Wed Sep 21 12:00:13 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1ae5310ebbecadab52c1b7fc29596ac5b61795a3
      https://github.com/llvm/llvm-project/commit/1ae5310ebbecadab52c1b7fc29596ac5b61795a3
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2022-09-21 (Wed, 21 Sep 2022)

  Changed paths:
    M clang/lib/Parse/ParseExpr.cpp

  Log Message:
  -----------
  Changing some strange code into an assert; NFC

This code was added in b65b1f322bd88513586a4539d2b5f18aeb698f3f, but it
was not noticed that the [[fallthrough]] behavior was very wrong. In C
mode, we would set the ParenExprType to CompoundLiteral and then
promptly overwrite that information by falling through.

After some investigation, I convinced myself that it is not possible to
hit this code path in C, only in C++. I've switched it to be an
assertion; I don't expect to hit it, but if we do hit it, that will at
least give us a code example we can use to reason about the intent of
the original code.




More information about the All-commits mailing list