[clang-tools-extra] r350761 - [clang-tidy] fix-up failing tests

Jonas Toth via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 9 13:03:54 PST 2019


Author: jonastoth
Date: Wed Jan  9 13:03:54 2019
New Revision: 350761

URL: http://llvm.org/viewvc/llvm-project?rev=350761&view=rev
Log:
[clang-tidy] fix-up failing tests

Removed:
    clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard.h
Modified:
    clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard-cxx11.cpp
    clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard.cpp

Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard-cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard-cxx11.cpp?rev=350761&r1=350760&r2=350761&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard-cxx11.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard-cxx11.cpp Wed Jan  9 13:03:54 2019
@@ -1,6 +1,6 @@
 // RUN: %check_clang_tidy %s modernize-use-nodiscard %t -- \
 // RUN:   -config="{CheckOptions: [{key: modernize-use-nodiscard.ReplacementString, value: '__attribute__((warn_unused_result))'}]}" \
-// RUN: -- -std=c++11 \
+// RUN: -- -std=c++11
 
 class Foo
 {

Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard.cpp?rev=350761&r1=350760&r2=350761&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard.cpp Wed Jan  9 13:03:54 2019
@@ -2,14 +2,20 @@
 // RUN:   -config="{CheckOptions: [{key: modernize-use-nodiscard.ReplacementString, value: 'NO_DISCARD'}]}" \
 // RUN: -- -std=c++17
 
-#include <functional>
+namespace std {
+template <class>
+class function;
+class string {};
+}
 
 namespace boost {
 template <class>
 class function;
 }
 
-#include "modernize-use-nodiscard.h"
+#define MUST_USE_RESULT __attribute__((warn_unused_result))
+#define NO_DISCARD [[nodiscard]]
+#define NO_RETURN [[noreturn]]
 
 #define BOOLEAN_FUNC bool f23() const
 
@@ -168,9 +174,9 @@ auto lambda1b = []()  { return true;};
 auto get_functor = [](bool check) {
     return  [&](const std::string& sr)->std::string {
         if(check){
-            return "some string";
+            return std::string();
         }
-        return "another string";
+        return std::string();
     };
 };
 

Removed: clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard.h?rev=350760&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard.h (original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-use-nodiscard.h (removed)
@@ -1,5 +0,0 @@
-
-#define MUST_USE_RESULT __attribute__((warn_unused_result))
-#define NO_DISCARD [[nodiscard]]
-#define NO_RETURN [[noreturn]]
-




More information about the cfe-commits mailing list