[cfe-commits] r82103 - in /cfe/trunk: test/Sema/block-explicit-return-type.c test/SemaObjC/block-explicit-return-type.m tools/clang-cc/clang-cc.cpp

Daniel Dunbar daniel at zuster.org
Wed Sep 16 17:47:27 PDT 2009


Author: ddunbar
Date: Wed Sep 16 19:47:27 2009
New Revision: 82103

URL: http://llvm.org/viewvc/llvm-project?rev=82103&view=rev
Log:
clang-cc: Remove -ObjC -ObjC++ handling from clang-cc.

Added:
    cfe/trunk/test/SemaObjC/block-explicit-return-type.m
      - copied, changed from r82088, cfe/trunk/test/Sema/block-explicit-return-type.c
Removed:
    cfe/trunk/test/Sema/block-explicit-return-type.c
Modified:
    cfe/trunk/tools/clang-cc/clang-cc.cpp

Removed: cfe/trunk/test/Sema/block-explicit-return-type.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/block-explicit-return-type.c?rev=82102&view=auto

==============================================================================
--- cfe/trunk/test/Sema/block-explicit-return-type.c (original)
+++ cfe/trunk/test/Sema/block-explicit-return-type.c (removed)
@@ -1,77 +0,0 @@
-// RUN: clang-cc -ObjC -fsyntax-only %s -verify -fblocks
-// FIXME: should compile
-// Test for blocks with explicit return type specified.
-
-typedef float * PF;
-float gf;
-
- at interface NSView
-  - (id) some_method_that_returns_id;
- at end
-
-NSView *some_object;
-
-void some_func (NSView * (^) (id));
-
-typedef struct dispatch_item_s *dispatch_item_t;
-typedef void (^completion_block_t)(void);
-
-typedef double (^myblock)(int);
-double test(myblock I);
-
-int main() {
-  __block int x = 1;
-  __block int y = 2;
-
-  (void)^void *{ return 0; };
-
-  (void)^float(float y){ return y; };
-
-  (void)^double (float y, double d) {
-    if (y)
-      return d;
-    else
-      return y;
-  };
-
-  const char * (^chb) (int flag, const char *arg, char *arg1) = ^ const char * (int flag, const char *arg, char *arg1) {
-    if (flag)
-      return 0;
-    if (flag == 1)
-      return arg;
-    else if (flag == 2)
-      return "";
-    return arg1; 
-  };
-
-  (void)^PF { return &gf; };
-
-  some_func(^ NSView * (id whatever) { return [some_object some_method_that_returns_id]; });
-
-  double res = test(^(int z){x = y+z; return (double)z; });
-}
-
-void func() {
-  completion_block_t X;
-
-  completion_block_t (^blockx)(dispatch_item_t) = ^completion_block_t (dispatch_item_t item) {
-    return X;
-  };
-
-  completion_block_t (^blocky)(dispatch_item_t) = ^(dispatch_item_t item) {
-    return X;
-  };
-
-  blockx = blocky;
-}
-
-
-// intent: block taking int returning block that takes char,int and returns int
-int (^(^block)(double x))(char, short);
-
-void foo() {
-   int one = 1;
-   block = ^(double x){ return ^(char c, short y) { return one + c + y; };};  // expected-error {{returning block that lives on the local stack}}
-   // or:
-   block = ^(double x){ return ^(char c, short y) { return one + (int)c + y; };};  // expected-error {{returning block that lives on the local stack}}
-}

Copied: cfe/trunk/test/SemaObjC/block-explicit-return-type.m (from r82088, cfe/trunk/test/Sema/block-explicit-return-type.c)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/block-explicit-return-type.m?p2=cfe/trunk/test/SemaObjC/block-explicit-return-type.m&p1=cfe/trunk/test/Sema/block-explicit-return-type.c&r1=82088&r2=82103&rev=82103&view=diff

==============================================================================
--- cfe/trunk/test/Sema/block-explicit-return-type.c (original)
+++ cfe/trunk/test/SemaObjC/block-explicit-return-type.m Wed Sep 16 19:47:27 2009
@@ -1,4 +1,4 @@
-// RUN: clang-cc -ObjC -fsyntax-only %s -verify -fblocks
+// RUN: clang-cc -fsyntax-only %s -verify -fblocks
 // FIXME: should compile
 // Test for blocks with explicit return type specified.
 

Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=82103&r1=82102&r2=82103&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Sep 16 19:47:27 2009
@@ -350,13 +350,6 @@
                     clEnumValEnd));
 
 static llvm::cl::opt<bool>
-LangObjC("ObjC", llvm::cl::desc("Set base language to Objective-C"),
-         llvm::cl::Hidden);
-static llvm::cl::opt<bool>
-LangObjCXX("ObjC++", llvm::cl::desc("Set base language to Objective-C++"),
-           llvm::cl::Hidden);
-
-static llvm::cl::opt<bool>
 ObjCExclusiveGC("fobjc-gc-only",
                 llvm::cl::desc("Use GC exclusively for Objective-C related "
                                "memory management"));
@@ -404,14 +397,6 @@
 PThread("pthread", llvm::cl::desc("Support POSIX threads in generated code"),
          llvm::cl::init(false));
 
-/// InitializeBaseLanguage - Handle the -x foo options.
-static void InitializeBaseLanguage() {
-  if (LangObjC)
-    BaseLang = langkind_objc;
-  else if (LangObjCXX)
-    BaseLang = langkind_objcxx;
-}
-
 static LangKind GetLanguage(const std::string &Filename) {
   if (BaseLang != langkind_unspecified)
     return BaseLang;
@@ -424,15 +409,9 @@
   }
 
   std::string Ext = std::string(Filename.begin()+DotPos+1, Filename.end());
-  // C header: .h
-  // C++ header: .hh or .H;
-  // assembler no preprocessing: .s
-  // assembler: .S
   if (Ext == "c")
     return langkind_c;
-  else if (Ext == "S" ||
-           // If the compiler is run on a .s file, preprocess it as .S
-           Ext == "s")
+  else if (Ext == "S" || Ext == "s")
     return langkind_asm_cpp;
   else if (Ext == "i")
     return langkind_c_cpp;
@@ -2289,7 +2268,6 @@
     LangOptions LangInfo;
     DiagClient->setLangOptions(&LangInfo);
 
-    InitializeBaseLanguage();
     LangKind LK = GetLanguage(InFile);
     InitializeLangOptions(LangInfo, LK);
     InitializeLanguageStandard(LangInfo, LK, Target.get(), Features);





More information about the cfe-commits mailing list