diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-03-14 21:43:30 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-03-14 21:43:30 +0000 |
commit | 1e989861604c917743cecb4b9d79a402ed1d8f1c (patch) | |
tree | 5a1b4fef882a80e49ba39d718eb20e9969293ae5 | |
parent | 161f9a382981b07897841566664a619e9c39538d (diff) | |
download | bcm5719-llvm-1e989861604c917743cecb4b9d79a402ed1d8f1c.tar.gz bcm5719-llvm-1e989861604c917743cecb4b9d79a402ed1d8f1c.zip |
Disable 'auto' type deduction in Objective-C. It likes 'id' a bit too
much to be useful.
llvm-svn: 127625
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaObjC/auto-objective-c.m | 33 |
2 files changed, 1 insertions, 34 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 450329a655a..d0e410f9bf4 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -1249,7 +1249,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, DiagID, getLang()); break; case tok::kw_auto: - if (getLang().CPlusPlus0x || getLang().ObjC2) { + if (getLang().CPlusPlus0x) { if (isKnownToBeTypeSpecifier(GetLookAheadToken(1))) { isInvalid = DS.SetStorageClassSpec(DeclSpec::SCS_auto, Loc, PrevSpec, DiagID, getLang()); diff --git a/clang/test/SemaObjC/auto-objective-c.m b/clang/test/SemaObjC/auto-objective-c.m deleted file mode 100644 index 5467e24a795..00000000000 --- a/clang/test/SemaObjC/auto-objective-c.m +++ /dev/null @@ -1,33 +0,0 @@ -// RUN: %clang_cc1 -x objective-c -fblocks -fsyntax-only -verify %s - -@interface I -{ - id pi; -} -- (id) Meth; -@end - -// Objective-C does not support trailing return types, so check we don't get -// the C++ diagnostic suggesting we forgot one. -auto noTrailingReturnType(); // expected-error {{'auto' not allowed in function return type}} - -typedef int (^P) (int x); - -@implementation I -- (id) Meth { - auto p = [pi Meth]; - return p; -} - -- (P) bfunc { - auto my_block = ^int (int x) {return x; }; - my_block(1); - return my_block; -} -@end - - -// rdar://9036633 -int main() { - auto int auto_i = 7; // expected-warning {{'auto' storage class specifier is redundant and will be removed in future releases}} -} |