summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp2
-rw-r--r--clang-tools-extra/test/clang-tidy/modernize-use-transparent-functors.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp
index 0389a5ed795..74f050babcb 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp
@@ -121,6 +121,8 @@ void UseTransparentFunctorsCheck::check(
return;
SourceLocation ReportLoc = FunctorLoc.getLocation();
+ if (ReportLoc.isInvalid())
+ return;
diag(ReportLoc, Message) << (FuncClass->getName() + "<>").str()
<< FixItHint::CreateRemoval(
FunctorTypeLoc.getArgLoc(0).getSourceRange());
diff --git a/clang-tools-extra/test/clang-tidy/modernize-use-transparent-functors.cpp b/clang-tools-extra/test/clang-tidy/modernize-use-transparent-functors.cpp
index b700f54f496..3efa916b247 100644
--- a/clang-tools-extra/test/clang-tidy/modernize-use-transparent-functors.cpp
+++ b/clang-tools-extra/test/clang-tidy/modernize-use-transparent-functors.cpp
@@ -104,4 +104,7 @@ int main() {
std::set2<int> control;
}
-
+struct ImplicitTypeLoc : std::set2<std::less<int>> {
+ // CHECK-MESSAGES: :[[@LINE-1]]:36: warning: prefer transparent functors
+ ImplicitTypeLoc() {}
+};
OpenPOWER on IntegriCloud