[clang-tools-extra] 218500d - [clang-tidy] Verify the fixes in abseil-redundant-strcat-calls test, NFC

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 17 01:19:26 PST 2020


Author: Haojian Wu
Date: 2020-11-17T10:15:29+01:00
New Revision: 218500d823c8f0f43fb9c0d8e2ed5d4dd197785b

URL: https://github.com/llvm/llvm-project/commit/218500d823c8f0f43fb9c0d8e2ed5d4dd197785b
DIFF: https://github.com/llvm/llvm-project/commit/218500d823c8f0f43fb9c0d8e2ed5d4dd197785b.diff

LOG: [clang-tidy] Verify the fixes in abseil-redundant-strcat-calls test, NFC

Added: 
    

Modified: 
    clang-tools-extra/test/clang-tidy/checkers/abseil-redundant-strcat-calls.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/test/clang-tidy/checkers/abseil-redundant-strcat-calls.cpp b/clang-tools-extra/test/clang-tidy/checkers/abseil-redundant-strcat-calls.cpp
index 2d7237971439..3afbac505cf1 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/abseil-redundant-strcat-calls.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/abseil-redundant-strcat-calls.cpp
@@ -154,9 +154,11 @@ using absl::StrCat;
 void Positives() {
   string S = StrCat(1, StrCat("A", StrCat(1.1)));
   // CHECK-MESSAGES: [[@LINE-1]]:14: warning: multiple calls to 'absl::StrCat' can be flattened into a single call
+  // CHECK-FIXES: string S = StrCat(1, "A", 1.1);
 
   S = StrCat(StrCat(StrCat(StrCat(StrCat(1)))));
   // CHECK-MESSAGES: [[@LINE-1]]:7: warning: multiple calls to 'absl::StrCat' can be flattened into a single call
+  // CHECK-FIXES: S = StrCat(1);
 
   // TODO: should trigger. The issue here is that in the current
   // implementation we ignore any StrCat with StrCat ancestors. Therefore
@@ -166,9 +168,11 @@ void Positives() {
 
   StrAppend(&S, 001, StrCat(1, 2, "3"), StrCat("FOO"));
   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple calls to 'absl::StrCat' can be flattened into a single call
+  // CHECK-FIXES: StrAppend(&S, 001, 1, 2, "3", "FOO");
 
   StrAppend(&S, 001, StrCat(StrCat(1, 2), "3"), StrCat("FOO"));
   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple calls to 'absl::StrCat' can be flattened into a single call
+  // CHECK-FIXES: StrAppend(&S, 001, 1, 2, "3", "FOO");
 
   // Too many args. Ignore for now.
   S = StrCat(1, 2, StrCat(3, 4, 5, 6, 7), 8, 9, 10,
@@ -177,6 +181,7 @@ void Positives() {
   // CHECK-MESSAGES: :[[@LINE-3]]:7: warning: multiple calls to 'absl::StrCat' can be flattened into a single call
   StrAppend(&S, StrCat(1, 2, 3, 4, 5), StrCat(6, 7, 8, 9, 10));
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: multiple calls to 'absl::StrCat' can be flattened into a single call
+  // CHECK-FIXES: StrAppend(&S, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
 }
 
 void Negatives() {


        


More information about the cfe-commits mailing list