blob: 60b38eabf1a106d80fe3ce27ca1e7401b782809b [file] [log] [blame]
Alexander Kornienko33a9bcc2014-04-29 15:20:10 +00001//===--- 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 Kornienkodad4acb2014-05-22 16:07:11 +000013#include "llvm/Support/system_error.h"
Alexander Kornienko9ff5b6f2014-05-05 14:54:47 +000014#include <string>
Alexander Kornienkodad4acb2014-05-22 16:07:11 +000015#include <utility>
16#include <vector>
Alexander Kornienko9ff5b6f2014-05-05 14:54:47 +000017
Alexander Kornienko33a9bcc2014-04-29 15:20:10 +000018namespace clang {
19namespace tidy {
20
Alexander Kornienkodad4acb2014-05-22 16:07:11 +000021struct 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 Kornienko33a9bcc2014-04-29 15:20:10 +000028/// \brief Contains options for clang-tidy.
29struct ClangTidyOptions {
Alexander Kornienko23fe9592014-05-15 14:27:36 +000030 ClangTidyOptions() : Checks("*"), AnalyzeTemporaryDtors(false) {}
31 std::string Checks;
Alexander Kornienkodad4acb2014-05-22 16:07:11 +000032
Alexander Kornienko9ff5b6f2014-05-05 14:54:47 +000033 // Output warnings from headers matching this filter. Warnings from main files
34 // will always be displayed.
35 std::string HeaderFilterRegex;
Alexander Kornienkodad4acb2014-05-22 16:07:11 +000036
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 McCarthyfec08c72014-04-30 14:09:24 +000041 bool AnalyzeTemporaryDtors;
Alexander Kornienko33a9bcc2014-04-29 15:20:10 +000042};
43
Alexander Kornienkodad4acb2014-05-22 16:07:11 +000044/// \brief Parses LineFilter from JSON and stores it to the \c Options.
45llvm::error_code parseLineFilter(const std::string &LineFilter,
46 clang::tidy::ClangTidyOptions &Options);
47
Alexander Kornienko33a9bcc2014-04-29 15:20:10 +000048} // end namespace tidy
49} // end namespace clang
50
51#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANG_TIDY_OPTIONS_H