[all-commits] [llvm/llvm-project] d8a5c7: [clang][Sema] Correct end for the `CastOperation.O...

Botond István Horváth via All-commits all-commits at lists.llvm.org
Tue Oct 24 07:44:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d8a5c79e8e006cf878e05aa316367c9684193117
      https://github.com/llvm/llvm-project/commit/d8a5c79e8e006cf878e05aa316367c9684193117
  Author: Botond István Horváth <horvath.botond.istvan at gmail.com>
  Date:   2023-10-24 (Tue, 24 Oct 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaCast.cpp
    M clang/test/Misc/misc-source-ranges.cpp

  Log Message:
  -----------
  [clang][Sema] Correct end for the `CastOperation.OpRange` (#69480)

Set the correct end for the CastOperation.OpRange in CXXFunctionalCastExpr.
Now it is the closing bracket's location instead of the parameter's location.

This can lead to better highlight in the diagnostics.
Similar to https://github.com/llvm/llvm-project/pull/66853

Before:

warning: cast from 'long (*)(const int &)' to 'decltype(fun_ptr)' (aka 'long (*)(int &)') converts to incompatible function type [-Wcast-function-type-strict]
   24 | return decltype(fun_ptr)( f_ptr /*comment*/);
      |        ^~~~~~~~~~~~~~~~~~~~~~~~

After:

warning: cast from 'long (*)(const int &)' to 'decltype(fun_ptr)' (aka 'long (*)(int &)') converts to incompatible function type [-Wcast-function-type-strict]
   24 | return decltype(fun_ptr)( f_ptr /*comment*/);
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reviewed By: AaronBallman, tbaederr

GitHub PR: https://github.com/llvm/llvm-project/pull/69480




More information about the All-commits mailing list