Author: Aaron Ballman Date: 2020-10-19T10:37:22-04:00 New Revision: b91a236ee1c3e9fa068df058164385732cb46bba
URL: https://github.com/llvm/llvm-project/commit/b91a236ee1c3e9fa068df058164385732cb46bba DIFF: https://github.com/llvm/llvm-project/commit/b91a236ee1c3e9fa068df058164385732cb46bba.diff LOG: Revert "Extend tests of run-clang-tidy" This reverts commit 627c01bee0deb353b3e3e90c1b8d0b6d73464466. Some failing build bots: http://lab.llvm.org:8011/#/builders/109/builds/690 http://lab.llvm.org:8011/#/builders/14/builds/476 Added: clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy.cpp Modified: Removed: clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy_config-file.cpp clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy_export-diagnostics.cpp ################################################################################ diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy.cpp new file mode 100644 index 000000000000..0d0e41e022ae --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy.cpp @@ -0,0 +1,18 @@ +// RUN: %run_clang_tidy --help +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %/t/test.cpp\",\"file\":\"%/t/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > %t/compile_commands.json +// RUN: echo "Checks: '-*,modernize-use-auto'" > %t/.clang-tidy +// RUN: echo "WarningsAsErrors: '*'" >> %t/.clang-tidy +// RUN: echo "CheckOptions:" >> %t/.clang-tidy +// RUN: echo " - key: modernize-use-auto.MinTypeNameLength" >> %t/.clang-tidy +// RUN: echo " value: '0'" >> %t/.clang-tidy +// RUN: cp "%s" "%t/test.cpp" +// RUN: cd "%t" +// RUN: not %run_clang_tidy "test.cpp" + +int main() +{ + int* x = new int(); + delete x; +} diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy_config-file.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy_config-file.cpp deleted file mode 100644 index 3976ccf8860d..000000000000 --- a/clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy_config-file.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// under test: -// - .clang-tidy read from file & treat warnings as errors -// - return code of run-clang-tidy on those errors - -// First make sure clang-tidy is executable and can print help without crashing: -// RUN: %run_clang_tidy --help - -// use %t as directory instead of file: -// RUN: rm -rf %t -// RUN: mkdir %t - -// add this file to %t, add compile_commands for it and .clang-tidy config: -// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %/t/test.cpp\",\"file\":\"%/t/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > %t/compile_commands.json -// RUN: echo "Checks: '-*,modernize-use-auto'" > %t/.clang-tidy -// RUN: echo "WarningsAsErrors: '*'" >> %t/.clang-tidy -// RUN: echo "CheckOptions:" >> %t/.clang-tidy -// RUN: echo " - key: modernize-use-auto.MinTypeNameLength" >> %t/.clang-tidy -// RUN: echo " value: '0'" >> %t/.clang-tidy -// RUN: cp "%s" "%t/test.cpp" - -// execute and check: -// RUN: cd "%t" -// RUN: not %run_clang_tidy "test.cpp" > %t/msg.txt 2>&1 -// RUN: FileCheck -input-file=%t/msg.txt -check-prefix=CHECK-MESSAGES %s \ -// RUN: -implicit-check-not='{{warning|error|note}}:' - -int main() -{ - int* x = new int(); - // CHECK-MESSAGES: :[[@LINE-1]]:3: error: {{.+}} [modernize-use-auto,-warnings-as-errors] - - delete x; -} diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy_export-diagnostics.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy_export-diagnostics.cpp deleted file mode 100644 index f2c97269391e..000000000000 --- a/clang-tools-extra/test/clang-tidy/infrastructure/run-clang-tidy_export-diagnostics.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// under test: -// - parsing and using compile_commands -// - export fixes to yaml file - -// use %t as directory instead of file, -// because "compile_commands.json" must have exactly that name: -// RUN: rm -rf %t -// RUN: mkdir %t -// RUN: echo '[{"directory":"%/S","command":"clang++ -c %s","file":"%s"}]' \ -// RUN: > %t/compile_commands.json - -// execute and check: -// RUN: cd "%t" -// RUN: %run_clang_tidy -checks='-*,bugprone-sizeof-container,modernize-use-auto' \ -// RUN: -p="%/t" -export-fixes=%t/fixes.yaml > %t/msg.txt 2>&1 -// RUN: FileCheck -input-file=%t/msg.txt -check-prefix=CHECK-MESSAGES %s \ -// RUN: -implicit-check-not='{{warning|error|note}}:' -// RUN: FileCheck -input-file=%t/fixes.yaml -check-prefix=CHECK-YAML %s - -#include <vector> -int main() -{ - std::vector<int> vec; - std::vector<int>::iterator iter = vec.begin(); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when declaring iterators - // CHECK-YAML: modernize-use-auto - - return sizeof(vec); - // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: sizeof() doesn't return the size of the container; did you mean .size()? [bugprone-sizeof-container] - // CHECK-YAML: bugprone-sizeof-container - // After https://reviews.llvm.org/D72730 --> CHECK-YAML-NOT: bugprone-sizeof-container -} - _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits