summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/google/NonConstReferences.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/google/NonConstReferences.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/google/NonConstReferences.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/google/NonConstReferences.cpp b/clang-tools-extra/clang-tidy/google/NonConstReferences.cpp
index a56d93792ed..cafc908d8a7 100644
--- a/clang-tools-extra/clang-tidy/google/NonConstReferences.cpp
+++ b/clang-tools-extra/clang-tidy/google/NonConstReferences.cpp
@@ -108,9 +108,16 @@ void NonConstReferences::check(const MatchFinder::MatchResult &Result) {
if (StringRef(ReferencedType.getAsString()).endswith("stream"))
return;
- diag(Parameter->getLocation(),
- "non-const reference parameter '%0', make it const or use a pointer")
- << Parameter->getName();
+ if (Parameter->getName().empty()) {
+ diag(Parameter->getLocation(),
+ "non-const reference parameter at index %0, "
+ "make it const or use a pointer")
+ << Parameter->getFunctionScopeIndex();
+ } else {
+ diag(Parameter->getLocation(),
+ "non-const reference parameter '%0', make it const or use a pointer")
+ << Parameter->getName();
+ }
}
} // namespace runtime
OpenPOWER on IntegriCloud