Alexander Kornienko | 33a9bcc | 2014-04-29 15:20:10 +0000 | [diff] [blame] | 1 | //===--- ClangTidyOptions.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_CLANG_TIDY_OPTIONS_H |
| 11 | #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANG_TIDY_OPTIONS_H |
| 12 | |
Alexander Kornienko | dad4acb | 2014-05-22 16:07:11 +0000 | [diff] [blame] | 13 | #include "llvm/Support/system_error.h" |
Alexander Kornienko | 9ff5b6f | 2014-05-05 14:54:47 +0000 | [diff] [blame] | 14 | #include <string> |
Alexander Kornienko | dad4acb | 2014-05-22 16:07:11 +0000 | [diff] [blame] | 15 | #include <utility> |
| 16 | #include <vector> |
Alexander Kornienko | 9ff5b6f | 2014-05-05 14:54:47 +0000 | [diff] [blame] | 17 | |
Alexander Kornienko | 33a9bcc | 2014-04-29 15:20:10 +0000 | [diff] [blame] | 18 | namespace clang { |
| 19 | namespace tidy { |
| 20 | |
Alexander Kornienko | dad4acb | 2014-05-22 16:07:11 +0000 | [diff] [blame] | 21 | struct FileFilter { |
| 22 | std::string Name; |
| 23 | // LineRange is a pair<start, end> (inclusive). |
| 24 | typedef std::pair<unsigned, unsigned> LineRange; |
| 25 | std::vector<LineRange> LineRanges; |
| 26 | }; |
| 27 | |
Alexander Kornienko | 33a9bcc | 2014-04-29 15:20:10 +0000 | [diff] [blame] | 28 | /// \brief Contains options for clang-tidy. |
| 29 | struct ClangTidyOptions { |
Alexander Kornienko | 23fe959 | 2014-05-15 14:27:36 +0000 | [diff] [blame] | 30 | ClangTidyOptions() : Checks("*"), AnalyzeTemporaryDtors(false) {} |
| 31 | std::string Checks; |
Alexander Kornienko | dad4acb | 2014-05-22 16:07:11 +0000 | [diff] [blame] | 32 | |
Alexander Kornienko | 9ff5b6f | 2014-05-05 14:54:47 +0000 | [diff] [blame] | 33 | // Output warnings from headers matching this filter. Warnings from main files |
| 34 | // will always be displayed. |
| 35 | std::string HeaderFilterRegex; |
Alexander Kornienko | dad4acb | 2014-05-22 16:07:11 +0000 | [diff] [blame] | 36 | |
| 37 | // Output warnings from certain line ranges of certain files only. If this |
| 38 | // list is emtpy, it won't be applied. |
| 39 | std::vector<FileFilter> LineFilter; |
| 40 | |
Alex McCarthy | fec08c7 | 2014-04-30 14:09:24 +0000 | [diff] [blame] | 41 | bool AnalyzeTemporaryDtors; |
Alexander Kornienko | 33a9bcc | 2014-04-29 15:20:10 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
Alexander Kornienko | dad4acb | 2014-05-22 16:07:11 +0000 | [diff] [blame] | 44 | /// \brief Parses LineFilter from JSON and stores it to the \c Options. |
| 45 | llvm::error_code parseLineFilter(const std::string &LineFilter, |
| 46 | clang::tidy::ClangTidyOptions &Options); |
| 47 | |
Alexander Kornienko | 33a9bcc | 2014-04-29 15:20:10 +0000 | [diff] [blame] | 48 | } // end namespace tidy |
| 49 | } // end namespace clang |
| 50 | |
| 51 | #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANG_TIDY_OPTIONS_H |