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

            Bug ID: 36248
           Summary: [clang-format] C++11 attribute confused for
                    Objective-C code
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: merlin.nim...@gmail.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

The following C++ header file is confused for Objective-C code:

```
#pragma once

#include <memory>

class SomeClass : public Object {
    int member;
};

void some_function() {
    hello();
}

[[ noreturn ]] void other_function(int arg);
```

Removing the `[[ noreturn ]]` attribute results in correct detection.
My project uses a `.clang-format` configuration file that only specifies
configuration for `Language: Cpp`, and so invoking clang-format results in an
error:

$ clang-format -style=file simple.h
Configuration file(s) do(es) not support Objective-C:
/path/to/project/.clang-format

I also tried forcing language detection with:
$ clang-format -style=file -assume-filename=simple.hpp simple.h

but that results in the same error (I guess because this option is only active
when reading from stdin).

---

Workarounds:

$ mv simple.h simple.hpp
$ clang-format -style=file simple.hpp

Or:

$ cat simple.h | clang-format -style=file -assume-filename=simple.hpp

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to