<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58841>58841</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
             [clang-format] Some C++/CLI constructs treated as Objective-C
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          stinos
      </td>
    </tr>
</table>

<pre>
    .clang-format:
```
Language:        Cpp
...
```

c1.h:
```
[Xml::Serialization::XmlTypeAttribute("Label")]
public ref struct Label
{
}
```

c2.h:
```
void Foo(System::Collections::Generic::IDictionary< K, V >^ d)
{
  for each(auto kvp in d)
  {
  }
}
```

With clang-format versions 15 and 16 (didn't test older ones):

```
> clang-format.exe --style=file c1.h
Configuration file(s) do(es) not support Objective-C: C:\temp\clangformat\.clang-format

> clang-format.exe --style=file c2.h
Configuration file(s) do(es) not support Objective-C: C:\temp\clangformat\.clang-format
```

The above is for C++/CLI code, but there have been other reports in the past where special cases in plain C and C++ result in the same problem: https://bugs.llvm.org/show_bug.cgi?id=48580.

With that in mind I'm wondering: instead of trying to fix this on a per-case basis, or using workarounds like renaming to .hpp or using stdin+make sure working directory is ok to pick up the .clang-format+` --assume-filename=.hpp`, would it be an acceptable solution to instead make the `--assume-filename` argument also work for files?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFVU2PozgQ_TVwKQXxEQI5cOgmnVFrW9pDj3bntjK4AE8MRrZJJvvrt-ykp5OdntHeNkIQuz7eq6pnaBQ_V1Er2dSvOqVHZoPsIYh3QfwQbOLr5Zcv5LKwHskO1189zxdbFEUfxlzubRINP8sa5I9fRums2cMrasGk-JtZoabLFtk-n2d8sFaLZrEYpGWQpi-sQUnPIN0G-e6SaF4aKVrQ2IGxemktXLwuKMXj25_dr4imPyd6VILDXili8Ho2FscLwVpJia0jbC4bn3CiMtrL4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