diff --git a/clang-tidy/modernize/RawStringLiteralCheck.cpp b/clang-tidy/modernize/RawStringLiteralCheck.cpp index b9641c3..1f51caa 100644 --- a/clang-tidy/modernize/RawStringLiteralCheck.cpp +++ b/clang-tidy/modernize/RawStringLiteralCheck.cpp @@ -108,7 +108,8 @@ void RawStringLiteralCheck::storeOptions(ClangTidyOptions::OptionMap &Options) { } void RawStringLiteralCheck::registerMatchers(MatchFinder *Finder) { - Finder->addMatcher(stringLiteral().bind("lit"), this); + Finder->addMatcher( + stringLiteral(unless(hasParent(predefinedExpr()))).bind("lit"), this); } void RawStringLiteralCheck::check(const MatchFinder::MatchResult &Result) { diff --git a/test/clang-tidy/modernize-raw-string-literal.cpp b/test/clang-tidy/modernize-raw-string-literal.cpp index b2f9e6c..77123c0 100644 --- a/test/clang-tidy/modernize-raw-string-literal.cpp +++ b/test/clang-tidy/modernize-raw-string-literal.cpp @@ -91,6 +91,10 @@ char const *const HexPrintable("\x40\\"); // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: {{.*}} can be written as a raw string literal // CHECK-FIXES: {{^}}char const *const HexPrintable(R"(@\)");{{$}} +char const *const prettyFunction(__PRETTY_FUNCTION__); +char const *const function(__FUNCTION__); +char const *const func(__func__); + #define TRICK(arg_) #arg_ char const *const MacroBody = TRICK(foo\\bar);