[cfe-commits] r127625 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/SemaObjC/auto-objective-c.m

Douglas Gregor dgregor at apple.com
Mon Mar 14 14:43:31 PDT 2011


Author: dgregor
Date: Mon Mar 14 16:43:30 2011
New Revision: 127625

URL: http://llvm.org/viewvc/llvm-project?rev=127625&view=rev
Log:
Disable 'auto' type deduction in Objective-C. It likes 'id' a bit too
much to be useful.

Removed:
    cfe/trunk/test/SemaObjC/auto-objective-c.m
Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=127625&r1=127624&r2=127625&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Mon Mar 14 16:43:30 2011
@@ -1249,7 +1249,7 @@
                                          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());

Removed: cfe/trunk/test/SemaObjC/auto-objective-c.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/auto-objective-c.m?rev=127624&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/auto-objective-c.m (original)
+++ cfe/trunk/test/SemaObjC/auto-objective-c.m (removed)
@@ -1,33 +0,0 @@
-// RUN: %clang_cc1 -x objective-c -fblocks -fsyntax-only -verify %s
-
- at interface I
-{
-  id pi;
-}
-- (id) Meth;
- at 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);
-
- at 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;
-}
- at 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}}
-}





More information about the cfe-commits mailing list