[PATCH] clang-format: Treat 'operator new' as function name.

strager strager.nds at gmail.com
Wed Jul 1 10:11:34 PDT 2015


================
Comment at: lib/Format/TokenAnnotator.cpp:1543
@@ -1542,3 +1542,3 @@
     if (!Current->MustBreakBefore && InFunctionDecl &&
-        Current->is(TT_FunctionDeclarationName)) {
+        Current->isOneOf(tok::kw_operator, TT_FunctionDeclarationName)) {
       // FIXME: Line.Last points to other characters than tok::semi
----------------
poiru wrote:
> This will (incorrectly) turn code like:
> ```
> A& A::operator=(const A&) {
>   return *this;
> }
> ```
> into:
> ```
> A& A::
> operator=(const A&) {
>   return *this;
> }
> ```
Cool. I'll add tests and figure something out.

http://reviews.llvm.org/D10860

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list