]> granicus.if.org Git - clang/commitdiff
Fix spurious remarks when -Weverything is used.
authorDiego Novillo <dnovillo@google.com>
Thu, 29 May 2014 16:19:27 +0000 (16:19 +0000)
committerDiego Novillo <dnovillo@google.com>
Thu, 29 May 2014 16:19:27 +0000 (16:19 +0000)
With -Weverything, the backend remarks are enabled. This was
causing spurious diagnostics for remarks that we don't yet
handle (cf http://reviews.llvm.org/D3683).

This will stop being a problem once http://reviews.llvm.org/D3683
is committed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209823 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenAction.cpp
test/Frontend/Weverything-and-remarks.cpp [new file with mode: 0644]

index 3db1660b805c0efc97eef09b33edb0d9d7d5ef32..4bb3895108d88dcca2160a4e2e6a5975dfc80b4d 100644 (file)
@@ -461,6 +461,12 @@ void BackendConsumer::DiagnosticHandlerImpl(const DiagnosticInfo &DI) {
     // handler. There is no generic way of emitting them.
     OptimizationRemarkHandler(cast<DiagnosticInfoOptimizationRemark>(DI));
     return;
+  case llvm::DK_OptimizationRemarkMissed:
+  case llvm::DK_OptimizationRemarkAnalysis:
+    // TODO: Do nothing for now. The implementation of these
+    // two remarks is still under review (http://reviews.llvm.org/D3683).
+    // Remove this once that patch lands.
+    return;
   default:
     // Plugin IDs are not bound to any value as they are set dynamically.
     ComputeDiagRemarkID(Severity, backend_plugin, DiagID);
diff --git a/test/Frontend/Weverything-and-remarks.cpp b/test/Frontend/Weverything-and-remarks.cpp
new file mode 100644 (file)
index 0000000..ce7e8f3
--- /dev/null
@@ -0,0 +1,28 @@
+// Test that -Weverything does not trigger any backend remarks.
+//
+// This was triggering backend remarks for which there were no frontend
+// flags to filter them. The handler in BackendConsumer::DiagnosticHandlerImpl
+// should not emitting diagnostics for unhandled kinds.
+
+// RUN: %clang -c -Weverything -O0 -o /dev/null %s 2> %t.err
+// RUN: FileCheck < %t.err %s
+
+typedef __char32_t char32_t;
+typedef long unsigned int size_t;
+template <class _CharT>
+struct __attribute__((__type_visibility__("default"))) char_traits;
+
+template <>
+struct __attribute__((__type_visibility__("default"))) char_traits<char32_t> {
+  typedef char32_t char_type;
+  static void assign(char_type& __c1, const char_type& __c2) throw() {
+    __c1 = __c2;
+  }
+  static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
+};
+char32_t* char_traits<char32_t>::move(char_type* __s1, const char_type* __s2,
+                                      size_t __n) {
+  { assign(*--__s1, *--__s2); }
+}
+
+// CHECK-NOT: {{^remark:}}