<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I'm currently working on a Clang modification that analyses the (iOS SDK) version in which certain symbols were introduced. Most of it is based on code that looks similar to this:<div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(195, 89, 0); "><span style="color: #000000">decl-></span><span style="color: #587ea8">getAttr</span><span style="color: #000000"><</span>AvailabilityAttr<span style="color: #000000">>()</span><span style="color: rgb(0, 0, 0); ">-></span><span style="color: rgb(88, 126, 168); ">getIntroduced</span><span style="color: rgb(0, 0, 0); ">()</span><span style="color: rgb(0, 0, 0); ">;</span></div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(195, 89, 0); "><span style="color: rgb(0, 0, 0); "><br></span></div><div style="margin: 0px; ">So far, this works fine for ObjC methods, properties, classes, and C functions. One missing piece are enumerations, but I've found that they seem to lack availability information alltogether. Let's pick an example, I'm trying to use the <span style="font-family: Menlo; font-size: 11px; ">PKPassKitErrorCode</span> enum that was introduced in iOS 6. The framework header declares the following:</div><div style="margin: 0px; "><br></div><div style="margin: 0px; "><div style="margin: 0px; font-size: 11px; font-family: Menlo; "><span style="color: #35568a">typedef</span> <span style="color: #777997">NS_ENUM</span>(NSInteger, PKPassKitErrorCode) {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> PKUnknownError = -<span style="color: #35568a">1</span>,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> PKInvalidDataError = <span style="color: #35568a">1</span>,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> PKUnsupportedVersionError,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> PKInvalidSignature,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(119, 121, 151); "><span style="color: #000000">} </span>NS_ENUM_AVAILABLE_IOS<span style="color: #000000">(</span><span style="color: #35568a">6</span><span style="color: #000000">_0);</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(119, 121, 151); "><span style="color: #000000"><br></span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(119, 121, 151); "><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">Obviously, availability information is provided using the usual macros. This is what the preprocessor generates:</span></div></div><div style="margin: 0px; "><br></div><div style="margin: 0px; "><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">typedef enum PKPassKitErrorCode : NSInteger PKPassKitErrorCode; enum PKPassKitErrorCode : NSInteger {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> PKUnknownError = -<span style="color: #35568a">1</span>,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> PKInvalidDataError = <span style="color: #35568a">1</span>,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> PKUnsupportedVersionError,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> PKInvalidSignature,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">} __attribute__((availability(ios,introduced=<span style="color: #35568a">6.0</span>)));</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "><br></div><div style="margin: 0px; ">Still looks ok to me, all the information I'm looking for is included. However, when I try to get the availability information during the compilation process (I'm modifying <span style="font-family: Menlo; font-size: 11px; color: rgb(195, 89, 0); ">Sema</span><span style="font-family: Menlo; font-size: 11px; ">::DiagnoseUseOfDecl()</span> in SemaExpr.cpp), there is none – <span style="font-family: Menlo; font-size: 11px; color: rgb(88, 126, 168); ">getAttr</span><span style="font-family: Menlo; font-size: 11px; "><</span><span style="color: rgb(195, 89, 0); font-family: Menlo; font-size: 11px; ">AvailabilityAttr</span><span style="font-family: Menlo; font-size: 11px; ">>()</span> returns NULL for EnumConstantDecls.</div><div style="margin: 0px; "><br></div><div style="margin: 0px; ">I have not started examining the parsing of the declaration, but wanted to ask first whether there's an obvious reason why the information is missing, or there's an obvious mistake/misassumption I'm making?</div><div style="margin: 0px; "><br></div><div style="margin: 0px; ">Any help is greatly appreciated.</div><div style="margin: 0px; ">Hagi</div><div style="margin: 0px; "><br></div></div></body></html>