The fixit is given only if the API_AVAILABLE macro is defined.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Thanks for working on this! This looks like it would be very useful.
lib/Sema/SemaDeclAttr.cpp | ||
---|---|---|
7230 ↗ | (On Diff #107674) | Its unfortunate to loop over every macro. Can we use Preprocessor::getMacroDefinition()? |
7231 ↗ | (On Diff #107674) | It would be nice if we could recommend using this macro even if it isn't defined, as users might not have included the <os/availability.h> header. Maybe we can do that on apple platforms, noting that the the macro is declared in os/availability.h if it isn't already defined? |
7238 ↗ | (On Diff #107674) | OffendingDecl, right? Thats the one with the offending availability attribute |
7240 ↗ | (On Diff #107674) | I was somewhat uncertain about adding a fixit for this because its difficult to determine where exactly the availability attribute should go, it looks like this doesn't emit an attribute at the right place for this, for example. (It should go after the meth) @interface X -(new_int)meth; @end Maybe we can do better if we look at what Enclosing actually declares? It's not worth it to emit an incorrect fixit. |
lib/Sema/SemaDeclAttr.cpp | ||
---|---|---|
7230 ↗ | (On Diff #107674) | Good call. |
7231 ↗ | (On Diff #107674) | I think we either have to go the full way (i.e. have an #include <os/availability.h> fixit inserted as well) or just avoid any fixits. Note that these fixits will be used pretty much only in Xcode which doesn't show any notes that don't have fixits, so an additional note wouldn't make sense. We could potentially change the message of note_partial_availability_silence but I doubt it's that useful. |
7240 ↗ | (On Diff #107674) | Yeah, Good point. |