[llvm-bugs] [Bug 36248] New: [clang-format] C++11 attribute confused for Objective-C code
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Feb 6 02:24:48 PST 2018
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: unassignedclangbugs at nondot.org
Reporter: merlin.nimier at gmail.com
CC: djasper at google.com, klimek at google.com,
llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180206/321049df/attachment.html>
More information about the llvm-bugs
mailing list