diff options
| author | Gabor Horvath <xazax.hun@gmail.com> | 2017-01-24 15:18:11 +0000 |
|---|---|---|
| committer | Gabor Horvath <xazax.hun@gmail.com> | 2017-01-24 15:18:11 +0000 |
| commit | 3ac2ad7d6cc826dee0cdf61923f1375a77a5a194 (patch) | |
| tree | 96ec685e5ba80d58170760fe6b47bfe7297d68ed /clang-tools-extra/test/clang-tidy/modernize-raw-string-literal-replace-shorter.cpp | |
| parent | 31f018032f3c0f91681a72613485dfdc51d62e5d (diff) | |
| download | bcm5719-llvm-3ac2ad7d6cc826dee0cdf61923f1375a77a5a194.tar.gz bcm5719-llvm-3ac2ad7d6cc826dee0cdf61923f1375a77a5a194.zip | |
[clang-tidy] Don't modernize-raw-string-literal if replacement is longer.
Fixes PR30964. The old behavior can be achieved using a setting.
Patch by: Andras Leitereg!
Differential Revision: https://reviews.llvm.org/D28667
llvm-svn: 292938
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/modernize-raw-string-literal-replace-shorter.cpp')
| -rw-r--r-- | clang-tools-extra/test/clang-tidy/modernize-raw-string-literal-replace-shorter.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/modernize-raw-string-literal-replace-shorter.cpp b/clang-tools-extra/test/clang-tidy/modernize-raw-string-literal-replace-shorter.cpp new file mode 100644 index 00000000000..673a8aa5af8 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/modernize-raw-string-literal-replace-shorter.cpp @@ -0,0 +1,13 @@ +// RUN: %check_clang_tidy %s modernize-raw-string-literal %t + +// Don't replace these, because the raw literal would be longer. +char const *const JustAQuote("quote:\'"); +char const *const NeedDelimiter("\":)\""); + +char const *const ManyQuotes("quotes:\'\'\'\'"); +// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: {{.*}} can be written as a raw string literal +// CHECK-FIXES: {{^}}char const *const ManyQuotes(R"(quotes:'''')");{{$}} + +char const *const LongOctal("\042\072\051\042"); +// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: {{.*}} can be written as a raw string literal +// CHECK-FIXES: {{^}}char const *const LongOctal(R"lit(":)")lit");{{$}} |

