PR4715

-Wno-error disables WarningsAsErrors instead of
mistakenly being treated like -Werror



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78987 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/Warnings.cpp b/lib/Frontend/Warnings.cpp
index c8fd5f6..87178e9 100644
--- a/lib/Frontend/Warnings.cpp
+++ b/lib/Frontend/Warnings.cpp
@@ -90,7 +90,7 @@
       }
       
       if (Specifier == 0) {
-        Diags.setWarningsAsErrors(true);
+        Diags.setWarningsAsErrors(isPositive);
         continue;
       }
       
diff --git a/test/Misc/diag-mapping2.c b/test/Misc/diag-mapping2.c
index 7e0d774..c5fd7ff 100644
--- a/test/Misc/diag-mapping2.c
+++ b/test/Misc/diag-mapping2.c
@@ -12,7 +12,10 @@
 // RUN: clang-cc %s -Werror=#warnings 2>&1 | grep "error:" &&
 
 // -Wno-error= overrides -Werror.  rdar://3158301
-// RUN: clang-cc %s -Werror -Wno-error=#warnings 2>&1 | grep "warning:"
+// RUN: clang-cc %s -Werror -Wno-error=#warnings 2>&1 | grep "warning:" &&
+
+// -Wno-error overrides -Werror.  PR4715
+// RUN: clang-cc %s -Werror -Wno-error 2>&1 | grep "warning:"
 
 #warning foo