[clang-format] Exclude kw_decltype in RemoveParentheses
authorOwen Pan <owenpiano@gmail.com>
Thu, 17 Aug 2023 08:00:02 +0000 (01:00 -0700)
committerTobias Hieta <tobias@hieta.se>
Wed, 30 Aug 2023 15:00:56 +0000 (17:00 +0200)
commit1440745b0a641205a6db6e99e68723c52d1c582b
treec52998077ee9ee4bf27d924cb7ce10bf74e42453
parent6f1974e04c3c223a812c6181c9d48ea85a472293
[clang-format] Exclude kw_decltype in RemoveParentheses

From https://en.cppreference.com/w/cpp/language/decltype:
Note that if the name of an object is parenthesized, it is treated as an
ordinary lvalue expression, thus decltype(x) and decltype((x)) are often
different types.

Fixes #64786.

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

(cherry picked from commit e3a79503a30f8c9d8fba79f3e5427bb895f320cf)
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTest.cpp