Issue 123142
Summary clang-format indents class member functions oddly if there are function-like macro invocations
Labels clang-format
Assignees
Reporter alanzhao1
    Given

```cpp
class PA_LOCKABLE Lock {
public:
  void Acquire() PA_EXCLUSIVE_LOCK_FUNCTION() {}
  void Release() PA_UNLOCK_FUNCTION() {}
};
```

where `PA_LOCKABLE`, `PA_EXCLUSIVE_LOCK_FUNCTION()`, and `PA_UNLOCK_FUNCTION()` are macros,

clang-format returns
```cpp
class PA_LOCKABLE Lock{
  public : void Acquire() PA_EXCLUSIVE_LOCK_FUNCTION(){} void Release()
 PA_UNLOCK_FUNCTION(){}
};
```

The main issues are:

* A space is added before and after the colon after `public`
* The space is removed between the class name and the curly bracket
* Very strange indentation and newlining of the two member functions

This regression occurred somewhere between 10664813fca8d5ccbfd90bae9e791b7062dabd7c and 29ed6000d21edd1a88b2daad242e1f356cafbaca
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to