[LLVMbugs] [Bug 15931] New: Poisoning Objective-C methods

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 8 00:38:17 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15931

            Bug ID: 15931
           Summary: Poisoning Objective-C methods
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: iamleeg at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Summary: Clang inherits the "poison" pragma from GCC. Unfortunately it doesn't
support poisoning Objective-C selectors very well.

Steps to reproduce: compile this code.

#import <Foundation/Foundation.h>
#pragma GCC poison initWithCString:

int main(int argc, char *argv[]) {
    @autoreleasepool {
        NSString *foo = [[NSString alloc] initWithCString:"foo"
encoding:NSUTF8StringEncoding];
        NSLog(@"%@", foo);
    }
}

Expected results: that should work. I've poisoned "initWithCString:" but used
"initWithCString:encoding:".

Actual results: two errors are emitted.

Untitled.m:2:35: error: can only poison identifier tokens
#pragma GCC poison initWithCString:
                                  ^
Untitled.m:6:37: error: attempt to use a poisoned identifier
                NSString *foo = [[NSString alloc] initWithCString:"foo"
encoding:NSUTF8StringEncoding];
                                                  ^
2 errors generated.

Notes: whether it's a separate pragma or not, I would like to enforce
Objective-C code guidelines by poisoning specific selectors. That shouldn't
poison other selectors that happen to contain my poisoned selectors in
substrings.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130508/67405006/attachment.html>


More information about the llvm-bugs mailing list