[llvm-bugs] [Bug 36468] New: [Formatter/ObjC] Add // clang-format Language=XXX support

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 21 09:09:22 PST 2018


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

            Bug ID: 36468
           Summary: [Formatter/ObjC] Add // clang-format Language=XXX
                    support
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bhamiltoncx at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

The heuristic to guess ObjC vs C++ is pretty good now, but there will always be
cases where it fails, e.g.


===
#import "SomeOtherHeader.h"

int DoStuff(SomeOtherType *type);
===

where we cannot tell from the lexer if this is C++ or ObjC.

To fix this, we should add support for a special comment, similar to the
existing "clang-format off" comment.

Something like this:

===
#import "SomeOtherHeader.h"

// clang-format Language=ObjC

int DoStuff(SomeOtherType *type);
===

-- 
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/20180221/9311aba5/attachment.html>


More information about the llvm-bugs mailing list