diff options
| author | Jonathan Roelofs <jonathan@codesourcery.com> | 2016-01-13 17:36:41 +0000 |
|---|---|---|
| committer | Jonathan Roelofs <jonathan@codesourcery.com> | 2016-01-13 17:36:41 +0000 |
| commit | d60388a9852f4a1b40b863a4736e8c9b87c478b0 (patch) | |
| tree | 36a70b21061a7e475119405e155af2edfd03e047 /clang-tools-extra/clang-tidy/ClangTidyOptions.cpp | |
| parent | 3f01e7a62edbcde0c87164b24aa9da9ca04ab7bd (diff) | |
| download | bcm5719-llvm-d60388a9852f4a1b40b863a4736e8c9b87c478b0.tar.gz bcm5719-llvm-d60388a9852f4a1b40b863a4736e8c9b87c478b0.zip | |
Teach clang-tidy how to upgrade warnings into errors.
Similar in format to the `-checks=` argument, this new `-warnings-as-errors=`
argument upgrades any warnings emitted by the former to errors.
http://reviews.llvm.org/D15528
llvm-svn: 257642
Diffstat (limited to 'clang-tools-extra/clang-tidy/ClangTidyOptions.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/ClangTidyOptions.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp b/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp index 6baca370e87..9f6be18d314 100644 --- a/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp @@ -85,6 +85,7 @@ template <> struct MappingTraits<ClangTidyOptions> { MappingNormalization<NOptionMap, ClangTidyOptions::OptionMap> NOpts( IO, Options.CheckOptions); IO.mapOptional("Checks", Options.Checks); + IO.mapOptional("WarningsAsErrors", Options.WarningsAsErrors); IO.mapOptional("HeaderFilterRegex", Options.HeaderFilterRegex); IO.mapOptional("AnalyzeTemporaryDtors", Options.AnalyzeTemporaryDtors); IO.mapOptional("User", Options.User); @@ -103,6 +104,7 @@ namespace tidy { ClangTidyOptions ClangTidyOptions::getDefaults() { ClangTidyOptions Options; Options.Checks = ""; + Options.WarningsAsErrors = ""; Options.HeaderFilterRegex = ""; Options.SystemHeaders = false; Options.AnalyzeTemporaryDtors = false; @@ -123,6 +125,12 @@ ClangTidyOptions::mergeWith(const ClangTidyOptions &Other) const { Result.Checks = (Result.Checks && !Result.Checks->empty() ? *Result.Checks + "," : "") + *Other.Checks; + if (Other.WarningsAsErrors) + Result.WarningsAsErrors = + (Result.WarningsAsErrors && !Result.WarningsAsErrors->empty() + ? *Result.WarningsAsErrors + "," + : "") + + *Other.WarningsAsErrors; if (Other.HeaderFilterRegex) Result.HeaderFilterRegex = Other.HeaderFilterRegex; |

