r295122 - Stop asserting when a meaningless -std= flag is passed for a non-compilation

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 14 15:41:38 PST 2017


Author: rsmith
Date: Tue Feb 14 17:41:38 2017
New Revision: 295122

URL: http://llvm.org/viewvc/llvm-project?rev=295122&view=rev
Log:
Stop asserting when a meaningless -std= flag is passed for a non-compilation
input kind; go back to silently ignoring the flag.

Added:
    cfe/trunk/test/Driver/unknown-std.S
Modified:
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=295122&r1=295121&r2=295122&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Feb 14 17:41:38 2017
@@ -1702,8 +1702,8 @@ static bool IsInputCompatibleWithStandar
       return true;
     break;
   default:
-    llvm_unreachable("Cannot decide whether language standard and "
-        "input file kind are compatible!");
+    // For other inputs, accept (and ignore) all -std= values.
+    return true;
   }
   return false;
 }

Added: cfe/trunk/test/Driver/unknown-std.S
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/unknown-std.S?rev=295122&view=auto
==============================================================================
--- cfe/trunk/test/Driver/unknown-std.S (added)
+++ cfe/trunk/test/Driver/unknown-std.S Tue Feb 14 17:41:38 2017
@@ -0,0 +1,2 @@
+// RUN: %clang -std=c++11 %s -E -o /dev/null 2>&1 | FileCheck %s --allow-empty
+// CHECK-NOT: error




More information about the cfe-commits mailing list