aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy')
-rw-r--r--clang-tools-extra/clang-tidy/ClangTidyOptions.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp14
-rw-r--r--clang-tools-extra/clang-tidy/utils/FixItHintUtils.cpp5
3 files changed, 14 insertions, 7 deletions
diff --git a/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp b/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
index 21455db..c4b47a4 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
@@ -247,7 +247,7 @@ ClangTidyOptions ClangTidyOptions::getDefaults() {
Options.WarningsAsErrors = "";
Options.HeaderFileExtensions = {"", "h", "hh", "hpp", "hxx"};
Options.ImplementationFileExtensions = {"c", "cc", "cpp", "cxx"};
- Options.HeaderFilterRegex = "";
+ Options.HeaderFilterRegex = ".*";
Options.ExcludeHeaderFilterRegex = "";
Options.SystemHeaders = false;
Options.FormatStyle = "none";
diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
index 64157f5..1ae8756 100644
--- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -93,7 +93,7 @@ Configuration files:
WarningsAsErrors: ''
HeaderFileExtensions: ['', 'h','hh','hpp','hxx']
ImplementationFileExtensions: ['c','cc','cpp','cxx']
- HeaderFilterRegex: ''
+ HeaderFilterRegex: '.*'
FormatStyle: none
InheritParentConfig: true
User: user
@@ -132,14 +132,16 @@ file, if any.
static cl::opt<std::string> HeaderFilter("header-filter", desc(R"(
Regular expression matching the names of the
-headers to output diagnostics from. Diagnostics
+headers to output diagnostics from. The default
+value is '.*', i.e. diagnostics from all non-system
+headers are displayed by default. Diagnostics
from the main file of each translation unit are
always displayed.
Can be used together with -line-filter.
This option overrides the 'HeaderFilterRegex'
option in .clang-tidy file, if any.
)"),
- cl::init(""),
+ cl::init(".*"),
cl::cat(ClangTidyCategory));
static cl::opt<std::string> ExcludeHeaderFilter("exclude-header-filter",
@@ -379,9 +381,9 @@ static void printStats(const ClangTidyStats &Stats) {
<< " with check filters";
llvm::errs() << ").\n";
if (Stats.ErrorsIgnoredNonUserCode)
- llvm::errs() << "Use -header-filter=.* to display errors from all "
- "non-system headers. Use -system-headers to display "
- "errors from system headers as well.\n";
+ llvm::errs() << "Use -header-filter=.* or leave it as default to display "
+ "errors from all non-system headers. Use -system-headers "
+ "to display errors from system headers as well.\n";
}
}
diff --git a/clang-tools-extra/clang-tidy/utils/FixItHintUtils.cpp b/clang-tools-extra/clang-tidy/utils/FixItHintUtils.cpp
index 086c7f3..b30c83e 100644
--- a/clang-tools-extra/clang-tidy/utils/FixItHintUtils.cpp
+++ b/clang-tools-extra/clang-tidy/utils/FixItHintUtils.cpp
@@ -21,6 +21,11 @@ FixItHint changeVarDeclToReference(const VarDecl &Var, ASTContext &Context) {
SourceLocation AmpLocation = Var.getLocation();
auto Token = utils::lexer::getPreviousToken(
AmpLocation, Context.getSourceManager(), Context.getLangOpts());
+
+ // For parameter packs the '&' must go before the '...' token
+ if (Token.is(tok::ellipsis))
+ return FixItHint::CreateInsertion(Token.getLocation(), "&");
+
if (!Token.is(tok::unknown))
AmpLocation = Lexer::getLocForEndOfToken(Token.getLocation(), 0,
Context.getSourceManager(),