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

Birunthan Mohanathas birunthan at mohanathas.com
Tue Jun 30 23:11:05 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
----------------
This will (incorrectly) turn code like:
```
A& A::operator=(const A&) {
  return *this;
}
```
into:
```
A& A::
operator=(const A&) {
  return *this;
}
```

http://reviews.llvm.org/D10860

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






More information about the cfe-commits mailing list