[cfe-commits] r138637 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/apple-kext-i386.cpp

Chad Rosier mcrosier at apple.com
Fri Aug 26 11:30:44 PDT 2011


Author: mcrosier
Date: Fri Aug 26 13:30:43 2011
New Revision: 138637

URL: http://llvm.org/viewvc/llvm-project?rev=138637&view=rev
Log:
[driver] Remove a few more options when clang invokes cc1plus for i386 kexts.
<rdar://problem/10027287>

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/apple-kext-i386.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=138637&r1=138636&r2=138637&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Aug 26 13:30:43 2011
@@ -2460,103 +2460,121 @@
        it != ie;) {
 
     StringRef Option = *it;
+    bool RemoveOption = false;
 
-    // We only remove warning options.
-    if (!Option.startswith("-W")) {
-      ++it;
+    // Remove -faltivec
+    if (Option.equals("-faltivec")) {
+      it = CmdArgs.erase(it);
+      ie = CmdArgs.end();
       continue;
     }
 
-    if (Option.startswith("-Wno-"))
-      Option = Option.substr(5);
-    else
-      Option = Option.substr(2);
-
-    bool RemoveOption = llvm::StringSwitch<bool>(Option)
-      .Case("address-of-temporary", true)
-      .Case("ambiguous-member-template", true)
-      .Case("analyzer-incompatible-plugin", true)
-      .Case("array-bounds", true)
-      .Case("array-bounds-pointer-arithmetic", true)
-      .Case("bind-to-temporary-copy", true)
-      .Case("bitwise-op-parentheses", true)
-      .Case("bool-conversions", true)
-      .Case("builtin-macro-redefined", true)
-      .Case("c++-hex-floats", true)
-      .Case("c++0x-compat", true)
-      .Case("c++0x-extensions", true)
-      .Case("c++0x-narrowing", true)
-      .Case("c++0x-static-nonintegral-init", true)
-      .Case("conditional-uninitialized", true)
-      .Case("constant-conversion", true)
-      .Case("CFString-literal", true)
-      .Case("constant-logical-operand", true)
-      .Case("custom-atomic-properties", true)
-      .Case("default-arg-special-member", true)
-      .Case("delegating-ctor-cycles", true)
-      .Case("delete-non-virtual-dtor", true)
-      .Case("deprecated-implementations", true)
-      .Case("deprecated-writable-strings", true)
-      .Case("distributed-object-modifiers", true)
-      .Case("duplicate-method-arg", true)
-      .Case("dynamic-class-memaccess", true)
-      .Case("enum-compare", true)
-      .Case("exit-time-destructors", true)
-      .Case("gnu", true)
-      .Case("gnu-designator", true)
-      .Case("header-hygiene", true)
-      .Case("idiomatic-parentheses", true)
-      .Case("ignored-qualifiers", true)
-      .Case("implicit-atomic-properties", true)
-      .Case("incompatible-pointer-types", true)
-      .Case("incomplete-implementation", true)
-      .Case("initializer-overrides", true)
-      .Case("invalid-noreturn", true)
-      .Case("invalid-token-paste", true)
-      .Case("literal-conversion", true)
-      .Case("literal-range", true)
-      .Case("local-type-template-args", true)
-      .Case("logical-op-parentheses", true)
-      .Case("method-signatures", true)
-      .Case("microsoft", true)
-      .Case("mismatched-tags", true)
-      .Case("missing-method-return-type", true)
-      .Case("non-pod-varargs", true)
-      .Case("nonfragile-abi2", true)
-      .Case("null-arithmetic", true)
-      .Case("null-dereference", true)
-      .Case("out-of-line-declaration", true)
-      .Case("overriding-method-mismatch", true)
-      .Case("readonly-setter-attrs", true)
-      .Case("return-stack-address", true)
-      .Case("self-assign", true)
-      .Case("semicolon-before-method-body", true)
-      .Case("sentinel", true)
-      .Case("shift-overflow", true)
-      .Case("shift-sign-overflow", true)
-      .Case("sign-conversion", true)
-      .Case("sizeof-array-argument", true)
-      .Case("sizeof-pointer-memaccess", true)
-      .Case("string-compare", true)
-      .Case("super-class-method-mismatch", true)
-      .Case("tautological-compare", true)
-      .Case("typedef-redefinition", true)
-      .Case("typename-missing", true)
-      .Case("undefined-reinterpret-cast", true)
-      .Case("unknown-warning-option", true)
-      .Case("unnamed-type-template-args", true)
-      .Case("unneeded-internal-declaration", true)
-      .Case("unneeded-member-function", true)
-      .Case("unused-comparison", true)
-      .Case("unused-exception-parameter", true)
-      .Case("unused-member-function", true)
-      .Case("unused-result", true)
-      .Case("vector-conversions", true)
-      .Case("vla", true)
-      .Case("used-but-marked-unused", true)
-      .Case("weak-vtables", true)
-      .Default(false);
-
+    // Handle machine specific options.
+    if (Option.startswith("-m")) {
+      RemoveOption = llvm::StringSwitch<bool>(Option)
+        .Case("-mthumb", true)
+        .Case("-mno-thumb", true)
+        .Case("-mno-fused-madd", true)
+        .Case("-mlong-branch", true)
+        .Case("-mlongcall", true)
+        .Case("-mcpu=G4", true)
+        .Case("-mcpu=G5", true)
+        .Default(false);
+    }
+    
+    // Handle warning options.
+    if (Option.startswith("-W")) {
+      // Remove -W/-Wno- to reduce the number of cases.
+      if (Option.startswith("-Wno-"))
+        Option = Option.substr(5);
+      else
+        Option = Option.substr(2);
+      
+      RemoveOption = llvm::StringSwitch<bool>(Option)
+        .Case("address-of-temporary", true)
+        .Case("ambiguous-member-template", true)
+        .Case("analyzer-incompatible-plugin", true)
+        .Case("array-bounds", true)
+        .Case("array-bounds-pointer-arithmetic", true)
+        .Case("bind-to-temporary-copy", true)
+        .Case("bitwise-op-parentheses", true)
+        .Case("bool-conversions", true)
+        .Case("builtin-macro-redefined", true)
+        .Case("c++-hex-floats", true)
+        .Case("c++0x-compat", true)
+        .Case("c++0x-extensions", true)
+        .Case("c++0x-narrowing", true)
+        .Case("c++0x-static-nonintegral-init", true)
+        .Case("conditional-uninitialized", true)
+        .Case("constant-conversion", true)
+        .Case("CFString-literal", true)
+        .Case("constant-logical-operand", true)
+        .Case("custom-atomic-properties", true)
+        .Case("default-arg-special-member", true)
+        .Case("delegating-ctor-cycles", true)
+        .Case("delete-non-virtual-dtor", true)
+        .Case("deprecated-implementations", true)
+        .Case("deprecated-writable-strings", true)
+        .Case("distributed-object-modifiers", true)
+        .Case("duplicate-method-arg", true)
+        .Case("dynamic-class-memaccess", true)
+        .Case("enum-compare", true)
+        .Case("exit-time-destructors", true)
+        .Case("gnu", true)
+        .Case("gnu-designator", true)
+        .Case("header-hygiene", true)
+        .Case("idiomatic-parentheses", true)
+        .Case("ignored-qualifiers", true)
+        .Case("implicit-atomic-properties", true)
+        .Case("incompatible-pointer-types", true)
+        .Case("incomplete-implementation", true)
+        .Case("initializer-overrides", true)
+        .Case("invalid-noreturn", true)
+        .Case("invalid-token-paste", true)
+        .Case("literal-conversion", true)
+        .Case("literal-range", true)
+        .Case("local-type-template-args", true)
+        .Case("logical-op-parentheses", true)
+        .Case("method-signatures", true)
+        .Case("microsoft", true)
+        .Case("mismatched-tags", true)
+        .Case("missing-method-return-type", true)
+        .Case("non-pod-varargs", true)
+        .Case("nonfragile-abi2", true)
+        .Case("null-arithmetic", true)
+        .Case("null-dereference", true)
+        .Case("out-of-line-declaration", true)
+        .Case("overriding-method-mismatch", true)
+        .Case("readonly-setter-attrs", true)
+        .Case("return-stack-address", true)
+        .Case("self-assign", true)
+        .Case("semicolon-before-method-body", true)
+        .Case("sentinel", true)
+        .Case("shift-overflow", true)
+        .Case("shift-sign-overflow", true)
+        .Case("sign-conversion", true)
+        .Case("sizeof-array-argument", true)
+        .Case("sizeof-pointer-memaccess", true)
+        .Case("string-compare", true)
+        .Case("super-class-method-mismatch", true)
+        .Case("tautological-compare", true)
+        .Case("typedef-redefinition", true)
+        .Case("typename-missing", true)
+        .Case("undefined-reinterpret-cast", true)
+        .Case("unknown-warning-option", true)
+        .Case("unnamed-type-template-args", true)
+        .Case("unneeded-internal-declaration", true)
+        .Case("unneeded-member-function", true)
+        .Case("unused-comparison", true)
+        .Case("unused-exception-parameter", true)
+        .Case("unused-member-function", true)
+        .Case("unused-result", true)
+        .Case("vector-conversions", true)
+        .Case("vla", true)
+        .Case("used-but-marked-unused", true)
+        .Case("weak-vtables", true)
+        .Default(false);
+    } // if (Option.startswith("-W"))
     if (RemoveOption) {
       it = CmdArgs.erase(it);
       ie = CmdArgs.end();

Modified: cfe/trunk/test/Driver/apple-kext-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/apple-kext-i386.cpp?rev=138637&r1=138636&r2=138637&view=diff
==============================================================================
--- cfe/trunk/test/Driver/apple-kext-i386.cpp (original)
+++ cfe/trunk/test/Driver/apple-kext-i386.cpp Fri Aug 26 13:30:43 2011
@@ -16,8 +16,8 @@
 // CHECK-MKERNEL: "-mkernel"
 
 // RUN: %clang -ccc-host-triple i386-apple-darwin10 \
-// RUN:   -Wno-self-assign -Wc++0x-extensions \
-// RUN:   -Wno-microsoft -Wmicrosoft \
+// RUN:   -Wno-self-assign -Wc++0x-extensions -Wno-microsoft -Wmicrosoft -Wvla \
+// RUN:   -faltivec -mthumb -mcpu=G4 -mlongcall -mno-longcall -msoft-float \
 // RUN:   -fapple-kext -### -fsyntax-only %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED < %t %s
 
@@ -26,3 +26,10 @@
 // CHECK-UNSUPPORTED-NOT: "-Wc++0x-extensions"
 // CHECK-UNSUPPORTED-NOT: "-Wno-microsoft"
 // CHECK-UNSUPPORTED-NOT: "-Wmicrosoft"
+// CHECK-UNSUPPORTED-NOT: "-Wvla"
+// CHECK-UNSUPPORTED-NOT: "-faltivec"
+// CHECK-UNSUPPORTED-NOT: "-mthumb"
+// CHECK-UNSUPPORTED-NOT: "-mlongcall"
+// CHECK-UNSUPPORTED: "-mno-longcall"
+// CHECK-UNSUPPORTED: "-msoft-float"
+





More information about the cfe-commits mailing list