How to find a Clang warning flag in Xcode that'

2019-04-26 19:14发布

问题:

I've got a warning I wish to suppress in Xcode, but I cannot seem to find the name of the warning. I've enabled -fdiagnostics-show-category=name and the logs show that it's a semantic issue. Looking at Clang's source, I think I've located a test for this scenario but can't seem to track down the name of it.

Currently, the build logs show this:

m:89:29: warning: assigning to 'id<AProtocol>' from incompatible type 'AViewController *' [Semantic Issue]
self.tableView.delegate = self.aController;

The ID for the warning is also 2 - but no matter what I try I cannot seem to make this go away:

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-WNO-CLUE-WHAT-THE-WARNING-FLAG-IS"
    self.tableView.delegate = self.aController;
#pragma clang diagnostic pop

Of course, I'm aware always fixing the warning is preferred, and I can do so with a protocol cast. But at this point, I've looked so hard into finding the warning, it just feels like unfinished business and I'd love to know the answer. I've also searched "freakingclangwarnings.com" and it's not present there either as far as I can tell.

回答1:

Searching source code, I'd guess it's warn_incompatible_qualified_id, defined in DiagnosticSemaKinds.td, which is one of those existing warnings that currently have no associated -W flag Possibly, more information in the revision log from when it was added.