blob: aabd435ce64b0d0fd60342ccc200a10ab92f121b [file] [log] [blame]
Richard Thomson8930aab2016-03-27 16:43:44 +00001//===--- RawStringLiteralCheck.h - clang-tidy--------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_RAW_STRING_LITERAL_H
11#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_RAW_STRING_LITERAL_H
12
13#include "../ClangTidy.h"
14//#include <string>
15
16namespace clang {
17namespace tidy {
18namespace modernize {
19
20/// This check replaces string literals with escaped characters to
21/// raw string literals.
22///
23/// For the user-facing documentation see:
24/// http://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html
25class RawStringLiteralCheck : public ClangTidyCheck {
26public:
27 RawStringLiteralCheck(StringRef Name, ClangTidyContext *Context);
28
29 void storeOptions(ClangTidyOptions::OptionMap &Options) override;
30 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
31 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
32
33private:
34 void replaceWithRawStringLiteral(
35 const ast_matchers::MatchFinder::MatchResult &Result,
36 const StringLiteral *Literal);
37
38 std::string DelimiterStem;
39};
40
41} // namespace modernize
42} // namespace tidy
43} // namespace clang
44
45#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_RAW_STRING_LITERAL_H