<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 3, 2016, at 11:45 AM, Douglas Gregor <<a href="mailto:dgregor@apple.com" class="">dgregor@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Feb 2, 2016, at 7:26 PM, Ben Langmuir via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>> wrote:<br class=""><br class="">Author: benlangmuir<br class="">Date: Tue Feb  2 21:26:19 2016<br class="">New Revision: 259624<br class=""><br class="">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=259624&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=259624&view=rev</a><br class="">Log:<br class="">Make CF constant string decl visible to name lookup to fix module errors<br class=""><br class="">The return type of the __builtin___*StringMakeConstantString functions<br class="">is a pointer to a struct, so we need that struct to be visible to name<br class="">lookup so that we will correctly merge multiple declarations of that<br class="">type if they come from different modules.<br class=""><br class="">Incidentally, to make this visible to name lookup we need to rename the<br class="">type to __NSConstantString, since the real NSConstantString is an<br class="">Objective-C interface type.  This shouldn't affect anyone outside the<br class="">compiler since users of the constant string builtins cast the result<br class="">immediately to CFStringRef.<br class=""><br class="">Since this struct type is otherwise implicitly created by the AST<br class="">context and cannot access namelookup, we make this a predefined type<br class="">and initialize it in Sema.<br class=""><br class="">Note: this issue of builtins that refer to types not visible to name<br class="">lookup technically also affects other builtins (e.g. objc_msgSendSuper),<br class="">but in all other cases the builtin is a library builtin and the issue<br class="">goes away if you include the library that defines the types it uses,<br class="">unlike for these constant string builtins.<br class=""><br class=""><a href="rdar://problem/24425801" class="">rdar://problem/24425801</a><br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Two comments below…</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">[snip]<br class=""><br class="">Modified: cfe/trunk/lib/Sema/Sema.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=259624&r1=259623&r2=259624&view=diff" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=259624&r1=259623&r2=259624&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/lib/Sema/Sema.cpp (original)<br class="">+++ cfe/trunk/lib/Sema/Sema.cpp Tue Feb  2 21:26:19 2016<br class="">@@ -189,6 +189,10 @@ void Sema::Initialize() {<br class="">   DeclarationName Protocol = &Context.Idents.get("Protocol");<br class="">   if (IdResolver.begin(Protocol) == IdResolver.end())<br class="">     PushOnScopeChains(Context.getObjCProtocolDecl(), TUScope);<br class="">+<br class="">+    DeclarationName ConstantString = &Context.Idents.get("NSConstantString");<br class="">+    if (IdResolver.begin(ConstantString) == IdResolver.end())<br class="">+      PushOnScopeChains(Context.getCFConstantStringDecl(), TUScope);<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Shouldn’t this be looking for __NSConstantString?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>D’oh.</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Also, isn’t CFSTR available even in C? This code path is Objective-C-only...</span><br class=""></div></blockquote><br class=""></div><div>Yes on both counts, will fix, thanks!</div><br class=""></body></html>