This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] structured binding in range for detected as Objective C
ClosedPublic

Authored by MyDeveloperDay on Mar 19 2019, 7:41 AM.

Details

Summary

Sometime after 6.0.0 and the current trunk 9.0.0 the following code would be considered as objective C and not C++

Reported by: https://twitter.com/mattgodbolt/status/1096188576503644160

$ clang-format.exe test.h
Configuration file(s) do(es) not support Objective-C: C:\clang\build\.clang-format

  • test.h --
#include <vector>
#include <string>

std::vector<std::pair<std::string,std::string>> C;

void foo()
{
   for (auto && [A,B] : C)
   {
       std::string D = A + B;
   }
}

The following code fixes this issue of incorrect detection

Diff Detail

Repository
rC Clang

Event Timeline

MyDeveloperDay created this revision.Mar 19 2019, 7:41 AM
MyDeveloperDay added a project: Restricted Project.
This revision is now accepted and ready to land.Mar 20 2019, 6:08 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 20 2019, 10:10 AM