[llvm-bugs] [Bug 30849] New: clang-format doesn't recognize access modifiers expanded by preprocessor?

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 31 11:35:34 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30849

            Bug ID: 30849
           Summary: clang-format doesn't recognize access modifiers
                    expanded by preprocessor?
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dank at kegel.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

Input:

#define _PRIVATE private
class x {
public:
  int y;

_PRIVATE:
  int z;
};


Bad output:

#define _PRIVATE private
class x {
public:
  int y;

  _PRIVATE : int z;
};

Desired output to treat a 'private' expanded from a macro the same as a bare
'private', i.e.

#define _PRIVATE private
class x {
public:
  int y;

_PRIVATE:
  int z;
};

The use case is "developers who need to be able to build a codebase with
private changed to public sometimes, and use a preprocessor definition to do
the dirty deed".

The codebase in question is 322KLOC, and this is the only showstopper for
using clang-format as the automated formatter for every commit.

Tested with 
clang-format version 3.8.0-2ubuntu4 (the default clang-format on ubuntu 16.04)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161031/f601239c/attachment-0001.html>


More information about the llvm-bugs mailing list