summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/readability-redundant-string-cstr-msvc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/readability-redundant-string-cstr-msvc.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/readability-redundant-string-cstr-msvc.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang-tools-extra/test/clang-tidy/readability-redundant-string-cstr-msvc.cpp b/clang-tools-extra/test/clang-tidy/readability-redundant-string-cstr-msvc.cpp
index 1c31118dbc6..a6b6b20728c 100644
--- a/clang-tools-extra/test/clang-tidy/readability-redundant-string-cstr-msvc.cpp
+++ b/clang-tools-extra/test/clang-tidy/readability-redundant-string-cstr-msvc.cpp
@@ -12,6 +12,7 @@ struct basic_string {
basic_string(const C *p);
basic_string(const C *p, const A &a);
const C *c_str() const;
+ const C *data() const;
};
typedef basic_string<char, std::char_traits<char>, std::allocator<char>> string;
}
@@ -24,7 +25,10 @@ struct StringRef {
void f1(const std::string &s) {
f1(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call to `c_str()` [readability-redundant-string-cstr]
+ // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call to 'c_str' [readability-redundant-string-cstr]
+ // CHECK-FIXES: {{^ }}f1(s);{{$}}
+ f1(s.data());
+ // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call to 'data' [readability-redundant-string-cstr]
// CHECK-FIXES: {{^ }}f1(s);{{$}}
}
void f2(const llvm::StringRef r) {
OpenPOWER on IntegriCloud