[cfe-commits] r158793 - in /cfe/trunk: include/clang/Basic/ include/clang/Driver/ include/clang/Frontend/ include/clang/Serialization/ lib/AST/ lib/Basic/ lib/CodeGen/ lib/Driver/ lib/Frontend/ lib/Lex/ lib/Rewrite/ lib/Sema/ lib/Serialization/ test/Analysis/ test/CodeGenObjC/ test/CodeGenObjCXX/ test/Coverage/ test/Driver/ test/Parser/ test/Preprocessor/ test/Rewriter/ test/SemaObjC/ test/SemaObjCXX/

John McCall rjmccall at apple.com
Wed Jun 20 11:36:31 PDT 2012


On Jun 20, 2012, at 9:01 AM, Jordan Rose wrote:
> On Jun 19, 2012, at 11:18 PM, John McCall wrote:
>> +bool ObjCRuntime::tryParse(StringRef input) {
>> +  // Look for the last dash.
>> +  std::size_t dash = input.rfind('-');
>> +
>> +  // We permit (1) dashes in the runtime name and (2) the version to
>> +  // be omitted, so ignore dashes that aren't followed by a digit.
>> +  if (dash != StringRef::npos && dash + 1 != input.size() &&
>> +      (input[dash+1] < '0' || input[dash+1] > '9')) {
>> +    dash = StringRef::npos;
>> +  }
>> +
> 
> I mis-parsed this comment as "We permit dashes in (the runtime name and the version) to be omitted", even with the numbers and what the code is actually doing.

I'll adjust this.

>> -           .Case("objc_nonfragile_abi", LangOpts.ObjCNonFragileABI)
>> -           .Case("objc_weak_class", LangOpts.ObjCNonFragileABI)
>> +           .Case("objc_nonfragile_abi", LangOpts.ObjCRuntime.isNonFragile())
>> +           .Case("objc_weak_class", LangOpts.ObjCRuntime.isNonFragile())
>>          .Case("ownership_holds", true)
>>          .Case("ownership_returns", true)
>>          .Case("ownership_takes", true)
>>          .Case("objc_bool", true)
>> -           .Case("objc_subscripting", LangOpts.ObjCNonFragileABI)
>> +           .Case("objc_subscripting", LangOpts.ObjCRuntime.isNonFragile())
> 
> Are objc_weak_class and objc_subscripting really supposed to be defined based on the fragility of the runtime, and not the availability of those actual features?

In both cases, these features are enabled by the non-fragile runtime.  Weak import of classes does require runtime support, and subscripting syntax is not permitted on the fragile runtime because it collides with pointer arithmetic.  I guess weak-import is arguably a NeXT-only feature;  I'll make this a distinct predicate.

John.



More information about the cfe-commits mailing list