misc-unused-parameters: Only remove parameters in the main source file.
In headers, they might always be pulled in to different TUs, even if
they are declared static or nested in an unnamed namespace.

llvm-svn: 243414
diff --git a/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp b/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
index 18e3960..f7770cc 100644
--- a/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
@@ -70,7 +70,9 @@
   };
 
   // Comment out parameter name for non-local functions.
-  if (Function->isExternallyVisible() || UsedByRef()) {
+  if (Function->isExternallyVisible() ||
+      !Result.SourceManager->isInMainFile(Function->getLocation()) ||
+      UsedByRef()) {
     SourceRange RemovalRange(Param->getLocation(), Param->getLocEnd());
     // Note: We always add a space before the '/*' to not accidentally create a
     // '*/*' for pointer types, which doesn't start a comment. clang-format will