Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[clang-format] Some C++/CLI constructs treated as Objective-C #58841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stinos opened this issue Nov 7, 2022 · 2 comments
Closed

[clang-format] Some C++/CLI constructs treated as Objective-C #58841

stinos opened this issue Nov 7, 2022 · 2 comments
Labels
c++/cli clang-format obsolete Issues with old (unsupported) versions of LLVM

Comments

@stinos
Copy link

stinos commented Nov 7, 2022

.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?

@llvmbot
Copy link
Member

llvmbot commented Nov 7, 2022

@llvm/issue-subscribers-clang-format

@owenca owenca added the obsolete Issues with old (unsupported) versions of LLVM label May 4, 2025
@owenca
Copy link
Contributor

owenca commented May 4, 2025

Can't reproduce with the latest clang-format.

@owenca owenca closed this as not planned Won't fix, can't repro, duplicate, stale May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++/cli clang-format obsolete Issues with old (unsupported) versions of LLVM
Projects
None yet
Development

No branches or pull requests

5 participants